POST Historical Bars
- NT8
- Tradovate
Pull historical OHLCV bars NT8
Retrieves closed historical OHLCV bars for any instrument available in NinjaTrader from the connected data feed. 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.
The CrossTrade NT8 add-on implements this endpoint with NinjaTrader.Data.BarsRequest and returns the req.Bars collection directly. CrossTrade does not subscribe to live market data, append a still-forming current bar, or return an isForming flag for this endpoint. Treat the response as NT8 historical, closed-bar data. If your strategy needs a strict live-boundary guard, set to to the last completed period boundary or drop any bar whose timestamp is at or after the period currently forming in your session context.
Endpoint
POST /v1/api/market/bars
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Body parameters
This is a POST 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, day, week, month, year |
period | int | Optional | Bar period value. Default: 1. Example: 5 for 5-minute bars |
daysBack | int | 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 | int | Optional | Maximum number of bars to return (taken from the most recent). Default: 5000. |
Code examples
- Python
- JavaScript
- cURL
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}")
const token = 'my-secret-token';
const url = "https://app.crosstrade.io/v1/api/market/bars";
const data = {
instrument: "ES 09-26",
periodType: "minute",
period: 5,
daysBack: 1,
limit: 3
};
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://app.crosstrade.io/v1/api/market/bars" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instrument": "ES 09-26",
"periodType": "minute",
"period": 5,
"daysBack": 1,
"limit": 3
}'
Response
- 200
- 400
{
"instrument": "ES 09-26",
"periodType": "minute",
"period": 5,
"count": 3,
"bars": [
{
"time": "2026-03-18T20:00:00.0000000Z",
"epoch": 1773864000000,
"open": 6731.75,
"high": 6731.75,
"low": 6731.75,
"close": 6731.75,
"volume": 1
},
{
"time": "2026-03-18T20:15:00.0000000Z",
"epoch": 1773864900000,
"open": 6719.0,
"high": 6719.0,
"low": 6719.0,
"close": 6719.0,
"volume": 1
},
{
"time": "2026-03-18T20:20:00.0000000Z",
"epoch": 1773865200000,
"open": 6713.5,
"high": 6713.5,
"low": 6713.5,
"close": 6713.5,
"volume": 1
}
],
"success": true
}
{
"error": "'instrument' is required"
}
Platform nuances
The request has a 10-second timeout. If NinjaTrader's data infrastructure takes longer than that to load the requested bars (which can happen with very large date ranges or exotic bar types), the response will return a timeout error. In that case, try reducing the date range or bar count.
WebSocket API
This request can also be made over the WebSocket API. All parameters are passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "GetBars",
"args": {
"instrument": "ES 09-26",
"periodType": "minute",
"period": 5,
"daysBack": 1,
"limit": 100
}
}
With an explicit date range:
{
"action": "rpc",
"id": "my-request-id",
"api": "GetBars",
"args": {
"instrument": "ES 09-26",
"periodType": "day",
"period": 1,
"from": "2026-03-01T00:00:00Z",
"to": "2026-03-18T00:00:00Z"
}
}
Tradovate
There is no historical-bars endpoint on the /v1/api/tv surface; bar data on this route comes from your NinjaTrader data feed. See the Tradovate API overview for what the Tradovate surface covers.
CrossTrade does not document a Tradovate historical-data alternative. For contract discovery only, use Find Contract or Suggest Contracts.