Three follow-ups to the gate probability floor (8f41143):
- Signals table shows the starred primary target (shared primaryTarget
helper) instead of an independently computed max-probability best,
so Overview, Signals and ticker details agree by construction.
- Targets pinned at the 3% probability clamp floor collapse to the
nearest one (enhance_trade_setup + backtest candidates in parity):
floor-pinned levels are indistinguishable to the model, so farther
ones were duplicate 3% rows inviting lottery headlines.
- get_trade_setups only returns setups re-emitted within
LIVE_SETUP_MAX_AGE_DAYS (3): an older latest row means the daily
scan no longer confirms the setup, and such rows otherwise surface
forever on Overview/Signals/ticker/alerts. History endpoints keep
full history.
Backtest on the Jul-3 snapshot is metric-identical to the gate-floor
run on all qualified stats (1089 qualified, Sharpe 2.02, CAGR +49.6%,
DD -15.8%): the prune only removes noise the gate already rejected.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A qualified setup's primary target must now clear MIN_TARGET_PROBABILITY
(20%), shared with the primary-selection floor in recommendation_service
and mirrored in the frontend gate. Closes the read-time hole where a
stale pre-c7a198b row starring a far lottery target (probability pinned
at the 3% clamp floor, R:R inflated by the same distance) qualified
forever: the scanner emits no replacement row and live R:R never decays.
A/B backtest vs c7a198b baseline (same July-3 snapshot): 7 of 1096
qualified setups removed; qualified net avg R 0.202 -> 0.207, hold
Sharpe 2.00 -> 2.02, CAGR +48.8% -> +49.6%, max DD unchanged at -15.8%.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The portfolio-monitor filters were native <select> elements with a
hardcoded bg-slate-950 - a look from before the design system. They
now use the shared Dropdown (same as the Setups filters), which also
gives them the dark themed menu and the portal fix from 6464fdd.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Signals > Setups filter dropdowns (Direction, Recommended Action)
opened UNDER the panels below: glass containers use backdrop-filter,
which creates a stacking context, so the menu's z-50 could never
compete with later sibling panels regardless of value.
The menu now portals to document.body with fixed positioning tracked
against the trigger (re-measured on scroll/resize), and click-outside
accounts for the portaled node. Applies to every Dropdown usage.
Menu background also updated from the old green-tinted #151911 to the
Horizon #14161f.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- PerfChart moves into the left column under Open Positions
(half-width), balancing the radar column.
Cleanup:
- Design mockup pages (DesignMockups / DesignHorizon / DesignOrbit)
and their routes removed - the redesign has shipped; the mockups
live on in git history. Main bundle shrinks ~97 kB and the
chunk-size warning goes away.
- frontend/tsconfig.tsbuildinfo untracked and gitignored (incremental
build artifact that churned in every commit).
- Dead npm test / test:watch scripts removed - vitest was never a
dependency; CI already skips the step via its vitest guard.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The focus|radar 3/5-2/5 pairing made the top-pick card cramped and the
full-width positions panel stretched its trade charts. Back to the
layout that worked: focus card full width, account ribbons, then
positions | radar side by side, performance chart at the bottom.
Kept from the rework: radar rows still swap the focus card - and now
reliably, because the ticker symbol inside a row is no longer a
navigation link (clicking anywhere in the row, symbol included,
selects it; the ticker page is reachable via the focus card's Ticker
details button). Below-gate inspection, badges, and the reset link
unchanged.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Layout regrouped by relationship, not size: the setup-in-focus card
and the radar sit side by side (they are one decision surface), the
four account ribbons move directly above the open positions they
describe, and a new performance chart closes the page.
- Radar rows are selectable: clicking one swaps the focus card to that
setup - including below-gate rows, whose card shows a muted
"rank N / below gate" badge and the disqualify reason in the footer,
with a "back to top pick" reset. The row currently in focus is
highlighted; ticker links still deep-link without selecting.
- Performance chart (the mockup's missing piece): new
GET /paper-trades/equity-curve computes, per benchmark trading day
since the first paper trade, the book's cumulative P&L (realized +
mark-to-market from stored OHLCV) vs the same cost basis riding SPY
over each trade's window (benchmark_prices). Pure curve math in
paper_trade_service with unit tests; hidden until there are 2+
points of data. Frontend renders both lines with crosshair readout,
zero baseline, and direct end labels.
Backend unit suite: 501 passed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The market regime banner took a full-width row on the dashboard for
ambient context. It is now a subtle status in the top bar (colored dot
+ "neutral regime", full headline and the longs/shorts caution in the
tooltip) linking to /regime - matching the mockup's nav.
The watchlist strip moves from the bottom of the dashboard (where it
got lost) into the freed spot right under the hero: a slim chip row
with today's move per symbol and the full-watchlist link. The empty
state is a one-line hint instead of a callout box.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The dashboard fingerprints sorted score dimensions alphabetically
while the ticker page rendered them in API order, so the same ticker
drew a differently-shaped polygon on each page.
New shared helper radarAxesFromDimensions() pins the axis order to the
backend's DIMENSIONS list (technical, sr_quality, sentiment,
fundamental, momentum; unknown dimensions append alphabetically) and
centralizes the label truncation. Used by the dashboard fingerprint
strip, the ticker header radar, and ScoreCard.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A setup's primary target could carry a ~3% probability: the picker
chose the most likely target among those with R:R >= 1.5, and after a
run-up that pool can contain only far "lottery" levels (the near,
likely levels fail the R:R floor). The lottery target's inflated R:R
then became the setup's headline and passed the activation gate's
min_rr floor - the gate's probability check only requires a value to
exist.
Fix, no new tuning knobs: the primary must clear BOTH floors
(R:R >= 1.5 AND probability >= 20%). When nothing does, fall back to
the most likely target overall, so the headline carries an honest low
R:R and the gate rejects the setup on real numbers instead of being
gamed by an unreachable target.
Deliberately NOT pure EV-maximization (p*RR): the probability model
adds strength/alignment bonuses as flat percentage points, so EV
arithmetic would scale those bonuses by (RR+1) and systematically
favor far targets on aligned setups - the same lottery bias through
the back door.
Shared by production (enhance_trade_setup) and the backtest simulator,
so backtest comparisons stay apples-to-apples. Unit tests pin the
degenerate case; full unit suite green (497 passed).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The inline take form under the price rail pushed the card apart. It is
now a focused overlay dialog (portaled to body - the unified panel's
backdrop-filter/overflow would trap a fixed element):
- symbol + direction header, stop/target/suggested-size summary line
- shares (autofocused), entry, and target selector
- Confirm trade / Cancel; closes on success, Escape, or backdrop click
- the card and panel never move
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The ladder target choice is lifted to the ticker page (per
direction), so selecting a target updates the candlestick overlay's
target line and zone too, with the R:R for the tooltip taken from
the ladder row.
- Price rail: the scale now always spans the entire target ladder, so
stop / entry / now hold their positions and only the target marker
moves when a different target is selected. The furthest target sits
at the right edge.
- Setup card layout: position sizing (shares / value / max loss,
details in the tooltip) and the Mark-as-taken button move to the top
right of the card header row, next to the stats they belong with -
the dangling bottom row is gone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
selectable targets drive the rail
- Data freshness is now the very first row of the ticker panel, above
the symbol - data age is the first thing to check.
- Indicator cards: long price-level lists (pivot swing highs/lows,
volume-profile HVN/LVN) no longer clip or overwhelm. Numeric lists
are clustered into ranges (values within ~0.75% of price merge),
sorted nearest-to-price first, capped at 4 chips with a "+n more"
note; scalar values wrap instead of overflowing the card.
- Recommendation verdict: the action ("LONG (high confidence)") is set
in the display face in accent cyan with the risk level beside it;
the signal breakdown (technical/momentum/sentiment) drops to a small
muted subtitle line.
- Target ladder is open by default and selectable: clicking a row
previews that target on the price rail and updates the R:R and
probability chips, the low-probability warning, and the prefilled
target in Mark-as-taken (still overridable there). The scanner's
primary stays the default; a non-primary choice is chipped as
"custom target".
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
verdict de-dup, target picker on take
Five fixes from prod review:
1. Data freshness row moves from the panel foot to directly under the
header - data age is a first-look concern.
2. Radar fingerprint labels were clipped left ("Momentum") and right
(value digits): label padding widened to fit "momentum 100" on both
anchored sides.
3. Indicators tab: the one-at-a-time dropdown (which also clipped) is
gone; all indicators load in parallel as quiet outlined cards - EMA
cross with its colored signal, RSI/ADX with a one-line human read
(overbought / trending / ...), values formatted to 2 decimals
instead of 4, normalized score demoted to a corner note.
4. Recommendation verdict line de-duplicated: the backend reasoning
already starts with the action label, so it now replaces the
headline instead of repeating under it.
5. Mark-as-taken: the take form gains a target selector listing every
detected target with price / probability / classification (primary
preselected), and the card warns when the primary target sits below
15% probability. Why the scanner promotes such a target to primary
is a separate (backend) question.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RecommendationPanel redesigned to match the rest of the redesign:
- Setup cards use the spatial price rail (stop -> entry -> now ->
target with live R-multiples) instead of the label/value text grid.
- One quiet chip row per card (direction, preferred marker, confidence,
R:R, target probability) replaces scattered header text.
- Position sizing is a single mono line (shares / position / max loss)
instead of a boxed 3-column mini-table; Mark-as-taken flow kept, in
the standard cyan button style.
- Full target ladder moves behind a disclosure (the primary target is
already on the rail); warnings (counter-trend, stale/invalidated
drift, earnings window, conflict flags) all kept.
- Cards are quiet outlined blocks, no glass-in-glass; the module
renders frameless inside the unified ticker panel's Analysis tab,
under the chart.
Ticker panel tabs now: Analysis, Standing, Dimensions, Indicators,
S/R Levels, Sentiment, Fundamentals - Standing and Dimensions were the
last below-the-fold sections; the whole page is now the single panel.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The previous pass kept a stack of independent glass cards (header,
recommendation, chart section, tab pills, per-tab sections), which read
as clutter. Now the page is a single casting, like the mockup:
One glass panel containing:
- header (identity, price, chips | actions + score fingerprint)
- inline hairline tab row (Analysis / Indicators / S/R Levels /
Sentiment / Fundamentals) with the chart-overlay pills riding on the
right of the row during Analysis
- tab body: Analysis = the candlestick chart; other tabs render their
panel inside via .hz-frameless, which strips the nested card chrome
(no card-in-card)
- panel foot: data freshness row (frameless now) with per-source
refresh
Below the panel, only on Analysis: the recommendation module and a
two-column Standing | Dimensions grid. Nothing removed; the standalone
Tabs bar, the separate chart card, and the duplicated section stack are
gone.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Restructures TickerDetailPage to match the Horizon mockup's ticker
drill-down while keeping every existing feature:
- Glass header card: eyebrow + big symbol/company, price with change
and freshness, chips (composite score, next earnings, top-pick /
open-trade pills) on the left; watchlist + Fetch All actions and the
score fingerprint radar on the right (hover a corner for values).
- Data freshness bar (per-source age + refresh buttons) moves to the
foot of the chart card, like the mockup's panel footer.
- Tabs extended to five: Analysis, Indicators, S/R Levels, Sentiment,
Fundamentals - sentiment and fundamentals no longer stack below the
analysis content, they are one tab away.
- ScoreCard gains showRadar prop so the fingerprint is not duplicated
in the Dimensions section.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes from first prod review of the redesign:
- Top navigation bar (TopBar) replaces the sidebar, like the mockup:
wordmark + sections + ticker search + jobs/status/logout; content in
a centered max-width column. MobileNav unchanged.
- Radar panel: qualified setups lead again (the actionable list, as
the old Top Setups did); non-qualified sit behind an "N below the
gate" toggle with per-rule reasons, auto-open only when nothing
qualifies. Adds mini radar fingerprints for the top 3 qualified
(dimension scores from the rankings endpoint, fixed axis order).
- Dashboard layout: open positions and radar side by side (xl), as in
the mockup.
- ScoreCard: the radar fingerprint was inside the showComposite block,
which the ticker page disables - it never rendered. Now it shows
whenever >= 3 dimensions exist.
- TradeChart: fresh positions with < 2 bars since entry rendered no
chart; now pads with ~10 pre-entry context bars (gray) and marks the
entry point. First open position auto-expands so the chart is
visible without a click.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the citron/green glass theme with the Horizon direction
(mockup at /design-horizon): space-void background, starfield, dim
Mars horizon, rim-cyan accent, rose for negative. Palette validated
for CVD separation and contrast on the dark surface.
- tailwind.config: gray -> cool space neutrals, blue/emerald -> cyan
scale, red -> rose; display font Space Grotesk
- globals.css: Horizon tokens, atmosphere, denser glass, cyan
buttons/inputs, price-rail / R-bar / radar chart CSS
- Dashboard rebuilt: verdict hero, top-pick card with spatial price
rail, KPI tiles, open positions as diverging R-bars with expandable
detail + trade chart (OHLCV since entry, entry/stop/target levels),
radar list with per-setup disqualify reason, watchlist chips
- OpenTradesPanel: table replaced by R-bar rows; all fields kept in
the drill-down (shares, P&L, alpha, trailing stop, sell)
- qualification: disqualifyReason() mirrors qualifiesSetup rule order
- CandlestickChart: canvas colors moved to Horizon palette; S/R now
cyan/neutral so rose stays reserved for the stop level
- ScoreCard: radar score fingerprint with hover values
- Design mockup pages included (routed in App.tsx)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Record every tested-and-confirmed knob (ATR trail, regime overlay, lookback,
cutoff x book, sizing, FIP tie-breaker) so the sweep is not repeated on the
same snapshot, including the inverse-vol mis-attribution warning and the
universe-level fip_id lead. Prune the done items from the next-experiments
list.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The portfolio monitor's Production row now replays the live qualification
flag and the Admin exit policy (mode/ATR multiplier/hold days) instead of a
frozen research-variant gate, so Admin tuning is reflected in the next run.
Single-source the 80/20 strategy_rank weights in momentum_service and pin
every dual-defined constant with a parity test. Behavior-preserving today:
the production sim reproduces the README baseline exactly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
A local backtest (offline prod snapshot, 506 tickers) evaluated blue-sky
projected targets under the PRODUCTION exit (3x ATR trailing + 30d max hold,
paper_trade_service DEFAULT_EXIT_MODE="atr_trailing"). Blue-sky setups are
dilutive: the qualified book scored 328% return / Sharpe 1.84 / DD -21.0%
WITHOUT them vs 300% / 1.58 / -18.7% WITH them. They rank high on momentum by
construction, so they grab slots from S/R setups that catch bigger runs under
a trailing-stop exit (only ~2pp worse drawdown doesn't justify the lost return
and Sharpe).
Reverts the scanner/TargetGenerator measured-move projection, the stricter
projected activation gate, the frontend qualification mirror, the `projected`
type field, and the projected tests -- all backend files are now byte-identical
to the pre-blue-sky commit.
Keeps the played-out "No current setup" UX (RecommendationPanel): when price
has run past the target (played out) or through the stop (invalidated), the
panel shows a plain no-setup state instead of a stale actionable card. This is
frontend-only (reads last close + existing setup fields) and is what actually
fixes the reported stale-below-price bug -- no backend change or rescan needed.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes stale below-price setups showing as current recommendations. Three
distinct causes share the symptom (get_trade_setups returns the latest stored
setup per direction and never expires it):
- Genuine blue-sky (no overhead S/R): scanner + TargetGenerator now project a
measured-move target (entry +/- 3*ATR, ~2:1 R:R), flagged projected with a
low sr_strength probability haircut. Overhead check keys on level tag OR price
so it never projects through a straddling resistance cluster.
- Projected targets clear a stricter activation bar (long-only, momentum >= 90,
confidence >= min+10), independent of the general momentum gate. Mirrored in
frontend qualification.ts.
- Played-out UX (fixes the reported TTWO case, which is R:R-starved under a
resistance cluster, not blue-sky): when price is at/past target or through the
stop, RecommendationPanel shows a "No current setup" state and softens the
stale ticker-level header/reasoning, instead of a stale actionable card.
No migration: the projected flag rides in existing targets_json. 504 backend
unit tests pass; frontend typechecks.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-ups from review of the Track Record slim:
- BacktestPanel: drop the stale "tracking check" sentence from the "How this is
measured" explainer — that check moved to the maintenance disclosure last
commit, so it no longer describes anything in this block.
- MyTradesPanel: rename the two identically-labelled "Exit" columns to "Exit Px"
(exit price) and "Reason" (close_reason) so they're not confusable.
- README: add "Reading a local backtest report" under Local Backtest Snapshots —
a section->decision map for reports/backtest-*.json. The strategy-tuning tables
removed from the deployed page (sweep, gate_ablation, time_exit_sweep,
signal_eval, strategy_variants) now live only in the local report, so this
keeps "research lives local" from meaning the decision knowledge evaporates.
tsc -b && vite build pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The "tracking/drift" chip compared the live target/stop/expired outcome cohort
against the backtest's target/stop bucket (overall_qualified) — a like-for-like
pipeline check — but sat directly under the portfolio monitor, which shows the
promoted 3x-ATR-trailing book. That juxtaposition (plus "faithfully implementing
it" copy) made a plumbing/QA signal read as validation of the ATR-trail strategy
you actually trade. It validates neither the trailing-stop book nor real trades.
- Move the check out of the monitor block into the "Track-record maintenance"
disclosure, relabelled "Setup-outcome pipeline check" with copy that says it
checks the setup-grading pipeline (no look-ahead/config/data drift), NOT the
ATR-trail production book. The genuine live validation stays My Trades (real
paper trades, same ATR-trail exits) up top.
- Add a compact "Exit" column to My Trades showing close_reason
(Stop/Trail/Target/Time/Manual) — the field was already plumbed to the
frontend PaperTrade type, so this is frontend-only.
tsc -b && vite build pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Strategy research now runs locally against DB snapshots (see README), so the
deployed Track Record page no longer needs the strategy-tuning output. Keep only
what answers "did my trades work / is the strategy working / what do I trade":
- Reshape BacktestPanel into an "Is the strategy working?" block: portfolio
monitor (unchanged), a deliberate metric set (CAGR, Sharpe, Max DD, Total
Return vs SPY, per-year returns), plus the folded-in live-vs-backtest verdict
and the backtest recommendation.
- Fold the standalone portfolio-sim table's unique rows (per-year returns, avg
hold, best/worst, avg P&L) into the monitor; drop the duplicate table.
- Slim TrackRecordPanel to My Trades -> Is it working? -> maintenance disclosure
(Evaluate/Reset demoted).
- Cut the local-research tables: percentile sweep, gate ablation, time-exit
sweep, strategy variants, signal-edge rank-IC, research candidates,
by-action/by-confidence breakdowns, and the bucket comparison.
Frontend-only; the weekly server backtest still computes the cut tables (they
feed the local report). tsc -b && vite build pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Both _atr_trailing_close (scheduled) and _atr_trailing_level (dashboard
read path) recomputed ATR from scratch on every post-entry bar via
compute_atr(rows[:idx+1]) — O(n*k) per trade. Replace with a single O(n)
Wilder pass, _atr_series_from_rows, that stores round(running, 4) at each
index. compute_atr keeps its running ATR unrounded through the recurrence
and rounds only at return, so this reproduces its per-prefix value exactly
(no behavior change; live-vs-backtest atr_trail3 parity still byte-identical).
Remove the now-unused _atr_from_rows and its compute_atr import. Add a
per-index parity test against compute_atr; existing ATR tests now mock
_atr_series_from_rows (same effect as the old fixed-ATR mock).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The deploy's `alembic upgrade head` failed at 016->017 with
StringDataRightTruncationError: the revision id
"017_add_trade_setup_strategy_rank" is 33 chars, but Postgres's
alembic_version.version_num is VARCHAR(32). Offline/SQLite checks don't
enforce the length, so this only surfaced against prod Postgres.
Rename the revision ids to the repo's short numeric convention (017, 018);
descriptive filenames are kept. down_revision links updated to match.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Fixes ruff E741 in the lookbacks comprehension of _portfolio_monitor,
which failed the CI lint step and blocked the deploy.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Migration 017 set down_revision to "016_add_signal_context_snapshots",
but migration 016's revision id is "016", so `alembic upgrade head` could
not resolve the chain and the deploy's auto-alembic step would fail. Point
017 at the real id "016".
Add migration 018 to delete any persisted `paper_exit_mode` row. The July
2026 promotion changed the paper-trade exit default to `atr_trailing`, but
`get_exit_policy` reads a stored value before the code default, so an
environment that had ever saved the old `time` mode would silently keep it
and never run the promoted 3x ATR trailing exit. Mirrors migration 015's
one-way settings reset.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Stored TradeSetup rows are point-in-time snapshots from the RR scan, so
the ticker page could show stale confidence/reasoning/composite (e.g.
sentiment=neutral in the setup card while the sentiment panel showed
bullish). Overlay current score/sentiment context onto the API payload
for GET /trades and GET /trades/{symbol}, gate and format Telegram
qualified-setup alerts on the same live values, and apply the
min_confidence/recommended_action filters after the overlay so they
judge what the caller actually sees. Stored setups stay frozen for
outcome analysis and backtests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Backtest report now includes research-only hold-to-horizon portfolio variants comparing raw vs residual 12-1 momentum, cutoff 80 vs 90, max 10 vs 15 positions, and SPY-200 risk scaling. A dynamic research recommendation panel flags residual momentum, cutoff 90, or regime scaling only when transparent promotion rules pass.
Adds signal_context_snapshots with migration 016 and captures one point-in-time context row per newly generated TradeSetup: setup fields, composite/dimensions, latest sentiment, latest fundamentals, and strategy_version=momentum_12_1_rr_time_v1. This is forward-only; no historical sentiment/fundamental backfill is attempted.
No live gate, paper-trade exit, or production ranking behavior changes.
Verification: 458 backend tests pass, ruff check app/ clean, frontend npm run build clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>