feat(stock): watchlist API 헬퍼 + useWatchlist 훅(낙관적 CRUD·알림) + 테스트

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UHXzpsZQxKG9hQmNRfZjRS
This commit is contained in:
2026-07-03 01:49:44 +09:00
parent ae33aa4def
commit a52fd0db8f
3 changed files with 181 additions and 0 deletions

View File

@@ -852,3 +852,13 @@ export function compatPatchReading(id, body) {
export function compatDeleteReading(id) {
return apiDelete(`/api/saju/compat/readings/${id}`);
}
// ── Stock Watchlist / Trade Alerts (관심종목·매매 시그널) ──
// GET /api/stock/watchlist → { watchlist: [{ ticker, name, note, params, added_at }] }
// POST /api/stock/watchlist body { ticker, name?, note? } → { ok: true }
// DELETE /api/stock/watchlist/{ticker} → 200/404
// GET /api/stock/trade-alerts?days=N → { alerts: [{ id, ticker, name, kind, condition, price, detail, fired_at }] }
export const getWatchlist = () => apiGet('/api/stock/watchlist');
export const addWatchlist = (body) => apiPost('/api/stock/watchlist', body);
export const removeWatchlist = (ticker) => apiDelete(`/api/stock/watchlist/${encodeURIComponent(ticker)}`);
export const getTradeAlerts = (days = 7) => apiGet(`/api/stock/trade-alerts?days=${days}`);