Tried the Correlation tab with AAPL,SPY — the format the input hint itself suggests (zh-CN locale: "逗号分隔的标的代码,如 BTC-USDT,ETH-USDT,AAPL,SPY", same in ja/ko/ar) — and every request fails with:
Could not fetch price data for at least 2 assets. Fetched: []
Description
compute_correlation_matrix (agent/backtest/correlation.py) passes the user's raw codes straight to the data loaders, but the loaders key US/HK/A-share instruments by the exchange-suffixed symbol (AAPL.US / 0700.HK / 600000.SH). A bare AAPL fails the yahoo loader's _is_supported() check (requires .US/.HK/.NS/.BO), returns an empty dict — and since that's not an exception, the yfinance fallback never fires either. Verified: AAPL.US → 103 rows, bare AAPL → nothing.
Digging further, two more layers make this worse:
infer_market's prefix heuristics misroute many symbols: bare 0700 (Tencent) → a_share, 9988 (Alibaba) → us_equity, 300750 (CATL, ChiNext) → hk_equity, and even suffixed 830799.BJ → us_equity (no .SH/.SZ/.BJ suffix handling at all).
- The fetch loop stops at the first available loader, not the first that returns data — when eastmoney (first in the HK chain) hits a network error, the asset silently vanishes even though yahoo (next in chain) can serve it.
- All failures are swallowed by bare
except: continue, so the only symptom is Fetched: [] with no clue why.
Steps to Reproduce
- Open the Correlation tab (
/correlation).
- Enter
AAPL,SPY (as the hint text suggests) and compute.
- Request fails with
Could not fetch price data for at least 2 assets. Fetched: [].
Same happens for bare A-share codes (600000,000001) and bare HK codes (0700,9988).
Interface
Web UI Correlation tab / GET /correlation?codes=AAPL,SPY (the API docstring example BTC-USDT,ETH-USDT,SPY fails the same way).
Note: en.json's hint was at some point changed to suffixed A-share examples (000001.SZ,600519.SH,000858.SZ), but zh-CN/ja/ko/ar still show the bare form — and either way, bare tickers arguably should work. Happy to submit a fix (have one working).
Tried the Correlation tab with
AAPL,SPY— the format the input hint itself suggests (zh-CN locale: "逗号分隔的标的代码,如 BTC-USDT,ETH-USDT,AAPL,SPY", same in ja/ko/ar) — and every request fails with:Description
compute_correlation_matrix(agent/backtest/correlation.py) passes the user's raw codes straight to the data loaders, but the loaders key US/HK/A-share instruments by the exchange-suffixed symbol (AAPL.US/0700.HK/600000.SH). A bareAAPLfails the yahoo loader's_is_supported()check (requires.US/.HK/.NS/.BO), returns an empty dict — and since that's not an exception, the yfinance fallback never fires either. Verified:AAPL.US→ 103 rows, bareAAPL→ nothing.Digging further, two more layers make this worse:
infer_market's prefix heuristics misroute many symbols: bare0700(Tencent) →a_share,9988(Alibaba) →us_equity,300750(CATL, ChiNext) →hk_equity, and even suffixed830799.BJ→us_equity(no.SH/.SZ/.BJsuffix handling at all).except: continue, so the only symptom isFetched: []with no clue why.Steps to Reproduce
/correlation).AAPL,SPY(as the hint text suggests) and compute.Could not fetch price data for at least 2 assets. Fetched: [].Same happens for bare A-share codes (
600000,000001) and bare HK codes (0700,9988).Interface
Web UI Correlation tab /
GET /correlation?codes=AAPL,SPY(the API docstring exampleBTC-USDT,ETH-USDT,SPYfails the same way).Note:
en.json's hint was at some point changed to suffixed A-share examples (000001.SZ,600519.SH,000858.SZ), but zh-CN/ja/ko/ar still show the bare form — and either way, bare tickers arguably should work. Happy to submit a fix (have one working).