fix: surface empty OHLCV fetch as a warning, not success
Fetching a symbol the provider doesn't cover (e.g. RHM/Rheinmetall — Alpaca serves US listings only) returned 0 bars but reported "complete · Successfully ingested 0 records", which the UI showed as green success. fetch_and_ingest now returns a distinct `no_data` status when the provider returns nothing AND the ticker has no history (vs. "already up to date" when bars exist). The fetch endpoint maps it to a `warning` source status, and the fetch toast renders it as ⚠ with the provider message instead of success. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,8 +114,9 @@ async def fetch_symbol(
|
||||
result = await ingestion_service.fetch_and_ingest(
|
||||
db, provider, symbol_upper, start_date, end_date
|
||||
)
|
||||
status_map = {"complete": "ok", "partial": "ok", "no_data": "warning"}
|
||||
sources_out["ohlcv"] = {
|
||||
"status": "ok" if result.status in ("complete", "partial") else "error",
|
||||
"status": status_map.get(result.status, "error"),
|
||||
"records": result.records_ingested,
|
||||
"message": result.message,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user