Trading Operations
Close Position
Manually close an existing position
POST
Overview
Manually close an existing position at the current market price. This endpoint allows you to realize profits or cut losses by closing your position immediately.Authentication
Include your API key in the X-API-Key header:Request Body
The unique identifier of the position to close.How to get: Use Get Positions to find your position IDs
Example: 12345
Example: 12345
Response Fields
Indicates if the position was closed successfully
Success message describing the operation
Blockchain transaction hash for the position closure
ID of the closed position
Price at which the position was closed
PnL from price movement only (excludes funding)
Total funding payments received/paid during position lifetime
Total PnL including funding (pricePnl + accumulatedFunding)
Net PnL after fees (grossPnl - fee)
Total fees charged for closing the position
Gas consumed for the transaction
Updated position object with closure details
Error Responses
Invalid position ID or position cannot be closed
Missing or invalid authentication token
Attempting to close position that doesn’t belong to your wallet
Rate limit exceeded (10 requests per minute for trading endpoints)
Next Steps
After closing a position:- Check Balance - View updated balance in Account
- Review Performance - Analyze trade in Dashboard
- Monitor Queue - If queued, check status with Queue Positions
- Plan Next Trade - Use Market Data for analysis