diff --git a/dashboard/backend/api/routers/backtests.py b/dashboard/backend/api/routers/backtests.py index a98b0a4e..86633644 100644 --- a/dashboard/backend/api/routers/backtests.py +++ b/dashboard/backend/api/routers/backtests.py @@ -3798,8 +3798,8 @@ class BacktestRunRequest(BaseModel): # params or a JSON body, so validation runs on the merged effective values in the # handler rather than only on the Pydantic body. MAX_STRATEGY_PROMPT_CHARS = 4000 -# Two weeks, matching the fortnight the Live Trading Leaderboard's seasons use -# so the product has one window vocabulary. It was 31, set when the fixed +# Two weeks, chosen to match the two-week seasons the Live Leaderboard had +# then (seasons are calendar months now). It was 31, set when the fixed # parent budget was the only bound: a 31-day window is ~22 weekdays x ~7 hourly # bars = ~154 decision bars, and a pipeline multiplies that by its step count, # so the UI permitted a window roughly 3x the modal default against a constant diff --git a/dashboard/backend/api/routers/leaderboard.py b/dashboard/backend/api/routers/leaderboard.py index 4a957ec1..6f551ba3 100644 --- a/dashboard/backend/api/routers/leaderboard.py +++ b/dashboard/backend/api/routers/leaderboard.py @@ -74,7 +74,7 @@ def api_get_leaderboard( Pass ?refresh=true to recompute (e.g. after config change); operators only, with X-Leaderboard-Refresh-Secret or an admin session, else 403. Pass ?period=daily for the rolling one-day board (weekends show Friday). - Pass ?period=live for the current calendar-month Live Trading Leaderboard + Pass ?period=live for the current calendar-month Live Leaderboard (freeze-window snapshots under leaderboard-live; GET never deploys models). """ # Public, unauthenticated endpoint: no exception text reaches the caller. @@ -181,7 +181,7 @@ def api_refresh_live_leaderboard( force: bool = Query(default=False, description="Replay the whole month from the 1st."), x_leaderboard_refresh_secret: str | None = Header(default=None, alias="X-Leaderboard-Refresh-Secret"), ): - """Cron hook: enqueue a Live Trading Leaderboard increment (non-blocking). + """Cron hook: enqueue a Live Leaderboard increment (non-blocking). Uses the same ``LEADERBOARD_DAILY_REFRESH_SECRET`` as the daily board. Returns **202 Accepted**; model steps run in a background thread. Public GET diff --git a/dashboard/backend/domain/leaderboard/live.py b/dashboard/backend/domain/leaderboard/live.py index e920518c..8aa18e21 100644 --- a/dashboard/backend/domain/leaderboard/live.py +++ b/dashboard/backend/domain/leaderboard/live.py @@ -1,4 +1,4 @@ -"""Calendar-month Live Trading Leaderboard. +"""Calendar-month Live Leaderboard. This board is not Daily stretched to 30 days and not the fixed contest window. One continuous paper-trading month per entry: the chart axis is the current @@ -347,8 +347,8 @@ def live_freeze_config( "end_date": freeze_end, "reference_start_date": reference_start_date(month_start, None), "period": "live", - "board_title": "Live Trading Leaderboard", - "phase_label": "Season 0", + "board_title": lb_service.LIVE_BOARD_TITLE, + "phase_label": lb_service.LIVE_PHASE_LABEL, "standings_label": "Performance", } @@ -1939,8 +1939,8 @@ def get_live_leaderboard( return { "period": "live", - "board_title": "Live Trading Leaderboard", - "phase_label": "Season 0", + "board_title": lb_service.LIVE_BOARD_TITLE, + "phase_label": lb_service.LIVE_PHASE_LABEL, "standings_label": "Performance", "window": { "start_date": start_date, diff --git a/dashboard/backend/domain/leaderboard/service.py b/dashboard/backend/domain/leaderboard/service.py index 284f0777..9ab856e3 100644 --- a/dashboard/backend/domain/leaderboard/service.py +++ b/dashboard/backend/domain/leaderboard/service.py @@ -604,6 +604,17 @@ def verify_daily_refresh_secret(provided: Optional[str]) -> None: # explicitly the one whose results nobody should read as a standing. Mirrors # PREVIEW_SEASON_NUMBER in dashboard/frontend/js/leaderboard.js. PREVIEW_SEASON_NUMBER = 0 +# The Live board's name and season label have exactly one owner: this pair. +# resolve_leaderboard_config("live"), live.live_freeze_config and the payload +# live.get_live_leaderboard serves all read them, and the static fallbacks in +# app.html / js/live-leaderboard.js are pinned to them by +# tests/test_frontend_live_leaderboard.py. "Trading" is dropped from the name +# because it read as real orders and collided with the Robinhood live-trading +# docs (docs/superpowers/specs/2026-10-14-atl-direction.md §6). The label is +# built from PREVIEW_SEASON_NUMBER so the number keeps one owner, and says +# "preview" until a season counts (Season 1 waits for the new engine). +LIVE_BOARD_TITLE = "Live Leaderboard" +LIVE_PHASE_LABEL = f"Season {PREVIEW_SEASON_NUMBER} · preview" DEFAULT_SEASON_TRADING_DAYS = 10 # One calendar year of weekday sessions. An upper bound rather than a sanity # check: `season_window` walks the calendar one day at a time and runs inside a @@ -748,7 +759,7 @@ def build_season_payload( config: Dict[str, Any], as_of: Optional[Union[date, datetime]] = None, ) -> Dict[str, Any]: - """The season block the Live Trading tab renders. + """The season block the Live tab renders. NOTHING HERE MAY CLAIM AN ADVANCE. ``last_advanced_date`` stays None and ``trading_days_elapsed`` stays 0 because no season has advanced -- there is @@ -841,11 +852,11 @@ def resolve_leaderboard_config(period: Optional[str] = "contest") -> Dict[str, A "ranking on this board counts. There is no advance engine yet." ), "period": "live", - "board_title": "Live Trading Leaderboard", + "board_title": LIVE_BOARD_TITLE, # Derived, never spelled out: a literal "Season 0" here is a second # owner of the season number, and the first thing the advance engine - # does is bump PREVIEW_SEASON_NUMBER. - "phase_label": f"Season {PREVIEW_SEASON_NUMBER}", + # does is bump PREVIEW_SEASON_NUMBER, which LIVE_PHASE_LABEL is built from. + "phase_label": LIVE_PHASE_LABEL, "standings_label": "Ranking", } return { diff --git a/dashboard/backend/infrastructure/market_data/us_market_calendar.py b/dashboard/backend/infrastructure/market_data/us_market_calendar.py index 6ec4b788..188026d6 100644 --- a/dashboard/backend/infrastructure/market_data/us_market_calendar.py +++ b/dashboard/backend/infrastructure/market_data/us_market_calendar.py @@ -1,7 +1,7 @@ """NYSE full-day holidays and early closes, computed by rule (no data file, no dependency). -Shared US market-data infrastructure: the Live Trading Leaderboard walks it +Shared US market-data infrastructure: the Live Leaderboard walks it forward day by day, and the Run Backtest modal's default period (``provider.default_backtest_window``) walks it back week by week. It lived under ``domain/leaderboard/`` while the board was its only reader; a calendar diff --git a/dashboard/backend/tests/domain/backtesting/test_stop_prices_not_enforced.py b/dashboard/backend/tests/domain/backtesting/test_stop_prices_not_enforced.py new file mode 100644 index 00000000..1ec837db --- /dev/null +++ b/dashboard/backend/tests/domain/backtesting/test_stop_prices_not_enforced.py @@ -0,0 +1,151 @@ +"""The legacy engine does not execute stop-loss or take-profit prices (D12). + +The safe-trading prompt's JSON shape carries ``stop_loss_price`` and +``take_profit_price`` (infrastructure/llm/validator.py), so a model can write +them, but the single-prompt decision loop that both boards' LLM entries run +(``PortfolioManager.make_trading_decision_with_llm``, reached from +``LLMAgentStrategy``) copies only symbol, action, size, confidence and reasoning +out of each reply. Both boards say so in their Rules and About cards +(dashboard/frontend/app.html). These tests are the other half of that copy: the +day this path starts reading the fields, they fail, and the copy changes in the +same PR. The new core executes stops for real (direction spec 2026-10-14 §4); +when it lands, invert these tests and delete the four disclaimers together. +""" + +import json +from datetime import datetime +from pathlib import Path + +from dashboard.backend.domain.backtesting import portfolio_manager as pm +from dashboard.backend.domain.backtesting.portfolio_manager import PortfolioManager + +_BACKEND = Path(__file__).resolve().parents[3] +_STOP_FIELDS = {"stop_loss_price": 240.0, "take_profit_price": 300.0} + + +class _Resp: + def __init__(self, text): + self._text = text + self.usage = None + self.content = [] + + +def _script(monkeypatch, replies): + """Answer each decision request with the next reply, in order.""" + queue = [json.dumps(reply) for reply in replies] + + def fake_request(client, **_kwargs): + return _Resp(queue.pop(0)) + + monkeypatch.setattr(pm, "_request_trading_decision", fake_request) + monkeypatch.setattr(pm, "_extract_response_text", lambda response: response._text) + monkeypatch.setattr(pm, "_extract_token_usage", lambda response: (100, 50)) + return queue + + +def _state(manager, price, timestamp): + held = manager.positions.get("AAPL", 0) + positions = [] + if held: + entry = manager.entry_prices.get("AAPL", price) + positions.append({ + "symbol": "AAPL", + "shares": held, + "entry_price": entry, + "current_price": price, + "position_value": held * price, + "pnl_pct": (price / entry - 1.0) * 100.0, + }) + return { + "timestamp": timestamp, + "cash": manager.cash, + "positions": positions, + "positions_value": held * price, + "total_equity": manager.cash + held * price, + "market_signals": { + "AAPL": {"price": price, "rsi": 50.0, "macd": 0.0, + "macd_signal": 0.0, "sma_20": price, "sma_50": price, + "bb_upper": price * 1.04, "bb_lower": price * 0.96, + "volume": 1000}, + }, + } + + +def _reply(action, **fields): + return {"actions": [{ + "symbol": "AAPL", + "action": action, + "confidence": 0.8, + "reasoning": "scripted", + **_STOP_FIELDS, + **fields, + }]} + + +def _decide(manager, price, timestamp): + return manager.make_trading_decision_with_llm( + _state(manager, price, timestamp), llm_client=object(), model="m" + ) + + +def test_stop_and_take_profit_fields_never_reach_the_executed_action(monkeypatch): + _script(monkeypatch, [_reply("buy", position_size=2)]) + manager = PortfolioManager(initial_capital=1000.0, allowed_symbols=["AAPL"]) + + decision = _decide(manager, 250.0, datetime(2026, 4, 1, 14, 30)) + + assert manager.llm_decisions == 1, "the model drove this step" + assert len(decision["actions"]) == 1 + action = decision["actions"][0] + assert set(action) == {"symbol", "action", "shares", "reason", "confidence"} + assert (action["symbol"], action["action"], action["shares"]) == ("AAPL", "buy", 2) + + +def test_a_held_position_is_not_sold_when_the_price_crosses_its_stop_or_target(monkeypatch): + remaining = _script(monkeypatch, [ + _reply("buy", position_size=2), + _reply("hold"), + _reply("hold"), + ]) + manager = PortfolioManager(initial_capital=1000.0, allowed_symbols=["AAPL"]) + opened = datetime(2026, 4, 1, 14, 30) + entry = _decide(manager, 250.0, opened) + manager.execute_actions(entry["actions"], {"AAPL": {"close": 250.0}}, opened) + # Each bar is decide, execute, then value the book, as llm_agent.py runs it. + manager.update_equity({"AAPL": {"close": 250.0}}, None, opened) + assert manager.positions == {"AAPL": 2} + + # 200 is below the 240 stop; 320 is above the 300 target. Neither sells, + # and valuing the book at either price does not close the position either. + for hour, price in ((15, 200.0), (16, 320.0)): + timestamp = datetime(2026, 4, 1, hour, 30) + decision = _decide(manager, price, timestamp) + manager.execute_actions(decision["actions"], {"AAPL": {"close": price}}, timestamp) + manager.update_equity({"AAPL": {"close": price}}, None, timestamp) + assert decision["actions"] == [] + assert manager.positions == {"AAPL": 2} + + assert [row["positions_value"] for row in manager.get_equity_curve()] == [500.0, 400.0, 640.0] + assert remaining == [] + assert [trade["side"] for trade in manager.trades] == ["BUY"] + assert manager.llm_decisions == 3 + + +def test_the_legacy_order_path_has_no_stop_handling(): + """A source guard, because a stop could be wired in a branch the two cases + above never reach. Lifting it is a decision, not a refactor: update the + "not executed" copy in app.html (Live and Competition Rules + About cards) + in the same PR.""" + for rel in ( + "domain/backtesting/portfolio_manager.py", + "domain/trading/execution.py", + # update_equity's valuation step, run after every bar's orders. + "domain/trading/portfolio.py", + "domain/leaderboard/strategies/llm_agent.py", + ): + text = (_BACKEND / rel).read_text(encoding="utf-8") + for field in ("stop_loss", "take_profit"): + assert field not in text, ( + f"{rel} now mentions {field}: if stops execute on the legacy " + "engine, the 'not executed' disclaimers in app.html are false" + ) diff --git a/dashboard/backend/tests/test_backtests_router.py b/dashboard/backend/tests/test_backtests_router.py index 1f5d35e8..33d49fc1 100644 --- a/dashboard/backend/tests/test_backtests_router.py +++ b/dashboard/backend/tests/test_backtests_router.py @@ -2363,8 +2363,9 @@ def test_backtest_window_cap_is_two_weeks(): counted LLM calls. A 31-day window is ~22 weekdays x ~7 hourly bars = ~154 decision bars, and a multi-step pipeline multiplies that by its step count -- far past what the fixed 3600s budget can finish. Two weeks matches the - fortnight the Live Trading Leaderboard's seasons already use, so the - product has one window vocabulary rather than two. + two-week seasons the Live Leaderboard had when this cap was set (seasons + are calendar months now), so the product had one window vocabulary rather + than two. """ assert bt.MAX_BACKTEST_DAYS == 14 diff --git a/dashboard/backend/tests/test_frontend_fast_boot.py b/dashboard/backend/tests/test_frontend_fast_boot.py index a306c3ea..25e04428 100644 --- a/dashboard/backend/tests/test_frontend_fast_boot.py +++ b/dashboard/backend/tests/test_frontend_fast_boot.py @@ -197,7 +197,7 @@ def test_cache_busters_bumped(): assert "app.js?v=164" in APP_HTML assert "js/agent-editor.js?v=33" in APP_HTML assert "styles.css?v=160" in APP_HTML - assert "js/leaderboard.js?v=39" in APP_HTML + assert "js/leaderboard.js?v=40" in APP_HTML assert "home-page.js?v=56" in APP_HTML assert "js/credit-format.js?v=1" in APP_HTML assert "js/credits.js?v=8" in APP_HTML diff --git a/dashboard/backend/tests/test_frontend_live_budget.py b/dashboard/backend/tests/test_frontend_live_budget.py index 6efe3596..6a79fe37 100644 --- a/dashboard/backend/tests/test_frontend_live_budget.py +++ b/dashboard/backend/tests/test_frontend_live_budget.py @@ -46,7 +46,8 @@ "Baselines keep updating." ) -# A board with prints, current, and models cached: the existing banner is hidden. +# A board with prints, current, and a printed model row (_banner_after adds +# it): the existing banner is hidden. _HEALTHY = { "has_prints": True, "snapshot_stale": False, @@ -67,8 +68,25 @@ def _attempt(outcome, kind=None, on="2026-08-27"): } +# The banner reads the rows, not live_status.models_cached (#586): with no +# printed model row it says model curves have not appeared yet. A healthy board +# therefore needs one printed, current model row for the banner to stay hidden. +_PRINTED_MODEL = { + "entry_id": "deepseek_v4_pro", + "model": "DeepSeek V4 Pro", + "is_model": True, + "status": "frozen", + "portfolio_value": 100500, + "snapshot_end": "2026-08-27", +} + + def _banner_after(status): - payload = {"window": {"label": "2026-08-01 — 2026-08-31"}, "entries": [], "live_status": status} + payload = { + "window": {"label": "2026-08-01 — 2026-08-31"}, + "entries": [_PRINTED_MODEL], + "live_status": status, + } return _run_live_js( f"updateLiveHeader({json.dumps(payload)});" "const b = document.getElementById('livePhaseBanner');" diff --git a/dashboard/backend/tests/test_frontend_live_leaderboard.py b/dashboard/backend/tests/test_frontend_live_leaderboard.py index 1ddf69bf..c99054f8 100644 --- a/dashboard/backend/tests/test_frontend_live_leaderboard.py +++ b/dashboard/backend/tests/test_frontend_live_leaderboard.py @@ -1,4 +1,4 @@ -"""Source guards for the Live Trading Leaderboard tab. +"""Source guards for the Live Leaderboard tab. /app has no JS test toolchain, so these assert against shipped HTML/JS as text. """ @@ -27,7 +27,7 @@ def _strip_js_comments(source: str) -> str: def test_live_subtab_is_visible_and_daily_stays_parked(): assert re.search( - r'data-competition-tab="live"[^>]*>\s*Live Trading Leaderboard', + r'data-competition-tab="live"[^>]*>\s*Live Leaderboard<', _APP_HTML, ) assert 'data-competition-tab="live"' in _APP_HTML @@ -401,3 +401,473 @@ def test_live_sharpe_is_the_competition_formatter_not_a_copy(): f"liveSortValue({json.dumps(_SHARPE_OK)}, 'sharpe')]));", ])) assert alone == [{"main": "—", "sub": "", "title": ""}, None] + + +# ── Naming and header copy (direction spec §6) ────────────────────────────── + + +def _live_view_markup() -> str: + """The #liveLeaderboardView markup, up to the Competition view.""" + return _APP_HTML.split('id="liveLeaderboardView"')[1].split('id="leaderboardView"')[0] + + +def _static_text(html: str, element_id: str) -> str: + """The text inside the element carrying `id=""` (no child tags).""" + match = re.search(rf'id="{element_id}"[^>]*>([^<]*)<', html) + assert match, f"#{element_id} is missing from app.html" + return match.group(1) + + +def test_the_board_is_named_live_leaderboard_on_every_surface(): + """'Trading' read as real orders and collided with the Robinhood + live-trading docs. The static title, the JS fallback and the payload all + resolve to service.LIVE_BOARD_TITLE.""" + from dashboard.backend.domain.leaderboard import service + + assert _static_text(_APP_HTML, "liveBoardTitle") == service.LIVE_BOARD_TITLE + assert f"payload.board_title || '{service.LIVE_BOARD_TITLE}'" in _LIVE_JS + visible = _strip_js_comments(re.sub(r"", "", _APP_HTML, flags=re.DOTALL)) + assert "Live Trading Leaderboard" not in visible + assert "Live Trading Leaderboard" not in _strip_js_comments(_LIVE_JS) + + +def test_the_subtitle_is_static_simulated_forward_only_copy(): + assert ( + _static_text(_APP_HTML, "liveBoardSubtitle") + == "Simulated fills · forward-only · no real money" + ) + source = _strip_js_comments(_LIVE_JS) + assert "liveBoardSubtitle" not in source, ( + "the subtitle is static copy in app.html; rewriting it from JS put " + "'paper trading' back on screen" + ) + assert "paper trading" not in source.lower() + + +def test_the_updated_stat_states_the_cadence_not_the_request_clock(): + """payload.updated_at is the wall clock of the GET, so rendering it always + read 'just now' on a board that last advanced days ago.""" + assert re.search( + r'Updated\s*' + r'Nightly after the close', + _live_view_markup(), + ) + source = _strip_js_comments(_LIVE_JS) + assert "liveUpdatedLabel" not in source + assert "updated_at" not in source + + +def test_the_season_stat_reads_season_0_preview_from_one_owner(): + from dashboard.backend.domain.leaderboard import service + + assert service.LIVE_PHASE_LABEL == "Season 0 · preview" + assert _static_text(_APP_HTML, "livePhaseLabel") == service.LIVE_PHASE_LABEL + assert f"payload.phase_label || '{service.LIVE_PHASE_LABEL}'" in _LIVE_JS + + +def test_neither_board_renders_a_stop_or_take_profit_price(): + """Both boards disclaim stops as not executed. A future trade-log or + reasoning view is the first place a model's stop_loss_price could appear + next to its decisions; it must label the value 'not executed' before this + guard is lifted, or the page contradicts its own Rules card.""" + leaderboard_js = (_FRONTEND / "js" / "leaderboard.js").read_text(encoding="utf-8") + for name, source in ( + ("js/live-leaderboard.js", _LIVE_JS), + ("js/leaderboard.js", leaderboard_js), + ): + stripped = _strip_js_comments(source) + assert "stop_loss" not in stripped, name + assert "take_profit" not in stripped, name + + +# ── #586: catching-up rows are printed, flagged, and not reported missing ─── +# +# These evaluate the whole of js/live-leaderboard.js under node against a fake +# DOM instead of lifting single functions, so a helper another change adds to +# the render path is exercised too rather than raising a ReferenceError here. + +_LIVE_FAKE_DOM = """ +const els = {}; +function el(id) { + if (!els[id]) { + els[id] = { + id, textContent: '', innerHTML: '', hidden: false, dataset: {}, style: {}, + classList: { toggle() {}, add() {}, remove() {}, contains() { return false; } }, + setAttribute() {}, querySelector() { return null; }, + }; + } + return els[id]; +} +globalThis.window = globalThis; +globalThis.document = { + getElementById: el, + querySelector: () => null, + querySelectorAll: () => [], + addEventListener() {}, +}; +globalThis.API_BASE = ''; +""" + + +def _render_catching_up_board(payload, select_id): + """Render `payload` the way loadLiveLeaderboardData does; return the banner, + the table body and the detail panel for the row `select_id`.""" + script = ( + _LIVE_FAKE_DOM + + fn_body("function escapeHtml(", _APP_JS) + + "\n" + + _LIVE_JS + + f"\nconst payload = {json.dumps(payload)};\n" + + "livePayload = payload;\n" + + "updateLiveHeader(payload);\n" + + "populateLiveTable();\n" + + f"renderLiveDetail(payload.entries.find((e) => e.entry_id === {json.dumps(select_id)}));\n" + + "process.stdout.write(JSON.stringify({\n" + + " banner: els.livePhaseBanner.textContent,\n" + + " bannerHidden: els.livePhaseBanner.hidden,\n" + + " table: els.liveLeaderboardTableBody.innerHTML,\n" + + " detail: els.liveSelectedDetail.innerHTML,\n" + + "}));\n" + ) + return run_node(script) + + +def _catching_up_entry(entry_id, name, status, *, value, snapshot_end, is_model=True): + """One board row in the shape live._entry_from_strategy serves.""" + printed = value is not None + return { + "entry_id": entry_id, + "model": name, + "team_name": name, + "team_badge": "Model" if is_model else "Index", + "is_model": is_model, + "status": status, + "rank": None, + "portfolio_value": value, + "cumulative_return": 0.05 if printed else None, + "sharpe_ratio": None, + "max_drawdown": None, + "num_trades": 3 if printed else None, + "snapshot_end": snapshot_end, + "equity_curve": ( + [{"timestamp": "2026-08-03T10:00:00-04:00", "equity": 100000}] if printed else [] + ), + } + + +def _catching_up_payload(*entries): + return { + "period": "live", + "board_title": "Live Leaderboard", + "phase_label": "Season 0 · preview", + "window": {"label": "2026-08-01 — 2026-08-31"}, + "entries": list(entries), + "live_status": { + "has_prints": True, + "snapshot_stale": False, + "frozen_through": "2026-08-27", + "snapshot_end": "2026-08-27", + "session_state": "closed", + # The server counts only ranked (frozen) rows here, so a model + # mid-replay reads 0. Held at 0 in every case: the banner must not + # depend on it. + "models_cached": 0, + "catching_up": [e["entry_id"] for e in entries if e["status"] == "catching_up"], + "trading_days_elapsed": 19, + "trading_days_total": 21, + }, + } + + +_SPY_ROW = _catching_up_entry( + "spy_index", "SPY", "frozen", value=101000.0, snapshot_end="2026-08-27", is_model=False +) + + +def _deepseek(status, *, value=105000.0, snapshot_end="2026-08-20"): + return _catching_up_entry( + "deepseek_v4_pro", "DeepSeek V4 Pro", status, value=value, snapshot_end=snapshot_end + ) + + +@_needs_node +def test_a_catching_up_model_is_printed_and_flagged_with_its_own_date(): + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("catching_up")), "deepseek_v4_pro" + ) + row = out["table"].split('data-live-entry="deepseek_v4_pro"')[1].split("")[0] + assert ( + 'Catching up' + ) in row + assert "5.00%" in row, "a catching-up row prints its figures" + assert ( + 'Status' + 'Catching up · through 2026-08-20' + ) in out["detail"] + assert "$105,000.00" in out["detail"] + assert "Awaiting freeze" not in out["detail"] + + +@_needs_node +def test_the_catching_up_date_is_escaped_in_the_badge_title_and_the_status_row(): + """A plain date escapes to itself, so the case above passes with either + escapeHtml call removed. A date carrying markup does not.""" + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("catching_up", snapshot_end='2026-08-20">')), + "deepseek_v4_pro", + ) + row = out["table"].split('data-live-entry="deepseek_v4_pro"')[1].split("")[0] + escaped = "Catching up · through 2026-08-20"><b>" + assert f'Catching up' in row + assert ( + 'Status' + f'{escaped}' + ) in out["detail"] + assert "" not in row + assert "" not in out["detail"] + + +@_needs_node +def test_the_banner_names_the_catching_up_model_instead_of_calling_it_missing(): + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("catching_up")), "deepseek_v4_pro" + ) + assert out["bannerHidden"] is False + assert "Model curves appear" not in out["banner"] + assert out["banner"] == ( + "DeepSeek V4 Pro is catching up (through 2026-08-20): it is shown but " + "not ranked until it reaches the latest session." + ) + + +@_needs_node +def test_the_banner_lists_every_catching_up_entry(): + qwen = _catching_up_entry( + "qwen3_7_plus", "Qwen3.7 Plus", "catching_up", value=99000.0, snapshot_end="2026-08-22" + ) + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("catching_up"), qwen), "qwen3_7_plus" + ) + assert out["banner"] == ( + "2 entries are catching up (DeepSeek V4 Pro through 2026-08-20, " + "Qwen3.7 Plus through 2026-08-22): they are shown but not ranked " + "until they reach the latest session." + ) + + +@_needs_node +def test_a_model_with_no_curve_still_gets_the_models_pending_banner(): + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("pending", value=None, snapshot_end=None)), + "deepseek_v4_pro", + ) + assert out["banner"] == ( + "Baselines frozen through 2026-08-27. Model curves appear once the nightly " + "refresh deploys them; they are never computed on page load." + ) + assert "Catching up" not in out["table"] + assert "Awaiting freeze" in out["detail"] + assert "Status" not in out["detail"] + + +@_needs_node +def test_a_catching_up_row_with_no_value_reads_as_pending_not_catching_up(): + """A row the server marks catching_up but sends no value for cannot print: + it is pending, and a 'Catching up' badge beside 'Awaiting freeze' would say + both at once.""" + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("catching_up", value=None)), + "deepseek_v4_pro", + ) + assert "Catching up" not in out["table"] + assert "Status" not in out["detail"] + assert "Awaiting freeze" in out["detail"] + assert out["banner"].startswith("Baselines frozen through 2026-08-27.") + + +@_needs_node +def test_a_stale_snapshot_banner_outranks_the_catching_up_line_and_the_badge_stays(): + payload = _catching_up_payload(_SPY_ROW, _deepseek("catching_up")) + payload["live_status"]["snapshot_stale"] = True + payload["live_status"]["frozen_through"] = "2026-08-28" + out = _render_catching_up_board(payload, "deepseek_v4_pro") + assert out["banner"].startswith("Showing the snapshot through 2026-08-27.") + assert ">Catching up" in out["table"] + + +@_needs_node +def test_a_current_board_shows_no_banner_and_no_badge(): + out = _render_catching_up_board( + _catching_up_payload(_SPY_ROW, _deepseek("frozen", snapshot_end="2026-08-27")), + "deepseek_v4_pro", + ) + assert out["bannerHidden"] is True + assert out["banner"] == "" + assert "Catching up" not in out["table"] + assert "Catching up" not in out["detail"] + + +def _ok_sharpe(value): + """The Sharpe fields boardSharpeValue accepts: status 'ok' plus a finite interval.""" + return { + "sharpe_status": "ok", + "sharpe_ratio": value, + "sharpe_ci_low": value - 1, + "sharpe_ci_high": value + 1, + "sharpe_days": 5, + } + + +@_needs_node +def test_catching_up_rows_sort_after_current_rows_and_before_pending_ones(): + """A catching-up row is shown but not ranked, and its figures are from an + earlier session than the rows beside it. Sorting a column must not slot it + in among the current rows, in either direction: DeepSeek's Sharpe would + sort first descending and Qwen's first ascending.""" + rows = [ + _catching_up_entry( + "claude_haiku_4_5", "Claude Haiku 4.5", "pending", value=None, snapshot_end=None + ), + {**_deepseek("catching_up"), **_ok_sharpe(9.0)}, + {**_SPY_ROW, **_ok_sharpe(1.0)}, + { + **_catching_up_entry( + "qwen3_7_plus", "Qwen3.7 Plus", "catching_up", + value=99000.0, snapshot_end="2026-08-22", + ), + **_ok_sharpe(-5.0), + }, + { + **_catching_up_entry( + "equal_weight_djia", "Equal Weight DJIA", "frozen", + value=100800.0, snapshot_end="2026-08-27", is_model=False, + ), + **_ok_sharpe(0.5), + }, + ] + script = ( + _LIVE_FAKE_DOM + + "\n" + + _board_sharpe_js() + + "\n" + + _LIVE_JS + + f"\nlivePayload = {{ entries: {json.dumps(rows)} }};\n" + + "liveSortKey = 'sharpe';\n" + + "liveSortDir = 'desc'; const desc = liveSortedEntries().map((e) => e.entry_id);\n" + + "liveSortDir = 'asc'; const asc = liveSortedEntries().map((e) => e.entry_id);\n" + + "process.stdout.write(JSON.stringify({ desc, asc }));\n" + ) + assert run_node(script) == { + "desc": [ + "spy_index", "equal_weight_djia", + "deepseek_v4_pro", "qwen3_7_plus", + "claude_haiku_4_5", + ], + "asc": [ + "equal_weight_djia", "spy_index", + "qwen3_7_plus", "deepseek_v4_pro", + "claude_haiku_4_5", + ], + } + + +def test_the_banner_no_longer_reads_models_cached(): + assert "models_cached" not in _strip_js_comments(_LIVE_JS) + + +def _num_cells(table, entry_id): + """The figure cells of one table row, in column order: Return, Sharpe, + Max DD, Trades, Avg hold, Win rate, vs SPY, Invested.""" + row = table.split(f'data-live-entry="{entry_id}"')[1].split("")[0] + return re.findall(r']*>(.*?)', row, flags=re.DOTALL) + + +def _with_return(entry, cumulative_return): + return {**entry, "cumulative_return": cumulative_return} + + +@_needs_node +def test_vs_spy_is_a_dash_wherever_the_two_returns_end_on_different_sessions(): + """The column is "Return minus SPY over the same frozen sessions". A + catching-up row's return ends sessions before SPY's, and a catching-up SPY's + ends before every current row's, so either subtraction mixes two windows: a + +5% row through 08-20 against SPY +1% through 08-27 printed +4.00%. Those + cells show the no-figure dash and sort as no figure; a current row against a + current SPY keeps its number.""" + qwen = _catching_up_entry( + "qwen3_7_plus", "Qwen3.7 Plus", "frozen", value=103000.0, snapshot_end="2026-08-27" + ) + rows = (_with_return(_SPY_ROW, 0.01), _deepseek("catching_up"), _with_return(qwen, 0.03)) + out = _render_catching_up_board(_catching_up_payload(*rows), "deepseek_v4_pro") + behind = _num_cells(out["table"], "deepseek_v4_pro") + assert (behind[0], behind[6]) == ("5.00%", "—"), "its own return stays; vs SPY does not" + assert _num_cells(out["table"], "qwen3_7_plus")[6] == "2.00%" + + lagging_spy = {**_with_return(_SPY_ROW, 0.01), "status": "catching_up", "snapshot_end": "2026-08-20"} + out = _render_catching_up_board( + _catching_up_payload(lagging_spy, _with_return(qwen, 0.03)), "qwen3_7_plus" + ) + assert _num_cells(out["table"], "qwen3_7_plus")[6] == "—" + + script = ( + _LIVE_FAKE_DOM + + "\n" + + _LIVE_JS + + f"\nlivePayload = {{ entries: {json.dumps(list(rows))} }};\n" + + "const [, behind, current] = livePayload.entries;\n" + + "process.stdout.write(JSON.stringify({\n" + + " behindIsNaN: Number.isNaN(liveSortValue(behind, 'vs_spy')),\n" + + " current: liveSortValue(current, 'vs_spy'),\n" + + "}));\n" + ) + out = run_node(script) + assert out["behindIsNaN"] is True, "a dash sorts as no figure, not as 0.00%" + assert out["current"] == pytest.approx(0.02) + + +@_needs_node +def test_a_catching_up_baseline_is_named_when_no_model_has_printed_yet(): + """With no model printed the banner opens "Baselines frozen through ", + which a lagging baseline is not; the catching-up line follows it, so that row + is named with its own date instead of being folded into the frozen ones.""" + equal_weight = _catching_up_entry( + "equal_weight_djia", "Equal Weight DJIA", "catching_up", + value=100500.0, snapshot_end="2026-08-15", is_model=False, + ) + out = _render_catching_up_board( + _catching_up_payload( + _SPY_ROW, equal_weight, _deepseek("pending", value=None, snapshot_end=None) + ), + "equal_weight_djia", + ) + assert out["banner"] == ( + "Baselines frozen through 2026-08-27. Model curves appear once the nightly " + "refresh deploys them; they are never computed on page load. " + "Equal Weight DJIA is catching up (through 2026-08-15): it is shown but " + "not ranked until it reaches the latest session." + ) + + +@_needs_node +def test_a_board_whose_only_prints_are_catching_up_is_not_called_empty(): + """live_status.has_prints counts ranked (frozen) rows only, as models_cached + did, so a board whose newest run could not plot and whose other rows are + catching up read "No freeze snapshot ... yet" over curves on screen. The + banner reads the rows; a board with no printed row keeps that line.""" + spy_pending = _catching_up_entry( + "spy_index", "SPY", "pending", value=None, snapshot_end=None, is_model=False + ) + payload = _catching_up_payload(spy_pending, _deepseek("catching_up")) + payload["live_status"]["has_prints"] = False + out = _render_catching_up_board(payload, "deepseek_v4_pro") + assert out["banner"] == ( + "DeepSeek V4 Pro is catching up (through 2026-08-20): it is shown but " + "not ranked until it reaches the latest session." + ) + + empty = _catching_up_payload( + spy_pending, _deepseek("pending", value=None, snapshot_end=None) + ) + empty["live_status"]["has_prints"] = False + out = _render_catching_up_board(empty, "deepseek_v4_pro") + assert out["banner"].startswith("No freeze snapshot for 2026-08-01 — 2026-08-31 yet. ") diff --git a/dashboard/backend/tests/test_frontend_live_trading_board.py b/dashboard/backend/tests/test_frontend_live_trading_board.py index a429173f..dea130f2 100644 --- a/dashboard/backend/tests/test_frontend_live_trading_board.py +++ b/dashboard/backend/tests/test_frontend_live_trading_board.py @@ -1,4 +1,4 @@ -"""Source guards for the Live Trading Leaderboard (frontend/js/leaderboard.js). +"""Source guards for the Live Leaderboard (frontend/js/leaderboard.js). /app has no build step and no JS test toolchain, so these assert against the shipped source as text -- the convention set by test_ai_hedge_fund_frontend.py. @@ -404,22 +404,26 @@ def test_the_season_constants_are_the_same_number_in_all_three_places(): def test_the_board_names_itself_on_screen(): header = _fn_body("updateLeaderboardHeader") - assert "'Live Trading Leaderboard'" in header, ( + assert "'Live Leaderboard'" in header, ( "the board title must name the board; folding the season number in " "here instead leaves it unnamed whenever a season is running" ) - assert 'data-competition-tab="live">Live Trading Leaderboard<' in _APP_HTML + assert 'data-competition-tab="live">Live Leaderboard<' in _APP_HTML + assert "Live Trading Leaderboard" not in _SOURCE, ( + "'Trading' was dropped from the board name (direction spec §6)" + ) def test_the_live_name_is_disclaimed_as_simulated(): - """"Live Trading" is a claim. The About card is where it gets qualified. + """"Live" is a claim about direction, not money. The About card is where + it gets qualified. PR #328's spec puts brokered execution in non-goals and execution/paper_backend.py is still a stub, so a board named for live trading that never says "simulated" is the UI making a promise the system does not keep. """ - about = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Trading Leaderboard") :] + about = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Leaderboard") :] about = about[: about.index("")] lowered = about.lower() assert "simulated" in lowered, "the About card must say the trading is simulated" @@ -427,7 +431,7 @@ def test_the_live_name_is_disclaimed_as_simulated(): def test_about_card_names_the_current_season(): - about = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Trading Leaderboard") :] + about = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Leaderboard") :] about = about[: about.index("")] assert "Season 0" in about, ( "the board is in Season 0; the About card is where that is established" @@ -576,3 +580,69 @@ def test_manual_refresh_does_not_default_to_billable_deploys(): assert re.search(r"default:\s*false", block.group(1)), ( "deploy_models must default to false while no board can show the result" ) + + +# ── The Competition board is labelled as legacy (direction spec §6) ───────── + + +def test_the_competition_header_names_the_legacy_engine_and_window(): + """The Competition board stays on the legacy engine and is retired, not + re-run, once Season 1 has data; its fixed historical window may sit inside + a model's training data. The header says both. Static copy: leaderboard.js + rewrites #boardSubtitle on every render and must leave this line alone.""" + competition = _APP_HTML_VISIBLE.split('id="leaderboardView"')[1] + identity = competition[: competition.index('class="leaderboard-header-bar compact"')] + assert ( + '

' + "legacy engine · historical window · may overlap model training data

" + ) in identity + live = _APP_HTML_VISIBLE.split('id="liveLeaderboardView"')[1].split('id="leaderboardView"')[0] + assert "legacy engine" not in live, "the Live board is not labelled legacy" + assert "boardEngineNote" not in _SOURCE, "leaderboard.js must not rewrite the note" + + +# ── Stop-loss / take-profit are not executed on the legacy engine (D12) ───── +# +# The other half of these is tests/domain/backtesting/test_stop_prices_not_enforced.py, +# which fails the day the legacy order path starts reading the two fields. + +_STOP_RULE = "
  • Stop-loss and take-profit prices a model writes are not executed
  • " + + +def _rules_items(view: str, formula: str) -> str: + rules = view[view.index(formula) :] + return rules[: rules.index("")] + + +def test_both_boards_rules_say_stop_prices_are_not_executed(): + live = _APP_HTML_VISIBLE.split('id="liveLeaderboardView"')[1].split('id="leaderboardView"')[0] + competition = _APP_HTML_VISIBLE.split('id="leaderboardView"')[1] + assert _STOP_RULE in _rules_items(live, "Official rank = latest frozen portfolio value") + assert _STOP_RULE in _rules_items(competition, "Official rank = final portfolio value") + + +def test_both_about_cards_say_stop_prices_are_not_executed(): + live = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Leaderboard") :] + live = live[: live.index("")] + assert ( + "A model may write a stop-loss or take-profit price into its decision. " + "The simulator does not act on either: orders are placed only at decision " + "times, and a position is never sold because the price reached the stop " + "or target the model wrote." + ) in live + marker = '

    Competition Leaderboard

    ' + competition = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index(marker) :] + competition = competition[: competition.index("")] + assert ( + "Official rank is by final portfolio value. " + "Stop-loss and take-profit prices a model writes are not executed." + ) in competition + + +def test_the_about_card_explains_the_catching_up_label(): + about = _APP_HTML_VISIBLE[_APP_HTML_VISIBLE.index("Live Leaderboard") :] + about = about[: about.index("")] + assert ( + "An entry more than one trading session behind is marked Catching up: " + "shown, but not ranked." + ) in about diff --git a/dashboard/backend/tests/test_landing_copy_register.py b/dashboard/backend/tests/test_landing_copy_register.py index db5ff3e8..82f8b3d3 100644 --- a/dashboard/backend/tests/test_landing_copy_register.py +++ b/dashboard/backend/tests/test_landing_copy_register.py @@ -805,7 +805,7 @@ def _app_html_live_surfaces() -> dict[str, str]: visible = re.sub(r"", "", app_html, flags=re.DOTALL) blurb_at = visible.index('id="homeModuleLiveBtn"') blurb = visible[blurb_at : visible.index("

    ", blurb_at)] - about_at = visible.index("Live Trading Leaderboard") + about_at = visible.index("Live Leaderboard") about = visible[about_at : visible.index("", about_at)] return {"app.html Home blurb": blurb, "app.html About card": about} diff --git a/dashboard/backend/tests/test_leaderboard_api.py b/dashboard/backend/tests/test_leaderboard_api.py index 21157262..0f3368d9 100644 --- a/dashboard/backend/tests/test_leaderboard_api.py +++ b/dashboard/backend/tests/test_leaderboard_api.py @@ -866,7 +866,8 @@ def _must_not_run(*_args, **_kwargs): assert resp.status_code == 200 body = resp.json() assert body["period"] == "live" - assert body["board_title"] == "Live Trading Leaderboard" + assert body["board_title"] == "Live Leaderboard" + assert body["phase_label"] == "Season 0 · preview" assert body["standings_label"] == "Performance" assert "live_status" in body status = body["live_status"] diff --git a/dashboard/backend/tests/test_leaderboard_season.py b/dashboard/backend/tests/test_leaderboard_season.py index ff5cdd5d..4603f62a 100644 --- a/dashboard/backend/tests/test_leaderboard_season.py +++ b/dashboard/backend/tests/test_leaderboard_season.py @@ -255,7 +255,9 @@ def test_the_live_phase_label_is_derived_from_the_season_number(): """A literal "Season 0" here is a second owner of the season number, and bumping PREVIEW_SEASON_NUMBER is the first act of the advance engine.""" live = service.resolve_leaderboard_config("live") - assert live["phase_label"] == f"Season {service.PREVIEW_SEASON_NUMBER}" + assert service.LIVE_PHASE_LABEL == f"Season {service.PREVIEW_SEASON_NUMBER} · preview" + assert live["phase_label"] == service.LIVE_PHASE_LABEL + assert live["board_title"] == service.LIVE_BOARD_TITLE == "Live Leaderboard" def test_the_route_documents_the_third_period(): diff --git a/dashboard/backend/tests/test_live_leaderboard.py b/dashboard/backend/tests/test_live_leaderboard.py index 63e7e9a6..7aee0382 100644 --- a/dashboard/backend/tests/test_live_leaderboard.py +++ b/dashboard/backend/tests/test_live_leaderboard.py @@ -1,4 +1,4 @@ -"""Tests for the calendar-month Live Trading Leaderboard. +"""Tests for the calendar-month Live Leaderboard. Isolated from contest/daily: live freeze uses ``leaderboard-live`` and must not rewrite the contest window. @@ -2221,3 +2221,100 @@ def test_a_row_with_no_seed_at_all_is_undefined_and_logged(no_alpaca, monkeypatc assert deepseek["sharpe_status"] == "undefined" assert deepseek["sharpe_ratio"] is None assert any("not a positive number" in r.getMessage() for r in caplog.records) + + +# ── The board's name and season label have one owner (service.py) ─────────── + + +def test_every_live_surface_reads_the_shared_title_and_phase_label(no_alpaca): + """Three dicts carry the Live board's name and season label: the payload the + public GET serves, the freeze config the refresh writes under, and the + service-side live config. Each used to spell both out, so a rename had three + places to miss and the season number had three owners.""" + as_of = datetime(2026, 8, 27, 17, 39, tzinfo=_ET) + assert lb_service.LIVE_BOARD_TITLE == "Live Leaderboard" + assert lb_service.LIVE_PHASE_LABEL == "Season 0 · preview" + for source in ( + live.get_live_leaderboard(as_of=as_of), + live.live_freeze_config(as_of), + lb_service.resolve_leaderboard_config("live"), + ): + assert source["board_title"] == lb_service.LIVE_BOARD_TITLE + assert source["phase_label"] == lb_service.LIVE_PHASE_LABEL + + +def test_no_backend_text_still_says_live_trading_leaderboard(): + """'Trading' was dropped from the name (direction spec §6): it read as real + orders and collided with the Robinhood live-trading docs. Docstrings, the + OpenAPI text and the refresh CLI's --help are read by people too.""" + from pathlib import Path + + backend = Path(live.__file__).resolve().parents[2] + scripts = backend.parent / "scripts" + offenders = sorted( + str(path.relative_to(backend.parent)) + for path in [*backend.rglob("*.py"), *scripts.rglob("*.py")] + if "tests" not in path.relative_to(backend.parent).parts + and "Live Trading Leaderboard" in path.read_text(encoding="utf-8") + ) + assert offenders == [], f"rename these to 'Live Leaderboard': {offenders}" + + +def _docstring_nodes(tree): + """The Constant nodes that are module, class or function docstrings.""" + import ast + + found = set() + for node in ast.walk(tree): + if isinstance(node, (ast.Module, ast.ClassDef, ast.FunctionDef, ast.AsyncFunctionDef)): + first = node.body[0] if node.body else None + if ( + isinstance(first, ast.Expr) + and isinstance(first.value, ast.Constant) + and isinstance(first.value.value, str) + ): + found.add(id(first.value)) + return found + + +def test_only_the_service_constants_spell_out_the_live_title_and_season_label(): + """The value test above passes if live.py goes back to its own "Live + Leaderboard" or "Season 0 · preview" literal, which makes a second owner + again. Outside the two service.py assignments, no backend or script string + (docstrings aside) is the board's name or carries the label's " · preview" + part, so neither can be spelled out, or the label rebuilt, anywhere else.""" + import ast + from pathlib import Path + + owners = {"LIVE_BOARD_TITLE", "LIVE_PHASE_LABEL"} + backend = Path(live.__file__).resolve().parents[2] + service_path = Path(lb_service.__file__).resolve() + owners_seen = set() + offenders = [] + for path in sorted([*backend.rglob("*.py"), *(backend.parent / "scripts").rglob("*.py")]): + rel = path.relative_to(backend.parent) + if "tests" in rel.parts: + continue + tree = ast.parse(path.read_text(encoding="utf-8")) + # Built from this tree alone: an id() is only an identity while its + # node is alive. Carried into the next file, service.py's freed ids + # get reused by that file's nodes and silently exempt them. + skip = _docstring_nodes(tree) + if path.resolve() == service_path: + for node in tree.body: + names = {t.id for t in getattr(node, "targets", []) if isinstance(t, ast.Name)} + if isinstance(node, ast.Assign) and names & owners: + owners_seen.update(names & owners) + skip.update(id(n) for n in ast.walk(node.value)) + offenders.extend( + f"{rel}:{node.lineno}" + for node in ast.walk(tree) + if isinstance(node, ast.Constant) + and isinstance(node.value, str) + and id(node) not in skip + and (node.value == lb_service.LIVE_BOARD_TITLE or "· preview" in node.value) + ) + assert owners_seen == owners, "service.py no longer assigns both constants" + assert offenders == [], ( + f"read lb_service.LIVE_BOARD_TITLE / LIVE_PHASE_LABEL instead: {offenders}" + ) diff --git a/dashboard/frontend/app.html b/dashboard/frontend/app.html index dafaad10..6e3be59f 100644 --- a/dashboard/frontend/app.html +++ b/dashboard/frontend/app.html @@ -67,7 +67,7 @@ if (saved && saved.page === 'playground' && saved.playgroundTab === 'paper') { return Object.assign({}, saved, { playgroundTab: 'agents' }); } - // The Daily Leaderboard became the Live Trading Leaderboard. + // The Daily Leaderboard became the Live Leaderboard. // Anyone whose last visit was that tab has 'daily' in localStorage // (or 'season' from a build of this branch); left alone the key // matches no boot-CSS rule and no panel, so Competition paints @@ -585,7 +585,7 @@

    to deny, two clicks upstream of the correction. -->

    Every AI model above traded the same fixed window. The - + is the other board — designed to move forward one trading session at a time, on prices nobody has seen yet. It is a Season 0 preview: the current calendar month, updated after each trading session closes. @@ -1572,7 +1572,7 @@

    Stop Loss / Take Profit

    -

    Live Trading Leaderboard

    +

    Live Leaderboard

    This board runs forward, one calendar month at a time, on NYSE trading days. “Live” describes the direction, not the money: this is simulated trading on real market data — no broker account, no real capital, and no order ever leaves this system.

    Each night after the US cash close (16:00 ET, or 13:00 on an NYSE early close), each entry is advanced one trading day: the model sees that day's real bars for the first time and its portfolio carries forward from where the previous day left it. Nobody — including us — knows what the next bar does when an entry locks, which is what separates this board from the fixed-window Competition one.

    Each entry is one continuous book that starts the month flat at $100,000 and ranks only the days inside it; the board resets on the 1st. Entries are a curated roster of AI models and baselines — there are no user submissions.

    -

    We are in Season 0, the shakedown season, so read the standings as a preview rather than an official result. An entry more than one trading session behind is shown but not ranked.

    +

    A model may write a stop-loss or take-profit price into its decision. The simulator does not act on either: orders are placed only at decision times, and a position is never sold because the price reached the stop or target the model wrote.

    +

    We are in Season 0, the shakedown season, so read the standings as a preview rather than an official result. An entry more than one trading session behind is marked Catching up: shown, but not ranked.

    Competition Leaderboard

    -

    Ranking is a backtest leaderboard, not live trading. Each entry is an hourly backtest over 2026-04-15 → 2026-05-15 (one-month window), comparing leading AI models, baseline strategies, and market indices. Official rank is by final portfolio value.

    +

    Ranking is a backtest leaderboard, not live trading. Each entry is an hourly backtest over 2026-04-15 → 2026-05-15 (one-month window), comparing leading AI models, baseline strategies, and market indices. Official rank is by final portfolio value. Stop-loss and take-profit prices a model writes are not executed.

    Schedule

    @@ -1642,16 +1643,16 @@

    Evaluation Metrics

    - + @@ -1888,6 +1900,11 @@
  • Higher account value ranks first
  • Ties break on cumulative return
  • Click column headers to re-sort
  • + +
  • Stop-loss and take-profit prices a model writes are not executed
  • @@ -2523,8 +2540,8 @@

    Refund Credits purchase

    - - + +