How can we access the historical equity data from the paper trading environment?
QUANTCONNECT COMMUNITY
How can we access the historical equity data from the paper trading environment?
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Varad Kabade
Hi Brian Christopher,
When deploying an algorithm for live trading (paper or real money), we can access historical data as we would have during backtesting and historical live data we store to fill the data gap since the backtest historical data stops at midnight of the current day. Refer to the following doc for more information.
Best,
Varad Kabade
Brian Christopher
Greetings Varad kabade, I think you misunderstood my question. I'm asking about the data for the SIMULATED PORTFOLIO EQUITY not historical data for securities.
Louis Szeto
Hi Brian,
We believe you want to retrieve the historical equity curve? You may set up a pandas series data in initialize method. Then update it in OnData method, and log/chart it:
Please see the attached backtest.
Best,
Louis Szeto
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Brian Christopher
Louis Szeto I see. so I would have to stop my paper trading algorithm, then add the new code and then restart paper trading? Do I understand this correctly?
Louis Szeto
Hi Brian
Yes please stop the live deployment first, then redeploy after adjustment. Remember that your positions will not be liquidated after stopping. And don't forget to set/skip initialization of values to relay from the previous state according to your strategy.
The historical equity values will only be accessible starting from the next deployment. To avoid a similar inconvenience in the future, we can save the historical equity curve data to ObjectStore and re-load after redeployment. Note that the equity curve won't be updated while the algorithm is not deployed. So, to track the equity curve during this time, the Initialize method will need to fill in the gap by using the portfolio holdings and their historical prices.
Best,
Louis Szeto
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Brian Christopher
Can you elaborate on this or is there an example that demonstrates what you mean here?:
Louis Szeto
Hi Brian
It means that if you've some conditions in your algorithm (e.g. some variable calculated as 100 but in initialize method set as 50, or your initialization will liquidate everything and restart running), then it'll be a better idea you amend/recalculate your initialization parameters according to your need to cohere with the previous live trading before redeployment. We suggest you use ObjectStore to store some of these conditions/parameters in case you'll need to stop your algorithm again in the future, then you can directly read it for resetting to the previous state. Please check the attached backtest for your reference.
We recommend you separate your live and backtest into 2 projects, as your backtest might rewrite the saved variables causing errors. (In the attached example, the switchTime will not be attainable in another same backtest as its value has been adapted to the time of the end of the previous backtest)
Best,
Louis Szeto
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Brian Christopher
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!