Adds Overload to AddIndexOption (#8291)
* Adds Overload to AddIndexOption Simplify usage. We don't need to create/add the underlying explicitly, see AddIndexOption(string, Resolution, string, bool) overload. * Addresses Peer-Review - Default market is `null` instead of `Market.USA` allowing for `BrokerageModel` setup. - `AddIndexOption` and `AddIndexOptionContract` methods now return `indexOption` objects. * Fixes Logic Bug
This commit is contained in:
committed by
GitHub
parent
e81bcbb987
commit
3b588d04fb
@@ -25,14 +25,12 @@ class BasicTemplateSPXWeeklyIndexOptionsAlgorithm(QCAlgorithm):
|
||||
self.set_end_date(2021, 1, 10)
|
||||
self.set_cash(1000000)
|
||||
|
||||
self.spx = self.add_index("SPX").symbol
|
||||
|
||||
# regular option SPX contracts
|
||||
self.spx_options = self.add_index_option(self.spx)
|
||||
self.spx_options = self.add_index_option("SPX")
|
||||
self.spx_options.set_filter(lambda u: (u.strikes(0, 1).expiration(0, 30)))
|
||||
|
||||
# weekly option SPX contracts
|
||||
spxw = self.add_index_option(self.spx, "SPXW")
|
||||
spxw = self.add_index_option("SPX", "SPXW")
|
||||
# set our strike/expiry filter for this option chain
|
||||
spxw.set_filter(lambda u: (u.strikes(0, 1)
|
||||
# single week ahead since there are many SPXW contracts and we want to preserve performance
|
||||
|
||||
Reference in New Issue
Block a user