"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(benchmark): recognize Yahoo Shanghai suffix
Rudy Celeklifbf7e2f59101
diff --git a/README.md b/README.mdindex f4902943d..eb5198bfb 100644--- a/README.md+++ b/README.md@@ -817,7 +817,7 @@ Run `vibe-trading alpha list` to browse, `vibe-trading alpha show <id>` for form| **Composite** | cross-market | one shared capital pool across markets (`source="auto"`) || **options_portfolio** | options | multi-leg, Greeks, payoff/scenario |-Benchmark selection honors `.SH`, `.SZ`, and `.BJ` A-share suffixes independently of the chosen loader, including offline local sources.+Benchmark selection honors `.SH`, `.SZ`, and `.BJ` A-share suffixes, plus Yahoo's `.SS` spelling for Shanghai, independently of the chosen loader, including offline local sources.Bars: 1m / 5m / 15m / 30m / 1H / 4H / 1D, plus weekly / monthly (1W / 1M, built from daily bars). 15 metrics + benchmark comparison, **5 portfolio optimizers** (equal-volatility / risk-parity / mean-variance / max-diversification / turnover-aware), and 3 validation tools (Monte Carlo / Bootstrap / Walk-Forward).diff --git a/agent/backtest/benchmark.py b/agent/backtest/benchmark.pyindex c5b2440ba..ed591133f 100644--- a/agent/backtest/benchmark.py+++ b/agent/backtest/benchmark.py@@ -165,7 +165,8 @@ def _infer_market(codes: list[str], source: str) -> str:first = codes[0].upper()- if first.endswith((".SH", ".SZ", ".BJ")):+ # Yahoo uses .SS for Shanghai; other loaders use the repository's .SH form.+ if first.endswith((".SH", ".SS", ".SZ", ".BJ")):return "a_share"if first.endswith(".US"):return "us_equity"diff --git a/agent/tests/test_benchmark_exchange_suffix_regressions.py b/agent/tests/test_benchmark_exchange_suffix_regressions.pyindex 8e95927a3..7bf809b80 100644--- a/agent/tests/test_benchmark_exchange_suffix_regressions.py+++ b/agent/tests/test_benchmark_exchange_suffix_regressions.py@@ -3,7 +3,7 @@ import pytestfrom backtest.benchmark import resolve_benchmark[email protected]("symbol", ["600000.SH", "000001.SZ", "830799.BJ"])[email protected]("symbol", ["600000.SH", "600000.SS", "000001.SZ", "830799.BJ"])@pytest.mark.parametrize("source", ["local", "baostock", "yfinance"])def test_explicit_ashare_suffix_selects_csi300_benchmark(symbol, source):seen = []