ZhuLinsen/daily_stock_analysis · error · DataFetchError
TickFlowFetcher only supports A-share/ETF symbols
Error message
TickFlowFetcher only supports A-share/ETF symbols
What it means
DataFetchError raised in TickFlowFetcher._fetch_raw_data when _to_tickflow_symbol(stock_code) returns falsy. TickFlow only serves A-share and ETF symbols, so HK/US/BSE or malformed codes are rejected before cache lookup or any API request.
Source
Thrown at data_provider/tickflow_fetcher.py:174
return TickFlow(api_key=self.api_key, timeout=self.timeout)
def _get_client(self):
if not self.api_key:
return None
if self._client is not None:
return self._client
with self._client_lock:
if self._client is None:
self._client = self._build_client()
return self._client
def _fetch_raw_data(
self, stock_code: str, start_date: str, end_date: str
) -> pd.DataFrame:
symbol = self._to_tickflow_symbol(stock_code)
if not symbol:
raise DataFetchError("TickFlowFetcher only supports A-share/ETF symbols")
cache_key = self._daily_cache_key(symbol, start_date, end_date)
cached = self._get_daily_cache(cache_key)
if cached is not None:
return cached
client = self._get_client()
if client is None:
raise DataFetchError("TickFlow API key is not configured")
request_count = self._daily_kline_count(start_date, end_date)
try:
df = client.klines.get(
symbol,
period="1d",
count=request_count,
start_time=self._date_to_ms(start_date),
end_time=self._date_to_ms(end_date, end_of_day=True),View on GitHub (pinned to 5159bd72e8)
Solutions
- Restrict TickFlowFetcher to A-share/ETF routing and send other markets to their dedicated providers.
- Verify _to_tickflow_symbol handles your code format; extend it if a valid A-share/ETF format is rejected.
- Rely on manager-level fallback on DataFetchError when routing cannot be guaranteed.
Example fix
# before
df = tickflow_fetcher.get_stock_data("AAPL", start, end) # DataFetchError
# after
symbol = tickflow_fetcher._to_tickflow_symbol(code)
if symbol:
df = tickflow_fetcher.get_stock_data(code, start, end)
else:
df = manager.get_stock_data(code, start, end) Defensive patterns
Strategy: validation
Validate before calling
symbol = tickflow_fetcher._to_tickflow_symbol(stock_code)
if not symbol:
df = manager.get_stock_data(stock_code, start, end) # non A-share/ETF goes elsewhere
else:
df = tickflow_fetcher.get_stock_data(stock_code, start, end) Type guard
def tickflow_supports(code: str) -> bool:
"""True when the code is an A-share/ETF symbol TickFlow can serve."""
return bool(tickflow_fetcher._to_tickflow_symbol(code)) Try / catch
try:
df = tickflow_fetcher.get_stock_data(code, start, end)
except DataFetchError as e:
if "only supports A-share/ETF" in str(e):
df = manager.get_stock_data(code, start, end)
else:
raise Prevention
- Confine TickFlowFetcher to the A-share/ETF chain.
- Add symbol-mapper unit tests for every code format your pipeline ingests.
When it happens
Trigger: Passing non-A-share codes (US tickers, HK codes, BSE codes) or unrecognizable A-share formats to TickFlowFetcher._fetch_raw_data.
Common situations: TickFlowFetcher configured in a chain that also receives HK/US names from a mixed portfolio; code normalization drift making valid A-share codes unrecognizable to _to_tickflow_symbol.
Related errors
- Cannot convert {stock_code} to Longbridge symbol
- TencentFetcher unsupported stock code: {stock_code}
- Backend executable not found: ${backendPath}
- Invalid share image record ID
- Desktop backend URL is unavailable
AI-assisted analysis of ZhuLinsen/daily_stock_analysis@5159bd72e8 (2026-08-15).
Data as JSON: /api/errors/360fed08c98ece54.
Report an issue: GitHub.