# XAUUSD-backtest **Repository Path**: wg722/xauusd-backtest ## Basic Information - **Project Name**: XAUUSD-backtest - **Description**: python实现的黄金量化统一回测器,实现效果与MT5平台回测一致,方便量化策略使用python优化后改为EA - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-22 - **Last Updated**: 2026-05-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # XAUUSD Backtest Standalone unified Python backtesting framework extracted from the GOLD research workspace. ## What is included - `src/gold_backtest/`: reusable backtest engine, metrics, runtime preflight, metric provenance, MT5 parity helpers, and strategy implementations. - `tests/`: synthetic/unit tests for the engine, strategies, parity adapters, and validation contracts. - `research/run_short_term_replacement_baseline.py`: single-strategy research runner with metric scopes/provenance output. - `research/run_multi_strategy_tooling_validation.py`: multi-strategy contract validation runner. - `research/run_auction_reset_*`: current auction-reset cost/fragility research scripts. Large market-data CSV files and generated evidence folders are intentionally excluded. ## Install ```powershell python -m pip install -e .[dev] ``` ## CLI quick start Input CSV format is headerless M1/OHLCV rows: ```text date,time,open,high,low,close,volume ``` Run the package CLI: ```powershell xauusd-backtest run --data path/to/XAUUSD_M1.csv --strategy atr_expansion_followthrough --rows 10000 ``` The legacy alias is also available: ```powershell gold-backtest run --data path/to/XAUUSD_M1.csv --strategy atr_expansion_followthrough --rows 10000 ``` ## Research runners Single strategy baseline: ```powershell python research/run_short_term_replacement_baseline.py ` --data path/to/XAUUSD_M1.csv ` --strategy auction_reset_recenter_book ` --params-path research/auction_reset_recenter_book_5y_params.json ` --strategy-type smart_grid ` --output research/output.json ``` Multi-strategy contract validation: ```powershell python research/run_multi_strategy_tooling_validation.py --run --output-dir research/evidence/tooling_validation ``` ## Validation Core smoke tests: ```powershell python -m pytest -q tests/test_backtest_framework.py tests/test_standards.py tests/test_runtime_preflight.py tests/test_execution_ledger_adapter.py tests/test_mt5_parity_adapter.py ``` Full tests can be run with: ```powershell python -m pytest -q ``` ## Notes - This repository is a research-grade backtesting toolkit, not a production trading system. - No live trading credentials, MT5 terminal state, or large proprietary tick datasets are included. - MT5 parity helpers are included for deterministic validation workflows, but MT5 execution artifacts should remain external evidence.