How to get optimal params from optimize method? #232
-
Hi, how do I get optimal params from optimize method? It's not specified in docs. I'd like to know optimal params, so I can use them live or to test them on different dataset (train-test split). I know there's a walkaround using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
You can pass stats = bt.optimize(...)
my_param1 = stats._strategy.my_param1
...
all_params: dict = stats._strategy._params # This is private API, may change |
Beta Was this translation helpful? Give feedback.
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: