Synpath
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

NameTypeDescription
enabledboolean
default true
max_order_contractsdecimalPer order.
max_order_notionaldecimalPer order, price × contracts.
max_position_contractsdecimalPer market, netted across books.
max_open_ordersinteger
max_orders_per_minuteinteger
daily_loss_limitdecimalRealized plus unrealized, per day.
min_price, max_pricedecimalPrice bounds, default 0.01 and 0.99.
price_collardecimalMaximum distance from the mark.
closing_soon_sintegerRefuse orders on a market closing within this many seconds.
duplicate_window_msinteger
default 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_preventionstring
default account
off, account or firm.
restrictedarrayMarket ids, or prefixes ending in *, nobody may trade.
paused_booksarray
exchange_limitsobjectPer-market caps the venue imposes.
max_event_contracts, max_venue_notionaldecimal

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