Skip to main content

Balance

GET /v1/account/balance
Returns your current account balance, P&L metrics, and starting capital.

Request

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

Response

{
  "balance": "993.50",
  "currency": "USD",
  "starting_balance": "1000.00",
  "unrealized_pnl": "3.00",
  "total_value": "1003.00"
}
FieldDescription
balanceCurrent cash balance (available for trading)
currencyAlways USD
starting_balanceInitial capital ($1,000 for virtual accounts)
unrealized_pnlUnrealized P&L (total_value − starting_balance)
total_valueCash balance + market value of open positions
Your total portfolio value = balance + market value of open positions. Use the Portfolio endpoint for a complete snapshot.

Python Example

import requests, os
from decimal import Decimal

BASE_URL = os.environ["POLYSIM_BASE_URL"]
headers = {"X-API-Key": os.environ["POLYSIM_API_KEY"]}

resp = requests.get(f"{BASE_URL}/v1/account/balance", headers=headers)

if resp.status_code == 200:
    data = resp.json()
    balance = Decimal(data["balance"])
    pnl = Decimal(data["total_value"]) - Decimal(data["starting_balance"])
    print(f"Balance: ${balance} | P&L: ${pnl}")
elif resp.status_code == 401:
    print("Invalid API key — check POLYSIM_API_KEY")

Next Steps