Back to Community
Can we save data into file in research and use it in an backtest/live algorithm.?

When working with research, we might run things like training a neural network or some other optimization on a set of data.

Is it possible, to save a specific set of data into a file and use it in the algorithm?

Say, I might like to run and save the network weights of a neural network and use that neural network weights during trading.

Sarvi

8 responses

You cannot do this....yet. I think it's one of the key capabilities we have to give you. I don't have a timeline on when we are going to do it yet, we are currently focused on getting research out to everyone, but I think it's high on the list of things to do after that.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Saravanan,

You could just copy the weights from the research platform and paste them into the backtester (or into a CSV that would then be uploaded to the backtester using fetcher). Or are you having trouble with this manual approach?

Grant

Grant,
Well. Network weights can be large and hence the matrix, so cut and paste is not going to be great, though doable with lots of patience :-)

Training a large neural network, and hence weight matrix, is not feasible within the time limits of quantopian live/backtest, but can be done in the research, since I haven't heard of any time limits.

The research platform doesn't allow writing out a CSV both locally or an external server, so there isnt a mechanism to push it out to a file or to an external server.

I think I can "theoretically open(,'w').write() the weights, but where does it go. Its local to the server my research instance is running on. There is no gaurantees that even my research platform instance can find it once reloaded.

The regular quantopian backtest/live cannot either.

May be I am completely misunderstanding what you are suggesting
Was just looking for a simpler route to go from research to a live algorithm. The more I try, I find quantopian live/backtest not so great for coming up with and fine tuning a model/algorithm.
But Quantopian research is, if only we could move back and forth easily.

Sarvi

Sarvi,

I don't think that there is any limit to the number of lines you can paste into an algo, so if you can copy the data from the research platform, and then simply paste them into your algo (e.g. in a function at the bottom of the code), then it should work. Tedious, but only a few mouse clicks, right? This would be a work-around until Q figures out how to make files generated in the research platform available to an algo.

Grant

Yup. It should

Good. Note that somewhere within the Q terms of use, I think that there is a blanket prohibition against copying anything (perhaps why Karen didn't make the copy-and-paste suggestion), but in this case, the data would be staying within the Q environment (although one could argue that they also end up in your local clipboard).

Saravanan, did you find a solution to your problem?

I'm facing the same issue trying to export a random forest that I trained from Research to Quantopian IDE.

Hi All,

Copy/Paste seems like quite a hack! Has this problem been solved yet?

I am trying to run a backtest of an algorithm that depends on a 1000x1000 matrix (it's the weights used in an Echo State Network). As you can imagine, it's pretty much impossible to copy 10^6 floats by copy paste.

Cheers,
Jason