Skip to main content

GET Positions

Get list of all positions in one account

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": [
{
"type": "NinjaTrader.Cbi.Position",
"account": "Sim101",
"instrument": "ES 12-25",
"instrumentType": "Future",
"marketPosition": "Long",
"quantity": 4,
"averagePrice": 5779.8125,
"marketPrice": 5796.25,
"unrealizedProfitLoss": 3287.5
}
],
"success": true
}

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"
}
}