Lux Docs
Cex

Surveillance

Post-trade market abuse detection and KYT monitoring

The surveillance service monitors every executed trade in real-time via a post-trade hook. It detects market abuse patterns and generates alerts for compliance review. Alerts are queryable via the admin API.

Detection Patterns

Wash Trading

Detects circular trade patterns where the same account executes matching buy and sell orders on the same symbol with the same quantity within a 5-minute window.

ParameterValue
Detection window5 minutes
Match criteriaSame account, same symbol, opposite sides, same quantity
SeverityHigh
ActionAlert generated, trade IDs recorded

Large Trade Alerts

Flags trades with notional value exceeding a configurable threshold.

ParameterDefault
Threshold$100,000
SeverityMedium

Structuring Detection

Identifies potential structuring (smurfing) where multiple transactions are placed just below the Currency Transaction Report (CTR) threshold to avoid reporting requirements.

ParameterDefault
CTR threshold$10,000
Detection range80% -- 99% of threshold ($8,000 -- $9,900)
Minimum transactions3 within window
Detection window24 hours
SeverityHigh

Velocity Monitoring

Detects abnormally high trading frequency for a single account.

ParameterDefault
Window1 hour
Max trades50 per window
DedupOne alert per account per window
SeverityMedium

Price Spike Detection

Uses second-derivative analysis to detect parabolic/exponential price movements. The algorithm splits the observation window into two halves, computes the rate of price change in each half, and triggers if:

  1. Total price change exceeds the spike threshold (default 10%), or
  2. Acceleration (rate-of-change increase) exceeds the acceleration threshold (default 5%) and total move exceeds half the spike threshold
ParameterDefault
Window5 minutes
Max price change10%
Acceleration threshold5% (second derivative)
SeverityMedium (high if >2x threshold, critical if >2x threshold)
DedupOne alert per symbol per window

Alert Structure

Each alert contains:

FieldDescription
idUnique alert identifier
typewash_trading, large_trade, structuring, velocity, price_spike
severitylow, medium, high, critical
account_idAccount that triggered the alert
symbolAffected instrument
detailsHuman-readable description
trade_idsList of trades involved
created_atWhen the alert was generated
statusopen, investigating, resolved, escalated

Alert Types

TypeCodeDescription
Wash Tradingwash_tradingCircular trade pattern
SpoofingspoofingOrder placement/cancellation patterns
LayeringlayeringMulti-level order manipulation
Front Runningfront_runningTrading ahead of client orders
Insider Tradinginsider_tradingMaterial non-public information
Market Manipulationmarket_manipulationGeneral manipulation
StructuringstructuringJust-below-threshold transactions
VelocityvelocityUnusual trade frequency
Large Tradelarge_tradeTrade above notional threshold
Price Spikeprice_spikeAbnormal price acceleration

KYT Configuration

The Know Your Transaction (KYT) configuration is tunable at runtime via surveillance.Service.SetKYTConfig():

cfg := surveillance.KYTConfig{
    CTRThreshold:        10000,     // USD
    LargeTradeThreshold: 100000,    // USD
    VelocityWindow:      1 * time.Hour,
    VelocityMaxTrades:   50,
    StructuringWindow:   24 * time.Hour,
    StructuringMinTxns:  3,
    PriceSpikeWindow:    5 * time.Minute,
    PriceSpikeMaxPct:    10.0,      // percent
    PriceSpikeAccelPct:  5.0,       // percent
}
svc.SetKYTConfig(cfg)

Admin Endpoints

EndpointDescription
GET /v1/admin/surveillance/alertsList all alerts
GET /v1/admin/surveillance/alerts?status=openFilter by status
POST /v1/admin/markets/{symbol}/haltHalt market (manual circuit breaker)
POST /v1/admin/markets/{symbol}/resumeResume halted market

Alerts with severity high or critical should be escalated to compliance for potential SAR filing with FinCEN.

Alert Lifecycle

Detection -> Alert Created (open)
                |
         Investigation (investigating)
                |
    +-----------+-----------+
    |           |           |
 Escalated   Resolved    Filed
 (to legal)  (false pos)  (SAR/STR)

On this page