Back

Error adding Treasury Futures in main.py AttributeError : 'FYNcurveSpread' object has no attribute 'future5yrNote'

I'm writing my own first algo on the platform. I am having trouble subscribing. # Subscribe and set our expiry filter for the futures chain
future5yrNote = self.AddFuture(Futures.Financials.Y5TreasuryNote)
future10yrNote = self.AddFuture(Futures.Financials.Y10TreasuryNote)

# Set our expiry filter to return all contracts expiring within 90 days
self.future5yrNote.SetFilter(0,90)
self.future10yrNote.SetFilter(0,90)

# Data resolution
self.UniverseSettings.Resolution = Resolution.Tick
During the algorithm initialization, the following exception has occurred: AttributeError : 'FYNcurveSpread' object has no attribute 'future5yrNote'
at Initialize in main.py:line 26
AttributeError : 'FYNcurveSpread' object has no attribute 'future5yrNote'Seems easy, just can't find the attribute name for that futures chain.?
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.


Hi Eugene,

To resolve this, we need to remove `self.` from lines 6 and 7. Notice how lines 2 and 3 do not include `self.` on the left side of `=`. If this does not solve the issue, please attach a backtest or embed the full code file so I can further assist with debugging. If needed, refer to our futures Bootcamp lesson for an example algorithm.

Best,
Derek Melchin

1

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