POST Reverse Position
Reverses the position specified by instrument in the account.
Combined Close Position and Place Order
Name
Value
Name
Type
Required
Description
Name
Type
Required
Description
Last updated
Reverses the position specified by instrument in the account.
Last updated
import requests
token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/accounts/Sim101/positions/reverseposition"
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}
data = {
"instrument": "MES 12-25",
"action": "BUY",
"orderType": "MARKET",
"quantity": 1,
"timeInForce": "DAY"
# "limitPrice": 5500
# "stopPrice": 0,
# "ocoId": "abc123",
# "strategy": "MyAtmStrategy"
}
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}"){
"orderId": "cb1fc8d4e1a84d29ae38fea964aaac8c",
"success": true
}{
"error": "No position found for instrument 'ES 12-25' in account 'sim101'"
}