tastytradeDeveloper Docs
Legacy ↗

API Reference / Market Sessions

List Sessions For Date Range

getMarketTimeSessions
get/market-time/sessions

Base URL: https://api.cert.tastyworks.com (Sandbox) · https://api.tastyworks.com (Production)

Returns the timings for each trading session in a date range for a single instrument collection. Pass `from-date`, `to-date`, and optionally `instrument-collection` (defaults to `Equity`); the span between `from-date` and `to-date` must not exceed 9 months. Useful for building a calendar of market hours.

Code samples

curl -X GET 'https://api.cert.tastyworks.com/market-time/sessions?from-date=2024-01-15&instrument-collection=Equity&to-date=2024-01-15' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'User-Agent: tastytrade-docs-example/1.0'

Parameters

NameInTypeDescription
from-datequerystringThe date to start from
e.g. "2024-01-15"
instrument-collectionquerystringThe instrument collection to get sessions for
enum: Equity, CME, CFE
e.g. "Equity"
to-date*querystringThe date to end at, the difference between from and to date must not exceed 9 months
e.g. "2024-01-15"

Responses

200An array of session timings, one per trading day in the requested range.application/json

Example response

{
  "data": {
    "items": [
      {
        "close-at": "2024-01-15T14:30:00.000Z",
        "close-at-ext": "2024-01-15T14:30:00.000Z",
        "instrument-collection": "Equity",
        "open-at": "2024-01-15T14:30:00.000Z",
        "start-at": "2024-01-15T14:30:00.000Z"
      }
    ]
  },
  "context": "/market-time/sessions",
  "pagination": {
    "per-page": 0,
    "page-offset": 0,
    "item-offset": 0,
    "total-items": 0,
    "total-pages": 0,
    "current-item-count": 0
  }
}

Schema

  • datarequiredobject
    • itemsrequiredarray<object>{5 fields}
  • contextrequiredstring

    example: "/market-time/sessions"

  • paginationobject

    Paging metadata, present on paginated list responses.

    • per-pageinteger
    • page-offsetinteger
    • item-offsetinteger
    • total-itemsinteger
    • total-pagesinteger
    • current-item-countinteger
401Missing or expired access token, or a missing/malformed `User-Agent` header.application/json

Example response

{
  "error": {
    "code": "unauthorized",
    "message": "No valid access token was provided; access tokens expire after 15 minutes."
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

422Invalid query parameters, for example a missing `to-date` or a `from-date`/`to-date` span that exceeds the 9-month maximum.application/json

Example response

{
  "error": {
    "code": "preflight_check_failure",
    "message": "One or more preflight checks failed",
    "errors": [
      {
        "code": "preflight_check_failure",
        "message": "A specific validation failed for this order."
      }
    ]
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

429Too many requests. Back off and reduce your request rate.application/json

Example response

{
  "error": {
    "code": "string",
    "message": "string",
    "errors": [
      {
        "code": "string",
        "message": "string",
        "domain": "string"
      }
    ]
  }
}

Schema

  • errorrequiredobject
    • coderequiredstring

      Machine-readable error code (see the Error reference).

    • messagerequiredstring

      Human-readable explanation.

    • errorsarray<object>{3 fields}

      Present for multi-error / validation failures; one entry per problem.

Related

Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.