GET Position
- NT8
- Tradovate
Get a specific position by instrument NT8
Returns the current NinjaTrader position for one account and instrument.
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
{
"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,
"success": true
}
{
"error": "Invalid request"
}
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 09-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 09-26), or Tradovate (ESU6) 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.
{
"success": true,
"data": {
"account": "DEMO12345678",
"symbol": "ESU6",
"netPos": 0,
"position": {}
}
}
Platform nuances
- Tradovate accepts three instrument naming forms and resolves them server-side.
- 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.