client.risk namespace exposes risk state inspection, per-subaccount limit configuration, an account-wide kill switch, and a risk-layer cancel-all endpoint. Use these controls to enforce pre-trade guardrails, respond to adverse market conditions, and satisfy operational risk requirements. The kill switch is a hard stop: activating it immediately halts all order submission and rejects new order requests until you explicitly deactivate it.
risk.state
Retrieve the current risk state for a subaccount, including whether any limits are breached or the kill switch is active. Method:client.risk.state(subaccount_id) — GET /v1/risk
string
required
The subaccount whose risk state to retrieve.
risk.limits
Retrieve configured risk limits. Pass asubaccount_id to get limits for a specific subaccount, or omit it to retrieve account-level limits.
Method: client.risk.limits(subaccount_id=None) — GET /v1/risk/limits
string
The subaccount whose risk limits to retrieve. Omit to retrieve account-level limits.
risk.set_limits
Configure risk limits. Provide the fields you want to set as keyword arguments. Fields omitted retain their existing values. Method:client.risk.set_limits(**payload) — PUT /v1/risk/limits
string
The subaccount to configure. Omit to set account-level limits.
string
Maximum quantity allowed on a single order submission.
string
Maximum aggregate position size across all instruments.
integer
Maximum number of simultaneously resting orders.
risk.kill_switch
Activate or deactivate the kill switch. When activated, Molecule immediately rejects all new order submissions and returnsForbiddenError with error code kill_switch. Deactivating the kill switch restores normal order flow.
Method: client.risk.kill_switch(enabled) — POST /v1/risk/kill-switch
boolean
required
Pass
True to activate the kill switch and halt all order submission. Pass False to deactivate it and resume normal operation.risk.cancel_all
Cancel all open orders for a subaccount via the risk layer. Method:client.risk.cancel_all(subaccount_id) — POST /v1/risk/cancel-all
string
required
The subaccount whose open orders to cancel.
