Trade Protection Rules

The matching engine enforces rate limits, minimum notional requirements, and other trade protections.

Protection Rules

ProtectionRuleError Code
Rate limitingWeighted action rate per symbol (see below).1429
Minimum notionalMinimum order size according to fee tier.1430
Quote restMinimum time between price-improving modifications.1430
Self-trade preventionOrders 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:

ActionMPC WeightMinimum IntervalDescription
Order placement1.01ms per symbolFull MPC binary search for sorted insertion
Cancel0.2200μs per symbolPosition-indexed lookup skips binary search
Modify1.21ms per symbolCancel (0.2) + insert (1.0)
Mass quote (batch)1.0 per batch1ms per symbolFused 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.