Skip to main content

POST Reverse

Combined Close Position and Place Order NT8​

Automatically reads the current position size and direction, then closes the position and opens one of equal size in the opposite direction.

Endpoint​

POST /v1/api/accounts/{account}/positions/reverse

Headers​

NameValue
Content-Typeapplication/json
AuthorizationBearer <token>

Path parameters​

NameTypeRequiredDescription
accountstringRequiredName of account in NT8

Body parameters​

NameTypeRequiredDescription
instrumentstringRequiredName of underlying instrument (e.g., "ES 12-24")

Code examples​

import requests

token = 'my-secret-token'

url = "https://app.crosstrade.io/v1/api/accounts/Sim101/positions/reverse"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {
"instrument": "MES 12-25"
}

try:
response = requests.post(url, headers=headers, json=data)
print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
print(f"An error occurred: {e}")

Response​

{
"orderId": "cb1fc8d4e1a84d29ae38fea964aaac8c",
"success": true
}

Platform nuances​

Only account and instrument are required — action and quantity are inferred from the live position. The endpoint returns an error if no position is open. Use this when you want to flip a position without specifying parameters manually; use Reverse Position when the replacement entry needs an explicit size or order type.

The endpoint waits for the current position and associated working orders to clear before placing the opposite entry. If settlement times out, it fails closed and does not place the replacement.

WebSocket API​

This request can also be made over the WebSocket API. The account path parameter and request body fields are all passed inside args.

{
"action": "rpc",
"id": "my-request-id",
"api": "Reverse",
"args": {
"account": "Sim101",
"instrument": "ES 12-26"
}
}