Skip to content
CAI
Software that uses CAICheck a score

Zuytan/rustrade

73.1

Strong · 21 September 2026

46.9k

lines of production code

Rust

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This release introduces a comprehensive agentic development structure and modular trading architecture, replacing monolithic components with a unified SystemClient interface and distinct agents for analysis, execution, and news processing. The system now features advanced statistical and ML-driven strategies, including an ensemble model and LSTM-based prediction, supported by a new adaptive optimization engine and configurable risk management framework. Additionally, the update delivers a modernized dashboard interface, robust CLI tools for optimization and training, and extensive test coverage for the new modular components.

Features

Added LSTM training script for high-fidelity simulation

A new Python script, \scripts/ml/train\_lstm.py\, has been added to support deep learning infrastructure. This script implements an LSTM-based predictor for time-series forecasting, handling data loading, sequence creation, model training, and ONNX export. It introduces a new capability to train and export deep learning models for simulation purposes.

scripts/ml · high confidence

Alpaca integration for market data, order execution, and live monitoring

The system now connects to the Alpaca API to fetch market data, execute trades, and stream live updates. This includes an \AlpacaMarketDataService\ that retrieves top movers, historical bars, and crypto asset lists, alongside an \AlpacaExecutionService\ that manages order placement and background portfolio synchronization. A dedicated \AlpacaTradingStream\ handles real-time trade updates via WebSocket, while an \AlpacaSectorProvider\ resolves asset sectors. On the frontend, a new API server exposes portfolio and position endpoints and broadcasts logs and order updates to connected WebSocket clients.

src/infrastructure · high confidence

Centralized configuration management with environment variable support

The application now uses a structured, environment-variable-driven configuration system. Users can configure broker credentials for Alpaca, Binance, and OANDA via environment variables. Risk management parameters (e.g., drawdown limits, position sizing) and strategy parameters (e.g., RSI thresholds, timeframe settings) are now loaded from environment variables, allowing for flexible deployment and environment-specific tuning. Additionally, a safety gate prevents accidental live trading on production endpoints unless explicitly enabled.

src/config · high confidence

Configurable risk appetite and optimization history tracking

The application now supports a configurable risk appetite score (1-9) that automatically calculates trading parameters like risk per trade, trailing stop multipliers, and position sizing, overriding individual environment variables when set. Additionally, a new optimization domain has been introduced to track optimization history and manage re-optimization triggers based on performance, regime changes, or scheduled intervals.

src · high confidence

The optimization module now features an \AdaptiveOptimizationService\ that automatically triggers re-optimization when performance degrades or market regimes shift. This service integrates with a new \GeneticOptimizer\ and \GridSearchOptimizer\ (in \core/\) to search for optimal strategy parameters using genetic algorithms and grid search. The system evaluates performance via \ExpectancyEvaluator\ and \PerformanceEvaluator\, and persists results in \OptimizationHistory\. Additionally, crypto symbols are grouped into \CryptoCluster\ groups for optimized parameter sharing, and benchmarking utilities (\BenchmarkTimer\, \BenchmarkStats\) are added to measure optimization performance.

src/application/optimization · high confidence

Introduce agentic development structure with modular skills and workflows

The \.agent\ directory has been restructured to support an agentic development workflow, introducing a modular skills system that guides the AI agent through various development tasks. New skills have been added for benchmarking, critical review, documentation, implementation (TDD), spec management, testing, trading best practices, and UI design, each with specific templates and scripts. Additionally, new workflows for feature implementation and code validation have been created to standardize the development process.

.agent · high confidence

Introduce core trading domain models and fee calculation infrastructure

The trading domain is reorganized into a dedicated \src/domain/trading\ module, moving and expanding key types such as \Order\, \Trade\, and \Portfolio\. A new \FeeModel\ trait and implementations (\ConstantFeeModel\, \TieredCorrelationId generation, and an \ArbitrageEngine\ for detecting cross-exchange opportunities. The \Portfolio\ struct gains fields for tracking starting cash, maximum equity, and day-trade counts, while \Trade\` gains fields for strategy, regime, and fees to support post-trade analysis.

src/domain/trading · high confidence

Introduce dashboard view model with metrics for P&L, win rate, risk, and sentiment

A new \DashboardViewModel\ has been added to the \src/interfaces/view\_models\ module, providing a centralized interface for dashboard data. It exposes structured metrics for daily P&L (including color and arrow indicators), win rate, risk score (with low/medium/high classifications), and sentiment analysis (aggregating held or tracked symbols with i18n labels). This change establishes the data layer for the dashboard UI, ensuring that risk and sentiment states are correctly reflected in the interface.

_src/interfaces/view\models · high confidence

Introduce dedicated UI components for settings and navigation

The application now features a new \ui\_components\ module that encapsulates the settings panel and sidebar navigation. This introduces a structured settings interface with tabs for the trading engine, language, shortcuts, help, and about sections, along with a sidebar for dashboard, analytics, architecture, and settings navigation. Users can now configure risk parameters, strategy modes, and other system settings through a dedicated, persistent settings view.

_src/interfaces/ui\components · high confidence

Introduce domain-layer abstractions for risk, ML, and data validation

The domain layer now includes structured error handling for trading, risk, and market data operations, providing clear failure modes for insufficient funds, position limits, and connectivity issues. A new repository pattern is introduced to abstract data persistence for trades, portfolios, candles, and strategies, enabling clean separation between business logic and storage. Additionally, the codebase adds a differentiable Spiking Neural Network (SNN) implementation with custom loss functions and surrogate gradients, alongside a sentiment analysis module and news listener structures. Data integrity is enforced through a new validation module that rejects impossible or suspect market events.

src/domain · high confidence

Introduce market regime detection, order flow analysis, and timeframe aggregation

The \src/domain/market\ module now includes new capabilities for identifying market conditions and analyzing price action. A \MarketRegimeDetector\ classifies the current market state (Trending Up/Down, Ranging, or Volatile) using statistical features like Hurst exponent and volatility scores. Additionally, the domain now supports Order Flow Imbalance (OFI) and Cumulative Delta calculations to track buying and selling pressure, as well as a Volume Profile to identify high-volume support and resistance zones. The system also introduces a \Timeframe\ enum and \TimeframeCandle\ struct to handle multi-timeframe data aggregation and synchronization.

src/domain/market · high confidence

Introduce modular configuration value objects for brokers and strategies

The monolithic configuration structure has been refactored into distinct domain value objects: \BrokerConfig\ and \StrategyConfig\. \BrokerConfig\ now encapsulates broker-specific settings (API keys, URLs, types) with built-in validation for non-Mock brokers. \StrategyConfig\ centralizes all strategy parameters (SMA, RSI, MACD, SNN, etc.) and enforces invariants such as positive periods and non-empty timeframes. This change improves modularity and testability by decoupling configuration logic from the main application state.

src/domain/config · high confidence

Introduce new dashboard and component architecture

The application now features a redesigned dashboard interface with a new dark-mode design system, including reusable components for cards, metrics, and charts. The main UI entry point has been refactored to use an MVVM pattern, dynamically rendering metric cards, activity feeds, and status indicators. This change establishes a modern, responsive layout for the core dashboard view.

src/interfaces · high confidence

Introduce new market data processing modules

Added new modules for market data processing: a candle aggregator that filters outlier quotes and aggregates 1-minute ticks into candles, a signal generator that maps technical indicators (RSI, MACD, BB, ADX, OFI) to strategy signals, a spread cache for real-time bid/ask tracking, a statistical features module implementing Hurst exponent and skewness calculations, and a timeframe aggregator that rolls 1-minute candles into higher timeframes.

_src/application/market\data · high confidence

Introduce statistical trading strategies: Z-Score Mean Reversion and ATR-normalized Momentum

Users can now apply two new statistical strategies to their trading workflows. The Z-Score Mean Reversion strategy identifies oversold conditions using Z-scores (deviations from the mean) to generate buy signals, and exits when price reverts to the mean. The Statistical Momentum strategy calculates ATR-normalized momentum to detect strong upward trends, requiring trend confirmation to filter signals. Both strategies are available in the \src/application/strategies/statistical\ module.

src/application/strategies/statistical · high confidence

Introduces dedicated modules for symbol context and trade filtering

The trading application now includes new \symbol\_context.rs\ and \trade\_filter.rs\ modules, exposing \SymbolContext\ and \TradeFilter\ structs. \SymbolContext\ manages per-symbol state, including candle history, technical indicators, and order flow metrics. \TradeFilter\ enforces trading rules such as long-only constraints, pending order checks, cooldown periods, and profitability/cost evaluations before executing trades.

src/application/trading · high confidence

Introduces domain models for risk management and volatility

The risk domain now includes new modules for managing risk appetite, optimal strategy parameters, and volatility-based position sizing. Users can now configure risk profiles (Conservative, Balanced, Aggressive) that dynamically adjust trading parameters like position size, stop-losses, and signal thresholds. Additionally, a volatility manager adjusts risk multipliers based on market conditions, while the risk configuration enforces safety limits like daily loss and drawdown caps.

src/domain/risk · high confidence

Introduces modularized trading agents for analysis, execution, and news processing

The application now features a modular agent architecture in the \src/application/agents\ directory, replacing the previous monolithic implementation. The \Analyst\ agent handles market analysis, signal generation, and trade proposals, while the \Executor\ agent manages order execution, portfolio state, and trailing stop management. A new \Listener\ agent processes news events and sentiment data, and a \NewsHandler\ processes news signals to generate trading actions. The \CandlePipeline\ and \RegimeHandler\ provide structured, testable stages for processing market data and adapting to market conditions. This refactoring improves code organization, testability, and separation of concerns within the trading system.

src/application/agents · high confidence

Introduces new monitoring and validation services for portfolio, strategy, and system health

Added new services in the monitoring module to enhance system observability and strategy validation. The \correlation\_service\ calculates and caches Pearson correlation matrices for trading symbols. A suite of health monitoring tools was added: \agent\_status\ tracks agent heartbeats and metrics; \connection\_health\_service\ monitors and broadcasts market data and execution connectivity status; and \heartbeat\ detects silent data streams. For portfolio management, \cost\_evaluator\ calculates transaction costs (commissions, slippage, spread) to assess trade profitability, while \portfolio\_state\_manager\ handles versioned portfolio snapshots and exposure reservations. Finally, \empirical\_win\_rate\_provider\ and \strategy\_validator\ enable backtesting validation by computing historical win rates and checking performance metrics against configurable thresholds.

src/application/monitoring · high confidence

Introduces new trading strategies and ML infrastructure for dynamic strategy selection

The application now supports a modernized strategy architecture featuring an Ensemble Strategy that aggregates signals from multiple sub-strategies (Statistical Momentum, Z-Score Mean Reversion, SMC, and an optional SNN Surrogate) with configurable voting thresholds and performance-based weighting. A new Order Flow Imbalance (OFI) strategy is added to trade institutional pressure and stacked imbalances. The system also introduces a StrategyFactory and StrategySelector to dynamically route to the appropriate strategy (SMC, Z-Score, Statistical, or ML) based on the detected market regime (Trending, Volatile, Ranging). Additionally, a new ML data collector and derivative encoding module are introduced to support the SNN surrogate model, which can be integrated into the ensemble for enhanced prediction.

src/application/strategies · high confidence

New CLI tools for ensemble optimization, headless server, and ML training

Added new binaries to the \src/bin\ directory to support advanced trading and optimization workflows. The \ensemble\_optimizer\ binary runs a grid search to find optimal weights for the ensemble strategy (StatMomentum, ZScoreMR, SMC). The \optimize\ binary provides a genetic algorithm-based parameter optimizer for single symbols, batches, or crypto clusters, with support for risk-score-based adaptation. A new \server\ binary enables headless, push-based observability for the trading system. Additionally, \train\_gen\ and \train\_surrogate\ binaries allow users to generate ML training data and train surrogate gradient spiking neural networks (SNN) directly from the command line.

src/bin · high confidence

New automated validation and benchmarking scripts for trading strategies

A suite of new scripts has been added to the \scripts/\ directory to automate strategy validation and performance benchmarking. The \validate\_strategies.sh\ script enforces minimum performance thresholds (Sharpe ratio, win rate, profit factor, drawdown) across multiple symbols and historical periods. Additional scripts (\auto\_benchmark.sh\, \benchmark\_stocks.sh\, \run\_regime\_benchmarks.sh\, \train\_and\_deploy.sh\, \optimize\_ml.sh\) and Python utilities (\compare\_strategies.py\, \validate\_risk\_filter.py\, \validate\_risk\_filter.sh\) provide automated backtesting, multi-stock evaluation, regime-based benchmarking, and ML model training/deployment pipelines. These tools generate detailed reports and CSV/JSON outputs to verify strategy viability before deployment.

scripts · high confidence

New benchmarking engine and reporting system

Added a new benchmarking module in src/application/benchmarking that provides a BenchmarkEngine for running single, multi-asset, parallel, and walk-forward backtests, along with a BenchmarkReporter that generates JSON reports and console summaries of performance metrics like return, win rate, and drawdown.

src/application/benchmarking · high confidence

New modular bootstrap system for agents, services, and persistence

The application now uses a new modular bootstrap system located in \src/application/bootstrap\ to initialize core components. This includes \agents.rs\ for managing agent lifecycles and communication channels, \services.rs\ for initializing market and execution services, and \persistence.rs\ for setting up the database and repositories. This change restructures how the application starts up, separating concerns into distinct modules for better organization and maintainability.

src/application/bootstrap · high confidence

New modular dashboard components for activity, analytics, and architecture views

The dashboard interface has been refactored into a set of new, modular UI components. Users can now view a structured system architecture diagram with real-time agent status and heartbeat monitoring. A dedicated analytics view displays performance metrics, equity curves, and a Monte Carlo simulation tool. The activity feed and news feed widgets have been restructured to use these new components, providing a cleaner, more consistent layout for logs, trade history, and market sentiment data.

_src/interfaces/dashboard\components · high confidence

New performance tracking and evaluation capabilities

The system introduces a new performance domain that provides comprehensive metrics calculation, including Sharpe ratio, win rate, and drawdown analysis. This includes a \PerformanceEvaluator\ that automatically triggers re-optimization when performance thresholds (e.g., drawdown limits or poor Sharpe ratios) are breached. Additionally, a Monte Carlo simulation engine is added to model potential equity paths and probability of profit, while a \PerformanceSnapshot\ structure captures the state of these metrics over time.

src/domain/performance · high confidence

New settings interface components for risk, strategy, and symbol selection

The settings interface has been restructured with new dedicated components for managing risk parameters, strategy configurations, and crypto pair selection. Users can now adjust risk scores and view derived profiles (conservative, balanced, aggressive) with corresponding strategy dropdowns in the risk settings. The strategy settings provide advanced controls for risk management (position size, daily loss, drawdown limits) and strategy selection. Additionally, a new symbol selector allows users to search, filter, and select multiple crypto pairs for trading.

_src/interfaces/settings\components · high confidence

Behavioural changes

Introduces comprehensive risk validation filters

The risk management system now enforces a suite of new validation rules before executing trades. These include a Buying Power Validator to prevent insufficient funds errors, a Circuit Breaker to halt trading after significant daily losses or drawdowns, a Correlation Filter to avoid over-concentration in correlated assets, a PDT (Pattern Day Trader) validator to enforce regulatory day-trade limits, a Position Size Validator to cap exposure per position and sector, a Price Anomaly Validator to detect erratic price movements, and a Sentiment Validator to block buys during extreme fear. These changes introduce new behavioral constraints on trade execution.

src/domain/risk/filters · high confidence

Refactored RiskManager into modular services and validation pipeline

The RiskManager has been refactored from a monolithic structure into a modular architecture. The core logic is now handled by a new RiskValidationPipeline that executes a sequence of validators (circuit breaker, price anomaly, PDT, sector exposure, correlation, position size, sentiment, and buying power). Additionally, responsibilities for emergency liquidation, order reconciliation, and portfolio valuation have been extracted into dedicated services (LiquidationService, OrderReconciler, PortfolioValationService, etc.) to improve code organization and maintainability.

_src/application/risk\management · high confidence

Refactored application layer to use a unified SystemClient interface

The application layer has been restructured to replace the previous monolithic \System\ orchestrator and separate agent modules (such as \Analyst\, \Executor\, \RiskManager\, and \Sentinel\) with a new \SystemClient\ interface. This client provides a unified way for the user interface or external agents to interact with the trading system, abstracting away the internal channel management. The \SystemClient\ exposes methods to poll for system events (candles, sentiment, news, logs) and send commands to various internal agents (sentinel, risk, analyst, listener) via a single handle. This change simplifies the public API for system interaction and improves modularity by decoupling the UI from the internal agent architecture.

src/application · high confidence

Test coverage

Added component tests for strategy selection, backtesting, crypto scanning, and execution deadlock handling; Added comprehensive risk management tests; Added comprehensive test suite for the Analyst agent; Added integration tests for core trading and risk management features; Added scenario tests for trading flows and risk controls; Added unit tests for strategy initialization and cold-start handling.

Dependencies

Upgrade core dependencies and add new libraries for trading, ML, and observability

The project's Rust dependencies have been updated to modernize the codebase and add new capabilities. Key upgrades include tokio (1.48.0 → 1.52.3), chrono (0.4.42 → 0.4.44), and serde (1.0.228). New dependencies have been added to support Binance integration (hmac, sha2, hex), advanced technical analysis (ta, statrs), machine learning (smartcore, ort, ndarray), and observability (prometheus, clap). The Cargo.toml also introduces new binary targets (server, benchmark, optimize, train\_surrogate) and features (ui, surrogate, oanda).

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 68 → 73 (+4.9)
  • Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 71 → 77 (+5.8)
  • Architecture 95 → 92 (-3.2)
  • Maturity 78 → 78 (-0.0)
  • Readiness 60 → 64 (+4.1)
  • Security 71 → 95 (+24.0)
  • Domain Modelling 100 → 100 (+0.0)
  • Event-Driven 80 → 80 (+0.0)
  • Event Sourcing 100 → 100 (+0.0)

Resolved (42)

  • Change coupling: analyst.rs ↔ optimizer.rs (src/application/agents/analyst.rs)
  • Change coupling: analyst.rs ↔ sentinel.rs (src/application/agents/analyst.rs)
  • Change coupling: analyst.rs ↔ websocket.rs (src/application/agents/analyst.rs)
  • Change coupling: circuit_breaker_validator.rs ↔ position_size_validator.rs (src/domain/risk/filters/circuit_breaker_validator.rs)
  • Change coupling: database.rs ↔ mod.rs (src/infrastructure/persistence/database.rs)
  • Change coupling: metrics.rs ↔ portfolio.rs (src/domain/performance/metrics.rs)
  • Change coupling: mod.rs ↔ database.rs (src/application/system/mod.rs)
  • Change coupling: position_size_validator.rs ↔ sector_exposure_validator.rs (src/domain/risk/filters/position_size_validator.rs)
  • Change coupling: risk_manager.rs ↔ database.rs (src/application/risk_management/core/risk_manager.rs)
  • Change coupling: scanner.rs ↔ mod.rs (src/application/agents/scanner.rs)
  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • High CVE: [GHSA redacted] (Cargo.lock)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 22 more

New (183)

  • AlpacaTradingStream::run_connection (cognitive 23) (src/infrastructure/alpaca/trading_stream.rs)
  • AlpacaWebSocketManager::run_connection (cognitive 77) (src/infrastructure/alpaca/websocket.rs)
  • AlpacaWebSocketManager::run_connection (cyclomatic 31) (src/infrastructure/alpaca/websocket.rs)
  • Analyst::run (cognitive 69) (src/application/agents/analyst.rs)
  • Analyst::run (cyclomatic 27) (src/application/agents/analyst.rs)
  • Change coupling: mod.rs ↔ execution_service.rs (src/application/system/mod.rs)
  • Change coupling: optimizer.rs ↔ mod.rs (src/application/optimization/optimizer.rs)
  • Change coupling: risk_manager.rs ↔ execution_service.rs (src/application/risk_management/core/risk_manager.rs)
  • Change-coupling hub: analyst.rs → sentinel.rs, optimizer.rs, websocket.rs (src/application/agents/analyst.rs)
  • ClassTooLong: PerformanceMetrics (src/domain/performance/metrics.rs)
  • ClassTooLong: RiskManager (src/application/risk_management/core/risk_manager.rs)
  • Dependency advisory scan runs only on code events
  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (src/application/strategies/order_flow.rs)
  • Duplicated block (10 lines × 2) (src/application/strategies/order_flow.rs)
  • Duplicated block (10 lines × 2) (src/infrastructure/binance/execution.rs)
  • Duplicated block (10 lines × 3) (src/infrastructure/alpaca/execution.rs)
  • Duplicated block (10–12 lines × 2) (src/domain/performance/metrics.rs)
  • …and 163 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

Zuytan/rustrade was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 53cd295664e45d5b9c7edcbf82b0bdb264fafdb1 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.