Skip to main content

Status

Retrieve market status information (open/closed) for dates and countries.

Making Requests

Use the status() method on the markets resource to fetch market status information.

Output FormatResult PayloadDescription
internal (default)MarketStatus[] or MarketStatusHuman[]Array of decoded market-status records.
jsonRaw JSON objectThe compressed, array-keyed response object.
csvBlobCSV payload. Use .save(filename) to write it.

status

status<P>(
params?: P,
): MarketDataResult<MarketStatus[] | MarketStatusHuman[]>

Fetches market status information. All parameters are optional.

Parameters

  • country (string, optional)

    Filter by country code (e.g. "US", "CA", "GB").

  • date (string | Date, optional)

    Specific date to fetch status for.

  • from (string | Date, optional)

    Start of the date range.

  • to (string | Date, optional)

    End of the date range.

  • countback (number, optional)

    Number of days to return, counting backwards from to (or the current date if to is not provided).

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

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

  • columns (optional): Columns to include.

  • addHeaders (optional): Whether to include headers in CSV output. Alias: headers.

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

  • mode (optional): The data mode to use.

Returns

import { MarketDataClient } from "marketdata-sdk-js";

const client = new MarketDataClient();

const result = await client.markets.status();

result.match(
(days) => {
for (const d of days) {
console.log(`date=${d.date} status=${d.status}`);
}
},
(error) => console.error(error.message),
);

MarketStatus

interface MarketStatus {
s?: string;
date: number;
status: string;
}

Properties

  • s (string, optional): Status indicator.
  • date (number): Unix timestamp of the trading day.
  • status (string): Market status (e.g. "open", "closed").

MarketStatusHuman

interface MarketStatusHuman {
s?: string;
Date: number;
Status: string;
}

MarketStatusHuman is returned when human: true is set.