Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to save a machine learning algo results for live trading?

I have an algo that give weight to securities in portfolio base on some indexes ans save previous weights in a context variable. I want to go live with this algo.
Does that variable sustain its value? if not how can I save the value for live trading? ( some solution other than log.info )

4 responses

cant you just determine the weights based off some trailing period? I imagine you would want the weights to be dynamic rather than using the same set of learning data for all future trading.. In this way quantopian warms up your algo to get the necessary weights. As for how information as passed between trade days I'm not sure if vars are stored or not.

Quoting @MarketTech from this post:

"It's been confirmed that any expando property hung off of the "context" object will be persisted across sessions and across system disruptions (if running in real time)."

Hello Hasan,

Note also that fetcher can be used to load data (https://www.quantopian.com/help#overview-fetcher). So, if you are computing the weights off-line, they can be loaded in.

I strongly suspect that if you go from fake money trading to real money trading, your algo will be re-started and you'll lose all stored values, unless you do something like this:

context.weights = [1,5,2,3,7,4]  

Then you can update context.weights as the algo runs.

Grant

Thanks Guys,

So in simple words, when i go to paper testing from full backtesting, all the values in context dict will be remained unchanged? and also when i go to real money trading from paper testing?

Hasan