Back

Having trouble with UniverseFunction in my first strategy, please advise

Hello,

 

So I worked off of the Iron Condor applied options strategy and followed it pretty closely, it builds, and has no issues until I begin to backtest, where it says the following:

During the algorithm initialization, the following exception has occurred: AttributeError : 'IronCondorAlgorithm' object has no attribute 'UniverseFunc'
at Initialize in main.py:line 22
AttributeError : 'IronCondorAlgorithm' object has no attribute 'UniverseFunc'

 

I would attach the strategy, but doesn't seem to be an option besides sharing with an individual, and my backtests don't run so I can't share those.

Here's line 22, with surrounding lines

 

        equity = self.AddEquity("SPY", Resolution.Minute)
        option = self.AddOption("SPY",Resolution.Minute)
        self.symbol = option.Symbol
        option.SetFilter(self.UniverseFunc) #THIS IS LINE 21, NO LINE 22 ##COMMENTED OUT

 

Here's the universe function:

I copied it directly from the Applied Options strategy because the one I wrote wasn't working,

 

def UniverseFunc(self, universe):
                return universe.IncludeWeeklys().Strikes(-15, 15).Expiration(timedelta(0), timedelta(40))

 

Please advise,

 

Zach

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.


Run a backtest, even if it doesn't work theres a share tab at the bottom of the page where you can share the blacktest here.

0

Hi Zach.

Welcome to QuantConnect. The Iron Condor strategy should also work with the ETF, SPY. Take a look at the backtest I've attached, where I replace the stock GOOG with the ETF, SPY. Good luck!

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