Skip to content

fix(propose): compare stops against completed sessions only - #67

Merged
HaoweiChan merged 3 commits into
mainfrom
claude/nervous-burnell-31fd6f
Oct 14, 2026
Merged

HaoweiChan merged 3 commits into
mainfrom
claude/nervous-burnell-31fd6f

Conversation

@HaoweiChan

@HaoweiChan HaoweiChan commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Why

The actual-portfolio propose pass ran at 2026-10-08 13:24 ET, mid-NYSE-session, and fired EXIT RVMD: "現價 185.43(2026-10-08 交易日)跌破 187.00". 185.43 was yfinance's still-forming intraday bar; RVMD closed 188.12 that day and never closed at or below 187 through 10-13. The book's stop veto (core/book.py stopped_out) is close-based, so the two rules disagreed about the same stop.

Task (verbatim): TASK-26 — propose compares stops against completed sessions only

Description

Seen 2026-10-09 01:24 Taipei (2026-10-08 13:24 ET, mid-NYSE-session): the actual-portfolio
propose pass fired EXIT RVMD because the "2026-10-08 session" price 185.43 was below the
187.00 stop. That number was yfinance's still-forming intraday bar; RVMD closed 188.12 that day
and never closed at or below 187 through 10-13. core/book.py stopped_out is close-based, so
the two rules disagreed about the same stop.

Change: each market profile (core/screening/__init__.py) carries its session close as
(timezone, HH:MM) — us America/New_York 16:00, tw Asia/Taipei 13:30. _run_propose drops
the panel's final row when that row is the market's today and the market's clock is before the
close, so every price propose reads (stop/EXIT, MA50, trail, scores) is a finished session.

Probe: KUROSHIO_LEDGER_DIR=$(mktemp -d) PYTHONPATH=. .venv/bin/python -m kuroshio.cli propose --ips ~/.kuroshio/ips-us.md --holdings ~/.kuroshio/book/latest/actual/holdings_us.yaml --market us --no-ledger · budget $0 · reps 1 — during the NYSE session the cards' session label is the previous trading day; after 16:00 ET it is today.

Acceptance Criteria

What changed

  • Each MarketProfile carries session_close = (IANA tz, HH:MM): us/us-leadership America/New_York 16:00, tw Asia/Taipei 13:30.
  • _run_propose passes the fetched panel through _completed_sessions: the final row is dropped when it is dated the market's today and the market's own clock is before its close. Every price propose reads (stop/EXIT, MA50, ATR trail, auto-scores, the asof label and the stop-ledger date) is therefore a finished session. Covers the CLI, kuroshio book's propose passes and the MCP propose tool, which all route through _run_propose.
    Not changed: screen, book's price columns and the other fetch_panel callers; early-close half days keep the bar out until 16:00 (delays the check, never fires early); card wording.

Verification

Gate: ruff clean · pytest 509/509 · 4fe0285 (after merging main)
Red-first: test_task26_mid_session_bar_does_not_fire_an_exit watched red on 5ab0fd5 with _completed_sessions as identity (EXIT RVMD at 185.43, asof 2026-10-08), green at 9498456; test_task26_after_the_close_the_same_bar_fires_the_exit and test_task26_completed_sessions_uses_the_market_clock red on the same stub, green at 9498456
Live: run local-9498456-1420Z ×1 on build 9498456 (2026-10-14 11:20 ET) · $0 — every card reads the 2026-10-13 session, 0 EXIT, exit 0; control on main (b10fe45) at the same minute reads the open 2026-10-14 bar
Not verified: a run after 16:00 ET reading today's bar live (covered by the 16:30 stubbed-clock test); TW live

Problems found

none

Follow-ups

none

Reviewer notes

Start here: _completed_sessions in kuroshio/cli.py
Reproduce: pytest tests/test_cli.py -q -k task26

Decision: met — verifier APPROVED, 1 model call

🤖 Generated with Claude Code

HaoweiChan and others added 2 commits October 14, 2026 23:21
A propose run during the US session read yfinance's still-forming bar as the
session close and fired EXIT RVMD on an intraday 185.43 against a 187.00 stop
RVMD never closed under. Each market profile now carries its session close
(timezone, HH:MM); _run_propose drops the panel's final row while that
market's today is still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HaoweiChan

Copy link
Copy Markdown
Owner Author

pr-loop/verifier APPROVED · no blocking findings
Gate: ruff 0 · pytest 482/482 · 9498456
Probe: local-9498456-1420Z

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@HaoweiChan
HaoweiChan merged commit 4e0e9fc into main Oct 14, 2026
6 checks passed
@HaoweiChan
HaoweiChan deleted the claude/nervous-burnell-31fd6f branch October 20, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant