GET Strategies
- NT8
- Tradovate
Get live strategies for one account NT8
Lists live NinjaScript strategies for one NinjaTrader account, including their current positions and state.
Endpoint
GET /v1/api/accounts/{account}/strategies
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Name of account in NT8 |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
includeTerminal | boolean | Optional | Include terminal strategies. Defaults to false. |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/accounts/Sim101/strategies"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers)
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/accounts/Sim101/strategies";
fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
}
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X GET "https://app.crosstrade.io/v1/api/accounts/Sim101/strategies" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Response
- 200
- 400
- 401
- 403
- 408
- 429
- 500
{
"strategies": [
{
"id": "334081921",
"account": "Sim101",
"strategyName": "ExampleStrategy",
"displayName": "ExampleStrategy",
"position": "Long",
"quantity": 1,
"averagePrice": 5804.75,
"unrealizedPnl": 0.0,
"className": "ExampleStrategy",
"fullName": "NinjaTrader.NinjaScript.Strategies.ExampleStrategy",
"assembly": "ExampleAssembly",
"hostMode": "account",
"isChartHosted": false,
"isHeadless": true,
"isAccountStrategyOnBars": false,
"isEnabled": true,
"isTerminal": false,
"state": "Realtime",
"instrumentName": "ES 12-26",
"accountDetail": {
"name": "Sim101",
"displayName": "Sim101",
"connection": "Simulation"
},
"instrument": {
"fullName": "ES 12-26",
"masterInstrument": "ES",
"instrumentType": "Future",
"exchange": "Globex",
"tickSize": 0.25,
"pointValue": 50
},
"barsPeriod": {
"type": "Minute",
"value": 5,
"value2": 1,
"baseType": "Minute",
"baseValue": 1,
"marketDataType": "Last"
},
"tradingHoursName": null,
"positionDetail": {
"marketPosition": "Long",
"quantity": 1,
"averagePrice": 5804.75,
"unrealizedPnl": 0,
"currency": 0,
"points": 0,
"percent": 0
},
"lifecycle": {
"state": "Realtime",
"isTerminal": false,
"isEnabled": true,
"calculate": "OnBarClose",
"startBehavior": "WaitUntilFlat",
"entriesPerDirection": 1,
"entryHandling": "AllEntries"
},
"runtime": {
"currentBar": 100,
"barsRequiredToTrade": 20,
"currentBars": [
100
],
"ordersCount": 1,
"activeOrderCount": 0
},
"chart": {
"hasChartControl": false,
"hasChartBars": false,
"hasChartPanel": false,
"chartControlType": null,
"chartBarsType": null,
"chartPanelType": null
},
"instruments": [
{
"fullName": "ES 12-26",
"masterInstrument": "ES",
"instrumentType": "Future",
"exchange": "Globex",
"tickSize": 0.25,
"pointValue": 50
}
],
"barsPeriods": [
{
"type": "Minute",
"value": 5,
"value2": 1,
"baseType": "Minute",
"baseValue": 1,
"marketDataType": "Last"
}
],
"parameters": {}
}
],
"count": 1,
"success": true
}
{
"success": false,
"error": "Account 'DemoAccount' not found"
}
{
"error": "Invalid bearer token"
}
{
"error": "Endpoint not available"
}
{
"error": "Client not ready to receive requests, disconnected."
}
// retryAfter is integer seconds; also sent as Retry-After.
{
"error": "Rate limit exceeded",
"retryAfter": 1
}
{
"success": false,
"error": "internal_error"
}
Success field types
Fields below strategies[] describe each strategy. Parameter names are strategy-defined, not fixed API fields.
| Field | Type | Description |
|---|---|---|
success | boolean | true on success. |
count | integer | Strategy count. |
strategies | array of objects | May be empty. |
strategies[].id, strategies[].account, strategies[].strategyName, strategies[].displayName, strategies[].className, strategies[].fullName, strategies[].assembly | string | Strategy identity and runtime type. |
strategies[].position, strategies[].hostMode, strategies[].state, strategies[].instrumentName | string | Position side, host, lifecycle state and instrument. |
strategies[].quantity | integer | Position size. |
strategies[].averagePrice, strategies[].unrealizedPnl | float | Entry price and P/L. |
strategies[].isTerminal, strategies[].isEnabled, strategies[].isChartHosted, strategies[].isHeadless, strategies[].isAccountStrategyOnBars | boolean | Runtime flags. |
strategies[].tradingHoursName | null in captures | Non-null variant not captured. |
strategies[].accountDetail | object | name, displayName, connection: string. |
strategies[].instrument, strategies[].instruments[] | object | fullName, masterInstrument, instrumentType, exchange: string; tickSize, pointValue: float. |
strategies[].instruments, strategies[].barsPeriods | array of objects | Instrument and period collections. |
strategies[].barsPeriod, strategies[].barsPeriods[] | object | type, baseType, marketDataType: string; value, value2, baseValue: integer. |
strategies[].positionDetail | object | marketPosition: string; quantity: integer; averagePrice, unrealizedPnl, currency, points, percent: float. |
strategies[].lifecycle | object | state, calculate, startBehavior, entryHandling: string; isTerminal, isEnabled: boolean; entriesPerDirection: integer. |
strategies[].runtime | object | currentBar, barsRequiredToTrade, ordersCount, activeOrderCount: integer; currentBars: array of integers. |
strategies[].chart | object | hasChartControl, hasChartBars, hasChartPanel: boolean; chartControlType, chartBarsType, chartPanelType: null in captures. |
strategies[].parameters | object | Strategy-defined keys; captured values include string, integer, float and boolean. |
Platform nuances
The hostMode and isChartHosted response fields distinguish chart-hosted strategies from account-hosted strategies.
WebSocket API
This request can also be made over the WebSocket API. The account path parameter is passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "ListStrategies",
"args": {
"account": "Sim101",
"includeTerminal": false
}
}
Tradovate
NinjaScript strategies are a NinjaTrader desktop concept, so there is no /v1/api/tv equivalent for listing an account's strategies. See the Tradovate API overview for what the Tradovate surface covers.
To inspect live positions and working orders instead, use the Tradovate accounts snapshot.