-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-
First off - thank you so much for this awesome utility and thank the entire community here for the awesome work done to support the effort!
I, like many others (I assume), hold multiple stocks in my portfolio... some individual, some ETFs. And although it's amazing how well backtesting.py has enabled me to hone in my hyperparameters using the optimize() function, it's left me wondering what could be done to take into account the varied nature of different assets (within reason... same asset class). I've already found that optimizing for one ticker can significantly improve my returns on another. But rather than just hope that optimization will carry across multiple assets, I'm trying to think of a way to optimize across them all together.
All this being said - I realize that the topic has been raised before. I'm just hoping to get some feedback on what others may have done to achieve this and/or ideas on how to account for multiple assets during optimization.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 2 replies
-
Off the top of my head, I'm thinking you may be able to load all of the dataframes for multiple assets (potentially even over varying timeframes). Then declare an array for each hyperparameter. Then create a for loop that goes through all assets... and within each asset loop, maybe run an individual asset optimize function multiple times - writing the optimized hyperparameters to their respective array with each loop. Then, find the mode of each hyperparameter array.
I think I might give this a try and let it run overnight. I will report back with any results.
Beta Was this translation helpful? Give feedback.
All reactions
-
Any findings?
Beta Was this translation helpful? Give feedback.
All reactions
-
With respect to this approach, which I have implemented, although with a loop loading, backtesting and then unloading the data for each of the assets, I must note a limitation: currently the optimization routine returns the first and lowest value if no difference whatsoever across all the values is detected (for certain assets, no trades might be happening whatever the values in the optimization, for certain other assets the values in the optimization might not determine any difference in the executed traders - although the former is for sure more frequent in my experience).
I think that in this respect the optimization routine should be returning either a NaN or a midway value or a 0.
If you have progressed with multiple assets, you might have some ideas about this feature, please share.
cheers,
Beta Was this translation helpful? Give feedback.