self.get_chain#

lumibot.strategies.strategy.Strategy.get_chain(self, chains: dict, exchange: str = 'SMART')

Return the portion of chains that corresponds to a single exchange.

Parameters#

param chains:

Payload previously produced by get_chains().

type chains:

dict

param exchange:

Exchange identifier (for example "SMART" or "CBOE").

type exchange:

str

Returns#

returns:

Mapping with the same keys as chains but narrowed to the requested exchange.

rtype:

dict

Examples#

  • Filter to SMART exchange

    chains = self.get_chains("SPY")
    smart_only = self.get_chain(chains, "SMART")
    print(smart_only["Exchange"])