Overview
The Risk Instance keeps order and position states, maintains the credit pool hierarchy, and performs all risk checks.
The output of the message parser consists of order actions. The risk instance determines the legality of those order actions. To accomplish this, Re ector acts "as-if" the following steps are taken:
- Identity - New order requests must have new ids. Modify requests must refer to existing and live ids.
- Sanity - The message parser actually performs most of the sanity checks because they can be done a priori, but the checks that require validating against old state end up here.
- Order State - A speculative order state is constructed.
- Order Diff - A diff between the speculative order state and the previous order state is calculated.
- Position Diff - The order state diff is transformed into a position diff.
- Position States - For each associated risk pool, a speculative position is created with the old position and the position diff.
- Risk Checks - For each associated risk pool, the speculative position is checked against the parameters for that pool.
- Success - If risk checks pass, speculative order and position states are made permanent, and order allowed through.
- Failure - If risk checks fail, order and position states are rolled back, and order action is denied.
Overview
Content Tools