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
integer
required
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
boolean
Indicates if the position was closed successfully
string
Success message describing the operation
string
Blockchain transaction hash for the position closure
integer
ID of the closed position
string
Price at which the position was closed
string
PnL from price movement only (excludes funding)
string
Total funding payments received/paid during position lifetime
string
Total PnL including funding (pricePnl + accumulatedFunding)
string
Net PnL after fees (grossPnl - fee)
string
Total fees charged for closing the position
integer
Gas consumed for the transaction
object
Updated position object with closure details
Error Responses
object
Invalid position ID or position cannot be closed
object
Missing or invalid authentication token
object
Attempting to close position that doesn’t belong to your wallet
object
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