POST
/positions/{accountId}/close-allClose all positions
Closes every open position of the account at market. Stop and take orders attached to them end up as canceled_by_position;
pending entry orders are left alone.
Responds 204 with no body.
Base URL
https://api.upscale.tradeParameters
Path
accountIdstring · uuidrequiredTrader account identifier. Must belong to the caller.
Example:
00000000-0000-4000-8000-000000000000Examples
curl --request POST 'https://api.upscale.trade/positions/{accountId}/close-all' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY'const response = await fetch("https://api.upscale.trade/positions/{accountId}/close-all", {
method: "POST",
headers: {
"Accept": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
},
});
console.log(response.status, await response.text());import requests
response = requests.request(
"POST",
"https://api.upscale.trade/positions/{accountId}/close-all",
headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY"},
timeout=30,
)
print(response.status_code, response.text)Responses
401
Unauthorized
403
The account belongs to another user (account_access_denied), or the request is authenticated with an API key while api_trading is disabled on the account (api_trading_not_enabled).
404
No account with this identifier.
429
Rate limit of the API key exceeded (api_key_rate_limit_exceeded). Retry-After says when to come back; the body carries the bucket (read / write), the window that tripped, its limit and retryAt.