Event-market analytics
Discover an active ticker, post a position, then read the event-specific risk block. Event-market discovery and calculation are licence-gated.
market = requests.get(
f"{C9_API_ENDPOINT}/validation-reference/events/search",
headers=HEADERS,
params={"exchange": "KALSHI", "q": "Apple DOJ", "limit": 1},
).json()["markets"][0]
payload = {
"calculation_type": "margins",
"portfolio": [{
"account_code": "EVENT_ACCOUNT",
"market_type": "EVENT",
"exchange_code": "KALSHI",
"ticker": market["ticker"],
"side": "YES",
"quantity": 1000,
"price_dollars": market["mark_dollars"],
"netting_enabled": True,
"currency_code": "USD",
}],
}
result = requests.post(f"{C9_API_ENDPOINT}/portfolios", headers=HEADERS, json=payload).json()["data"][0]
Read initial_margin for the clearing requirement and event_risk for value_at_risk, expected_shortfall, worst settlement stress, scenario P&L, probability shocks, and model coverage.
{
"event_risk": {
"value_at_risk": 20.01,
"expected_shortfall": 20.01,
"stress_loss": 697.00,
"stress_scenario": "full_settlement"
}
}