Updates Python Example get_value to get (#8806)

`get` is the Pythonist way to access a dictionary.
Also, `not x` replaces `is None`, since the former translates into is None or empty.
This commit is contained in:
Alexandre Catarino
2025-06-03 21:03:12 +01:00
committed by GitHub
parent c9c892510a
commit 1d6a5472b0
8 changed files with 15 additions and 15 deletions
@@ -46,8 +46,8 @@ class BasicTemplateOptionsAlgorithm(QCAlgorithm):
def on_data(self, slice):
if self.portfolio.invested or not self.is_market_open(self.option_symbol): return
chain = slice.option_chains.get_value(self.option_symbol)
if chain is None:
chain = slice.option_chains.get(self.option_symbol)
if not chain:
return
# we sort the contracts to find at the money (ATM) contract with farthest expiration