Argus Margin Intelligence & Data Analysis System
AMIDAS is a high-performance quantitative trading and backtesting engine engineered entirely in Rust. Designed to operate 24/7 on edge hardware (Raspberry Pi), it bridges the gap between fundamental SEC financial data and automated, margin-aware portfolio management.
The system serves as a private "Quant Lab," built to identify market inefficiencies through dynamic scoring, while strictly enforcing risk management and realistic tax accounting. With full Interactive Brokers (IBKR) integration, AMIDAS provides a seamless pipeline from historical research to live market execution.
- Dual-Broker Architecture: Engineered for both speed and traceability. Utilizes a blazingly fast in-memory broker for combinatorial mass-backtesting, paired with a persistent simulated broker that logs every atomic transaction to SQLite for granular auditability.
- Live Market Integration: Fully integrated with the Interactive Brokers (IBKR) API, allowing strategies to transition from simulated environments to live/paper trading with minimal friction.
- Institutional-Grade Accounting: Implements a custom accounting engine that tracks latent liquidation taxes and gross dividend reinvestments. It accurately simulates local tax laws (e.g., prohibition of loss carryforwards) to calculate true net performance.
- Point-in-Time Accuracy: The architecture strictly prevents look-ahead bias and simulates real-world execution slippage, ensuring backtest results are highly realistic.
- Dynamic Combinatorial Scoring: The strategy engine dynamically evaluates equities across multiple fundamental dimensions (e.g., P/E, ROIC). It utilizes configurable buy/sell thresholds to ruthlessly cull underperforming assets.
The codebase is structured into specialized crates, ensuring a clean separation of concerns:
amidas_core: The foundational domain models (Company, Fundamentals, Price) and shared business logic.amidas_errors: Centralized custom error definitions guaranteeing robust error propagation and predictable failure handling.amidas_storage: The persistence layer. Powered by SQLite and SQLx for ACID-compliant storage of market history, featuring RAM-based caching mechanisms for high-speed iterations.amidas_ingest: The asynchronous data harvester, specialized in fetching and parsing raw financial data from external APIs.amidas_scoring: The evaluation engine calculating dynamic scores based on customizable fundamental weights.amidas_invest: The allocation mastermind. Orchestrates theInvestManager, enforcing sector constraints, calculating precise position sizing, and executing portfolio rebalancing logic.amidas_broker: The execution layer. Features a multi-tiered design encompassing the high-speedInMemoryBroker, the auditableSimulatedBroker, and theIBKR Adapterfor real-world order routing.amidas_backtest: The time-machine. Simulates thousands of strategy permutations against historical timelines, generating detailed performance (CAGR, Net ROI) and drawdown metrics.amidas_cli: The lightweight command-line interface to monitor, control, and evaluate the engine's asynchronous processes.
- Language: Rust (Stable)
- Concurrency: Tokio
- Database Interface: SQLx (Compile-time checked queries)
- Storage Engine: SQLite (Optimized for edge-device I/O)
- Brokerage API: Interactive Brokers (TWS/IB Gateway)
- Workspace & Modular Crate Structure
- Database Schema & Async Migration Logic
- Data Ingestion & RAM-based Valuation Caching
- Detailed Single-Strategy Backtest Engine (with DB-persisted audit trails)
- High-Speed In-Memory Mass Backtesting
- Interactive Brokers (IBKR) API Integration
- Dynamic Thresholding & Combinatorial Strategy Generator
- Resolve Mass-Backtest Concurrency State Leakage
- Margin Monitoring Dashboard (CLI Integration)