Skip to main content
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.
This doc covers the data endpoints for querying positions, orders, and transaction history. Use these endpoints to build dashboards, track P&L, and maintain audit trails.

Prerequisite

To query position data, you need:
API REFERENCEFor complete endpoint specifications, see the Prediction API Reference.

Querying Positions

Use GET /positions to retrieve position data with comprehensive P&L information.
ParameterTypeDescription
ownerPubkeystringWallet public key (required)
marketPubkeystringFilter by market account pubkey
marketIdstringFilter by market ID
isYesbooleanFilter by position side
startnumberPagination start index
endnumberPagination end index
List endpoints (/positions, /orders, /history) return a pagination object alongside data:
FieldTypeDescription
startintegerStart index of the current page
endintegerEnd index of the current page
totalintegerTotal number of results available
hasNextbooleantrue if more results exist beyond the current page

Position Fields

Each position includes identity, state, and P&L fields. All USD values are in micro USD (1,000,000 = $1.00).

Identity and State

FieldTypeDescription
pubkeystringPosition account public key
ownerPubkeystringPosition owner wallet public key
marketIdstringExternal market identifier
isYesbooleantrue if this is a YES position, false for NO
contractsstringNumber of contracts held (u64 as string)
openOrdersintegerNumber of currently open orders for this position
claimablebooleantrue when the position qualifies for payout claim
claimedbooleanWhether payout has already been claimed
claimedUsdstringAmount claimed in micro USD
openedAtintegerUnix timestamp (seconds) when the position was opened
updatedAtintegerUnix timestamp (seconds) of the last position update
claimableAtinteger, nullableUnix timestamp (seconds) when position becomes claimable
settlementDateinteger, nullableUnix timestamp (seconds) when the market settles

Pricing and P&L

FieldTypeDescription
totalCostUsdstringTotal cost basis in micro USD
sizeUsdstringAlias of totalCostUsd in micro USD
avgPriceUsdstringAverage entry price per contract in micro USD
markPriceUsdstring, nullableCurrent mark price per contract in micro USD; null when market is closed
sellPriceUsdstring, nullableCurrent best exit price for this side in micro USD; null when unavailable
valueUsdstring, nullableCurrent mark-to-market value in micro USD; null when market is closed
payoutUsdstringNotional payout if position wins (contracts x $1)
pnlUsdstring, nullableUnrealized P&L in micro USD; null when market is closed
pnlUsdPercentnumber, nullableUnrealized P&L as percentage of cost basis
pnlUsdAfterFeesstring, nullableUnrealized P&L after estimated fees in micro USD
pnlUsdAfterFeesPercentnumber, nullableUnrealized P&L after fees as percentage of cost basis
realizedPnlUsdnumberRealized P&L from closed portions in micro USD
feesPaidUsdstringTotal fees paid in micro USD

Metadata

FieldTypeDescription
eventMetadataobjectParent event metadata: eventId, title, subtitle, imageUrl, isLive, isActive, category, subcategory, beginAt, closeCondition
marketMetadataobjectMarket metadata: marketId, eventId, title, subtitle, description, status, result, openTime, closeTime

Get All Positions

const response = await fetch(
  'https://api.jup.ag/prediction/v1/positions?' + new URLSearchParams({
    ownerPubkey: wallet.publicKey.toString()
  }),
  {
    headers: {
      'x-api-key': 'your-api-key'
    }
  }
);

const positions = await response.json();
const positions = await fetch(
  'https://api.jup.ag/prediction/v1/positions?' + new URLSearchParams({
    ownerPubkey: wallet.publicKey.toString()
  }),
  {
    headers: { 'x-api-key': 'your-api-key' }
  }
).then(r => r.json());

// Calculate totals
let totalValue = 0;
let totalCost = 0;
let totalPnl = 0;

for (const position of positions.data) {
  totalValue += parseInt(position.valueUsd) || 0;
  totalCost += parseInt(position.totalCostUsd) || 0;
  totalPnl += parseInt(position.pnlUsd) || 0;
}

console.log('Portfolio Summary:');
console.log(`Total Value: $${(totalValue / 1_000_000).toFixed(2)}`);
console.log(`Total Cost: $${(totalCost / 1_000_000).toFixed(2)}`);
console.log(`Total P&L: $${(totalPnl / 1_000_000).toFixed(2)}`);

