Files
signal-platform/app/schemas/watchlist.py
T
dennisthiessen 30effa89b7
Deploy / lint (push) Successful in 6s
Deploy / test (push) Failing after 12s
Deploy / deploy (push) Has been skipped
feat: ticker search, watchlist momentum column, alpha vs S&P 500
Three usability fixes:

1. Global ticker search in the sidebar (TickerSearch) — typeahead over the
   tracked universe that opens a ticker's detail page without adding it to the
   watchlist. Also wired into the mobile nav.

2. Watchlist table shows the ticker's 12-1 momentum percentile (the top-pick
   selector) instead of the noisy full S/R-level list. Enriched from the setup
   already loaded in watchlist_service._enrich_entry — no extra query.

3. Alpha vs the S&P 500 on paper trades (open + closed). New benchmark_prices
   table + benchmark_service store SPY daily closes (a standalone series, not a
   Ticker, so it never enters the scanner / momentum ranking / rankings) via a
   new daily-pipeline step. paper_trade_service computes per-trade
   benchmark_return / alpha_pct / alpha_usd over each holding period; the open-
   trades table, dashboard, and closed-trades panel surface per-trade and total
   alpha. The list read path never makes a provider call.

Deploy: alembic upgrade head, then run the benchmark/daily job once to populate
SPY closes (alpha shows "—" until then).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 08:44:40 +02:00

41 lines
1.0 KiB
Python

"""Pydantic schemas for watchlist endpoints."""
from __future__ import annotations
from datetime import date, datetime
from typing import Literal
from pydantic import BaseModel, Field
class SRLevelSummary(BaseModel):
"""Compact SR level for watchlist entry."""
price_level: float
type: Literal["support", "resistance"]
strength: int = Field(ge=0, le=100)
class DimensionScoreSummary(BaseModel):
"""Compact dimension score for watchlist entry."""
dimension: str
score: float
class WatchlistEntryResponse(BaseModel):
"""A single watchlist entry with enriched data."""
symbol: str
entry_type: Literal["auto", "manual"]
composite_score: float | None = None
dimensions: list[DimensionScoreSummary] = []
rr_ratio: float | None = None
rr_direction: str | None = None
momentum_percentile: float | None = None
sr_levels: list[SRLevelSummary] = []
last_close: float | None = None
change_pct: float | None = None
price_date: date | None = None
added_at: datetime