enzoampil / fastquant

fastquant — Backtest and optimize your ML trading strategies with only 3 lines of code!
MIT License
1.48k stars 236 forks source link

Automatically install Fastquant on-demand on notebooks #383

Open miohtama opened 2 years ago

miohtama commented 2 years ago

Is your feature request related to a problem? Please describe.

A lot of notebooks have commented out pip install line at the start.

Describe the solution you'd like

You can automatically install fastquant on demand like the example below - this considers both installed and fresh notebook servers. It is especially handly for Colab that keeps nuking out your installation between sessions:

try:
    import fastquant
except ImportError:
    # fastquant was not installed, install on demand
    !pip install fastquant
    # Reloads installed Python packages from the desk
    import site
    site.main()  

The user does not need to restart the notebook.

Additional context

Happy to make a PR to update lesson notebooks for this model if this sounds reasonble.

mikeejazmines commented 2 years ago

Hey! Good idea, would be a great addition if anyone wants to pick this up