Compute Time-Weighted Return for a Fund With Daily Cash Flows
Last updated: November 29, 2026
Quick Overview
Given daily start market value, end market value and external cash flow for an account, compute its cumulative time-weighted return in pandas, and explain why it differs from the money-weighted return.
BlackRock
November 29, 20260
0
0 solved
Given daily start market value, end market value and external cash flow for an account, compute its cumulative time-weighted return in pandas, and explain why it differs from the money-weighted return.
Performance attribution and reporting for BlackRock funds and Aladdin clients depend on returns that neutralize client deposits and withdrawals. The interviewer checks that the candidate places the flow correctly in the denominator, chains daily returns geometrically, and can explain TWR versus IRR to a portfolio manager.
What the Interviewer Expects
- Adjusts the denominator for the timing convention of the flow
- Chains daily returns multiplicatively, not additively
- Validates sorted dates and non-positive capital
- Explains when TWR and money-weighted return diverge
- Mentions fees and gross versus net returns
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you handle a flow that arrives at end of day instead of start?
- How would you annualize a return over 17 months?
- Why do GIPS standards prefer TWR for composites?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Columns date, start_mv, flow, end_mv. I ask when the flow happens. If the flow arrives at the start of the day it is invested for the whole day, so the day's capital is start_mv + flow. If it arri...
Approach
Daily return . Cumulative TWR is . This removes the effect of how much money the client added and when, which is what a manager controls: the re...