Algorithmic Trading Platform

Architecture / Component

Overview

Evaluates trading strategies against live or simulated market data and generates order signals. Shares a common strategy framework with the Backtesting Engine.

Navigation

Architecture

Contracts

Referenced By 1

Architecture

Documents

Strategy Engine README document repo://graph/nodes/5d979244ec4ca158b56ae3b812cbe6f0/artifacts/strategy-engine-readme.md

Strategy Engine

Responsibilities

The Strategy Engine runs pluggable trading strategies against incoming market data and publishes trading signals.

  • Subscribes to MarketTick events on the EventBus
  • Runs all registered IStrategy implementations against each tick
  • Publishes Signal events (BUY/SELL) when a strategy fires
  • Supports backtest mode: feed ticks directly via run_backtest(ticks) without publishing to the bus

Interface

Method Description
add_strategy(strategy) Register a new IStrategy at runtime
remove_strategy(strategy_id) Remove a strategy by ID
run_backtest(ticks) Run all strategies against a tick sequence; returns list of Signals
strategies List of registered strategy IDs
signals All signals generated since creation

Built-in Strategies

Strategy Logic
MomentumStrategy BUY/SELL when last price deviates from rolling average by > threshold
SmaCrossoverStrategy BUY when fast SMA crosses above slow SMA; SELL on cross below

IStrategy Protocol

class IStrategy(Protocol):
    @property
    def strategy_id(self) -> str: ...
    def evaluate(self, tick: MarketTick) -> Signal | None: ...

Event Flow

MarketTick → StrategyEngine.on_tick() → IStrategy.evaluate() → Signal (published)

Design Notes

  • Strategies are stateful per-symbol (maintain rolling price windows)
  • Multiple strategies can be registered simultaneously
  • Backtest mode does not publish to the bus — safe for offline analysis
  • Source: src/components/strategy_engine.py