Skip to main content

Portfolio

GET /v1/account/portfolio
Returns a complete portfolio snapshot combining balance, positions, and aggregate metrics.

Request

curl -H "X-API-Key: $API_KEY" \
  https://api.polysimulator.com/v1/account/portfolio

Response

{
  "balance": {
    "user_id": 1,
    "balance": "993.50",
    "currency": "USD",
    "starting_balance": "1000.00",
    "pnl": "-6.50",
    "pnl_percent": "-0.65"
  },
  "positions": [
    {
      "id": 1,
      "market_id": "0x1a2b3c...",
      "outcome": "Yes",
      "quantity": "10.0",
      "avg_entry_price": "0.65",
      "current_price": "0.70",
      "market_value": "7.00",
      "unrealized_pnl": "0.50",
      "status": "OPEN"
    }
  ],
  "total_position_value": "7.00",
  "total_portfolio_value": "1000.50",
  "total_unrealized_pnl": "0.50",
  "total_trades": 5,
  "win_rate": "60.00"
}
FieldDescription
total_position_valueSum of all open position market values
total_portfolio_valueCash balance + total position value
total_unrealized_pnlSum of all unrealized P&L
total_tradesTotal filled orders
win_ratePercentage of profitable closed positions

Bot Integration

portfolio = requests.get(
    f"{BASE}/v1/account/portfolio",
    headers=headers,
).json()

cash = Decimal(portfolio["balance"]["balance"])
total = Decimal(portfolio["total_portfolio_value"])
positions = portfolio["positions"]

print(f"Cash: ${cash} | Total: ${total} | Positions: {len(positions)}")
print(f"Win rate: {portfolio['win_rate']}%")

# Check if over-allocated
cash_pct = cash / total * 100
if cash_pct < 20:
    print("Warning: Low cash — consider reducing positions")

Next Steps