gavindiaz 5f3dcd037c MT5 environment backup: redacted config, wine wrapper, report index
Machine-level files for the Linux/headless MT5 setup that are neither
source (mt5-quant) nor workspace (mt5-project):

- config/mt5-quant.yaml.example: real config with login and password
  replaced by placeholders. The live file is ~/.local/bin/config/mt5-quant.yaml.
- bin/wine-wrapper.sh: portable Wine 11.21 launcher installed at ~/.local/bin/wine.
- db/reports.db: report index (SQLite, reports + deals). Contains no credentials.

Wine itself, the MT5 client install and the compiled mt5-quant binary are
rebuilt from documented steps in README.md rather than stored here.
2026-11-02 13:39:22 +00:00

mt5-env — MT5 回测环境的机器级配置备份

mt5-quant 源码在 mt5-quant 仓库,工作区(EA/脚本/set 文件)在 mt5-project 仓库。 这个仓库只放不随源码走、重建麻烦或不可再生成的文件。

内容

路径 说明
config/mt5-quant.yaml.example 线上配置的脱敏副本。真实文件在 ~/.local/bin/config/mt5-quant.yaml(权限 600)
bin/wine-wrapper.sh 免 root 的 portable Wine 11.21 包装脚本,真实位置 ~/.local/bin/wine
db/reports.db 回测报告索引(SQLite,reports + deals 两张表),真实位置 ~/.local/bin/reports.db

恢复步骤

# 1. 配置:复制并填入凭据(文件名必须是 mt5-quant.yaml)
mkdir -p ~/.local/bin/config
cp config/mt5-quant.yaml.example ~/.local/bin/config/mt5-quant.yaml
chmod 600 ~/.local/bin/config/mt5-quant.yaml
$EDITOR ~/.local/bin/config/mt5-quant.yaml   # 填 backtest_login / backtest_password

# 2. wine wrapper
cp bin/wine-wrapper.sh ~/.local/bin/wine && chmod 700 ~/.local/bin/wine

# 3. 报告索引(可选,空库也能自动重建)
cp db/reports.db ~/.local/bin/reports.db

不在这个仓库里的东西

这些体积大、可直接重装,靠下面的步骤恢复:

  • Wine:解压 wine-11.21-amd64-wow64 到 ~/opt/(约 815 MB)
  • MT5 客户端:~/.wine/drive_c/Program Files/MetaTrader 5 IC Markets Global(约 2.5 GB), 用 IC Markets 安装器装进 WINEPREFIX=~/.wine
  • mt5-quant 二进制:从 mt5-quant 仓库 fix/linux-path-and-optimizer 分支 cargo build --release 编译,放到 ~/.local/bin/mt5-quant
  • Xvfb:headless 模式需要 Xvfb :99

装完后跑 bash ~/workspace/mt5-project/scripts/healthcheck.sh 自检。

配置路径的坑

mt5-quant 读配置时优先找二进制同级目录,即 ~/.local/bin/config/mt5-quant.yaml。 放在 ~/.config/mt5-quant/ 的配置不生效。

Linux 符号链接(旧二进制兼容用)

历史上有三条 symlink 兜底大小写/路径差异,当前构建的二进制已不需要,healthcheck.sh --fix 会清理:

  • <MT5>/config -> Config
  • <MT5>/metaeditor64.exe -> MetaEditor64.exe
  • Program Files/MetaTrader 5 -> MetaTrader 5 IC Markets Global

凭据

backtest_password 以明文存储,是 MT5 命令行回测的必需项。 本仓库只有占位符;真实值不要提交,也不要贴到 issue 里。

S
Description
No description provided
Readme
321 KiB
Languages
Shell 100%