Get a Specific Position

const positionPubkey = 'position-pubkey-789';
const response = await fetch(
  `https://api.jup.ag/prediction/v1/positions/${positionPubkey}`,
  {
    headers: {
      'x-api-key': 'your-api-key'
    }
  }
);

const position = await response.json();

Querying Orders

Use GET /orders to retrieve order history and fill details.
ParameterTypeDescription
ownerPubkeystringWallet public key
startnumberPagination start (or timestamp)
endnumberPagination end (or timestamp)

Order Fill Details

FieldDescription
statuspending, filled, or failed
filledContractsNumber of contracts executed
avgFillPriceUsdAverage execution price
totalCostUsdTotal cost of filled portion
feesPaidUsdFees charged
createdAtUnix timestamp of order creation
filledAtUnix timestamp of fill completion

Get All Orders

const response = await fetch(
  'https://api.jup.ag/prediction/v1/orders?' + new URLSearchParams({
    ownerPubkey: wallet.publicKey.toString()
  }),
  {
    headers: {
      'x-api-key': 'your-api-key'
    }
  }
);

const orders = await response.json();

Get Order Status

Use GET /orders/status/{orderPubkey} for detailed status and event history.
const orderPubkey = 'order-pubkey-123';
const response = await fetch(
  `https://api.jup.ag/prediction/v1/orders/status/${orderPubkey}`,
  {
    headers: {
      'x-api-key': 'your-api-key'
    }
  }
);

const status = await response.json();

Transaction History

Use GET /history to retrieve a complete audit trail of all prediction market activity.
ParameterTypeDescription
ownerPubkeystringWallet public key
positionPubkeystringFilter by specific position
startnumberStart timestamp or index
endnumberEnd timestamp or index
idstringFilter by specific event ID

Event Types

Event TypeDescription
order_createdNew order placed on-chain
order_filledOrder matched and executed
order_failedOrder could not be filled
position_updatedPosition modified by order fill
position_lostMarket resolved against position
payout_claimedWinnings withdrawn

History Event Fields

Each history event includes these fields. All USD values are in micro USD (1,000,000 = $1.00).
FieldTypeDescription
idintegerUnique history event identifier
eventTypestringEvent type (see table above)
signaturestringSolana transaction signature
slotstringSolana slot number
timestampintegerUnix timestamp (seconds) when the event occurred
orderPubkeystringAssociated order account public key
positionPubkeystringAssociated position account public key
marketIdstringExternal market identifier
ownerPubkeystringPosition or order owner public key
keeperPubkeystringKeeper that processed the transaction
externalOrderIdstringClient-provided order identifier
orderIdstringExternal order identifier from the venue
isBuybooleantrue when the event relates to a buy order
isYesbooleantrue when the event relates to the YES side
contractsstringNumber of contracts in the order
filledContractsstringNumber of contracts filled
contractsSettledstringNumber of contracts settled in this event
avgFillPriceUsdstringAverage fill price in micro USD
maxFillPriceUsdstringMaximum fill price in micro USD
maxBuyPriceUsdstring, nullableBuyer-specified max fill price in micro USD
minSellPriceUsdstring, nullableSeller-specified min fill price in micro USD
depositAmountUsdstringAmount deposited for this order in micro USD
totalCostUsdstringTotal cost of the order in micro USD
feeUsdstring, nullableFee charged for this event in micro USD
grossProceedsUsdstringGross proceeds before fees in micro USD
netProceedsUsdstringNet proceeds after fees in micro USD
transferAmountTokenstring, nullableToken amount transferred (native token units)
realizedPnlstring, nullableRealized P&L in micro USD
realizedPnlBeforeFeesstring, nullableRealized P&L before fees in micro USD
payoutAmountUsdstringPayout amount in micro USD (populated for payout_claimed events)
eventIdstringExternal event identifier
marketMetadataobjectMetadata for the associated market
eventMetadataobjectMetadata for the parent event

Get Transaction History

const response = await fetch(
  'https://api.jup.ag/prediction/v1/history?' + new URLSearchParams({
    ownerPubkey: wallet.publicKey.toString()
  }),
  {
    headers: {
      'x-api-key': 'your-api-key'
    }
  }
);

const history = await response.json();

What’s Next

Explore social features to view profiles, follow traders, and track leaderboards.

Social Features

Profiles, leaderboards, and trade feeds