Quant Arb Core Class Diagram

Focused on the main dataclasses and orchestrating objects that drive quote normalization, compare, intent creation, monitoring, and paper execution.

Core classes selected from domain/, application/, adapters/ Quote + source: str + symbol: str + bid: float, ask: float + ts_exchange: int, ts_local: int + normalized_bid/ask: float | None + mid + comparable_bid / comparable_ask DirectedEdge + sell_source / buy_source + sell_symbol / buy_symbol + edge: float + raw_edge: float + triggered PairComparison + pair_key: str + sell_a_buy_b: DirectedEdge + sell_b_buy_a: DirectedEdge + best_edge RuntimeTuning + spread_threshold: float + cooldown_ms: int + max_position: float + enabled_pairs: tuple[str, ...] + normalization_scales: dict[str, float] CompareEngine - latest quotes by source - threshold: float + on_quote_updated(event) -> CompareSnapshot + compare current venues into PairComparison + applies threshold before snapshot consumers decide OpportunityPipeline - _tuning: RuntimeTuning - _engine: CompareEngine - _deduper: SignalDeduper - _planner: PaperExecutionPlanner + ingest_quote(quote) -> OpportunityPlan | None + normalize_quote() + _select_best_edge(snapshot) + build_execution_intent() + planner.build(intent, updated_source) ExecutionLeg + source: str + symbol: str + side: str ExecutionIntent + hedge_id: str + sell_leg: ExecutionLeg + buy_leg: ExecutionLeg + quantity: float + edge_value: float + threshold: float, ts_local: int + build_execution_intent(edge, threshold, ts, qty) OpportunityPlan / OpportunityReason OpportunityPlan + intent: ExecutionIntent + paper_plan: PaperExecutionPlan + reason: OpportunityReason OpportunityReason + updated_source, pair_key, edge_value, raw_edge_value MT5Bridge - _queue - _pending + parse_tick_payload() + enqueue_intent(), poll_command() PaperExecutionGateway - capabilities + prepare_exchange_order() returns normalized ExchangeOrderRequest PaperOrchestrator - mt5_bridge: MT5Bridge - _pipeline: OpportunityPipeline - _tracker: InFlightOrderTracker - _compensation: CompensationEngine - _gateway: PaperExecutionGateway + ingest_quote_payload() + poll_mt5_command() + apply_fill_update() PublicMonitorRunner - monitor: PublicPaperMonitor - sleep_fn + run_iterations() + _append_lines() uses MonitorStats / _PairStats PublicPaperMonitor / PublicQuoteRuntime PublicPaperMonitor + run_cycle_reports() + build_with_rest_fetchers() PublicQuoteRuntime + okx_runner / binance_runner + poll_once(), poll_once_tagged() Tracking + Repair OrderUpdate InFlightOrder ExecutionGroup InFlightOrderTracker CompensationAction CompensationEngine track intent -> update fills -> evaluate repair used by produced by engine configures embedded in creates returns composes wrapped by monitored by fill updates

Domain center

  • • Quote is the atomic market object.
  • • DirectedEdge is the directional arbitrage opportunity.
  • • PairComparison holds both directions and exposes best_edge.

Application center

  • • OpportunityPipeline is the main decision point: normalize -> compare -> dedupe -> intent.
  • • PaperOrchestrator composes the pipeline with bridge, gateway, tracking, and compensation.
  • • PublicMonitorRunner and PublicPaperMonitor wrap the orchestrator for repeated monitoring cycles.

Adapter center

  • • MT5Bridge converts MT5 payloads and buffers commands.
  • • PaperExecutionGateway only prepares exchange orders; it does not place live trades.
  • • Tracking and compensation are modeled but remain in-memory support components today.