Hi all
Does anyone know if it is possible to plot a seaborn graph in my algorithm backtesting?
Thanks!
QUANTCONNECT COMMUNITY
Hi all
Does anyone know if it is possible to plot a seaborn graph in my algorithm backtesting?
Thanks!
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.
Derek Melchin
Hi Jenny,
We cannot create seaborn graphs on the backtest view page. However, we can save the data we'd like to plot in the ObjectStore, then load that data into the Research environment to plot with Seaborn. For example, in the backtest, we save the portfolio equity over time.
def OnEndOfDay(self): self.equity_over_time.append(self.Portfolio.TotalPortfolioValue) def OnEndOfAlgorithm(self): self.ObjectStore.Save('equity', json5.dumps(self.equity_over_time))
Then in Research, we load this data and plot it.
qb = QuantBook() equity_over_time = json5.loads(qb.ObjectStore.Read('equity')) sns.lineplot(x=equity_over_time, y=range(len(equity_over_time)))
See the attached backtest and notebook for reference. Alternatively, for generating plots on the backtest view page without Seaborn, review our charting documentation.
Best,
Derek Melchin
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.
Jenny
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!