feat: ticker validation + SLV/USO/WEAT/CORN/TUR added to ETFs watchlist

Backend:
- GET /api/market/validate?symbol= — validates ticker against yfinance,
  returns {valid, name, price} or {valid: false, reason: 'helpful message'}
- Added SLV, USO, WEAT, CORN, TUR to ETFs WATCHLIST category

Frontend:
- validateTicker() async helper exported from useApi.ts
- InstrumentPicker (PatternLab): custom ticker field now validates before selecting
  Shows spinner while checking, red error message if not found on yfinance
- InstrumentLens (PatternExplorer): same validation on Go button + Enter key

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-22 20:15:26 +02:00
parent a92094e1f3
commit 6cca7f66b6
5 changed files with 131 additions and 36 deletions

View File

@@ -16,6 +16,10 @@ export const useAllQuotes = () =>
refetchInterval: 60_000,
})
export type TickerValidation = { valid: boolean; symbol: string; name?: string; price?: number; change_pct?: number; reason?: string }
export const validateTicker = (symbol: string): Promise<TickerValidation> =>
api.get('/market/validate', { params: { symbol } }).then(r => r.data)
export const useHistory = (symbol: string, period = '1y', interval = '1d') =>
useQuery<HistoricalCandle[]>({
queryKey: ['history', symbol, period, interval],