Reference
Position events+
PremiumEvery fill in its position-lifecycle context, tagged with the position it belongs to and what it did to it (open, increase, decrease, close, liquidation). Search the history over REST, or stream fills live over WebSocket with the same fields (delivery is best-effort; the REST endpoints remain the durable source of truth). A position's own fill timeline is under Positions.
Position events search
PremiumGET
Every fill, newest first, tagged with its position and what it did to that position (open, increase, decrease, close, liquidation). Cursor-paginated, up to 500 rows per page.
History depth
Headers
- API key sent in the request header; never accepted as a query parameter.
x-api-keystringrequiredQuery parameters
- Filter to a single market symbol, e.g. SOL (one value; lists are not supported). Results may aggregate protocol-native variants that share the market symbol.
- Filter to a protocol-native market variant.
- Filter to a wallet address.
- Comma-separated event types to return: open, increase, decrease, close, liquidation. Omit for all.
- Inclusive RFC 3339 window start; defaults to the plan's history limit.
- Inclusive RFC 3339 window end; defaults to the current time.
- Opaque token from the previous page; omit for the first page and keep all filters unchanged while paging.
marketstringmarket_variantstringaddressstringtypestringfromstringtostringcursorstringResponse
200{ data: PositionEvent[], next_cursor }Request
cURL
curl --request GET \ --url https://api.perpdb.xyz/v1/gmtrade/position-events/search?type=open,close \ --header 'x-api-key: ak_...'
Example
{
"data": [
{
"protocol": "gmtrade",
"position_id": 46962943,
"market": "XAU",
"market_variant": "XAU/USD[USDC]",
"address": "T35qH6R6xcffWQibQG8mHqusuM4gVzbnyC4cHFMkB2Hn",
"side": "short",
"type": "increase",
"time": "2026-11-25T18:51:50.000Z",
"size_delta_usd": 5171.133810368194,
"position_size_usd": 11071.133810368194,
"collateral_delta_usd": 72.83278588944,
"price": 3547.979980173537,
"entry_price": 3542.5175653795654,
"pnl_delta_usd": 0,
"fee_usd": 0.91218702672,
"borrowing_fee_usd": 0.00292653168,
"funding_fee_usd": 0,
"liquidation_fee_usd": 0,
"fee_total_usd": 0.9151135584,
"trade_id": 829916,
"tx": "n8F1qDSuiYRrX1S1Gcu9YMF5JS1pRxfniZF3QumZrLKpNrrxSBPvvgHcsXXATgWdEcW7jYQ3C2sgBQfdcUrN9GT"
},
{
"protocol": "gmtrade",
"position_id": 46963864,
"market": "XAU",
"market_variant": "XAU/USD[USDC]",
"address": "9MjTmAdFS1dzix5dmzU9hzBCAyYdUZWrqWiRZR9JLjeG",
"side": "short",
"type": "increase",
"time": "2026-11-25T18:51:50.000Z",
"size_delta_usd": 899.9999999999991,
"position_size_usd": 6703.999999999999,
"collateral_delta_usd": -0.15713985360000038,
"price": 3547.979943821285,
"entry_price": 3551.3910579781864,
"pnl_delta_usd": 0,
"fee_usd": 0.1571398536,
"borrowing_fee_usd": 0,
"funding_fee_usd": 0,
"liquidation_fee_usd": 0,
"fee_total_usd": 0.1571398536,
"trade_id": 829915,
"tx": "pTKnBnFPyYPz8uahpMEfLj2QFYrJfwQTNZWsaJXC1P4SHQH9iLyTDvhwCM7GRcTTfDwtfnLG4ub41rfoV7AxupVq"
}
],
"next_cursor": "MjAyNi0xMS0yNVQxODo0MjozMi4wMDBafDIyNzc5N3xDMzFYWVlHZG05ajdKY05Tb1Vzbm1RRmdYM0txYkpCRWRkOTJHMWk2VzdaN3w4ODVkNGY4YmI2NzE"
}Position event stream
PremiumWSS
Stream fills as they land, each tagged with the position_id the REST surface exposes. The scope is the URL, so watching several scopes means opening several connections.
Headers
- API key sent in the WebSocket upgrade header; never accepted as a query parameter.
x-api-keystringrequiredQuery parameters
- Optionally filter the stream to a market symbol or protocol-native market variant, when available.
- Optionally filter the stream to an owner address; combining filters returns their intersection.
- Deliver only these event types, comma-separated: open, increase, decrease, close, liquidation. Combines with market and address. Omit for all.
marketstringaddressstringtypestringConnection limits
- Concurrent connections per account
- 50
Response
101{ data: PositionEvent }Request
websocat
websocat -H 'x-api-key: ak_...' \ 'wss://api.perpdb.xyz/v1/stream/gmtrade/position-events?market=SOL'
Example
{
"data": {
"protocol": "gmtrade",
"position_id": 4821937,
"market": "SOL",
"market_variant": "SOL/USD[WSOL-USDC]",
"address": "7NfgSkEcRr3FBixjD5cJTmb4kAV8Y6DAxNvbLnk3S9pE",
"side": "long",
"type": "increase",
"time": "2026-08-09T14:32:07.184Z",
"size_delta_usd": 2500,
"position_size_usd": 7500,
"collateral_delta_usd": 500,
"price": 168.42,
"entry_price": 165.87,
"pnl_delta_usd": 0,
"fee_usd": 1.5,
"borrowing_fee_usd": 0.22,
"funding_fee_usd": 0.08,
"liquidation_fee_usd": null,
"fee_total_usd": 1.8,
"trade_id": 918273,
"tx": "3QzUyfWvYcJ8gV1kM5xTn9rBq2eL6hPdS4mKjNwEbAtCgRfXhZs7DqoJp8uWvYcLkM5xTn9rBq2eL6hPdS4mKjNw"
}
}