{"id":26870772,"url":"https://github.com/jialuechen/trademind","last_synced_at":"2025-04-07T08:17:34.715Z","repository":{"id":251517123,"uuid":"837476283","full_name":"jialuechen/trademind","owner":"jialuechen","description":"A High-Performance Visual Algorithmic Trading Framework","archived":false,"fork":false,"pushed_at":"2025-03-31T00:08:40.000Z","size":775,"stargazers_count":104,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T01:20:08.046Z","etag":null,"topics":["algorithmic-trading","backtesting-engine","electronic-trading","event-driven","high-frequency-trading","machine-learning","quantitative-finance","simulation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jialuechen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-03T05:09:18.000Z","updated_at":"2025-03-31T00:08:43.000Z","dependencies_parsed_at":"2024-08-03T16:59:55.386Z","dependency_job_id":"e34484bf-24d2-499f-90fd-481ceda9377f","html_url":"https://github.com/jialuechen/trademind","commit_stats":null,"previous_names":["jialuechen/tfq-finance","jialuechen/tradezen","jialuechen/trademind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Ftrademind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Ftrademind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Ftrademind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jialuechen%2Ftrademind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jialuechen","download_url":"https://codeload.github.com/jialuechen/trademind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246933788,"owners_count":20857126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithmic-trading","backtesting-engine","electronic-trading","event-driven","high-frequency-trading","machine-learning","quantitative-finance","simulation"],"created_at":"2025-03-31T07:07:33.119Z","updated_at":"2025-04-07T08:17:34.697Z","avatar_url":"https://github.com/jialuechen.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TradeMind: An Algorithmic Trading Framework\n\nTradeMind is a high-performance, professional-grade quantitative trading platform designed for algorithmic trading, with a focus on low-latency execution, advanced strategy development, and real-time market microstructure visualization analysis.\n\n## System Architecture\n\n![Quantitative Trading Platform System Architecture](assets/architecture.png)\n\nThe platform consists of five key layers:\n\n1. **Exchanges and Data Sources Layer**\n   - Connects to stock and futures exchanges\n   - Integrates with data vendors and real-time feeds\n   - Provides raw market data for processing\n\n2. **Trading and Data Connectivity Layer**\n   - FIX Engine for low-latency exchange communication\n   - WebSocket APIs for modern connectivity\n   - Data collectors and market data adapters\n\n3. **Core Engine Layer (C++)**\n   - High-performance order book engine\n   - Sophisticated order management system\n   - Strategy execution engine\n   - Real-time risk management\n\n4. **Strategy Development Layer (Python)**\n   - Flexible strategy framework for algorithm development\n   - Comprehensive backtesting engine for strategy evaluation\n\n5. **Analysis \u0026 Visualization Layer**\n   - Transaction cost analysis to optimize trading performance\n   - Real-time visualization of market data and system metrics\n\nAll these components are supported by a robust **Distributed Infrastructure** layer that includes:\n   - ZeroMQ message bus for low-latency inter-component communication\n   - Docker containerization for deployment flexibility\n   - Kubernetes orchestration for scaling and management\n   - Comprehensive monitoring and automatic recovery systems\n\n## Key Features\n\n- **High-Performance Core Engine**: C++ implementation of critical components ensures microsecond-level response time\n- **Real-time Market Microstructure Analysis**: Capture and analyze order book dynamics and liquidity metrics\n- **Flexible Strategy Development**: Python API for rapid strategy development using machine learning and quantitative models\n- **Comprehensive Backtesting**: Event-driven backtesting engine with realistic market simulation\n- **Low-Latency Order Execution**: FIX protocol integration for direct exchange connectivity\n- **Distributed Architecture**: Microservices design with ZeroMQ messaging for horizontal scalability\n- **Cloud-Ready Deployment**: Containerized services that can be deployed in cloud environments\n\n## Getting Started\n\n### Prerequisites\n\n- C++17 compatible compiler (GCC 7+, Clang 5+, MSVC 2019+)\n- CMake 3.15+\n- Python 3.8+\n- ZeroMQ 4.3+\n- Boost 1.70+\n- Fix8 (for FIX protocol support)\n- YAML-CPP\n\n### Building from Source\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/jialuechen/trademind.git\n   cd trademind\n   ```\n\n2. Build the C++ components:\n   ```bash\n   mkdir build \u0026\u0026 cd build\n   cmake ..\n   make -j$(nproc)\n   ```\n\n3. Install the Python package:\n   ```bash\n   cd python\n   pip install -e .\n   ```\n\n### Configuration\n\nEdit the configuration files in the `config` directory to set up:\n\n- Exchange connections\n- Market data sources\n- Risk parameters\n- Logging preferences\n- Performance settings\n\nExample configuration is provided in `config/config.yaml`.\n\n### Running the Platform\n\nTo start the platform with default settings:\n\n```bash\n./bin/trademind\n```\n\nTo specify a custom configuration file:\n\n```bash\n./bin/trademind --config /path/to/custom_config.yaml\n```\n\n## Strategy Development\n\nTradeMind provides a powerful Python API for developing trading strategies. Here's a minimal example:\n\n```python\nfrom pyquant import Strategy, Context, OrderSide, OrderType\n\nclass SmaStrategy(Strategy):\n    def initialize(self) -\u003e None:\n        # Set strategy parameters\n        self.parameters = {\n            \"symbol\": \"AAPL\",\n            \"fast_period\": 10,\n            \"slow_period\": 30,\n            \"trade_size\": 100\n        }\n        \n        # Add symbols to trade\n        self.context.symbols = [self.parameters[\"symbol\"]]\n        \n    def on_bar(self, context: Context, bar_dict) -\u003e None:\n        symbol = self.parameters[\"symbol\"]\n        bars = bar_dict[symbol]\n        \n        # Calculate moving averages\n        fast_ma = bars['close'].rolling(self.parameters[\"fast_period\"]).mean()\n        slow_ma = bars['close'].rolling(self.parameters[\"slow_period\"]).mean()\n        \n        # Get current position\n        position = context.get_position(symbol)\n        \n        # Trading logic: Buy when fast MA crosses above slow MA\n        if fast_ma.iloc[-2] \u003c= slow_ma.iloc[-2] and fast_ma.iloc[-1] \u003e slow_ma.iloc[-1]:\n            if position.quantity \u003c= 0:\n                self.buy(symbol, self.parameters[\"trade_size\"])\n                \n        # Sell when fast MA crosses below slow MA\n        elif fast_ma.iloc[-2] \u003e= slow_ma.iloc[-2] and fast_ma.iloc[-1] \u003c slow_ma.iloc[-1]:\n            if position.quantity \u003e= 0:\n                self.sell(symbol, self.parameters[\"trade_size\"])\n```\n\n## Backtesting\n\nTo backtest a strategy:\n\n```python\nfrom pyquant import BacktestEngine, BacktestVisualizer, Timeframe\nimport pandas as pd\n\n# Load historical data\ndata = pd.read_csv(\"data/AAPL_daily.csv\", index_col='date', parse_dates=True)\n\n# Create and configure strategy\nstrategy = SmaStrategy()\n\n# Set up backtest engine\nbacktest = BacktestEngine()\nbacktest.add_strategy(strategy)\nbacktest.add_bar_data(\"AAPL\", Timeframe.D1, data)\n\n# Run backtest\nresults = backtest.run(\n    start_time=data.index[100],\n    end_time=data.index[-1],\n    initial_capital=100000.0\n)\n\n# Visualize results\nvisualizer = BacktestVisualizer()\nvisualizer.generate_report(results)\n```\n\n## Parameter Optimization\n\nTradeMind includes tools for strategy parameter optimization:\n\n```python\nfrom pyquant import StrategyOptimizer\n\n# Create optimizer\noptimizer = StrategyOptimizer(SmaStrategy)\noptimizer.add_bar_data(\"AAPL\", Timeframe.D1, data)\n\n# Define parameter grid\nparam_grid = {\n    \"fast_period\": [5, 10, 15, 20],\n    \"slow_period\": [20, 30, 40, 50],\n}\n\n# Run grid search\nbest_params = optimizer.grid_search(\n    param_grid=param_grid,\n    start_time=data.index[100],\n    end_time=data.index[-1],\n    optimize_metric='sharpe_ratio'\n)\n\nprint(f\"Best parameters: {best_params}\")\n```\n\n## Distributed Deployment\n\nFor production environments, TradeMind can be deployed as a distributed system using Docker and Kubernetes:\n\n```bash\ncd docker\ndocker-compose up -d\n```\n\nFor Kubernetes deployment:\n\n```bash\nkubectl apply -f kubernetes/trademind.yaml\n```\n\n## Contributing\n\nContributions are welcome! Please check out our [contributing guidelines](CONTRIBUTING.md) for details on how to submit pull requests, report issues, or suggest improvements.\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjialuechen%2Ftrademind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjialuechen%2Ftrademind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjialuechen%2Ftrademind/lists"}