Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Apply automated grid search straight from backtest #75

Closed
enzoampil opened this issue May 2, 2020 · 4 comments · Fixed by #82
Closed

[FEATURE] Apply automated grid search straight from backtest #75

enzoampil opened this issue May 2, 2020 · 4 comments · Fixed by #82
Assignees
Labels
enhancement New feature or request

Comments

@enzoampil
Copy link
Owner

enzoampil commented May 2, 2020

Currently the backtest function only takes on one set of arguments at a time. In practice we actually want to run results on multiple combinations. (e.g. multiple possible values for slow and fast moving average).

Utilize cerebro.optstrategy to perform the above (reference)

@enzoampil enzoampil added the enhancement New feature or request label May 2, 2020
@enzoampil enzoampil self-assigned this May 2, 2020
@jpdeleon
Copy link
Collaborator

jpdeleon commented May 3, 2020

Once done, we can mention in the notebook that fastquant does this automatically. :)

I think this merits backtest to be a class of its own so we access it's properties e.g. the best parameters, the backtrader figure using the best parameters, etc.

@enzoampil
Copy link
Owner Author

@jpdeleon Noted on the notebook :)

hmm not necessary for it to have its own class if all of these properties are found straight from the cerebro object rigth?

@jpdeleon
Copy link
Collaborator

jpdeleon commented May 5, 2020

@enzoampil I agree. Sorry I missed earlier your note about cerebro.optstrategy that does parameter optimization under the hood already. I think any parameter in a strategy can be optimized already using that method.

So the grid_search notebook is only useful for presentation but not useful in practice.

Also check this backtrader script that optimizes across strategies.

@enzoampil
Copy link
Owner Author

enzoampil commented May 9, 2020

Planning to apply the ff:

  1. Perform grid search if any of the parameters are input as an iterable (kwargs input)
  2. If plot = True only the "optimal" version of the strategy is returned
  3. Add explicit usage of Analyzers to choose the metric of comparison across strategies (ref)
  4. Will set returns and sharpe as the default analyzers.
  5. Instead of cerebro, parameters and metrics will be returned by backtest. These come from stratruns, since this contains both analyzer metrics and all metrics related to the run (e.g. final portfolio value)

@enzoampil enzoampil linked a pull request May 9, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants