Closed-position stats for a wallet
Changed onAggregate over the wallet's CLOSED position lifecycles: count, average/min/max hold time, total and average realized PnL, win/loss counts, win rate, and the first/last close time (RFC 3339). Source: the latest 10,000 eligible rows for the wallet in position_lifecycles_full — closed perps only, excluding censored lifecycles that opened before the table's start. There is no time cutoff. The 10,000-position cap bounds work for very active wallets; totalPositions is therefore at most 10,000. losingPositions counts realized_pnl <= 0 (flat closes included), so winningPositions + losingPositions = totalPositions. winRate = winningPositions / totalPositions x 100. Coverage: this route previously aggregated the legacy closed_positions table, whose history reaches further back than the lifecycle table (which begins on 2026-08-31) but whose PnL was the unrealized snapshot at close rather than realized PnL, and whose exact per-position resolution could not complete within the request budget for wallets with tens of thousands of closed positions. totalPositions and firstClose can therefore be lower/later than before because lifecycle history is shorter and the newest 10,000-position cap may apply; PnL figures are now realized. Wallets with no eligible closed lifecycle return zero counts and omit firstClose/lastClose.
Request
- Base URLhttps://api.coinversa.ai
- AuthAPI key in header X-API-Key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
Wallet address to inspect (0x followed by 40 hexadecimal characters; case-insensitive). An address with no indexed history returns an empty result, not 404.
Response
OK
Example response
{
"$schema": "https://api.coinversa.ai/schemas/ClosedPositionStatsBody.json"
}Changes
- info
api tag
Pulseadded - info
added the non-success response with the status
- info
removed the non-success response with the status
- info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status
- info