Position Partial Sell
This allows users to sell a portion of their leveraged position while keeping the rest active.
How It Works:
The partial sell feature uses two API endpoints, which can be bundled together using Jito on the front-end:
Split Position - Divides a position into two separate positions
Sell Manual Build - Sells one of the split positions
API Endpoints:
1. Split Position
POST /positions/split
Request Body:
{
"positionId": string, // Position address to split
"userPubKey": string, // User's wallet public key
"splitRatioBps": number, // Split ratio in basis points (2500 = 25%)
"quoteToken": string // Quote token mint address
}Example Request:
{
"positionId": "AezAHf5e6Cfiyyvu35KkWKEuZKLsEAN4XWzA36NvvCBw",
"userPubKey": "CL7LTBpFgEcMrDkTfQpet9VvsGJas1iTxRJ6m1tXrTA9",
"splitRatioBps": 2500,
"quoteToken": "So11111111111111111111111111111111111111112"
}Response:
Example Response:
2. Sell Manual Build
POST /positions/sell-manual-build
Request Body:
Example Request Body:
Response:
Implementation Steps:
Get Split Transaction & Position Data
Call
/positions/splitwith desired split ratio (in basis points)Receive the transaction and new position details
Get Sell Transaction
Use the
newPosition1data from split responseCall
/positions/sell-manual-buildwith the position details
Bundle with Jito
Get latest blockhash
Deserialize both transactions
Add Jito tip transaction (recommended: use 1.5x of 99th percentile tip floor)
Sign all three transactions
Submit bundle to Jito
Jito Bundle Implementation Example:
Last updated