Own Liquidity Module Architecture
The module consists of five components, each responsible for its own part of the trade pipeline. Below is the component list, their areas of responsibility, and how they interact.
Components
| Component | Responsibility |
| Swap Engine | Deal logic: swap creation, rate fixing, execution orchestration from incoming payment to payout |
| Inventory Manager | Asset accounting: balances per currency, target inventory levels, current position deviation |
| Matching Layer | Logic for using accumulated inventory: determines whether an order can be executed from inventory |
| Pricing Engine | Price calculation: the final rate accounting for the market, base spread, and the system’s current position |
| Risk Engine | Deviation control: monitors inventory deviation from the target level and limits position growth |
Component interaction
Typical order pipeline:
Client request
│
▼
Pricing Engine ────────────► final_rate calculation
│ (market_rate, base_spread, inventory_skew)
▼
Swap Engine ───────────────► swap creation, rate fixing
│
▼
Matching Layer ────────────► check: execute from inventory?
│ (for the Release phase — asset availability in inventory)
▼
Inventory Manager ─────────► balance changes (inventory_delta recalculated)
│
▼
Risk Engine ───────────────► position deviation control
(signals for Pricing Engine and Matching Layer)
- Pricing Engine calculates the price before the swap is created — accounting for the current inventory_skew (see Pricing Engine).
- Swap Engine fixes the rate and drives the trade through its statuses.
- Matching Layer decides whether to execute the trade from accumulated inventory (Inventory Release phase) or to accept the asset into inventory (Inventory Fill phase).
- Inventory Manager records balance changes after execution: total_balance, reserved_balance, available_balance (see Inventory Model).
- Risk Engine closes the loop: position deviation feeds back into pricing and Matching Layer decisions.
Key principle
The components form a closed loop: trades change inventory → inventory state changes price → price changes the trade flow. Thanks to this loop the system balances its position economically, without mandatory external hedging of every order.
See also