Liquidate open positions either by position ID, symbol, or liquidate all open positions at once. Liquidation forcibly closes positions and updates their status to LIQUIDATED.
Liquidation is a destructive operation that immediately closes positions. Use with caution in production environments.
Endpoints
Liquidate Single Position
POST /api/v1/trading/liquidate
Liquidate one open position by either position_id or symbol.
Liquidate All Positions
POST /api/v1/trading/liquidate_all
Liquidate all open positions in a single operation.
Liquidate Single Position
Request Body
Unique identifier of the position to liquidate. Takes priority over symbol if both are provided. Format: pos-YYYYMMDDHHMMSS-sequence Example: "pos-20260303120000-1"
Trading pair symbol. Liquidates the first open position matching this symbol. Example: "BTC/USDT"
Either position_id or symbol must be provided. If both are provided, position_id takes precedence.
Response
Response status: "success" or "error"
Updated position details after liquidation Show PositionRecord properties
Unique position identifier
ID of the order that opened this position
Exchange where position was held
Position side (BUY or SELL)
Position size (decimal string)
Entry price (decimal string)
Position status - will be LIQUIDATED after successful liquidation
ISO 8601 timestamp when position was opened
ISO 8601 timestamp when position was liquidated
Error Responses
400 Bad Request : Neither position_id nor symbol was provided
404 Not Found : No open position found matching the criteria
500 Internal Server Error : Failed to liquidate position
Example Request
curl -X POST https://api.neuratrade.com/api/v1/trading/liquidate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"position_id": "pos-20260303120000-1"
}'
curl -X POST https://api.neuratrade.com/api/v1/trading/liquidate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"symbol": "BTC/USDT"
}'
Example Response
{
"status" : "success" ,
"data" : {
"position_id" : "pos-20260303120000-1" ,
"order_id" : "ord-20260303120000-1" ,
"exchange" : "binance" ,
"symbol" : "BTC/USDT" ,
"side" : "BUY" ,
"size" : "0.01" ,
"entry_price" : "50000.00" ,
"status" : "LIQUIDATED" ,
"opened_at" : "2026-03-03T12:00:00Z" ,
"updated_at" : "2026-03-03T12:10:00Z"
}
}
{
"status" : "error" ,
"error" : "open position not found"
}
Liquidate All Positions
Request
No request body required. All open positions will be liquidated.
Response
Response status: "success" or "error"
Container for liquidation results Number of positions liquidated
Array of liquidated position records (see PositionRecord schema above)
Example Request
curl -X POST https://api.neuratrade.com/api/v1/trading/liquidate_all \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"status" : "success" ,
"data" : {
"count" : 2 ,
"positions" : [
{
"position_id" : "pos-20260303120000-1" ,
"order_id" : "ord-20260303120000-1" ,
"exchange" : "binance" ,
"symbol" : "BTC/USDT" ,
"side" : "BUY" ,
"size" : "0.01" ,
"entry_price" : "50000.00" ,
"status" : "LIQUIDATED" ,
"opened_at" : "2026-03-03T12:00:00Z" ,
"updated_at" : "2026-03-03T12:15:00Z"
},
{
"position_id" : "pos-20260303120000-2" ,
"order_id" : "ord-20260303120000-2" ,
"exchange" : "okx" ,
"symbol" : "ETH/USDT" ,
"side" : "SELL" ,
"size" : "0.5" ,
"entry_price" : "3000.00" ,
"status" : "LIQUIDATED" ,
"opened_at" : "2026-03-03T12:05:00Z" ,
"updated_at" : "2026-03-03T12:15:00Z"
}
]
}
}
{
"status" : "success" ,
"data" : {
"count" : 0 ,
"positions" : []
}
}
Liquidation Confirmation
When a position is liquidated:
Position status is updated to LIQUIDATED
Associated order status is updated to CLOSED
Update timestamp is set to the liquidation time
Position remains in database for historical tracking and auditing
Liquidation does NOT execute actual exchange orders. This endpoint only updates the internal position tracking state. For production use, integrate with exchange APIs to execute closing orders.