self.get_chain

strategies.strategy.Strategy.get_chain(self, chains, exchange='SMART')

Returns option chain for a particular exchange.

Takes in a full set of chains for all the exchanges and returns on chain for a given exchange. The the full chains are returned from get_chains method.

Parameters
  • chains (dictionary of dictionaries) – The chains dictionary created by get_chains method.

  • exchange (str optional) – The exchange such as SMART, CBOE. Default is SMART

Returns

A dictionary of option chain information for one stock and for one exchange. It will contain:

  • Underlying conId (int)

  • TradingClass (str) eg: FB

  • Multiplier (str) eg: 100

  • Expirations (set of str) eg: {20230616, …}

  • Strikes (set of floats)

Return type

dictionary

Example

>>> # Will return the option chains for SPY
>>> asset = "SPY"
>>> chain = self.get_chain(asset)