Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ideas for Optimizing Across Assets? #364

cwolf908 started this conversation in Ideas
Discussion options

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?

You must be logged in to vote

Replies: 1 comment 2 replies

Comment options

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.

You must be logged in to vote
2 replies
Comment options

Any findings?

Comment options

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /