POST Flatten Everything
Flattens all positions and orders in all accounts for all instruments.
Flatten all NT8 positions and orders
POST /v1/api/positions/flatten
Closes positions in all or one account that meet all of the specified criteria: account, instrument, market position.
WARNING: An empty JSON payload (i.e., no filters applied) to this endpoint will close all positions and all orders across all accounts.
Headers
Name
Value
Content-Type
application/json
Authorization
Bearer <token>
Body
Name
Type
Required
Description
account
string
Optional
Name of the account
instrument
string
Optional
Name of underlying instrument
marketPosition
string
Optional
"long" or "short"
Code Examples
import requests
url = "https://app.crosstrade.io/v1/api/positions/flatten"
headers = {
"Authorization": "Bearer frvO0lK6cXe9ML5ITNlEduwP5J1oNzLT0XTBRjR_OZ0",
"Content-Type": "application/json"
}
data = {
"account": "Sim101",
"instrument": "MES 12-25",
"marketPosition": "short"
}
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
Last updated