Back

Add another Resolution and Indicator to the MultipleSymbolConsolidatonAlgorithm.Py QCAlgorithm

First I want to thank Jared Broad, the QC Staff and also the entire QC community for all of the work that has been done and is being done at QuantConnect.

I am working in Python.  I am trying to determine how to create a strategy that can access multiple symbols with multiple Resolutions (ie. Minute and Daily) for each symbol. And then for each symbol and Resolution have multiple indicators.

As an example in the MultipleSymbolConsolidatonAlgorithm.Py QCAlgorith which was recently converted from C# to Python by Jing Wu (jingwu74 GitHub Pull Request #1505). There are 3 equities (AAPL, SPY, and IBM). The 3 equities are consolidated to 10 minute bars with 10 minute SMA indicators.

I want to add a Daily Resolution and a 5 Day EMA for each symbol.  I am not sure of what I need to do to add the Daily Resolution to the algorithm.
It would be very helpful if someone could add a second Resolution to the MultipleSymbolConsolidatonAlgorithm.Py QCAlgorith to demostrate a strategy with multiple Resolutions.

My question concerns the self.Data dictionary in the MultipleSymbolConsolidatonAlgorithm.Py.
Will the self.Data dictionary contain the 10 minute data and the Daily data or is it necessary to create a new dictionary for the Daily data?

I have attached the MultipleSymbolConsolidatonAlgorithm.Py algorithm.

Update Backtest








Hi Hal, in order to use multiple resolutions for multiple symbols, you could create multiple data consolidators in your algorithm, like one consolidator for 10 minutes another consolidator for 1 day.

tenMinutesConsolidator = TradeBarConsolidator(TimeSpan.FromMinutes(10))
oneDayConsolidator = TradeBarConsolidator(timedelta(1))

Here is an example 

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DataConsolidationAlgorithm.py

 

In terms of multiple symbols, if your self.Data dictionary only contains the SymbolData(SMA indicator) for 10-minute resolution, it might be easier to create another dictionary like self.oneDayData = {} to add the indicator values for 1-day resolution. They all keyed by the symbol. Thus in OnData(self, data), you could use those SMA indicators by those keys.

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.


Thanjk you, Jing Wu for the the examples and ideas.  I will be trying out the ideas and examples.

I really apprecite your help and time.

Thank you.

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