POST Reverse
- NT8
- Tradovate
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
| Name | Value |
|---|---|
| Content-Type | application/json |
| Authorization | Bearer <token> |
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
account | string | Required | Name of account in NT8 |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Required | Name of underlying instrument (e.g., "ES 12-24") |
Code examples
- Python
- JavaScript
- cURL
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}")
const token = 'my-secret-token';
const url = "https://app.crosstrade.io/v1/api/accounts/Sim101/positions/reverse";
const data = {
instrument: "MES 12-25"
};
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://app.crosstrade.io/v1/api/accounts/Sim101/positions/reverse" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"instrument": "MES 12-25"
}'
Response
- 200
- 400
{
"orderId": "cb1fc8d4e1a84d29ae38fea964aaac8c",
"success": true
}
{
"error": "No position found for instrument 'ES 12-25' in account 'sim101'"
}
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 09-26"
}
}
Combined Close Position and Place Order Tradovate
Liquidates the current Tradovate position and opens an equal-sized position in the opposite direction. The request executes server-side through the same validation and controls as a Tradovate webhook signal, including field validation, Account Manager locks, and Trade Copier fan-out.
Endpoint
POST /v1/api/tv/accounts/{account}/positions/reverse
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 |
Body parameters
| Name | Type | Required | Description |
|---|---|---|---|
instrument | string | Required | Continuous (ES1!), NT8 (ES 09-26), or Tradovate (ESU6) instrument form |
The current position size and direction are read from the live account. No action or quantity is supplied.
Code examples
- Python
- JavaScript
- cURL
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/positions/reverse"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {
"instrument": "ES1!"
}
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}")
const token = 'my-secret-token';
const url = "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/positions/reverse";
const data = {
instrument: "ES1!"
};
fetch(url, {
method: "POST",
headers: {
"Authorization": `Bearer ${token}`,
"Content-Type": "application/json"
},
body: JSON.stringify(data)
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
TOKEN="my-secret-token"
curl -X POST "https://app.crosstrade.io/v1/api/tv/accounts/DEMO12345678/positions/reverse" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"instrument": "ES1!"}'
Response
This abbreviated response envelope shows the operation result. The full response also includes dispatcher context such as destination, account, instrument, and duration.
{
"success": true,
"api": "reverse",
"response": {}
}
Platform nuances
- The live position determines the replacement side and size.
- The command waits for the current position and working orders to clear. A settlement timeout fails closed without placing the opposite entry.
- Tradovate accepts three instrument naming forms.
- The operation does not require the NinjaTrader add-on to be connected.
- Account Manager and Trade Copier behavior is applied by the shared dispatcher.
See the Tradovate API overview for the full field grammar, mutation safety guarantees, and error table.