POST Historical Bars

Returns an array of historical quotes at the period, duration, and granularity specified

Request historical OHLCV bar data for any instrument available in NinjaTrader. This is an async operation that requests data from NT8's historical data infrastructure, so the response may take a moment depending on the date range and bar type.

Pull historical OHLCV bars

POST /v1/api/market/bars

Headers

Name
Value

Content-Type

application/json

Authorization

Bearer <token>

Body Parameters

Even though this is a GET request, parameters are sent as a JSON body.

Name
Type
Required
Description

instrument

string

Required

Instrument name (e.g., "ES 09-26")

periodType

string

Optional

Bar type. Default: "minute". Options: minute, tick, day, week, month, year, second, range, renko

period

integer

Optional

Bar period value. Default: 1. Example: 5 for 5-minute bars

daysBack

integer

Optional

Number of days of history. Default: 1. Ignored if from is provided

from

string

Optional

Start date in UTC (e.g., "2026-03-17T00:00:00Z")

to

string

Optional

End date in UTC. Default: now

limit

integer

Optional

Maximum number of bars to return (taken from the most recent). Default: 5000.

Code Examples

import requests

token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/market/bars"
headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}

data = {
    "instrument": "ES 09-26",
    "periodType": "minute",
    "period": 5,
    "daysBack": 1,
    "limit": 3
}

try:
    response = requests.post(url, headers=headers, json=data)
    print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
    print(f"An error occurred: {e}")

Response

circle-exclamation

WebSocket API

This request can also be made over the WebSocket API. All parameters are passed inside args.

With an explicit date range:

Last updated