We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No need to define SetFilter for the underlying future. The option chain should have the mapped contract.
If we need to set the filter.
N/A
# region imports from AlgorithmImports import * # endregion class BasicFutureOptionAlgorithm(QCAlgorithm): def initialize(self): self.set_start_date(2023,1,1) self._future = self.add_future(Futures.Indices.SP_500_E_MINI, extended_market_hours=True, data_mapping_mode=DataMappingMode.OPEN_INTEREST, data_normalization_mode=DataNormalizationMode.BACKWARDS_RATIO, contract_depth_offset=0) #self._future.set_filter(0, 182) # < --uncomment to get options self.add_future_option(self._future.symbol, lambda u: u.strikes(-1, 1)) def on_data(self, data): # Iterate all Option chains to find the desired future and future options contracts for canonical_symbol, chain in data.option_chains.items(): future_contract = canonical_symbol.underlying for symbol, contract in chain.contracts.items(): contract.strike # Get the Option chain for the mapped contract chain = data.option_chains.get(Symbol.create_canonical_option(self._future.mapped)) if chain: for symbol, contract in chain.contracts.items(): contract.strike
master
The text was updated successfully, but these errors were encountered:
By the way, it would be nice to be able to get the chain with the underlying symbol:
chain = data.option_chains.get(self._future.mapped)
Sorry, something went wrong.
No branches or pull requests
Expected Behavior
No need to define SetFilter for the underlying future. The option chain should have the mapped contract.
Actual Behavior
If we need to set the filter.
Potential Solution
N/A
Reproducing the Problem
Checklist
master
branchThe text was updated successfully, but these errors were encountered: