TPF Labs
Risk and kill switchAll pages

Risk and kill switch

Every new crypto order passes one check before it leaves, whether it comes from the ticket, an algo, a strategy or the API. Cancels skip the check and always go out.

Stop trading

Open Automation → Risk.

ActionEffect
Kill allHalts every book and sends a cancel for every open order.
KillThe same for one book. The others keep trading.
ReducingThe book may only send orders that shrink a position.

Active

New orders, within limits

Reducing

Only orders that shrink a position

Halted

Cancels only

Prediction-market orders have their own caps and their own stop. See Orders and caps. Kill all on this page does not cover them.

Capital

Declare the desk's capital first. Without it every new order is refused. Money limits can be a dollar amount or a percentage of this figure. You get a warning when it is above what your accounts report.

Limits

Defaults apply to every book. A book can inherit a limit, set its own or, for most limits, turn it off. The page shows the value in force and where it came from. A change that lets more through needs a second confirmation and is written to the audit log.

LimitWhat it holds
Order notionalOne order.
Instrument notionalThe worst case on one instrument.
Book notionalThe worst case over everything the book holds.
Open ordersHow many may be working.
Price bandHow far from the mid an order may be priced.
Orders in windowHow many orders may go out in a period.
Repeat entriesHow often a book may fill and enter again in a period.
Quote ageRefuses to open on a price older than this.
Option premium, option open lotsOptions only.

The worst case counts working orders on the same side as filled and does not net orders on the other side. An order that reduces a position is not held back by the notional limits. An identical order within a second is refused as a duplicate, unless the book is set up to repeat itself.

Losses

The 1-minute, 5-minute and 1-hour loss levels send a warning and nothing else. The daily loss level can also act. Set Past daily loss to Reducing or Halted. With Off it only warns. The figures include unrealised profit and loss, and neither action closes a position.

When the exchange disagrees

About every 30 seconds raikiri asks each connected exchange for positions, open orders, balances and fills, where the exchange offers them. A position that differs twice in a row stops new orders to that account until a person resolves it. Cancels still go out. Ops → Reconciliation lists each difference.

An order that got no reply stays open until the exchange's own records settle it. Do not send it again before that.

Audit log

Ops → Audit shows who did what and why it was allowed or refused, including the limit that refused an order. Entries are chained by hash, and the page checks the chain. The check finds edits, deletions and reordering. A full rewrite would only show against a copy of the last hash kept somewhere else, so keep one if you need that proof.

Why was my order refused

  • No capital declared, or the book or desk is halted or reducing.
  • The order is above a limit. Children of an algo count one by one.
  • The quote is older than the limit, which often means that the exchange's feed is down.
  • The same order was sent within the last second.
  • The exchange rejected it: balance, margin, minimum size or price step. The order history shows its status.