GET Position
- NT8
- Tradovate
Get a specific position by instrument NT8
Returns the current NinjaTrader position for one account and instrument.
Supply the full native NT8 instrument name, including the intended contract month and year for futures. Continuous-symbol translation is a webhook-ingestion feature, not part of this endpoint's contract. Your integration is responsible for selecting the correct instrument. See NT8 instrument names.
Endpoint
GET /v1/api/accounts/{account}/position
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 |
|---|---|---|---|
instrument | string | Required | URL-encoded instrument name |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/accounts/Sim101/position"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
try:
response = requests.get(url, headers=headers, params={'instrument': 'MES 06-25'})
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 params = new URLSearchParams({ instrument: 'MES 06-25' });
const url = `https://app.crosstrade.io/v1/api/accounts/Sim101/position?${params}`;
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/position?instrument=MES%2006-25" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
Response
- 200
- 400
- 401
- 403
- 408
- 429
- 500
{
"type": "NinjaTrader.Cbi.Position",
"account": "Sim101",
"instrument": "ES 12-25",
"instrumentType": "Future",
"marketPosition": "Long",
"quantity": 4,
"averagePrice": 5779.8125,
"marketPrice": 5789.5,
"unrealizedProfitLoss": 1937.5,
"tag": null,
"success": true
}
{
"error": "Position for instrument 'ES 12-26' not found in account 'Sim101'"
}
{
"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
| Field | Type | Description |
|---|---|---|
success | boolean | true on success. |
type, account, instrument, instrumentType | string | Position identity and instrument category. |
marketPosition | string | Long, Short, or Flat. |
quantity | integer | Position size. |
averagePrice, marketPrice, unrealizedProfitLoss | float | Entry price, market price and P/L in currency units. |
tag | string or null | Associated tag; null when untagged. |
Platform nuances
NT8 returns position fields at the top level and expresses direction with marketPosition.
WebSocket API
This request can also be made over the WebSocket API. The account path parameter and instrument query parameter are passed inside args.
{
"action": "rpc",
"id": "my-request-id",
"api": "GetPosition",
"args": {
"account": "Sim101",
"instrument": "ES 12-26"
}
}
Get a specific position by instrument Tradovate
Returns the net position for one linked Tradovate account and instrument. The request executes server-side against the Tradovate Web API and works while NinjaTrader is closed.
Endpoint
GET /v1/api/tv/accounts/{account}/position?instrument=
Headers
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Tradovate account name, such as DEMO12345678 |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Required | Continuous (ES1!), NT8 (ES 12-26), or Tradovate (ESZ6) instrument form |
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/position"
headers = {
"Authorization": f"Bearer {token}"
}
params = {
"instrument": "ES1!"
}
try:
response = requests.get(url, headers=headers, params=params)
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 params = new URLSearchParams({ instrument: "ES1!" });
const url = `https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/position?${params}`;
fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${token}`
}
})
.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/tv/accounts/DEMO12345678/position?instrument=ES1!' \
-H "Authorization: Bearer $TOKEN"
Response
Successful reads return {"success": true, "data": ...}. Here, data contains account,
symbol, signed netPos, and the underlying position object. A positive netPos is long,
a negative value is short, and 0 means flat.
- 200
- 400
- 401
- 403
- 429
- 500
- 502
- 503
// Captures only contain a flat position; populated position fields are unverified.
{
"success": true,
"data": {
"account": "DEMO12345678",
"symbol": "ESZ6",
"netPos": 0,
"position": {}
}
}
{
"success": false,
"error": "unknown_account"
}
{
"success": false,
"error": "inactive_subscription"
}
{
"success": false,
"error": "tradovate_not_linked"
}
// retryAfter is integer seconds; also sent as Retry-After.
{
"success": false,
"error": "rate_limited",
"detail": "CrossTrade API rate limit exceeded (180 requests/min per user). Retry after 1s.",
"retryAfter": 1
}
{
"success": false,
"error": "internal_error"
}
{
"success": false,
"error": "tradovate_unavailable",
"detail": "Tradovate is temporarily unavailable. Please try again shortly."
}
{
"success": false,
"error": "temporarily_disabled"
}
Success field types
| Field | Type | Description |
|---|---|---|
success | boolean | true on success. |
data | object | Position lookup result. |
data.account, data.symbol | string | Account and resolved contract. |
data.netPos | integer | Signed net quantity. |
data.position | object | Empty when flat; populated shape not yet captured on this route. |
Platform nuances
- Tradovate accepts three instrument naming forms and resolves them server-side.
- This is Tradovate's raw position row, which can keep reporting the pre-fill state for tens of seconds after a fill. For a live net right after a fill, use
GET /v1/api/tv/accounts/{account}/positions, which is fill-reconciled. - Direction is represented by the sign of
netPos, rather than the NT8marketPositionfield. - The response is wrapped in
data; the NT8 endpoint returns position fields at the top level.
See the Tradovate API overview for the full field grammar, mutation safety guarantees, and error table.