Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(backtest): restore crypto-first market inference; tolerate meta-less registry entries

Yufeng He7a10e6eb756e
diff --git a/agent/backtest/correlation.py b/agent/backtest/correlation.py
index 5bd38eb6f..fccb156f3 100644
--- a/agent/backtest/correlation.py
+++ b/agent/backtest/correlation.py
@@ -39,9 +39,6 @@ def infer_market(code: str) -> str:
code_upper = code.strip().upper()
if canonical_fx_pair(code_upper):
return "forex"
- detected = _detect_market(code_upper)
- if detected != "a_share":
- return detected
crypto_suffixes = ("USDT", "BTC", "ETH", "BNB", "SOL", "ADA", "DOGE")
if (
"/" in code_upper
@@ -55,6 +52,9 @@ def infer_market(code: str) -> str:
)
):
return "crypto"
+ detected = _detect_market(code_upper)
+ if detected != "a_share":
+ return detected
if code_upper.endswith(".HK"):
return "hk_equity"
if code_upper.endswith((".SH", ".SZ", ".BJ")):
diff --git a/agent/src/tools/alpha_bench_tool.py b/agent/src/tools/alpha_bench_tool.py
index 784082c72..49ef799de 100644
--- a/agent/src/tools/alpha_bench_tool.py
+++ b/agent/src/tools/alpha_bench_tool.py
@@ -692,7 +692,7 @@ def _validate_bench_data_requirements(registry: Any, alpha_ids: list[str], unive
ValueError: If US-only SEC inputs are requested from another universe.
"""
columns = sorted({column for aid in alpha_ids
- for column in (registry.get(aid).meta or {}).get("columns_required", [])
+ for column in (getattr(registry.get(aid), "meta", None) or {}).get("columns_required", [])
if column.startswith("fund:")})
if columns and universe != "sp500":
raise ValueError("Fundamental factor evaluation currently uses SEC US filings. Choose the S&P 500 universe.")