Risk
Replace risk rules
Install a new rule set. Versioned in the journal; a later rejection records the version that refused it.
PUT/riskself-hosted · access token · manage_credentials
Self-hosted. Served by synpath serve on your own machine or host, which must be running; the engine and its order types live there. Nothing on this page runs on Synpath's servers.
Every refusal names its rule: kill_switch, book_paused, restricted, price_bounds, price_collar, max_order_contracts, max_order_notional, duplicate, order_rate, closing_soon, max_open_orders, self_trade, max_position, exchange_limit, max_event, daily_loss or max_venue_notional.
Request body
| Name | Type | Description |
|---|---|---|
enabled | booleandefault true | |
max_order_contracts | decimal | Per order. |
max_order_notional | decimal | Per order, price × contracts. |
max_position_contracts | decimal | Per market, netted across books. |
max_open_orders | integer | |
max_orders_per_minute | integer | |
daily_loss_limit | decimal | Realized plus unrealized, per day. |
min_price, max_price | decimal | Price bounds, default 0.01 and 0.99. |
price_collar | decimal | Maximum distance from the mark. |
closing_soon_s | integer | Refuse orders on a market closing within this many seconds. |
duplicate_window_ms | integerdefault 2000 | An order with the same market, side, price and size as one sent within this window is refused as an accidental repeat. Orders the engine places for its own order types are exempt, and so is an order whose client_order_id you set yourself. 0 turns the rule off. |
self_trade_prevention | stringdefault account | off, account or firm. |
restricted | array | Market ids, or prefixes ending in *, nobody may trade. |
paused_books | array | |
exchange_limits | object | Per-market caps the venue imposes. |
max_event_contracts, max_venue_notional | decimal |
Response
The rules now in force.
import os
import httpx
TOKEN = os.environ["SYNPATH_ACCESS_TOKEN"]
r = httpx.put("http://127.0.0.1:8000/trading/risk", headers={"Authorization": f"Bearer {TOKEN}"}, json={"enabled":true,"max_order_contracts":"100","max_order_notional":"50","max_position_contracts":"500","max_open_orders":50,"max_orders_per_minute":60,"daily_loss_limit":"500","min_price":"0.01","max_price":"0.99","price_collar":"0.10","closing_soon_s":60,"duplicate_window_ms":2000,"self_trade_prevention":"account","exchange_limits":{},"max_event_contracts":null,"max_venue_notional":null,"paused_books":[],"restricted":["kalshi:KXELON*"]})
r.raise_for_status()
print(r.json())200
{
"enabled": true,
"max_order_contracts": "100",
"max_order_notional": "50",
"max_position_contracts": "500",
"max_open_orders": 50,
"max_orders_per_minute": 60,
"daily_loss_limit": "500",
"min_price": "0.01",
"max_price": "0.99",
"price_collar": "0.10",
"closing_soon_s": 60,
"duplicate_window_ms": 2000,
"self_trade_prevention": "account",
"exchange_limits": {},
"max_event_contracts": null,
"max_venue_notional": null,
"paused_books": [],
"restricted": [
"kalshi:KXELON*"
]
}
