I'm brand new to QuantConnect, and I'm trying to understand how to build a custom bar using Python, which appears that it should be pretty easy. I found a Data Consolidation Algorithm here:
When I run this I get "TypeError: no constructor matches given arguments".
This seems to occur when creating the "thirtyMinuteConsolidator". The attached backtest has everything pretty much commented out to run (I don't see that I can add a backtest that has errored out).
What am I missing here?
Thank you!
Alexandre Catarino
Sorry for taking so long to answer. In your code, there was only two things that were wrong.
First, you forgot to save the Symbol. You were using the Security to subscribe the symbol:
self.spy = self.AddEquity("SPY") # Wrong
self.spy = self.AddEquity("SPY").Symbol # Right
Then you were using a Symbol when you should use a String in the Plot method:
self.Plot(bar.Symbol, "3HourBar", bar.Close) # Wrong
self.Plot(bar.Symbol.Value, "3HourBar", bar.Close) # Right
On the other hand, you should be able to use python timedelta as an argument for the methods in Initialize.
This is a bug we are looking into.
Meanwhile, you can use C# TimeSpan.
Aaron Eller
Thank you, Alexandre!
Alexandre Catarino
We have updated our python framework.
Please try to run the DataConsolidationAlgorithm exactly like we found it at Github.
Aaron Eller
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!