feat: complete Rust migration with modular architecture

Major changes:
- Migrate Python/shell scripts to Rust modules:
  - analytics/extract.py → src/analytics/extract.rs (ReportExtractor)
  - analytics/analyze.py → src/analytics/analyze.rs (DealAnalyzer)
  - scripts/mqlcompile.sh → src/compile/mql_compiler.rs (MqlCompiler)
  - scripts/backtest_pipeline.sh → src/pipeline/backtest.rs (BacktestPipeline)

- New modular structure:
  - src/models/ - Config, Deal, Metrics, Report structs
  - src/analytics/ - Report parsing and deal analysis
  - src/compile/ - MQL5 compilation via Wine
  - src/pipeline/ - 5-stage backtest orchestration
  - src/tools/ - 27 MCP tool definitions and handlers

- Remove PyInstaller setup (now pure Rust)
- Remove migrated shell scripts (backtest_pipeline.sh, mqlcompile.sh)
- Add GitHub Actions CI/CD for macOS & Linux releases
- Update all documentation for Rust architecture

Binary size: 4.3MB (no Python dependencies)
Tools: 27 MCP tools fully functional
This commit is contained in:
Devid HW
2026-04-18 15:07:08 +07:00
parent 41792b1292
commit a3b046c68f
37 changed files with 3809 additions and 1587 deletions
+24 -18
View File
@@ -2,9 +2,22 @@
## Quick Setup
### 1. Build Executable
### Option 1: Download Prebuilt Binary (Recommended)
```bash
bash scripts/build-executable-onedir.sh
# macOS (Apple Silicon)
curl -L -o mt5-quant.tar.gz https://github.com/masdevid/mt5-mcp/releases/latest/download/mt5-quant-macos-arm64.tar.gz
tar -xzf mt5-quant.tar.gz
# Linux (x64)
curl -L -o mt5-quant.tar.gz https://github.com/masdevid/mt5-mcp/releases/latest/download/mt5-quant-linux-x64.tar.gz
tar -xzf mt5-quant.tar.gz
```
### Option 2: Build from Source
```bash
bash scripts/build-rust.sh
```
### 2. Configure Windsurf
@@ -14,23 +27,16 @@ Edit `~/.windsurf/config.yaml`:
```yaml
mcpServers:
mt5-quant:
command: /Users/masdevid/jobs/mt5-mcp/dist/mt5-quant/mt5-quant
```
Or dengan environment variable:
```yaml
mcpServers:
mt5-quant:
command: /Users/masdevid/jobs/mt5-mcp/dist/mt5-quant/mt5-quant
command: /Users/masdevid/jobs/mt5-quant/target/release/mt5-quant
env:
MT5_MCP_HOME: /Users/masdevid/jobs/mt5-mcp
MT5_MCP_HOME: /Users/masdevid/jobs/mt5-quant
```
### 3. Restart Windsurf
Close dan reopen Windsurf untuk load MCP server.
Close and reopen Windsurf to load the MCP server.
### 4. Verify
Di Windsurf chat, test dengan:
In Windsurf chat, test with:
```
Run verify_setup
```
@@ -39,16 +45,16 @@ Run verify_setup
### Build untuk Distribution
```bash
# Build
bash scripts/build-executable-onedir.sh
# Build release binary
cargo build --release
# Create tarball
tar -czf mt5-quant-macos-arm64.tar.gz -C dist mt5-quant
tar -czf mt5-quant-macos-arm64.tar.gz -C target/release mt5-quant
# Deploy ke remote server
scp mt5-quant-macos-arm64.tar.gz user@server:~/
ssh user@server "tar -xzf mt5-quant-macos-arm64.tar.gz -C /opt/"
ssh user@server "ln -s /opt/mt5-quant/mt5-quant /usr/local/bin/"
ssh user@server "ln -s /opt/mt5-quant /usr/local/bin/"
# Copy config
scp -r config/mt5-quant.yaml user@server:~/.config/mt5-quant/config/
@@ -71,7 +77,7 @@ mcpServers:
### MCP server not appearing
1. Check Windsurf logs: `~/.windsurf/logs/`
2. Verify executable path is absolute
3. Test executable manually: `./dist/mt5-quant/mt5-quant --help`
3. Test executable manually: `./target/release/mt5-quant --help`
### Config not found
Set `MT5_MCP_HOME` environment variable atau pastikan config di default location: