Get Position History
Query the authenticated user's closed prediction market positions. Includes settlement results (WIN/LOSE) for resolved events.
HTTP Request
POST/v5/alpha/prediction/position-historyRequest Parameters
| Parameter | Required | Type | Comments |
|---|---|---|---|
| tokenId | false | string | Filter by outcome token ID |
| eventId | false | string | Filter by event ID |
| result | false | integer | Filter by position outcome. Refer to predictionPositionResult |
| days | false | integer | Look back N days. Max: 90 |
| limit | false | integer | Number of records per page |
| pageIndex | false | integer | Page number starting from 1 |
Response Parameters
| Parameter | Type | Comments |
|---|---|---|
| positions | array | Closed position records |
| > positionId | string | Position ID |
| > tokenId | string | Outcome token ID |
| > eventId | string | Event ID |
| > outcomeName | string | Outcome label (e.g., YES, NO) |
| > shares | string | Total shares that were held |
| > cost | string | Total USDC cost of this position |
| > avgPrice | string | Average cost price per share |
| > exitPrice | string | Price at which the position was closed |
| > realizedPnl | string | Realized profit/loss (USDC). Positive = profit |
| > realizedPnlRate | string | Realized P&L as decimal ratio |
| > result | integer | Position outcome. Refer to predictionPositionResult |
| > closedAt | integer | Position close timestamp (UTC milliseconds) |
| total | integer | Total matching records |
Request Example
- HTTP
- Python
- Node.js
POST /v5/alpha/prediction/position-history HTTP/1.1
Host: api.bybit.com
X-BAPI-SIGN: XXXXXX
X-BAPI-API-KEY: xxxxxxxxxxxxxxxxxx
X-BAPI-TIMESTAMP: 1704067200000
X-BAPI-RECV-WINDOW: 5000
Content-Type: application/json
{
"limit": 20,
"pageIndex": 1,
"days": 30
}
Response Example
{
"retCode": 0,
"retMsg": "OK",
"result": {
"positions": [
{
"positionId": "pos_456",
"tokenId": "token_yes_456",
"eventId": "event_456",
"outcomeName": "YES",
"shares": "200",
"cost": "140.00",
"avgPrice": "0.70",
"exitPrice": "1.00",
"realizedPnl": "60.00",
"realizedPnlRate": "0.429",
"result": 1,
"closedAt": 1704153600000
}
],
"total": 1
},
"retExtInfo": {},
"time": 1704067200000
}