Trade Protection Rules
The matching engine enforces rate limits, minimum notional requirements, and other trade protections.
Protection Rules
| Protection | Rule | Error Code |
|---|---|---|
| Rate limiting | Weighted action rate per symbol (see below). | 1429 |
| Minimum notional | Minimum order size according to fee tier. | 1430 |
| Quote rest | Minimum time between price-improving modifications. | 1430 |
| Self-trade prevention | Orders from the same account do not match each other. | — |
Rate Limiting — Weighted Action Costs
Not all operations consume equal MPC capacity. GoDark uses a weighted action cost model that reflects the actual computational cost of each operation:
| Action | MPC Weight | Minimum Interval | Description |
|---|---|---|---|
| Order placement | 1.0 | 1ms per symbol | Full MPC binary search for sorted insertion |
| Cancel | 0.2 | 200μs per symbol | Position-indexed lookup skips binary search |
| Modify | 1.2 | 1ms per symbol | Cancel (0.2) + insert (1.0) |
| Mass quote (batch) | 1.0 per batch | 1ms per symbol | Fused MPC rounds regardless of leg count |
This weighted model allows significantly higher cancel throughput compared to a flat action rate. Market makers, who typically cancel 10-50x more than they place, benefit from the reduced cancel cost.
Minimum Notional
Each order must have a notional value specified in the fee tier. Calculate notional as:
notional = quantity × price
Quote Rest Period
After modifying a price, you must wait 1 millisecond before making another price-improving modification on the same order.
Self-Trade Prevention
Orders from the same account never match each other. This prevents accidental wash trading and ensures all executions are against different counterparties.