Skip to main content

GET Positions

Get list of all positions in one account NT8​

Lists the positions in one NinjaTrader account's current position collection. The account lookup is case-insensitive. This endpoint does not explicitly remove flat positions: check marketPosition and quantity before treating a row as open.

Endpoint​

GET /v1/api/accounts/{account}/positions

Headers​

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Path parameters​

NameTypeRequiredDescription
accountstringRequiredName of account in NT8

Code examples​

import requests

token = 'my-secret-token'

url = "https://app.crosstrade.io/v1/api/accounts/Sim101/positions"
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}")

Response​

// positions may be []; tag is null when untagged.
{
"positions": [
{
"type": "NinjaTrader.Cbi.Position",
"account": "Sim101",
"instrument": "ES 12-26",
"instrumentType": "Future",
"marketPosition": "Long",
"quantity": 2,
"averagePrice": 6000.25,
"marketPrice": 6001.5,
"unrealizedProfitLoss": 125.0,
"tag": null
}
],
"success": true
}

Success field types​

All fields are required. Only tag is nullable. Float fields accept whole or fractional JSON numbers.

FieldTypeDescription
successbooleantrue on success.
positionsarray of objectsAccount's position collection; may be empty.
positions[].typestringNormally NinjaTrader.Cbi.Position.
positions[].accountstringAccount name reported by NT8.
positions[].instrumentstringFull instrument name, including the futures contract month.
positions[].instrumentTypestringInstrument category, such as Future.
positions[].marketPositionstringLong, Short, or Flat.
positions[].quantityintegerPosition size; side is given by marketPosition.
positions[].averagePricefloatAverage entry price.
positions[].marketPricefloatMarket price at the snapshot.
positions[].unrealizedProfitLossfloatUnrealized P/L in currency units.
positions[].tagstring or nullAssociated tag, or null when untagged.

Platform nuances​

NT8 returns the position collection in positions. Each position uses marketPosition for its side and includes the current unrealizedProfitLoss. This account-specific route does not support an includeFlat query parameter and does not explicitly filter flat entries from NT8's collection.

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": "ListPositions",
"args": {
"account": "Sim101"
}
}