How lumina-lumi/openmanus-autoquant works
Project Type & Purpose
• Project Type: It is a full-scale financial quant system with modular components that use AI to generate and iterate trading strategies.
• Purpose: To automatically generate, test, and optimize trading strategies by integrating financial data pipelines (using sources like akshare), detailed analysis modules, strategy generators, and backtesting engines (integrating frameworks like backtrader).
File Structure Analysis
• Top-Level Organization:
• The “app” directory contains all core modules. Subdirectories include:
▸ agent – Contains several types of intelligent agents (e.g., browser, manus, mcp, react, swe, toolcall) which likely orchestrate different parts of the workflow.
▸ flow – Involved in planning and managing workflows for strategy generation and execution.
▸ mcp – Contains a server module; perhaps it handles communication or coordination between different agents.
▸ prompt – Holds different prompt templates corresponding to various tasks (e.g., browser, planning, toolcall) which align with an LLM-based chain-of-thought generation.
▸ sandbox – Provides a secure/test environment to execute and manage experimental code (modules for terminal operations, exception handling, etc).
▸ tool – Offers a library of helper routines (backtesting, strategy generation, browser usage, stock data fetching, file operations, etc). Notably, specific tool subdirectories (such as “search”) indicate modularity and specialization in tasks.
▸ resource – Contains markdown documentation for APIs and stock data integration; these act as API docs or specifications for data extraction.
• Other Files:
• Main scripts (e.g., main.py, run_flow.py, run_mcp*.py) signal different launch entry points for various parts of the system.
• Configuration files (Dockerfile, setup.py, requirements.txt, .pre-commit-config.yaml, and GitHub workflow files) ensure standardized build, dependency management, and deployment pipelines.
README Insights
• Describes the full automated workflow—from data pipeline (akshare integration) and analysis to strategy generation and refinement.
• Highlights the system’s iterative nature (self-generation, self-iteration, self-optimization), confirming that the module interactions are dynamic.
• Mentions integration with backtesting frameworks (backtrader) and outlines its value for private equity funds, individual investors, and academic research.
a. Main Components:
• Data Pipeline/Integration Module: Interfaces with financial data sources such as akshare.
• Analysis Engine: Handles data processing and business-specific analysis.
• Strategy Generation Module: Uses intelligent agents (under app/agent and app/prompt) to create strategies.
• Backtesting Engine: Uses backtrader (and associated tools in app/tool/backtest.py) for simulation and evaluation.
• Optimization Loop: Dynamically refines strategies based on backtesting results.
• Workflow / Flow Manager: (app/flow) coordinates the overall process and iteration.
• Communication/Coordination Server: (app/mcp) oversees agent communications.
• Sandbox Environment: (app/sandbox) for controlled code execution and testing.
• Tools & Utility Modules: (app/tool and its submodules) support specialized tasks, including market data fetching, search, and code execution.
b. Relationships & Interactions:
• Directional flows from data ingestion, to analysis, through strategy generation, into backtesting, and finally into optimization feedback.
• That the agents in “app/agent” work in tandem with prompt templates in “app/prompt” to drive LLM interactions.
• Workflow orchestration in “app/flow” that schedules and manages these activities.
• Deployment interactions with external libraries (e.g., akshare, backtrader) and optional browser automation with Playwright.
c. Architectural Patterns & Design Principles:
• Modular Design: Each major functionality (data, analysis, strategy generation, backtesting) is encapsulated in its own module.
• Separation of Concerns: Clear boundary between components like agents, flow management, and tools.
• Iterative/Feedback Loop: The core workflow supports self-iteration (cycle between strategy optimization and backtesting).
• Extensibility: The existence of multiple agent implementations and a sandbox environment shows an emphasis on adding new functionality without major refactoring.
d. Relevant Technologies & Frameworks:
• Python (use of virtual environments via conda or uv).
• Backtrader for backtesting.
• akshare for data collection.
• Playwright, if browser automation is enabled.
• GitHub workflows, Docker, and pre-commit hooks for CI/CD and quality management.