Skip to main content

Positions

GET /v1/account/positions
Returns your current positions with live market values and unrealized P&L.

Query Parameters

ParameterTypeDefaultDescription
statusstringFilter: OPEN or CLOSED

Request

curl -H "X-API-Key: $API_KEY" \
  "https://api.polysimulator.com/v1/account/positions?status=OPEN"

Response

[
  {
    "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"
  }
]
FieldDescription
quantityNumber of shares held
avg_entry_priceVolume-weighted average entry price
current_priceLatest market price for this outcome
market_valuequantity × current_price
unrealized_pnlmarket_value - (quantity × avg_entry_price)

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"]}

# Fetch open positions
resp = requests.get(
    f"{BASE_URL}/v1/account/positions",
    headers=headers,
    params={"status": "OPEN", "limit": 50},
)
resp.raise_for_status()
positions = resp.json()

total_unrealized = Decimal("0")
for pos in positions:
    unrealized = Decimal(pos["unrealized_pnl"])
    total_unrealized += unrealized
    print(f"{pos['market_id'][:16]} {pos['outcome']}: "
          f"qty={pos['quantity']} entry={pos['avg_entry_price']} "
          f"now={pos['current_price']} pnl={unrealized}")

print(f"\nTotal unrealized P&L: ${total_unrealized}")

Position Lifecycle


Next Steps