Hey partners! We've released new endpoints that enable partial position selling. This allows users to sell a portion of their leveraged position while keeping the rest active.
The partial sell feature uses two API endpoints, which can be bundled together using Jito on the front-end:
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:
{
"transaction": string, // Base58 encoded transaction to sign
"newPosition1": { // Position to be sold (splitRatioBps %)
"splitRatioBps": number,
"positionData": {
"publicKey": string,
"account": {
"collateralAmount": number,
"collateralType": string,
"seed": string,
"userPaid": number,
"amount": number
}
}
},
"newPosition2": { // Remaining position (100 - splitRatioBps %)
// Same structure as newPosition1
}
}
Example Response:
{
"transaction": "base58_encoded_transaction",
"newPosition1": {
"splitRatioBps": 2500,
"positionData": {
"publicKey": "3QsgyW8ahzSbhCyxZW6WdsfC4ufHdnAVoPwxQnnqbuoh",
"account": {
"collateralAmount": 1421706,
"collateralType": "JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN",
"seed": "HyzvdsBihv7Hd8skcX9xvBNufqzf7sikCjRSYHByk4Bj",
"userPaid": 625000,
"amount": 62500
}
}
},
"newPosition2": { */* remaining 75% position data */* }
}
POST /positions/sell-manual-build
Request Body: