Skip to content

Make test results time-invariant#14

Merged
ojustino merged 9 commits into
mainfrom
normalize-tests
Apr 9, 2026
Merged

Make test results time-invariant#14
ojustino merged 9 commits into
mainfrom
normalize-tests

Conversation

@ojustino

@ojustino ojustino commented Jan 3, 2025

Copy link
Copy Markdown
Owner

Progress toward figuring out a way to reliably reverse adjustments made to historical price data (splits, dividends, etc.) so test results remain consistent over time. At the moment, results for a script I run today will be slightly different in a few months and noticeably different in a few years.

Comparisons of strategies against each other calculated at the same time are OK, but comparing a calculation from 2022 to one from today is not apples-to-apples. For example, maybe the differently-adjusted price data leads a strategy to sell an extra share of an asset during a rebalance in today's simulation where it wouldn't have done so in the past. The differences aren't large, but it would be nice to achieve full reproducibility.

@ojustino

ojustino commented Jan 3, 2025

Copy link
Copy Markdown
Owner Author

A comment in test_suite.py suggests that run_time_loop() may double count dividends? Investigate again

@ojustino
ojustino force-pushed the normalize-tests branch 3 times, most recently from 5b0c53b to b5960a0 Compare April 3, 2026 05:42
@ojustino

ojustino commented Apr 9, 2026

Copy link
Copy Markdown
Owner Author

I think the latest commits finally reflect an approach that will lead to consistent test results over time, along with some quality of life additions (AttrDict to treat the assets dictionaries and their dataFrames as class attributes, accepting string dates in the simulator in addition to pandas Timestamps and datetimes, more clarity with the cash_out_dividends argument).

As a result, simulations can now be made time-invariant, so I will merge to avoid bloating the PR. There is more to investigate with consistency between dividend-adjusted and non-dividend-adjusted results given equivalent portfolios over identical time windows. I hope to modify the tests' assert statements after that's been diagnosed since a fix would produce different numbers than I'd calculate now anyway.

@ojustino
ojustino merged commit 3896b9f into main Apr 9, 2026
0 of 2 checks 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.

1 participant