self.get_chains#
- lumibot.strategies.strategy.Strategy.get_chains(self, asset: Asset)
Return the option-chain information for
asset
.The broker returns the option chain for every exchange that trades the asset. Each exchange entry includes the contract multiplier and nested strike data so strategies can validate expirations and strikes before placing orders.
Parameters#
- param asset:
Instrument whose option chain is being fetched.
- type asset:
lumibot.entities.Asset
Returns#
- returns:
Mapping containing
Multiplier
(string contract multiplier),Exchange
(source exchange identifier), andChains
(nested dictionaries keyed first by option side—CALL
/PUT
—and then by expiration string). Each expiration maps to a list of strikes.- rtype:
dict
Examples#
Option chain lookup
chains = self.get_chains("SPY") july_calls = chains["Chains"]["CALL"]["2023-07-31"] print(f"First July strike: {july_calls[0]}")