# High-Risk Sleeve Momentum Reconfirmation — invoked automatically by
# sleeve_monitor.sh, once per newly-flagged ticker from sleeve_monitor.py.
# Not run by hand; not a separate cron entry.
#
# ALERT-ONLY. This prompt never places an order. Options-trading approval on
# the account is unverified as of 2026-08-31 (the auto-mode classifier
# blocked even a preview call), and Neil explicitly asked for a fast
# alert-and-manual-execute model instead ("you model and verify... I can
# review, but[,] sell[/act] in minutes of that notification"). Do not call
# create_option_instruction, create_order_instruction, or any other
# order-placing tool from this flow. If a future session verifies options
# approval and Neil asks to automate execution, that is a deliberate, separate
# change to this prompt -- not something to infer from this comment.

---

**Why this exists (added 2026-08-31):** `sleeve_monitor.py` is deliberately
mechanical and price-only (tmx_quotes has no volume field) -- it flags that a
ticker's intraday move crossed a threshold AND is accelerating, and explicitly
does NOT check volume, RSI, MACD, or anything else. This flow closes that gap
the same way `watchlist_trigger_reconfirm_prompt.md` does for the core swing
system: pull real data from Questrade (the only source with volume/historical
bars available here, no web search) and actually score the move before
bothering Neil with a notification, so what lands on his phone is "here's a
real, scored setup" rather than "a price moved."

You are given one `TICKER` (bare, e.g. `SU`) and its mechanical trigger line
from `sleeve_monitor.py`'s stdout (today's %% change and the acceleration over
the last few polls).

**Step 0 — Tool-availability check** (same pattern as
`daily_scan_prompt.md` Step 6 point 0 / `watchlist_trigger_reconfirm_prompt.md`
Step 0). If `mcp__Questrade__list_accounts` (or any other `mcp__Questrade__*`
tool) is not available in your toolset, you are still the real unattended
invocation. Call `ntfy_alert.send_alert()` with `priority='urgent'` naming
`TICKER` and stating the Questrade connector was unavailable for this sleeve
check, then stop. Do not attempt anything below.

**Step 1 — Resolve the instrument.** Call `search_symbols` for `TICKER`,
filter to `listingMarket == "TSX"`. Zero or 2+ matches → alert
(`priority='default'`) that the mechanical trigger fired but the symbol
couldn't be cleanly resolved, and stop.

**Step 2 — Pull live price + enough history to actually score momentum.**
Call `get_quotes` for the live price. Call `get_historical_data`
(`granularity: "1d"`, `to` = today) for the last 60-80 daily bars (concatenate
repeated calls if truncated -- see `technical_indicators.py`'s header for the
pagination pattern). Append today's still-forming bar from the live quote.
Pipe the combined bars into `python3 /media/raid/rshare/SwingTrader/technical_indicators.py`
for `rsi14`, `macd_histogram`, `ema20`/`ema50`/`ema200`, `atr14`, and
`volume_ratio_vs_20d_avg` -- this is the real volume data
`sleeve_monitor.py` couldn't check.

**Step 3 — Score against `screen_criteria.json` → `entry_setups.setup_D_momentum`**
using today's Questrade-confirmed numbers (not the mechanical trigger's
price-only changePct). Also check `screen_criteria.json` →
`data_integrity.stale_flagged_input_rule` if anything can't be confirmed —
don't silently guess. Also pull the day's leading sector from context if
readily available (not worth a fresh search here); if unknown, use the
standard RSI ceiling rather than the leading-sector one.

**A mechanical trigger firing is not itself a passing score.** Score honestly
against all 5 points. If the honest score is below 4, or a decisive signal
can't be confirmed, this is a "not yet" outcome, not a forced yes.

**Step 4 — Check the sleeve ledger.** Read `sleeve_ledger.json`. If
`cash_available_cad` is below roughly 10% of `allocated_capital_cad`, or the
sleeve's cumulative realized P/L (sum of `closed_positions[].pl_dollars`) has
breached `sleeve_circuit_breaker.max_drawdown_halt_pct` below
`allocated_capital_cad`, do not suggest a new idea regardless of score — alert
(`priority='default'`) stating the sleeve is out of room / in its circuit
breaker, and stop.

**Step 5 — Branch on the result:**

- **Score 4-5, all data confirmed:** this is a real idea. If you have
  reasonable confidence the account has options approval (skip this check if
  unknown — see the note below), call `get_option_expiries` then
  `get_option_chain` (`closestStrikes: 2-3`, `optionType` matching direction,
  an expiry roughly 2-4 weeks out to balance leverage against theta decay) to
  name a specific suggested contract (strike + expiry) — this is READ-ONLY
  data pulling, not an order. Compute a suggested max premium to risk as
  `min(sleeve_watchlist.json → max_premium_per_idea_pct_of_sleeve% of
  allocated_capital_cad, cash_available_cad)`. Send
  `ntfy_alert.send_alert()` with `priority='urgent'` (Neil needs to act within
  minutes) stating: ticker, direction (call/put), suggested strike + expiry,
  today's confirmed price/RSI/volume-ratio/why it scored well, suggested max
  premium to risk, and explicitly: **"Not auto-executed — place manually in
  the Questrade app if you agree, this alert expires in relevance within
  minutes."** Do not call any order-placing tool.
  Options-approval note: if `get_option_chain` or `preview_option_instruction`
  return anything indicating the account lacks options trading approval, say
  so plainly in the alert instead ("options data unavailable/not approved —
  suggesting the underlying equity or a leveraged sector ETF instead") and
  name the underlying equity trade instead (still not auto-executed).
- **Score below 4, or a decisive number still can't be confirmed:** send
  `ntfy_alert.send_alert()` with `priority='default'`, stating the ticker,
  the confirmed numbers, the resulting score, and why it doesn't qualify yet
  — same "real numbers even when the answer is no" principle as
  `watchlist_trigger_reconfirm_prompt.md`.

**Step 6 — Log the check** regardless of outcome, appending one line to
`daily_run.log`:
`[sleeve_reconfirm] TICKER: score N/5, price $X.XX, alerted (idea/no-idea/skipped)`

**Step 7 — Updating the ledger after Neil actually trades.** This flow never
writes to `sleeve_ledger.json` itself — it only reads it in Step 4. If Neil
later tells you (in a normal interactive session, not this automated flow)
that he executed a trade off one of these alerts, update
`sleeve_ledger.json`'s `open_positions`/`cash_available_cad` by hand at that
point, the same manual-trust pattern `place_trade_prompt.md` uses for the
core system's positions.json.
