---
title: Strikes
sidebar_position: 3
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
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 Format | Return Type | Description |
|---------------|-------------|-------------|
| **DATAFRAME** | `pandas.DataFrame` or `polars.DataFrame` | Returns a DataFrame with strike prices (default). |
| **INTERNAL** | `OptionsStrikes` or `OptionsStrikesHumanReadable` | Returns an OptionsStrikes object. When `use_human_readable=True`, returns an OptionsStrikesHumanReadable object with capitalized field names. |
| **JSON** | `dict` | Returns the raw JSON response as a dictionary. |
| **CSV** | `str` | Writes CSV data to file and returns the filename string. |
## strikes
```python
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](/sdk/py/settings#output-format), optional)
The format of the returned data. Defaults to `OutputFormat.DATAFRAME`. See [Settings](/sdk/py/settings) for details.
- `date_format` ([DateFormat](/sdk/py/settings#date-format), optional)
The date format to use in the response. Defaults to `DateFormat.UNIX`. See [Settings](/sdk/py/settings) for details.
- [`columns`](/sdk/py/settings#columns) (optional)
Specify which columns to include in the response. See [Settings](/sdk/py/settings) for details.
- [`add_headers`](/sdk/py/settings#headers) (optional)
Whether to include headers in the response. See [Settings](/sdk/py/settings) for details.
- [`use_human_readable`](/sdk/py/settings#human-readable) (optional)
Whether to use human-readable format for values. Only applies when `output_format=OutputFormat.INTERNAL`. See [Settings](/sdk/py/settings) for details.
- `mode` ([Mode](/sdk/py/settings#data-mode), optional)
The data feed mode to use. See [Settings](/sdk/py/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.
```python
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)
```
```python
from marketdata.client import MarketDataClient
from marketdata.input_types.base import OutputFormat
client = MarketDataClient()
# Get options strikes as internal object
strikes = client.options.strikes("AAPL", output_format=OutputFormat.INTERNAL)
# Access strike prices
# Strikes are stored as dynamic fields based on expiration dates
# Access them via __dict__ or getattr
print(f"Updated: {strikes.updated}")
# Example: Access strikes for a specific expiration date
# The field names are expiration dates in format "YYYY-MM-DD"
for key, value in strikes.__dict__.items():
if key not in ["s", "updated"]:
print(f"{key}: {value}")
```
```python
from marketdata.client import MarketDataClient
from marketdata.input_types.base import OutputFormat
client = MarketDataClient()
# Get options strikes as JSON
strikes = client.options.strikes("AAPL", output_format=OutputFormat.JSON)
print(strikes)
```
```python
from marketdata.client import MarketDataClient
from marketdata.input_types.base import OutputFormat
from pathlib import Path
client = MarketDataClient()
# Get options strikes as CSV
csv_file = client.options.strikes(
"AAPL",
output_format=OutputFormat.CSV,
filename=Path("strikes.csv")
)
print(f"CSV file saved to: {csv_file}")
```
```python
from marketdata.client import MarketDataClient
from marketdata.input_types.base import OutputFormat
client = MarketDataClient()
# Get options strikes in human-readable format
strikes = client.options.strikes(
"AAPL",
output_format=OutputFormat.INTERNAL,
use_human_readable=True
)
# Access strike prices and date
print(f"Date: {strikes.Date}")
# Strikes are stored as dynamic fields based on expiration dates
# Access them via getattr or __dict__
```
## OptionsStrikes
```python
@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
```python
@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`).