Change to how backtesting handles expensive instruments #938
robcarver17
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've made the following changes to the backtest. This is because I'm researching fast trading, on a dataset that includes many instruments that are too expensive to trade even one trading rule if I enforce my speed limit.
Before: if you set a speed limit which resulted in no trading rules being cheap enough to trade, then there would be an error. This was a pain, since I've added lots of expensive instruments, I've had to manually hack the instrument list or forecast weights.
Now: Instead of an error, all the forecast weights are set to zero. That means the given instrument will have a zero combined forecast, and zero subsystem positions.
Because having zero positions will mess up instrument weight estimations (think of the correlation matrix!), I've included additional code in the portfolio stage which will automatically give a zero instrument weight to any instrument which has positions that are always zero (or nan). The most likely cause of this will be not having any cheap enough trading rules. Note this zero weight will be applied even if you are using static, not estimated, portfolio weights.
Beta Was this translation helpful? Give feedback.
All reactions