You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(tg_bot): /watch resolves and stores stock name from backend
Fixes review issue OpenByteInc#10 — /list previously showed `—` for every code
because cmd_watch always passed name=None and watchlist_add was
INSERT OR IGNORE.
Three coordinated changes:
1. QuantDingerClient.get_symbol_name() hits the public
GET /api/market/symbols/search endpoint (unauthed; seed DB lookup),
returns the first result's name or None on any error / no match /
symbol-echo. Best-effort, never raises.
2. Storage.watchlist_add now uses UPSERT with COALESCE(old, new) so:
- existing name is never overwritten (preserves prior intent)
- existing NULL name CAN be backfilled by a later add with a real
name (matches the lazy-fill use case)
added_by / added_at stay from the original insert.
3. cmd_watch awaits get_symbol_name before storing; passes the result
through. Reply now echoes the name when available
(e.g. "✅ 已加入 watchlist: 600519 貴州茅台").
Pre-existing watchlist rows with NULL name will stay NULL until
re-watched; users wanting to backfill can /unwatch + /watch the code.
Tests: +5 (1 storage backfill, 4 get_symbol_name covering happy /
no-match / symbol-echo / HTTP 500). Full suite 61/61.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments