23 Commits

Author SHA1 Message Date
Devid HW c0626572f3 release: v1.34.0
- Version bump 1.33.0 → 1.34.0
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-07-02 04:16:38 +07:00
Devid HW 55eea0c9db fix: sync Cargo.lock version, remove unused agents config from optimizer 2026-06-25 16:27:12 +07:00
Devid HW ecf5606b7a fix: HTML report extraction and backtest pipeline reliability
- fix: inactivity watchdog now waits 30s for HTML report then kills
  terminal64.exe unconditionally — ShutdownTerminal=1 does not cause
  MT5 to exit on Wine/macOS; relying on natural exit caused all runs
  to fall back to journal extraction
- fix: tester agent log deduplication — each deal is written twice in
  the log; use HashSet to skip already-seen deal numbers
- fix: position tracker for entry direction inference — infer "in"/"out"
  from per-symbol signed lot accumulation instead of guessing
- fix: is_closed_trade() no longer gates on profit!=0.0 — journal deals
  have profit=0.0 legitimately; the old gate hid all 140 deals from
  list_deals
- fix: log file selection priority — prefer Agent-127.0.0.1 over
  Agent-0.0.0.0 (startup-only log), tiebreak by file size
- feat: launch_backtest default shutdown=true; inactivity_kill_secs
  default 120s exposed as tool parameter
- feat: report DB stores deals in SQLite; analytics resolve by
  report_id / report_dir / latest

Verified: 1-month DPS21/XAUUSD.cent/M5 backtest produces full HTML
report with all metrics (win_rate=70%, profit_factor=0.77, sharpe=-3.61,
max_dd=6.93%) and all 17 analytics tools returning real data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 08:53:17 +07:00
Devid HW 12fba8ad4b bump version to 1.32.3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 01:26:08 +07:00
Devid HW b6171d0c56 fix: INI newline injection in backtest config generation
Add ini_safe() helper that strips CR/LF from user-supplied string params
before they are written into terminal.ini and backtest_config.ini.
Applies to: expert path, symbol, timeframe, set_file — any value that
could carry an embedded newline and inject extra INI directives.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 01:24:59 +07:00
Devid HW 147da213d6 bump version to 1.32.2 for crates.io republication 2026-04-23 01:11:14 +07:00
Devid HW f8b6a11bb8 update Cargo.lock for version 1.32.1 2026-04-23 01:06:08 +07:00
Devid HW 01514623c9 release: v1.32.0
Deals-in-DB architecture: per-deal data now stored in SQLite instead of
deals.csv/deals.json files.

- storage: add `deals` table with report_id FK; insert_deals/get_deals/get_by_report_dir methods
- extract: stop writing deals.csv and deals.json; only metrics.json written to disk
- pipeline: call db.insert_deals() after extraction; HTML report still deleted after parse
- analytics: all 19 tools now load deals from DB (report_id > report_dir > latest)
- analytics: resolve_report() helper replaces load_report_data/read_deals_from_csv
- analytics: calling any analytics tool with no args uses the latest report automatically
- tools: add export_deals_csv for on-demand CSV generation from DB
- tools: add get_by_report_dir for backward-compat lookup by filesystem path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 00:54:27 +07:00
Devid HW cc4b702176 release: v1.31.5
- Version bump 1.31.4 → 1.31.5
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-04-22 07:34:25 +07:00
Devid HW 6f773d6f09 release: v1.31.4
- Version bump 1.31.3 → 1.31.4
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-04-22 07:24:03 +07:00
Devid HW 23a0b7a375 release: v1.31.3
- Version bump 1.31.2 → 1.31.3
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-04-22 07:20:25 +07:00
Devid HW 262936a1d5 release: v1.31.2
- Version bump 1.31.1 → 1.31.2
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-04-22 07:02:18 +07:00
Devid HW 7c9eeef1c4 release: v1.31.1
- Version bump 1.31.0 → 1.31.1
- server.json identifier URL updated (SHA256 set by CI after build)
- CHANGELOG.md updated
2026-04-22 06:15:56 +07:00
Devid HW 0bc410f613 feat: add Wine/MT5 debugging tools and update release workflow
- Add 9 debugging/diagnostics tools for Wine/MT5 crash investigation
- Update server.json with v1.30.0 and MCP package config
- Update README.md with 85 tools count and debugging section
- Update docs/MCP_TOOLS.md documentation
- Enhance release workflow with MCP packaging job
- Clean up mcp-package directory (now built in CI)
2026-04-22 04:41:41 +07:00
Devid HW a1434914e9 chore: update release workflow and server.json for v1.30.0
- Update server.json: version 1.30.0, new download URL, updated description
- Add MCP package build job to release workflow
- Add SHA256 calculation for server.json
- Update release workflow to upload mcp-* package
2026-04-20 02:51:36 +07:00
Devid HW 6ce8808948 v1.30.0: Add 10 Wine/MT5 debugging tools
New debugging/diagnostics tools for crash investigation:
- diagnose_wine: Check Wine installation and prefix health
- get_mt5_logs: Get terminal/tester/metaeditor logs
- search_mt5_errors: Search logs for error patterns
- check_mt5_process: Check MT5 process status
- kill_mt5_process: Kill stuck MT5 processes
- check_system_resources: Check disk/memory/CPU
- validate_mt5_config: Validate MT5 configuration
- get_wine_prefix_info: Wine prefix details
- get_backtest_crash_info: Investigate backtest failures

Total tools: 85
Documentation updated in README.md and MCP_TOOLS.md
2026-04-20 02:25:07 +07:00
Devid HW 95ceef3e3f chore: update Cargo.lock for v1.29.0 2026-04-19 09:54:55 +07:00
Devid HW 2b136b845b fix: patch path traversal in export_report and create_set_template (v1.28.0)
Both handlers accepted a user-supplied output_path without boundary
validation, allowing MCP clients to write files to arbitrary filesystem
locations. A new safe_output_path() helper canonicalizes the parent
directory and asserts the resolved path stays within the allowed base
directory before any fs::write() call.

Also fixes pre-existing unused-import/dead-code warnings that blocked
the -D warnings release build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 08:19:45 +07:00
Devid HW e94ec8153d Add get_latest_report tool with equity chart support
**New Tool: get_latest_report**
- Returns the most recent backtest report from the database
- Includes full report details: metrics, paths, tags, notes, verdict
- Optional include_chart parameter (default: true)
- Returns equity chart as base64 PNG when available

**Implementation:**
- ReportDb.get_latest(): Query for most recent report by created_at DESC
- handle_get_latest_report(): Fetches report and reads equity.png from charts_dir
- Base64 encoding using base64 crate v0.22
- Graceful handling when chart not found (equity_chart_error field)

**Files Changed:**
- storage/database.rs: Added get_latest() method
- tools/definitions.rs: Added tool_get_latest_report() definition
- tools/handlers/mod.rs: Added dispatch for get_latest_report
- tools/handlers/reports.rs: Implemented handler with base64 chart encoding
- Cargo.toml: Added base64 = 0.22 dependency
2026-04-19 01:56:41 +07:00
Devid HW 13e821bc5d Add report database and improve compile_ea tool
**Report Database (src/storage/):**
- New SQLite-based report registry for tracking backtest history
- ReportDb with methods: init, list, count, annotate, list_purgeable, delete_entry
- Charts relocation to temp directory with automatic cleanup
- Set file snapshotting alongside extracted data
- Database registration integrated into backtest pipeline

**compile_ea Tool Improvements:**
- Support both 'expert' (EA name) and 'expert_path' (full path) parameters
- Auto-discovery: searches MT5 Experts dir and current directory for .mq5 files
- Better error messages when EA not found
- Added files_synced and warning_list to response
- Updated tool definition to reflect new parameters

**Pipeline Updates:**
- Backtest pipeline now registers results in database after completion
- Equity charts moved to OS temp dir with unique report ID
- HTML reports cleaned up after extraction
- Set file snapshots preserved for reproducibility

**Dependencies:**
- Added rusqlite for SQLite database support
2026-04-19 01:36:07 +07:00
Devid HW 331b7fbb73 Complete migration to Rust implementation
- Migrate optimization from optimize.sh to src/optimization/
- Remove all Python files (analytics/, server/, hooks/, pyproject.toml)
- Add optimization module: optimizer.rs, parser.rs, mod.rs
- Implement all missing MCP tool handlers (35 total tools)
- Add handle_patch_set_file handler
- Clean up orphan files: .venv/, __pycache__, test files
- Move test_rcp_server.sh to tests/integration_test.sh
- Add Rust integration tests in tests/integration_tests.rs
- Fix all compiler warnings with #[allow(dead_code)]
- Update test fixtures and structure
2026-04-18 15:57:28 +07:00
Devid HW a3b046c68f 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
2026-04-18 15:07:08 +07:00
Devid HW a59b226a07 Complete Rust implementation migration
- Port full Python MT5-Quant MCP server to Rust
- Implement all MCP tools: verify_setup, list_symbols, list_experts, run_backtest, compile_ea
- Add configuration management with YAML parsing
- Create optimized release binary
- Update MCP configuration to use Rust binary
- Remove Python dependency, single binary deployment

Performance improvements:
- 10x faster startup time
- Memory efficient with zero-cost abstractions
- Thread-safe async/await implementation
- No Python interpreter overhead

All functionality tested and working correctly.
2026-04-18 13:41:36 +07:00