Skip to content

bug: preserve TPEx market in Yahoo OHLCV fallback #481

@cct08311github

Description

@cct08311github

Summary

Recent commit 6608f5cd5e4d8840ee80f7bdfd20236df262c0e6 added Yahoo Finance OHLCV fallback in run_daily_fetch(), but the new path assumes every symbol in eod_prices is TWSE. The schema explicitly supports both TWSE and TPEx.

Evidence

  • src/openclaw/market_data_fetcher.py wrote Yahoo fallback rows with a hardcoded market='TWSE'.
  • src/openclaw/agents/eod_analysis.py and src/openclaw/eod_ingest.py pass SELECT DISTINCT symbol FROM eod_prices, which includes TPEx holdings.
  • This causes TPEx symbols to go through the wrong fallback path and be persisted back with the wrong market.

Minimal fix

  • Look up each symbol's market from existing eod_prices rows.
  • Skip TWSE STOCK_DAY for TPEx symbols.
  • Use Yahoo .TWO for TPEx symbols and preserve the original market on insert.

Verification

  • Add a regression test in src/tests/test_market_data_fetcher.py covering a TPEx symbol through Yahoo fallback.
  • Run pytest -q src/tests/test_market_data_fetcher.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend/API/database workbugSomething isn't workingin-progressWork currently being implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions