Skip to main content

Query PnL (PREDICTION_TRADE)

API Description

Query profit and loss records for the authenticated user's prediction positions. When tokenId is provided, returns a single record in pnl; otherwise returns a list in pnlList.

HTTP Request

GET /sapi/v1/w3w/wallet/prediction/pnl/query

Request Weight(IP)

200

Request Parameters

NameTypeMandatoryDescription
walletAddressSTRINGYESUser's prediction wallet address
tokenIdSTRINGNOFilter by prediction token ID
marketIdLONGNOFilter by market ID. Must be > 0
marketTopicIdLONGNOFilter by market topic ID. Must be > 0
activeOnlyBOOLEANNOIf true, return only active (unresolved) positions

Response Example

{
"chainId": "56",
"walletAddress": "0x12e32db8817e292508c34111cbc4b23340df542c",
"pnl": null,
"pnlList": [
{
"id": 10001,
"chainId": "56",
"userId": 100103755893,
"walletAddress": "0x12e32db8817e292508c34111cbc4b23340df542c",
"marketTopicId": 4229564,
"marketId": 5567895,
"marketOutcomeId": 10001,
"tokenId": "112233",
"conditionId": "0xabc123",
"vendor": "PREDICT_FUN",
"collateralType": 1,
"currentShares": "1923.07",
"avgPrice": "0.52",
"currentPrice": "0.55",
"buyCount": 2,
"buyShares": "1923.07",
"buyAmtUsd": "1.00",
"sellCount": 0,
"sellShares": "0.00",
"sellAmtUsd": "0.00",
"redeemCount": 0,
"redeemShares": "0.00",
"redeemPayoutUsd": "0.00",
"buyFeeShares": "0.00",
"sellFeeUsd": "0.00",
"totalFeeUsd": "0.02",
"realizedPnl": "0.00",
"unrealizedPnl": "0.06",
"totalPnl": "0.06",
"pnlPercentage": "6.00",
"isResolved": false,
"isWinner": null,
"lastEventTime": 1748132000000,
"lastEventTxHash": null,
"blockNumber": 12345678
}
],
"totalCount": 1,
"totalRealizedPnl": "0.00",
"totalUnrealizedPnl": "0.06",
"totalPnl": "0.06"
}