trophy

Long Only, ETF Alpha Streams Competition with $27,500 Prize Pool      T-17

Back

How to Create and Add to Pandas DataFrame from TradeBar?

My algorithm holds multiple timeframes. Currently, I rely on an indicator set to a given timeframe where its value is updated by the consolidator. However I've since moved on to analyzing the 'raw' time series data (seasonal_decompose) which relies on timestamp indeces to automatically select the preferred frequency for analysis. Since my consolidator datapoints aren't in Pandas DataFrame format (close prices only, no timestamps), I need a way to create and add to a custom pandas dataframe.

So given a list of timeframes, symbols and consolidators (see notebook), how do I:

1) Create a custom empty pandas dataframe (I will do this during OnSecuritiesChanged in my algorithm) in which it indexes rows by timestamp and the columns are the symbols.

2) Update that dataframe (consolidator's OnConsolidated handle), where the current row's index is the TradeBar's timestamp, and the column the data goes in is respective to its symbol.

Update Backtest







0

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.


I was able to find an answer.

0

Please share with everyone :)
0

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.


It's in the notebook; are you able to see it?

0

Thank you yes! It wasn't in my email client. 

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed