Back

Custom data and QC historical/Live data at the same time

Question:
Lets say if I am trading on a symbol "SPY" where I want to get public void OnData(TradeBars data) events per definition of my algorithm (in back testing data comes from QC). Moreover I like to add custom data to my algorithm to alter decision on when to buy/sell spy e.g. AddData("CUSTOM");

In the above scenario, is there way to get both of the following event?
public void OnData(TradeBars data)
{
}
public void OnData(CAPE data)
{
}

Thanks
Update Backtest








Hi @Desi, you can do exactly as you have above -- the data will be pipped into both methods in the order it happens. Are you talking about in live trading?

Alternatively there is a "Slice" handler -- this creates events on each moment of time.
public override void OnData(Slice data) {}
0

@Desi I have asked this question as well. See my question with the corresponding answers here:

External data source for real-time trading
0

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