Skip to main content

Expirations (JavaScript SDK)

  • Last updated
  • View as Markdown

Retrieve the list of current or historical option expiration dates for a given underlying symbol.

Making Requests​

Use the expirations() method on the options resource to fetch available expiration dates.

Output FormatResult PayloadDescription
internal (default)OptionsExpirationsResponse or OptionsExpirationsHumanResponseObject with the list of expirations.
jsonRaw JSON objectThe raw response as returned by the API.

expirations​

// Positional form
expirations<P>(
symbol: string,
params?: P,
): MarketDataPromise<OptionsExpirationsResponse | OptionsExpirationsHumanResponse>

// Object form
expirations<P>(
params: P & { symbol: string },
): MarketDataPromise<OptionsExpirationsResponse | OptionsExpirationsHumanResponse>

Fetches the list of expirations for a single underlying symbol.

Parameters​

  • symbol (string)

    The underlying stock symbol.

  • strike (number, optional)

    Filter to expirations that have at least one contract at the given strike.

  • date (string | Date, optional)

    Fetch expirations as-of a specific historical date.

  • outputFormat (optional): The format of the returned data. Alias: format.

  • dateFormat (optional): Date format. Alias: dateformat.

  • columns (optional): Columns to include.

  • useHumanReadable (optional): Use human-readable field names. Alias: human.

Returns​

import { MarketDataClient } from "@marketdata/sdk";

const client = new MarketDataClient();

try {
const data = await client.options.expirations("AAPL");
console.log(`Updated: ${data.updated}`);
for (const exp of data.expirations) {
console.log(exp);
}
} catch (error) {
console.error(error);
}

OptionsExpirationsResponse​

interface OptionsExpirationsResponse {
s: string;
expirations: string[];
updated: number;
}

Properties​

  • s (string): Status indicator.
  • expirations (string[]): List of expiration dates in YYYY-MM-DD format.
  • updated (number): Unix timestamp when the data was last updated.

OptionsExpirationsHumanResponse​

interface OptionsExpirationsHumanResponse {
s?: string;
Expirations: string[];
Date: number;
}

OptionsExpirationsHumanResponse is returned when human: true is set.