Back to Community
Saving trained sklearn models for live trading?

Hi Quantopians,

I wanted to train a SKlearn model using any of the ML algorithms implemented in that package and save that trained Classifier/Regressor for later use. I don't want to re iterate the run of learning. I just want to use the trained model directly.

One other thing, Would you please install XGboost library?

Regards,
Amro

1 response

Hello Amro,

I'm only aware of two ways to get external data into the backtest/live trading platform. First and most simply, you can copy and paste data into the code. This is the easiest way to get started, in my opinion. For a live-running algo, you'd need to stop the algo to update the data, and then re-start it. A second approach would be to have a look at fetcher in the help docs. I don't have direct experience, but I think that with fetcher, you could make changes to the external file (to be "fetched") as the algo trades live (so long as you take note of "Live Trading and Fetcher" on the help page).

In theory, you should be able to train your model using the Quantopian research platform, and be able to make the results available for live trading, on-the-fly without stopping the algo. Quantopian has not provided this capability (strangely). Perhaps they aren't ready to declare the research platform to be a fully supported tool for production trading?

Grant