Add system alerts log with nav badge and Admin Alerts tab.
Persist job and ingestion warnings/errors for 7 days, surface a dismissible top-nav badge, treat stale OHLCV as a warning (e.g. ticker renames), and show market bar age on the ticker freshness chip.
This commit is contained in:
@@ -60,3 +60,30 @@ async def test_empty_fetch_with_existing_history_is_up_to_date(session):
|
||||
|
||||
assert result.status == "complete"
|
||||
assert result.records_ingested == 0
|
||||
|
||||
|
||||
async def test_empty_fetch_with_stale_history_reports_stale(session):
|
||||
# Provider returns nothing but last stored bar is weeks old — classic
|
||||
# rename/delist case (e.g. SATS after it became ECHO). Must not look like success.
|
||||
await _add_ticker(session, "SATS")
|
||||
today = date.today()
|
||||
old = [
|
||||
OHLCVData(
|
||||
ticker="SATS",
|
||||
date=today - timedelta(days=20 + i),
|
||||
open=100.0,
|
||||
high=101.0,
|
||||
low=99.0,
|
||||
close=100.0,
|
||||
volume=1000,
|
||||
)
|
||||
for i in range(3)
|
||||
]
|
||||
await svc.fetch_and_ingest(session, MockMarketDataProvider(ohlcv_data=old), "SATS")
|
||||
|
||||
result = await svc.fetch_and_ingest(session, MockMarketDataProvider(ohlcv_data=[]), "SATS")
|
||||
|
||||
assert result.status == "stale"
|
||||
assert result.records_ingested == 0
|
||||
assert result.last_date is not None
|
||||
assert "renamed" in (result.message or "").lower() or "halted" in (result.message or "").lower()
|
||||
|
||||
Reference in New Issue
Block a user