BETAThe Prediction Market API is currently in beta and subject to breaking changes as we continue to improve the product. If you have any feedback, please reach out in Discord.
Prerequisite
Before managing positions, ensure you have:- An API key from the Jupiter Portal
- Open positions from Opening Positions
- Requires signing and transaction submission, install
@solana/web3.jsnpm library
Viewing Your Positions
See Position Data & History for full details on how to query, filter, and interpret your open positions, including all available parameters and data fields. Example: Fetch all your open positionsFor descriptions of all position fields, parameters, and how to aggregate P&L,
see the Position Data & History doc.All USD values returned are denominated in native token units of JupUSD or USDC, where 1,000,000 units = $1.00.
Viewing Your Orders
See Position Data & History for details on available parameters, order fields, and examples. Example: Fetch all your open ordersSelling Contracts
You can sell contracts by closing entire position.Close Entire Position
UseDELETE /positions/{positionPubkey} to sell all contracts in a position.
Close All Positions
UseDELETE /positions to close all your open positions at once. This is useful for quickly exiting all markets.
Sign and Submit the Transaction
You’ll receive a base64-encoded transaction. You need to sign and submit it to finalize the position closure on-chain.Full Close Position Code Example
Full Close Position Code Example
