curl -X GET "https://api.polyhush.com/api/v1/trading/pnl" \
-H "X-API-Key: your-api-key"
Response
Total profit/loss (realized + unrealized).
Realized profit/loss from completed trades, settlements, and fees.
Unrealized profit/loss from open positions (current price vs average price).
Total USDC spent on buy orders (all-time).
Total USDC received from sell orders (all-time).
Total USDC received from market settlements and refunds.
Total fees paid (sell fees + settlement fees).
Current market value of all open positions.
{
"total_pnl": 12.45,
"realized_pnl": -45.02,
"unrealized_pnl": 57.47,
"total_buys": 1190.10,
"total_sells": 1035.35,
"total_settlements": 121.29,
"total_fees": 11.56,
"portfolio_value": 102.50
}
How PnL is Calculated
Realized PnL
realized_pnl = (total_sells + total_settlements) - (total_buys + total_fees)
This represents the actual profit or loss from:
- Selling positions (at higher or lower price than purchased)
- Market settlements (winning or losing predictions)
- Minus all fees paid
Unrealized PnL
unrealized_pnl = sum((current_price - average_price) * size) for each open position
This represents the paper profit or loss if you were to sell all open positions at current market prices.
Total PnL
total_pnl = realized_pnl + unrealized_pnl