Skip to content

How to get optimal params from optimize method? #232

Answered by kernc
TomaszLakota asked this question in Q&A
Discussion options

You must be logged in to vote

You can pass Backtest.optimize(..., return_heatmap=True) to get back a series of all tried parameter combinations with their result values. See how to handle it in #101.
Alternatively, as the tutorial briefly mentions, you can access the best parameters as set on the strategy instance:

stats = bt.optimize(...)
my_param1 = stats._strategy.my_param1
...
all_params: dict = stats._strategy._params  # This is private API, may change

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TomaszLakota
Comment options

@PilotGFX
Comment options

Answer selected by TomaszLakota
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants