Claude Skill

market-session-tracker

Use when monitoring stocks/ETFs/indices across pre-market, open, intraday, or close — especially when the user is reading session action live and may revise their take as it unfolds. Triggers include 盘前/盘中/收盘 sessions, multi-symbol watchlists (e.g. MU/TSM/SMH semi tracking), user

LLM Mart · 0 points · 7 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download kansoku-trade-kansoku-.claude_skills_market-session-tracker-4994657.zip · 12 KB
Part of kansoku-trade/kansoku — 11 skills

Install

skills CLI npx skills add https://github.com/kansoku-trade/kansoku/tree/main/.claude/skills/market-session-tracker
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install kansoku-trade-kansoku@llmmart
Git git clone https://github.com/kansoku-trade/kansoku.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole kansoku-trade/kansoku collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Market Session Tracker

Real-time US-market analysis pattern. Sits on top of longbridge-quote, longbridge-kline, longbridge-capital-flow, longbridge-market-temp — adds orchestration, breakout verification, distribution detection, tier classification, and revision discipline.

Standard symbol sets

Theme Symbols
Semi / memory MU.US, TSM.US, DRAM.US (Roundhill Memory ETF), SMH.US, SOXX.US
Indices QQQ.US, SPY.US, DIA.US, IWM.US
Vol / risk-off VXX.US, UVXY.US, TLT.US, GLD.US

.SOX.US is unavailable on Longbridge — use SMH/SOXX ETF proxies.

Seven protocols

0. Trump-feed sweep (pre-cash) — before any pre-market read, run python3 .claude/skills/trump-truth-monitor/scripts/fetch.py --hours 14. Any high-tier post touching watchlist sectors (tariff_trade / semi_tech / energy / fed_macro / geopolitical) goes into the session report as a candidate explanation for any gap, before running quote-based exuberance math. Skip when the watchlist has no policy-exposed names. See trump-truth-monitor skill for tier grading.

1. Pre-market verification — compute pre vol % of prev day full vol, and pre high % over prev_close. Flag exuberance when pre vol > 5% of prev day and pre high > prev_close × 1.07.

2. Failed-breakout 6-signal stack — count how many fire in the cash session:

  1. Pre-market high NOT touched in first 30 min of cash
  2. New intraday high breaks → price falls back below the broken level within minutes
  3. Volume does NOT expand at the breakout
  4. Sector ETF (SMH/SOXX) does NOT confirm by going green
  5. Leader stock (MU for memory; TSM for foundry; NVDA for AI) does NOT make new high
  6. Capital flow: all 3 buckets net selling

≥ 4 signals fired = failed breakout / distribution. Name the tier (§5).

3. Capital flow triple-bucket — longbridge capital <SYM> --format json. Net = capital_in − capital_out for each of large / medium / small. All 3 net out = textbook distribution. Use --flow for accelerating-outflow detection.

4. Cross-asset sentiment matrix

Pattern Interpretation
DIA > SPY > QQQ + VXX down Rotation (defensive), not panic
VXX up + GLD up + TLT up True risk-off
Sector red + SPY flat + VXX down Isolated distribution
HK/CN valuation ≥ 80 + sentiment ≤ 35 Known-bubble (overvalued, retail knows)

5. Pullback tier classification

Tier Triggers
1 震荡 Stock −2% from intraday high; closes green
2 实质回调 Stock −5% from peak; sector ETF turns red
3 板块下跌 Sector −3%+; broad indices flat-to-red
4 风险传染 SPY −1%+; VXX +5%+; defensives also fall

Always name the tier explicitly — never vague "weakening".

6. Scenario probabilities — always 3 scenarios (Bull / Base / Bear) with explicit % (sum=100) and trigger conditions. Mark probabilities as subjective. Revise as data flows with timestamps: 09:30 初判 → 09:54 修正 → 09:56 再修正.

7. Thesis revision discipline — when user says "突破"/"冲高"/"回调":

  1. Re-pull live quote + intraday minute tail — do NOT auto-agree
  2. Check cash intraday high vs pre-market high vs prior intraday high
  3. Distinguish: true breakout (new high > pre high, holds 5+ min) vs partial (breaks prior intra high but not pre high) vs recovery (only bounces from intra low)
  4. If data contradicts user, disagree with evidence

Output format (each snapshot)

  • Time (ET) — always
  • Symbol table — last, change%, intra high/low, vs pre high, vol
  • Key signal (one sentence)
  • Tier (if pullback context)
  • Next watch levels (explicit prices, not "around X")
  • Source: 长桥证券 · Disclaimer: ⚠️ 仅供参考,不构成投资建议

Session report logging

After a session, write a structured log using templates/session-report.md in this skill. Default path: ~/git/trade/journal/YYYY-MM-DD-<theme>.md (a dedicated git repo; journal/ avoids the logs global-gitignore collision). Captures pre-market verdict, opening behavior, tier evolution, thesis revisions, capital flow, cross-asset sentiment, end-of-day outcome, and lessons.

Optional: position context

When user provides positions or asks via longbridge positions:

  • Show symbol, qty, avg cost, current price, unrealized P&L, % of book
  • Cross-reference which positions are exposed to the current move
  • Do NOT recommend buy/sell — defer to user

Anti-patterns

  • ❌ Auto-confirming user's directional read (re-pull data first)
  • ❌ Calling a cash bounce a "breakout" without checking pre-market high
  • ❌ Single-point price prediction (use 3 scenarios)
  • ❌ Vague "weak/strong" — use tier classification
  • ❌ Conflating sector weakness with systemic (check VXX/GLD/SPY)
  • ❌ Calling trend in first 5 min (wait for 30-min K)
Files (kansoku)
  • launchd
    • dev.innei.trade.weekly-watch.plist 1.2 KB · in bundle
    • README.md 4.5 KB
      # Weekly Watch — launchd 安装说明
      
      每周一早上 09:00(本地时间)自动跑 `scripts/weekly-watch.py`,把市场温度、AI 主线本周走势、5 项量化阈值警报、近期财报倒计时写到 `journal/YYYY-MM-DD-weekly-watch.md`。
      
      > 为什么选周一 09:00 本地:CST 周一 09:00 = ET 周日 21:00。美股周末闭市,数据冻结在上周五收盘。早晨打开 journal 就能看到「上周已发生」+「本周财报预告」,一周的观察节奏从这一份开始。
      
      > 想周末看?把 Weekday 改成 7(周日)或 6(周六)。想美股开盘日看?把 Weekday 改成 2(周二),早晨能看到上周完整 + 本周第一天行情。
      
      ---
      
      ## 一次性手动验证
      
      先验证脚本本身能跑通(不写 journal):
      
      ```bash
      cd ~/git/trade
      python3 .claude/skills/market-session-tracker/scripts/weekly-watch.py --smoke
      # 期望: {"ok": true, ...} 含市场温度
      ```
      
      再跑一次完整流程(写 journal):
      
      ```bash
      python3 .claude/skills/market-session-tracker/scripts/weekly-watch.py
      # 期望: ✓ wrote journal/YYYY-MM-DD-weekly-watch.md
      #       flags fired: N — 三同跌, ...
      ```
      
      打开生成的 journal 文件确认内容正确:
      
      ```bash
      ls -lt journal/*-weekly-watch.md | head -1
      ```
      
      ---
      
      ## 安装 launchd(自动每周跑)
      
      ```bash
      # 1. 复制模板到 LaunchAgents,并替换 __REPO_ROOT__ 为真实路径
      sed "s|__REPO_ROOT__|$HOME/git/trade|g" \
        .claude/skills/market-session-tracker/launchd/dev.innei.trade.weekly-watch.plist \
        > ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      
      # 2. 加载到 launchd
      launchctl load ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      
      # 3. 验证已注册(应该能看到 dev.innei.trade.weekly-watch)
      launchctl list | grep weekly-watch
      ```
      
      ---
      
      ## 临时手动触发一次(测试 launchd 是否真能拉起)
      
      ```bash
      launchctl start dev.innei.trade.weekly-watch
      # 然后看输出日志
      tail -50 .claude/skills/market-session-tracker/launchd/weekly-watch.stdout.log
      tail -50 .claude/skills/market-session-tracker/launchd/weekly-watch.stderr.log
      ```
      
      ---
      
      ## 修改触发时间
      
      编辑 `~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist` 的 `StartCalendarInterval`,然后重新加载:
      
      ```bash
      launchctl unload ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      launchctl load ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      ```
      
      `Weekday` 取值:`0` 或 `7` = 周日,`1` = 周一,`2` = 周二,...,`6` = 周六。
      
      ---
      
      ## 卸载
      
      ```bash
      launchctl unload ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      rm ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist
      ```
      
      ---
      
      ## 故障排查
      
      | 症状                                            | 检查                                                                                          |
      | ----------------------------------------------- | --------------------------------------------------------------------------------------------- |
      | `launchctl list` 没看到 weekly-watch            | plist 路径或语法错误。`plutil ~/Library/LaunchAgents/dev.innei.trade.weekly-watch.plist` 验证 |
      | stderr.log 出现 `longbridge: command not found` | `EnvironmentVariables.PATH` 没包含 longbridge 二进制路径。`which longbridge` 找到路径加进去   |
      | stderr.log 出现 connect timeout                 | 长桥 API 临时故障。脚本内置 2 次重试,仍失败则当周跳过即可                                    |
      | 输出的 journal 文件没生成                       | 检查 `--no-write` 是否误传;检查 `journal/` 目录权限                                          |
      | Mac 睡眠时错过触发                              | launchd 默认不会唤醒系统执行。需要在「系统设置 → 节能」里加唤醒计划,或接受偶尔错过           |
      
      ---
      
      ## 脚本逻辑速查
      
      `weekly-watch.py` 检查 5 项**可自动测**的阈值:
      
      1. **市场温度 > 85(狂热)或 < 25(恐慌)** — 长桥读数
      2. **VXX > 35** — 真恐慌阈值
      3. **SPY 距 50 日高点 > -10%** — 大盘进入修正
      4. **MAGS + MU + SMH 本周同步下跌** — 区分轮动 vs 系统性的关键
      5. **关键财报倒计时** — NVDA / MU / MSFT / META / GOOG / AMZN 下次电话会日期
      
      剩下 4 项**只能人工查**(脚本里只留提醒):
      
      - 超大厂投资级债券利差(要 FRED)
      - DRAM 杠杆 ETF AUM(要 issuer 页)
      - Samsung/SK 海力士消费级 DRAM 产能新闻
      - 超大厂 CFO 对 AI ROI 的措辞(财报季实际听电话会)
      
      完整 11 信号清单见 `memory/project-ai-memory-cycle-top-signals.md`。
      
  • scripts
    • weekly-watch.py 12.7 KB
      #!/usr/bin/env python3
      """Weekly market watch — pulls 4 key signals + market temp, writes journal entry.
      
      Designed to run weekly (e.g. Monday morning) via launchd. Anchors on the
      4-item watchlist defined in journal/2026-06-26-fear-vs-tape.md §7:
        1. Hyperscaler capex guidance (qualitative — only flagged near earnings)
        2. Hyperscaler IG bond spreads (qualitative — needs FRED, hard-coded reminder)
        3. MU earnings call "customer inventory rising" language (countdown only)
        4. NVDA forward backlog QoQ delta (countdown only)
      
      And 5 quantitative thresholds checkable from longbridge alone:
        - Market temp > 85 (euphoria) or < 25 (panic)
        - VXX sustained > 35
        - SPY drawdown > 10% from 50-day high
        - MAGS + MU + SMH same-week all red (rotation vs systemic discriminator)
        - DRAM ETF AUM (manual — printed reminder only)
      
      Output: ok-envelope JSON to stdout + markdown file to journal/.
      """
      
      import argparse
      import json
      import subprocess
      import sys
      from datetime import date, datetime, timezone
      from pathlib import Path
      
      REPO_ROOT = Path(__file__).resolve().parents[4]
      JOURNAL_DIR = REPO_ROOT / "journal"
      
      INDEX_SYMBOLS = ["SPY.US", "QQQ.US", "MAGS.US", "DIA.US", "IWM.US"]
      AI_MAIN = ["MU.US", "NVDA.US", "MRVL.US", "SMH.US", "SOXX.US", "DRAM.US"]
      RISK_SIGNAL = ["VXX.US", "GLD.US", "TLT.US"]
      ALL_SYMBOLS = INDEX_SYMBOLS + AI_MAIN + RISK_SIGNAL
      
      EARNINGS_CALENDAR = {
          "NVDA.US": ("2026-08-27", "NVDA Q2 FY27 — 听 forward backlog 是否首次环比下滑"),
          "MU.US":   ("2026-12-18", "MU Q4 FY26 — 听是否出现「customer inventory rising」措辞"),
          "MSFT.US": ("2026-10-29", "MSFT Q1 FY27 — 听 CFO 是否用 'review pace of AI investment'"),
          "META.US": ("2026-10-29", "META Q3 — 听 capex 指引方向"),
          "GOOGL.US": ("2026-10-28", "GOOGL Q3 — 听 capex 指引方向"),
          "AMZN.US": ("2026-10-30", "AMZN Q3 — 听 AWS AI capex 措辞"),
      }
      
      CO_MOVEMENT_LOOKBACK_DAYS = 7
      
      
      def lb_json(*args, timeout=30, retries=2):
          cmd = ["longbridge", *args, "--format", "json"]
          last_err = None
          for attempt in range(retries + 1):
              try:
                  result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
              except subprocess.TimeoutExpired:
                  last_err = f"timeout after {timeout}s"
                  continue
              if result.returncode == 0:
                  return json.loads(result.stdout)
              last_err = result.stderr.strip() or result.stdout.strip()
          raise RuntimeError(f"longbridge {' '.join(args)} failed after {retries+1} tries: {last_err}")
      
      
      def market_temp_dict():
          raw = lb_json("market-temp", "US")
          return {row["field"]: row["value"] for row in raw}
      
      
      def quotes_by_symbol(symbols):
          raw = lb_json("quote", *symbols)
          return {q["symbol"]: q for q in raw}
      
      
      def daily_klines(symbol, count=60):
          return lb_json("kline", symbol, "--period", "day", "--count", str(count))
      
      
      def pct_change(curr, prev):
          if prev == 0:
              return 0.0
          return (curr - prev) / prev * 100
      
      
      def week_change_pct(symbol):
          klines = daily_klines(symbol, count=CO_MOVEMENT_LOOKBACK_DAYS + 1)
          if len(klines) < 2:
              return None
          first_close = float(klines[0]["close"])
          last_close = float(klines[-1]["close"])
          return pct_change(last_close, first_close)
      
      
      def spy_drawdown_from_50d_high(quotes):
          klines = daily_klines("SPY.US", count=50)
          if not klines:
              return None, None
          high_50d = max(float(k["high"]) for k in klines)
          spy_now = float(quotes["SPY.US"]["last"])
          return pct_change(spy_now, high_50d), high_50d
      
      
      def earnings_countdown(today):
          out = []
          for sym, (datestr, note) in EARNINGS_CALENDAR.items():
              try:
                  target = datetime.strptime(datestr, "%Y-%m-%d").date()
              except ValueError:
                  continue
              days = (target - today).days
              if days < -7:
                  continue
              out.append({"symbol": sym, "date": datestr, "days_left": days, "note": note})
          return sorted(out, key=lambda x: x["days_left"])
      
      
      def evaluate_thresholds(temp, quotes, weekly_changes, spy_dd):
          flags = []
      
          try:
              t = int(temp.get("Temperature", "0"))
              if t > 85:
                  flags.append(("狂热警戒", f"市场温度 {t} > 85(极度看多)→ 历史顶部常见区间"))
              elif t < 25:
                  flags.append(("恐慌警戒", f"市场温度 {t} < 25(极度恐慌)→ 历史底部常见区间"))
          except ValueError:
              pass
      
          vxx = quotes.get("VXX.US")
          if vxx:
              vxx_last = float(vxx["last"])
              if vxx_last > 35:
                  flags.append(("VXX 高位", f"VXX 收 {vxx_last:.2f} > 35(真恐慌阈值)"))
      
          if spy_dd is not None and spy_dd < -10:
              flags.append(("大盘走弱", f"SPY 距 50 日高点 {spy_dd:.2f}%(< -10%)→ 大盘已进入修正"))
      
          mags_w = weekly_changes.get("MAGS.US")
          mu_w = weekly_changes.get("MU.US")
          smh_w = weekly_changes.get("SMH.US")
          if all(x is not None and x < 0 for x in (mags_w, mu_w, smh_w)):
              flags.append((
                  "三同跌",
                  f"MAGS/MU/SMH 本周同步下跌(MAGS {mags_w:+.2f}% / MU {mu_w:+.2f}% / SMH {smh_w:+.2f}%)→ "
                  "区分轮动 vs 系统性的关键信号"
              ))
      
          return flags
      
      
      def render_markdown(today, temp, quotes, weekly_changes, spy_dd, spy_50d_high, flags, earnings):
          lines = [
              f"# {today.isoformat()} · 每周市场观察 (auto)",
              "",
              f"**生成时间**: {datetime.now(timezone.utc).strftime('%Y-%m-%d %H:%M UTC')}",
              f"**脚本**: `.claude/skills/market-session-tracker/scripts/weekly-watch.py`",
              f"**关联**: [2026-06-26-fear-vs-tape.md](2026-06-26-fear-vs-tape.md) §7(4 项观察清单)",
              "",
              "---",
              "",
              "## 1. 阈值警报",
              "",
          ]
          if flags:
              for tag, msg in flags:
                  lines.append(f"- **🔴 {tag}** — {msg}")
          else:
              lines.append("**无警报**。5 项量化阈值全部安全。继续按节奏观察。")
          lines.extend(["", "---", "", "## 2. 市场温度(长桥读数)", ""])
          lines.append(f"- 温度: **{temp.get('Temperature', '?')}** — {temp.get('Description', '?')}")
          lines.append(f"- 估值: {temp.get('Valuation', '?')} · 情绪: {temp.get('Sentiment', '?')}")
      
          lines.extend(["", "---", "", "## 3. 关键指数本周走势", "",
                        "| 标的 | 现价 | 距 prev close | 本周变化 |",
                        "|---|---:|---:|---:|"])
          for sym in INDEX_SYMBOLS:
              q = quotes.get(sym)
              if not q:
                  continue
              w = weekly_changes.get(sym)
              w_str = f"{w:+.2f}%" if w is not None else "—"
              lines.append(f"| {sym} | {q['last']} | {q['change_percentage']}% | {w_str} |")
      
          lines.append("")
          if spy_dd is not None:
              lines.append(f"**SPY 距 50 日高点**: {spy_dd:+.2f}% (50 日高 = ${spy_50d_high:.2f})")
      
          lines.extend(["", "---", "", "## 4. AI 主线本周走势", "",
                        "| 标的 | 现价 | 距 prev close | 本周变化 |",
                        "|---|---:|---:|---:|"])
          for sym in AI_MAIN:
              q = quotes.get(sym)
              if not q:
                  continue
              w = weekly_changes.get(sym)
              w_str = f"{w:+.2f}%" if w is not None else "—"
              lines.append(f"| {sym} | {q['last']} | {q['change_percentage']}% | {w_str} |")
      
          lines.extend(["", "---", "", "## 5. 风险信号资产", "",
                        "| 标的 | 现价 | 距 prev close | 本周变化 |",
                        "|---|---:|---:|---:|"])
          for sym in RISK_SIGNAL:
              q = quotes.get(sym)
              if not q:
                  continue
              w = weekly_changes.get(sym)
              w_str = f"{w:+.2f}%" if w is not None else "—"
              lines.append(f"| {sym} | {q['last']} | {q['change_percentage']}% | {w_str} |")
      
          lines.extend(["", "---", "", "## 6. 财报倒计时", ""])
          if earnings:
              lines.append("| 标的 | 日期 | 倒计时 | 要听的信号 |")
              lines.append("|---|---|---:|---|")
              for e in earnings:
                  days = e["days_left"]
                  badge = f"{days} 天" if days >= 0 else f"刚过 {-days} 天(应已读电话会)"
                  lines.append(f"| {e['symbol']} | {e['date']} | {badge} | {e['note']} |")
          else:
              lines.append("近期无关键财报(窗口 -7 天 +∞)。")
      
          lines.extend([
              "",
              "---",
              "",
              "## 7. 不能自动测、要人工去看的(提醒)",
              "",
              "- **超大厂投资级债券利差**(需要 FRED / 第三方)—— 当前基线 +50-80bp。破 +100bp 预警,破 +150bp 触发清单 §11。手动查:FRED `BAMLC0A4CBBB` 或 IG 利差仪表盘。",
              "- **DRAM 杠杆 ETF AUM**(清单 §6 散户 FOMO 标记)—— 当前约 $XB(手动查 ETF issuer 页)。破 $5B 触发。",
              "- **Samsung/SK Hynix 新增消费级 DRAM 产能新闻**(清单 §1)—— 手动关注三星 / SK 海力士 capex announcement。",
              "- **超大厂 CFO 对 AI ROI 的措辞**(清单 §7,最毒)—— 关注 \"review pace of AI investment\" 类原话。",
              "",
              "---",
              "",
              "**数据源**: 长桥证券 · **Disclaimer**: ⚠️ 仅供参考,不构成投资建议",
          ])
      
          return "\n".join(lines) + "\n"
      
      
      def main():
          parser = argparse.ArgumentParser(description="Weekly market watch — pulls 4 key signals + market-temp.")
          parser.add_argument("--smoke", action="store_true", help="Connectivity self-test")
          parser.add_argument("--json", action="store_true", help="Output JSON envelope only")
          parser.add_argument("--no-write", action="store_true", help="Print markdown to stdout, do not write to journal/")
          parser.add_argument("--verbose", "-v", action="store_true")
          args = parser.parse_args()
      
          if args.smoke:
              try:
                  temp = market_temp_dict()
                  envelope = {"ok": True, "data": {"market_temp": temp}, "meta": {"smoke": True}}
                  print(json.dumps(envelope, ensure_ascii=False, indent=2))
                  sys.exit(0)
              except Exception as exc:
                  envelope = {"ok": False, "error": str(exc), "hint": "check `longbridge auth login` / network"}
                  print(json.dumps(envelope, ensure_ascii=False), file=sys.stderr)
                  sys.exit(1)
      
          try:
              if args.verbose:
                  print("[verbose] pulling market temp…", file=sys.stderr)
              temp = market_temp_dict()
      
              if args.verbose:
                  print(f"[verbose] pulling quotes for {len(ALL_SYMBOLS)} symbols…", file=sys.stderr)
              quotes = quotes_by_symbol(ALL_SYMBOLS)
      
              if args.verbose:
                  print("[verbose] computing weekly changes…", file=sys.stderr)
              weekly_changes = {}
              for sym in ALL_SYMBOLS:
                  try:
                      weekly_changes[sym] = week_change_pct(sym)
                  except Exception as exc:
                      if args.verbose:
                          print(f"[verbose] week_change {sym}: {exc}", file=sys.stderr)
                      weekly_changes[sym] = None
      
              if args.verbose:
                  print("[verbose] computing SPY 50d drawdown…", file=sys.stderr)
              try:
                  spy_dd, spy_50d_high = spy_drawdown_from_50d_high(quotes)
              except Exception as exc:
                  if args.verbose:
                      print(f"[verbose] spy_dd: {exc}", file=sys.stderr)
                  spy_dd, spy_50d_high = None, None
      
              flags = evaluate_thresholds(temp, quotes, weekly_changes, spy_dd)
              today = date.today()
              earnings = earnings_countdown(today)
              markdown = render_markdown(today, temp, quotes, weekly_changes, spy_dd, spy_50d_high, flags, earnings)
      
              out_path = None
              if not args.no_write:
                  JOURNAL_DIR.mkdir(parents=True, exist_ok=True)
                  out_path = JOURNAL_DIR / f"{today.isoformat()}-weekly-watch.md"
                  out_path.write_text(markdown, encoding="utf-8")
      
              if args.json:
                  envelope = {
                      "ok": True,
                      "data": {
                          "path": str(out_path) if out_path else None,
                          "flags": [{"tag": t, "msg": m} for t, m in flags],
                          "market_temp": temp,
                          "spy_drawdown_50d": spy_dd,
                          "earnings_upcoming": earnings,
                      },
                      "meta": {"date": today.isoformat(), "symbols": len(ALL_SYMBOLS)},
                  }
                  print(json.dumps(envelope, ensure_ascii=False, indent=2))
              elif args.no_write:
                  sys.stdout.write(markdown)
              else:
                  print(f"✓ wrote {out_path}")
                  print(f"  flags fired: {len(flags)}{' — ' + ', '.join(t for t,_ in flags) if flags else ''}")
      
          except Exception as exc:
              envelope = {"ok": False, "error": str(exc), "hint": "check `longbridge auth login` / network / API quota"}
              print(json.dumps(envelope, ensure_ascii=False), file=sys.stderr)
              sys.exit(1)
      
      
      if __name__ == "__main__":
          main()
      
  • templates
    • session-report.md 4 KB
      # Session Report — {{YYYY-MM-DD}}
      
      **Time zone**: ET · **Market**: {{US/HK/CN}} · **Theme**: {{e.g. 半导体 / AI / 存储}}
      **Watchlist**: {{SYM1, SYM2, ...}}
      
      ---
      
      ## 1. Pre-market (04:00–09:30 ET)
      
      | Symbol | Prev Close | Pre High | Pre Last | Pre Vol (M) | Vol % prev day | Δ% pre_high vs prev_close | Verdict |
      | ------ | ---------: | -------: | -------: | ----------: | -------------: | ------------------------: | ------- |
      
      > _Data source_: `longbridge quote <SYM> --format json` for pre_market_quote · `longbridge kline <SYM> --period day --count 5 --format json` for prev day full vol.
      
      **Exuberance flag**: {{YES / NO}}
      **Reason**: {{pre vol > 5% prev day **and** pre high > prev_close × 1.07 → expect fade test}}
      **Key news / catalysts**: {{trillion-dollar cap, earnings, etc.}}
      
      ---
      
      ## 2. Opening 30 min (09:30–10:00 ET)
      
      | Symbol | Open | Intra High | Intra Low | 10:00 Last | Pre High touched? | Δ% from open |
      | ------ | ---: | ---------: | --------: | ---------: | ----------------- | -----------: |
      
      **6-signal failed-breakout stack** — {{N}} / 6 fired:
      
      - [ ] Pre-market high NOT touched in cash within 30 min
      - [ ] New intraday high broke then price fell back below it
      - [ ] Volume did NOT expand at breakout
      - [ ] Sector ETF (SMH/SOXX) did NOT confirm green
      - [ ] Leader stock did NOT make new high
      - [ ] All 3 capital flow buckets net selling
      
      **Initial tier**: {{Tier 1 / 2 / 3 / 4}}
      **Initial thesis**: {{one-sentence}}
      
      ---
      
      ## 3. Intraday Thesis Revisions
      
      ### {{HH:MM ET}} — initial判
      
      - **Snapshot**: {{symbol: last, change%, intra high/low}}
      - **Triggers fired**: {{which of the 6}}
      - **Probabilities**: Bull {{X}}% / Base {{Y}}% / Bear {{Z}}%
      
      ### {{HH:MM ET}} — 修正 N
      
      - **Trigger of revision**: {{user said X / data showed Y}}
      - **What changed**: {{specific delta in price / vol / breadth}}
      - **New probabilities**: Bull {{X}}% / Base {{Y}}% / Bear {{Z}}%
      - **New tier**: {{...}}
      
      _(repeat per revision)_
      
      ---
      
      ## 4. Capital Flow (leader symbol = {{SYM}})
      
      | Bucket    |  In | Out | **Net** |
      | --------- | --: | --: | ------: |
      | Large     |     |     |         |
      | Medium    |     |     |         |
      | Small     |     |     |         |
      | **Total** |     |     |         |
      
      > _Units_: raw values from `longbridge capital <SYM> --format json` (Longbridge does not label units explicitly; empirically scale appears to be **千USD / $k**). Record both raw numbers and inferred unit; do not silently convert.
      > _Time series_: `longbridge capital <SYM> --flow --format json` for per-minute series.
      
      **3-bucket alignment**: {{ALL OUT / mixed / ALL IN}}
      **Outflow acceleration**: {{YES / NO — e.g. 13:38 −30k → 13:44 −47k per min}}
      
      ---
      
      ## 5. Cross-Asset Sentiment
      
      | Indicator      | Value |  Δ% | Interpretation |
      | -------------- | ----: | --: | -------------- |
      | QQQ.US         |       |     |                |
      | SPY.US         |       |     |                |
      | DIA.US         |       |     |                |
      | VXX.US         |       |     |                |
      | TLT.US         |       |     |                |
      | GLD.US         |       |     |                |
      | US market-temp |       |   — |                |
      
      **Diagnosis**: {{Rotation defensive / True risk-off / Isolated sector distribution / Bubble unwind}}
      
      ---
      
      ## 6. Close (16:00 ET)
      
      | Symbol | Open | High | Low | Close | Vol (M) | Daily K shape |
      | ------ | ---: | ---: | --: | ----: | ------: | ------------- |
      
      **Final tier**: {{Tier N}}
      **Day's narrative**: {{one paragraph — gap-up + fade / breakout confirmed / failed breakout / etc.}}
      
      ---
      
      ## 7. Outcome vs Thesis
      
      - **Initial Bull / Base / Bear**: {{X% / Y% / Z%}}
      - **Actual outcome**: matches {{Bull / Base / Bear}}
      - **Best revision**: revision N at HH:MM — what data triggered the right call
      - **Missed signals**: {{any signals you read wrong}}
      
      ---
      
      ## 8. Lessons
      
      - {{one to three takeaways}}
      
      ---
      
      **Sources**: 长桥证券 / Longbridge Securities
      **Disclaimer**: ⚠️ 仅供参考,不构成投资建议 / For reference only, not investment advice.
      
  • SKILL.md 5.9 KB
    ---
    name: market-session-tracker
    description: Use when monitoring stocks/ETFs/indices across pre-market, open, intraday, or close — especially when the user is reading session action live and may revise their take as it unfolds. Triggers include 盘前/盘中/收盘 sessions, multi-symbol watchlists (e.g. MU/TSM/SMH semi tracking), user observations like "突破"/"冲高"/"回调"/"假突破", capital flow checks, market temperature checks, semi/AI/memory plays, and any request that bundles a position context with a live read.
    ---
    
    # Market Session Tracker
    
    Real-time US-market analysis pattern. Sits on top of `longbridge-quote`, `longbridge-kline`, `longbridge-capital-flow`, `longbridge-market-temp` — adds orchestration, breakout verification, distribution detection, tier classification, and revision discipline.
    
    ## Standard symbol sets
    
    | Theme          | Symbols                                                                  |
    | -------------- | ------------------------------------------------------------------------ |
    | Semi / memory  | `MU.US`, `TSM.US`, `DRAM.US` (Roundhill Memory ETF), `SMH.US`, `SOXX.US` |
    | Indices        | `QQQ.US`, `SPY.US`, `DIA.US`, `IWM.US`                                   |
    | Vol / risk-off | `VXX.US`, `UVXY.US`, `TLT.US`, `GLD.US`                                  |
    
    `.SOX.US` is unavailable on Longbridge — use `SMH`/`SOXX` ETF proxies.
    
    ## Seven protocols
    
    **0. Trump-feed sweep (pre-cash)** — before any pre-market read, run `python3 .claude/skills/trump-truth-monitor/scripts/fetch.py --hours 14`. Any `high`-tier post touching watchlist sectors (tariff_trade / semi_tech / energy / fed_macro / geopolitical) goes into the session report as a candidate explanation for any gap, **before** running quote-based exuberance math. Skip when the watchlist has no policy-exposed names. See `trump-truth-monitor` skill for tier grading.
    
    **1. Pre-market verification** — compute pre vol % of prev day full vol, and pre high % over `prev_close`. Flag **exuberance** when pre vol > 5% of prev day **and** pre high > `prev_close × 1.07`.
    
    **2. Failed-breakout 6-signal stack** — count how many fire in the cash session:
    
    1. Pre-market high NOT touched in first 30 min of cash
    2. New intraday high breaks → price falls back below the broken level within minutes
    3. Volume does NOT expand at the breakout
    4. Sector ETF (`SMH`/`SOXX`) does NOT confirm by going green
    5. Leader stock (MU for memory; TSM for foundry; NVDA for AI) does NOT make new high
    6. Capital flow: all 3 buckets net selling
    
    **≥ 4 signals fired = failed breakout / distribution.** Name the tier (§5).
    
    **3. Capital flow triple-bucket** — `longbridge capital <SYM> --format json`. Net = `capital_in − capital_out` for each of large / medium / small. **All 3 net out = textbook distribution.** Use `--flow` for accelerating-outflow detection.
    
    **4. Cross-asset sentiment matrix**
    
    | Pattern                               | Interpretation                          |
    | ------------------------------------- | --------------------------------------- |
    | DIA > SPY > QQQ + VXX down            | Rotation (defensive), **not panic**     |
    | VXX up + GLD up + TLT up              | **True risk-off**                       |
    | Sector red + SPY flat + VXX down      | **Isolated** distribution               |
    | HK/CN valuation ≥ 80 + sentiment ≤ 35 | Known-bubble (overvalued, retail knows) |
    
    **5. Pullback tier classification**
    
    | Tier       | Triggers                                   |
    | ---------- | ------------------------------------------ |
    | 1 震荡     | Stock −2% from intraday high; closes green |
    | 2 实质回调 | Stock −5% from peak; sector ETF turns red  |
    | 3 板块下跌 | Sector −3%+; broad indices flat-to-red     |
    | 4 风险传染 | SPY −1%+; VXX +5%+; defensives also fall   |
    
    Always **name the tier explicitly** — never vague "weakening".
    
    **6. Scenario probabilities** — always 3 scenarios (Bull / Base / Bear) with explicit % (sum=100) and trigger conditions. Mark probabilities as subjective. **Revise as data flows** with timestamps: `09:30 初判 → 09:54 修正 → 09:56 再修正`.
    
    **7. Thesis revision discipline** — when user says "突破"/"冲高"/"回调":
    
    1. Re-pull live quote + intraday minute tail — do NOT auto-agree
    2. Check cash intraday high vs **pre-market high** vs prior intraday high
    3. Distinguish: **true breakout** (new high > pre high, holds 5+ min) vs **partial** (breaks prior intra high but not pre high) vs **recovery** (only bounces from intra low)
    4. If data contradicts user, **disagree with evidence**
    
    ## Output format (each snapshot)
    
    - **Time (ET)** — always
    - **Symbol table** — last, change%, intra high/low, vs pre high, vol
    - **Key signal** (one sentence)
    - **Tier** (if pullback context)
    - **Next watch levels** (explicit prices, not "around X")
    - **Source**: 长桥证券 · **Disclaimer**: ⚠️ 仅供参考,不构成投资建议
    
    ## Session report logging
    
    After a session, write a structured log using **`templates/session-report.md`** in this skill. Default path: `~/git/trade/journal/YYYY-MM-DD-<theme>.md` (a dedicated git repo; `journal/` avoids the `logs` global-gitignore collision). Captures pre-market verdict, opening behavior, tier evolution, thesis revisions, capital flow, cross-asset sentiment, end-of-day outcome, and lessons.
    
    ## Optional: position context
    
    When user provides positions or asks via `longbridge positions`:
    
    - Show symbol, qty, avg cost, current price, unrealized P&L, % of book
    - Cross-reference which positions are exposed to the current move
    - **Do NOT recommend buy/sell** — defer to user
    
    ## Anti-patterns
    
    - ❌ Auto-confirming user's directional read (re-pull data first)
    - ❌ Calling a cash bounce a "breakout" without checking pre-market high
    - ❌ Single-point price prediction (use 3 scenarios)
    - ❌ Vague "weak/strong" — use tier classification
    - ❌ Conflating sector weakness with systemic (check VXX/GLD/SPY)
    - ❌ Calling trend in first 5 min (wait for 30-min K)
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related