Skip to main content

Strikes

Get a list of available strike prices for an underlying symbol.

Making Requests

Use the strikes() method on the options resource to fetch strike prices. The method supports multiple output formats:

Output FormatReturn TypeDescription
DATAFRAMEpandas.DataFrame or polars.DataFrameReturns a DataFrame with strike prices (default).
INTERNALOptionsStrikes or OptionsStrikesHumanReadableReturns an OptionsStrikes object. When use_human_readable=True, returns an OptionsStrikesHumanReadable object with capitalized field names.
JSONdictReturns the raw JSON response as a dictionary.
CSVstrWrites CSV data to file and returns the filename string.

strikes

def strikes(
symbol: str,
*,
expiration: str | datetime.datetime = None,
date: str | datetime.datetime = None,
output_format: OutputFormat = OutputFormat.DATAFRAME,
date_format: DateFormat = None,
columns: list[str] = None,
add_headers: bool = None,
use_human_readable: bool = False,
mode: Mode = None,
filename: str | Path = None,
) -> OptionsStrikes | OptionsStrikesHumanReadable | dict | str | MarketDataClientErrorResult

Fetches available strike prices for a given symbol. The symbol parameter can be passed as the first positional argument or as a keyword argument. All other parameters must be keyword-only.

Parameters

  • symbol (str)

    The underlying stock symbol for which to fetch strike prices.

  • expiration (str | datetime.datetime, optional)

    Filter by expiration date.

  • date (str | datetime.datetime, optional)

    Historical date for the strike prices.

  • output_format (OutputFormat, optional)

    The format of the returned data. Defaults to OutputFormat.DATAFRAME. See Settings for details.

  • date_format (DateFormat, optional)

    The date format to use in the response. Defaults to DateFormat.UNIX. See Settings for details.

  • columns (optional)

    Specify which columns to include in the response. See Settings for details.

  • add_headers (optional)

    Whether to include headers in the response. See Settings for details.

  • use_human_readable (optional)

    Whether to use human-readable format for values. Only applies when output_format=OutputFormat.INTERNAL. See Settings for details.

  • mode (Mode, optional)

    The data feed mode to use. See Settings for details.

  • filename (str | Path, optional)

    File path for CSV output (only used with output_format=OutputFormat.CSV).

Returns

  • OptionsStrikes | OptionsStrikesHumanReadable | dict | str | MarketDataClientErrorResult

    The strike prices in the requested format, or a MarketDataClientErrorResult if an error occurred.

from marketdata.client import MarketDataClient

client = MarketDataClient()

# Get options strikes as DataFrame (default)
# symbol can be passed positionally or as keyword
df = client.options.strikes("AAPL")
# or
df = client.options.strikes(symbol="AAPL")

print(df)

OptionsStrikes

@dataclass
class OptionsStrikes:
s: str
updated: datetime.datetime
# Dynamic fields: expiration dates as keys (e.g., "2024-01-20": list[float])

OptionsStrikes represents strike prices for options, with dynamic fields based on expiration dates. Each expiration date becomes a field containing a list of strike prices.

Properties

  • s (str): Status indicator ("ok" for successful responses).
  • updated (datetime.datetime): The time when the data was last updated (automatically converted from timestamp).
  • Dynamic fields: Each expiration date (in format "YYYY-MM-DD") becomes a field containing a list of strike prices (list[float]).

Notes

  • The updated field is automatically converted to a datetime.datetime object from a Unix timestamp.
  • Strike prices are organized by expiration date, with each expiration date as a field name.
  • Access strikes using getattr() or __dict__ (e.g., getattr(strikes, "2024-01-20")).

OptionsStrikesHumanReadable

@dataclass
class OptionsStrikesHumanReadable:
Date: datetime.datetime
# Dynamic fields: expiration dates as keys (e.g., "2024-01-20": list[float])

OptionsStrikesHumanReadable represents strike prices in human-readable format with capitalized field names and formatted values.

Properties

  • Date (datetime.datetime): The time when the data was last updated (automatically converted from timestamp).
  • Dynamic fields: Each expiration date (in format "YYYY-MM-DD") becomes a field containing a list of strike prices (list[float]).

Notes

  • The Date field is automatically converted to a datetime.datetime object from a Unix timestamp.
  • Strike prices are organized by expiration date, with each expiration date as a field name.
  • Access strikes using getattr() or __dict__ (e.g., getattr(strikes, "2024-01-20")).
  • Field names use capitalized format (e.g., Date instead of updated).