Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roi: better debug, faster and fixes calculation on dates that have just P update (fixes #2298) #2300

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

adept
Copy link
Collaborator

@adept adept commented Dec 11, 2024

This fixes #2298

On days that has just price (P) directives we need to update internal TWR unit cost accordingly (and we were not doing this).

However, simply pretending that every day with P directive has a zero-value cashflow is suboptimal for people who has lots of P directives and few actual investment-related transactions.

So TWR code was rewritten to ditch the old pre-new-valuation-framework code and do the Proper Thing that better lines up with canonical way to compute TWR, by splitting the reporting inteval into subperiod on every cashflow, valuing investment immediately after each one, and computing the geometric mean of all subperiod returns, adjusted for cashflows.

This should do valuations on every cashflow date + two more for start and end of reporting period (actually this last bit is not new and is happening already).

Small variations in tests is due to the code now doing valuation consistently for all casflows/cashflow dates, which was not being done before.

@adept adept changed the title roi: better debug, fix calculation on dates that have just P update (fixes #2298) roi: better debug, faster and fixes calculation on dates that have just P update (fixes #2298) Dec 18, 2024
@simonmichael simonmichael merged commit dde5a59 into simonmichael:master Dec 18, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TWR aggregation looks wrong
2 participants