API Reference / Market Sessions
Get Current Equities Session
getMarketTimeEquitiesSessionsCurrent/market-time/equities/sessions/currentBase URL: https://api.cert.tastyworks.com (Sandbox) · https://api.tastyworks.com (Production)
Returns the current equities trading session along with its previous and next sessions. Optionally pass `current-time` to evaluate the session as of a specific instant instead of now; the response `state` field indicates the market's current state.
Code samples
curl -X GET 'https://api.cert.tastyworks.com/market-time/equities/sessions/current?current-time=2024-01-15T14%3A30%3A00.000Z' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'User-Agent: tastytrade-docs-example/1.0'import requests
url = "https://api.cert.tastyworks.com/market-time/equities/sessions/current?current-time=2024-01-15T14%3A30%3A00.000Z"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
}
resp = requests.get(url, headers=headers)
print(resp.status_code, resp.json())const resp = await fetch("https://api.cert.tastyworks.com/market-time/equities/sessions/current?current-time=2024-01-15T14%3A30%3A00.000Z", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"User-Agent": "tastytrade-docs-example/1.0",
},
})
const data = await resp.json()
console.log(resp.status, data)package main
import (
"net/http"
"io"
"fmt"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.cert.tastyworks.com/market-time/equities/sessions/current?current-time=2024-01-15T14%3A30%3A00.000Z", nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("User-Agent", "tastytrade-docs-example/1.0")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(resp.Status, string(out))
}import java.net.URI;
import java.net.http.*;
HttpClient client = HttpClient.newHttpClient();
HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.cert.tastyworks.com/market-time/equities/sessions/current?current-time=2024-01-15T14%3A30%3A00.000Z"))
.header("Authorization", "Bearer YOUR_ACCESS_TOKEN")
.header("User-Agent", "tastytrade-docs-example/1.0")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> resp = client.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(resp.statusCode() + " " + resp.body());Parameters
| Name | In | Type | Description |
|---|---|---|---|
| current-time | query | string | The time the current session is based on e.g. "2024-01-15T14:30:00.000Z" |
Responses
Example response
{
"data": {
"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",
"next-session": {
"close-at": "2024-01-15T14:30:00.000Z",
"close-at-ext": "2024-01-15T14:30:00.000Z",
"instrument-collection": "string",
"open-at": "2024-01-15T14:30:00.000Z",
"session-date": "2024-01-15",
"start-at": "2024-01-15T14:30:00.000Z"
},
"previous-session": {
"close-at": "2024-01-15T14:30:00.000Z",
"close-at-ext": "2024-01-15T14:30:00.000Z",
"instrument-collection": "string",
"open-at": "2024-01-15T14:30:00.000Z",
"session-date": "2024-01-15",
"start-at": "2024-01-15T14:30:00.000Z"
},
"state": "string"
},
"context": "/market-time/equities/sessions/current"
}Schema
datarequiredobject (CurrentSession)The current trading session for an instrument collection, including its state and the immediately previous and next sessions. Returned for equity and futures current-session endpoints.
close-atstring <date-time>ISO-8601 date-time at which the session closes.
close-at-extstring <date-time>ISO-8601 date-time of the session's extended close.
instrument-collectionstringThe instrument collection this session applies to, for example `Equity`, `CME`, or `CFE`.
example:
"Equity"open-atstring <date-time>ISO-8601 date-time at which the session opens.
start-atstring <date-time>ISO-8601 date-time at which the session starts.
next-sessionobject{6 fields}The next trading session that follows the current one.
previous-sessionobject{6 fields}The previous trading session that preceded the current one.
statestringThe current state of the market for this session.
contextrequiredstringexample:
"/market-time/equities/sessions/current"
Example response
{
"error": {
"code": "unauthorized",
"message": "No valid access token was provided; access tokens expire after 15 minutes."
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
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
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Example response
{
"error": {
"code": "string",
"message": "string",
"errors": [
{
"code": "string",
"message": "string",
"domain": "string"
}
]
}
}Schema
errorrequiredobjectcoderequiredstringMachine-readable error code (see the Error reference).
messagerequiredstringHuman-readable explanation.
errorsarray<object>{3 fields}Present for multi-error / validation failures; one entry per problem.
Related
- Rate-limit class:
read· idempotent — Rate limits & backoff - Error reference — codes, causes, and fixes
Agents: this page is also Markdown (with the embedded OpenAPI definition) — append .md or send Accept: text/markdown. Index at /llms.txt.