Files
2026-06-26 20:50:07 +08:00

49 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""XAUUSD instrument configs for GoldScalperPro (IC Markets Global).
Real broker specs pulled live from MT5 (doc 05 §1) on 2026-06-26. Plus the
cost-stress variants (worst_case / best_case) derived via get_profile for
robustness testing (doc 06 §4). Never edit these by hand to make a backtest
look better — that's the exact failure mode doc 04 Rule 2 warns about.
"""
from __future__ import annotations
from shared.instruments import InstrumentConfig, InstrumentProfile, get_profile
from shared.instruments.config import SpreadMode, SwapMode
# Real specs from IC Markets Global MT5 (queried 2026-06-26).
# tick_value=1.0 means 1 point of price move = $1 per lot (since point=0.01
# and tick_size=0.01 and contract_size=100oz → $0.01 × 100 = $1 per tick).
XAUUSD_REAL = InstrumentConfig(
name="XAUUSD IC Markets (real)",
symbol="XAUUSD",
point=0.01,
digits=2,
tick_size=0.01,
tick_value=1.0,
contract_size=100.0,
volume_min=0.01,
volume_step=0.01,
volume_max=100.0,
spread_mode=SpreadMode.BAR_COLUMN,
spread_fixed_points=0.0,
swap_mode=SwapMode.FIXED_PER_LOT,
swap_long=-53.719,
swap_short=37.202,
swap_annual_pct=0.0,
triple_swap_weekday=3,
profile=InstrumentProfile.REAL,
spread_bar_column_fallback=20.0, # current spread as fallback
)
# Cost-stress variants (doc 06 §4): wider spread + harsher swap for worst,
# tighter / softer for best. Built via get_profile from the real config.
XAUUSD_WORST = get_profile(XAUUSD_REAL, InstrumentProfile.WORST_CASE)
XAUUSD_BEST = get_profile(XAUUSD_REAL, InstrumentProfile.BEST_CASE)
# Convenience lookup for robustness.cost_stress().
XAUUSD_PROFILES = {
"real": XAUUSD_REAL,
"worst_case": XAUUSD_WORST,
"best_case": XAUUSD_BEST,
}