BTC single 5min candlestick direction + close price prediction. Hybrid engine + LLM architecture. SKILL.md is the index, see details in
references/。 v5.9 cognitive shift: from "13-factor predictor" → "3-signal mispricing detector" — direction accuracy is not the edge,EV = p − P − 成本is (see adversarial review report) v6.0 execution shift: direction changed from "body continuation statistics" tosingle-vote decision by true OFI net flow — the bet is on the flow-gap where "net flow has already happened, token price has not yet priced it in"
⚠️ Easily confused with same-name: this skill only does BTC single-instrument 5min direction + prediction market EV. For full-market perpetual price-volume breakout scanning, use
coin-vp-scanner— for the difference between the two see below and coin-vp-scanner's division of labor。
Trigger
5minbtc / 5min btc / btc 5min / 监控 (with continuous monitoring)
When to use
| Scenario | Approach |
|---|---|
| Current 5min candlestick direction + price level | ✅ Standard procedure, direction=OFI net flow, edge=mispricing EV (v5.8 zero-lookahead backtest 61.4% is continuation, not alpha, see performance snapshot) |
| Continuous in-session monitoring, wait for clear signal | ✅ Monitor mode (scripts/5minbtc-monitor.py + Monitor tool) |
| Binance prediction market Up/Down 5m trading | ✅ paper simulation/real-time monitoring (see prediction market strategy) |
| "Will BTC rise or fall tonight" (wide window) | ⚠️ Run current candlestick + give directional lean, annotate "outside engine confidence interval" |
| "Next candlestick" / "in 1 hour" | Guide user to trigger again at that candlestick's start time |
Monitor mode (Claude Code)
See details in monitoring-claude-code.md
# 无限持续, 直到用户喊停 (会话内盯盘推荐)
Monitor(command: "python3 <SKILL>/scripts/5minbtc-monitor.py --max-runs 0", persistent: true)
# 默认 20 次采样 (约 40 分钟)
python3 <SKILL>/scripts/5minbtc-monitor.py
# 单次判断 (非持续)
python3 <SKILL>/scripts/5minbtc-monitor.py --dry-run
- Clear signal = bias non-neutral + strength∈{medium,moderate,strong} + conf≥50 → auto-stop
(⚠️ measured engine strength output
medium, the decision set must also includemediumandmoderate) - Sample at minute 2/3 of each candle (progress ~40-70%), earlier than cron's minute 4
- Event stream:
START/DIR-CHANGE/CLEAR-SIGNAL/ENGINE-ERR/MAX-RUNS - Stop: user says "stop/end" →
TaskStopstop Monitor CLEAR-SIGNALmust pull a full engine snapshot for secondary confirmation- Engine verification:
python3 scripts/test_engine.py(13 items, self-contained runner no pytest needed; for slow tests add--slow) — if pytest is installed can alsopython3 -m pytest scripts/test_engine.py -v(original filenametest_engine_v58.pyhad a version number, drifted once engine upgraded to v6.0, changed on 2026-09-10 to no version number)
Quick start
SKILL_DIR=/home/aa/.hermes/profiles/cqo/skills/5minbtc
# 1. 并行: 引擎 + 新闻 + settle (前一根)
python3 $SKILL_DIR/5minbtc-log.py settle-all 2>&1
python3 $SKILL_DIR/5minbtc-engine-v6.0.py 2>&1
python3 $SKILL_DIR/5minbtc-news.py 2>&1
# 2. 3 路 web_search (并行)
# "Bitcoin BTC breaking news price" / "crypto market macro stocks today" / "比特币 BTC 最新 晚间"
# 3. LLM 分析 → 输出 (见 output-template.md)
# 4. 写日志
python3 $SKILL_DIR/5minbtc-log.py log \
"<candle.iso>" <pred_close> <pred_high> <pred_low> \
<conf> <bias> <news_sent> <vol_pct>
Architecture (1 line/component)
- Engine
5minbtc-engine-v6.0.py(v6.0, output"version": "6.0.0"): bias decided by single vote from true OFI net flow (ofi_n>0→bull / <0→bear, binary choice with no neutral; if ofi_n missing/is 0 fall back to body sign and markmeta.body_fallback) + probabilityP(close>open|ofi)Three layers (empirical calibration table Bayesian shrink + flow-gap + last 60s flow) + three independent filters (multi-timeframe 4h/1h/15m structure + cross-asset ETH/SOL breadth + WS OFI freshness reversal protection) + 9-way parallel HTTP- ⚠️ Probabilities are unreliable during the K-line opening phase(known issue, see pitfalls): main source
ofi_n = 2*(tb/v)−1is taken fromcurrently in progressK-line,_ofi_native()only blocksv<=0、no minimum sample size protection → a small amount of volume in the first few seconds of the opening can push ofi_n to ±0.9. Andvol_gate(L692 judges byMIN_VOL_FRAC=0.25whether flow is sufficient)is computed but never participates in any decision, it is just a decorative field in the output.Recommended to trust probability/place orders only after progress ≥40% - Threshold:
T_OFI_GATE=0.20/T_OFI_60=0.35/ WS quality gateOFI_CR_MIN=0.80/OFI_BAYES_N=30 - The 13 factors are still computed and output(JSON contract preserved), but since v6.0do not participate in bias decisions — score is only used for
strengthlabels and LLM reference
- ⚠️ Probabilities are unreliable during the K-line opening phase(known issue, see pitfalls): main source
- Order flow
scripts/ofi_feed.py: trade+bookTicker combined stream tick-rule inference of active buy/sell, writes~/bb-auto/ofi.json, with ts freshness (>30s the engine degrades to trusting only the REST main source) (launchd: com.daniel.ofi-feed) - Logs
5minbtc-log.py: jsonl append + incremental settle (written to logs/) - News
5minbtc-news.py: CoinDesk RSS (the only stable source, ~14min delay) - Resident process (launchd):
5minbtc_realtime.py(5s refresh, prediction snapshot + EV order placement) /5minbtc_watch.py/5minbtc_trader.py --paper-monitor - LLM: factor scoring benchmark + LLM comprehensive judgment + template output
Iron rules
- The engine script must be re-executed every time — no caching
- Must re-search 3 groups of news every time
- First settle the previous candle, then log the new prediction
- The LLM may fine-tune the engine's
pred_close/range, but must state the reason ⚠️ bias should not be overridden lightly (v6.0): the direction is decided by a single OFI vote; the LLM using factors/news to flip the direction = retreating to the disproven path. Only whenmeta.body_fallback=Trueor OFI data is missing is it allowed to change bias, and the reason must be explicitly stated. - Output 15-25 lines (balancing depth and Telegram readability)
Key decision rules (⚠️ historical rules: v5.7.x factor scoring path)
Since v6.0 bias is decided by a single true OFI vote; the following rules no longer determine direction. They still have reference value only on the two fallback paths: ①
meta.body_fallback=True(ofi_n missing/0, direction falls back to the body sign) ② when the LLM reviews, explainmetaconflicting fields. The engine'sraw scoreis still output, but only affectsstrengthlabels, not bias.
- half_body vs imbalance conflict (v5.7.2): |half_body|>0.25 + |imbalance|>0.5 + progress≥45% → prioritize half_body (note: both weights have been zeroed since v5.9)
- TREND strong trend decel constraint (v5.7.4): when EMA delta>$100, |decel|>0.7 requires |half_body|>0.15 confirmation in the same direction
- fatigue≥0.8: conf cap 40, reverse +10pp
- chainlink_offset contradiction: bias=bull but pred_close<current → use current as anchor ±ATR×0.3
- Extreme progress (>80%): pred_close scaled proportionally to remaining time
- Body=0 continuous mode: pred_close → current ± ATR×0.2, conf drops to 35-42%
Performance snapshot (updated 2026-09-10)
The figures are based on the Adversarial review report — most old figures contain look-ahead bias.
- v5.7 backtest 71.2% contains look-ahead bias(marked "known" in the file itself); zero-look-ahead v5.8: first 2 1min=61.4%, first 4=69.5%
- But 61-70% is the continuity of "confirming only after watching the K-line finish", not alpha — market makers have already priced it into the token price
- Real baseline after removing the fluff: non-neutral direction 57.7% | bull 63.9% (the only significant one) | bear 50.0% = pure coin flip
- paper trading: full-sample UP fills 44% (+$0.24) | sweet spot UP ask 0.40-0.50 → 60% (+$1.39) ← the only positive-EV range
- Conclusion: the edge is not in whether the direction is right, it is in
EV = p − P − 成本 > 0. v6.0's mispricing detection (flow-gap) does exactly this directly. - Current LLM:
zai/glm-5.2(8-15s/run) | opencaio measured MiniMax-M3 at ~2.7s as a faster option
📚 Citation index (references/)
Core methodology
- strategy-adversarial-review.md — Adversarial review report: first principles + 13-factor falsification + what to keep/delete/missing + P0/P1/P2 action list (v5.9 basis)
- lessons.md — 25 core lessons (must-read, includes 23-25 added 2026-07-05)
- pitfalls.md — Centralized index of 20 pitfalls (must-read, includes the parallel max() evaluation pitfall; #18 = K-line opening probability is unreliable; #19 = "true OFI" only covers a single market; #20 = endpoint failure causes silent gaps)
- changelog.md — detailed changes from v5.0 ~ v6.0
- skill-organization.md — Skill file structure pattern (reusable) — SKILL.md INDEX + references/ split by topic
Execution and output
- execution.md — complete execution steps + iron rules + wide-window handling
- output-template.md — LLM output template + adjudication rules
- monitoring-claude-code.md — Monitoring mode: Monitor tool integration + event protocol
- telegram-push-monitor.md — Telegram push daemon: watch sampling cadence/event types/recording and settlement/launchd persistence
- prediction-trading-cli.md — Binance prediction trading CLI: 5minbtc_trader.py usage/parameters/security contract/API endpoints (including --paper/--paper-monitor simulation)
- prediction-market-strategy.md — Prediction market profit strategy: EV=p−P, price gating, Kelly position sizing, paper simulation
Data sources & network
- news-sources.md — news source evaluation (after cleanup only CoinDesk remains)
- binance-api-geo.md — Binance endpoint regional issues
- binance-endpoint-flapping.md — endpoint bidirectional failover
- high-latency-network-handling.md — high-latency network handling (SSL timeout)
One each for Binance's three failure modes (431/451 regional, tunnel jitter, high-latency SSL timeout),not duplicate documentation, see setup-from-scratch.md §6。
Engine-specific
- cron-llm-provider-failure.md — Cron LLM Provider failure diagnosis (including job list §8) + version sync rules
Backtesting & review
- backtest-findings.md — 365-day backtest in-depth review + factors have no predictive power
- backtest-v58-1min-findings.md — v5.8 real 1min half-K-line backtest
- review-procedure.md — daily review process + data quality check
Data collection & repository
- sync-procedure.md — AGI-Super-Team sync process (path mapping +
-cValidation + logs archival policy) - archive.md — Version archival: v5.0→v6.0 evolution + which versions are no longer retrievable + archival SOP
- setup-from-scratch.md — Build from scratch: dependencies/directories/keys/6 launchd services/validation checklist/log rotation/troubleshooting table
- scheduled-tasks.md — System-level scheduled task tutorial: resident vs scheduled / 2 tasks / launchd+cc-connect+hermes three routes / plist template / 13 pitfalls
- quant-knowledge-index.md — 50-round distillation knowledge base index
Retrospective records
⚠️ reviews/ directory does not exist locally —— The early file tree claimed there were 23 monthly-archived retrospective records (2026-05/06/07), but they were never actually written to disk.
The retrospective conclusions are currently scattered across lessons.md、pitfalls.md、
strategy-adversarial-review.md and reports/ .
To restore this habit, you first need to add the disk-writing step for review-procedure.md , don't just declare it in the docs.
Report library
14 in-depth distillation reports in the reports/ directory (also synced in AGI-Super-Team): R01-R14.
Division of labor with coin-vp-scanner
Both are trading-type skills, but they don't bet on the same thing, don't mix them up:
| 5minbtc (this skill) | coin-vp-scanner | |
|---|---|---|
| Instrument | Single instrument BTC | All Binance USDT perpetuals |
| Timeframe | Single 5min candle | 1–30min short-term |
| Core logic | True OFI net flow + mispricing detection (net flow has occurred, token price not yet priced → flow-gap) | Deterministic structural breakout (volume surge + strong body + close breaks 1h structural level + trend in same direction, all four ✓) |
| Decision basis | Probability P(close>open|ofi) vs market token price → EV = p − P |
Structural rule boolean determination, not probabilistic |
| Output | Direction bull/bear + probability + edge | Leverage / TP / SL trading card |
| Execution method | Prediction market Up/Down token, paper only (LIVE_GATE hard gate) |
Direct contract short-term trading |
| Code location | This directory is self-contained (engine+scripts+launchd) | Code is in ~/projects/coin-vp-scanner/, this skill is only an index |
One-line selection: To bet that "the market priced it wrong" → 5minbtc; to catch "price broke down/up on volume" → coin-vp-scanner.
Repository sync
See sync-procedure.md. Brief:
rsync -av --exclude='data/' --exclude='__pycache__/' \
--exclude='*.jsonl' --exclude='*.jsonl.*' --exclude='*.gz' \
/home/aa/.hermes/profiles/cqo/skills/5minbtc/ \
/home/aa/clawd/repos/AGI-Super-Team/skills/5minbtc/
cd /home/aa/clawd/repos/AGI-Super-Team
git add skills/5minbtc/ && git commit -m "sync(skills/5minbtc): <版本>" && git push origin main
Backtesting system
backtest/
├── fetch_data.py # Binance 历史数据下载
├── run_backtest.py # v5.6 回测 (因子无预测力, 公平回测)
├── run_backtest_v57.py # v5.7 回测 (含前视偏差, 已知)
├── run_backtest_v58.py # v5.8 回测 (真实 1min 半 K线, 零前视) ← 推荐
├── run.sh # 一键运行
├── data/ # 5min (105K) + 1min (259K) K线
└── results/ # 回测结果 (gitignore)
File structure
5minbtc/
├── SKILL.md # 本文件 (~170 行 INDEX)
├── 5minbtc-engine-v6.0.py # 主引擎 (v6.0 真OFI 一票定方向, launchd 调用)
├── 5minbtc-news.py # 新闻扫描 (CoinDesk RSS, 唯一稳定源)
├── 5minbtc-log.py # 日志记录 (写入 logs/)
├── logs/ # 日志 (当月 live + 历史按月压缩)
│ ├── 5minbtc-log.jsonl # 当月 live (不入库)
│ └── archive/*.jsonl.gz # 月度压缩归档 (入库, 见 archive.md)
├── references/ # 24 份专项 ref (含 skill-organization 模式)
├── backtest/ # 回测系统 (results/ 不入库)
├── data/ # 运行时 (news-risk-level.json 等)
├── scripts/ # 复盘/监控/交易脚本
│ ├── 5minbtc-monitor.py # ★ 监控脚本 (Claude Code Monitor 集成, v1.0)
│ ├── 5minbtc_watch.py # ★ Telegram 推送监控 daemon (事件驱动+预测记录+收盘结算)
│ ├── 5minbtc_day_stats.py # 预测战绩查询 (今日/历史, --push 推送)
│ ├── 5minbtc_trader.py # ★ 币安预测交易桥接 (--once/--loop/--monitor/--paper/--paper-monitor)
│ ├── prediction_ws_feed.py # 币安 w3w-prediction WS 实时价源 (<200ms)
│ ├── ofi_feed.py # ★ 真订单流采集 (trade+bookTicker, launchd com.daniel.ofi-feed)
│ ├── 5minbtc_keyless_paper.py # 免密钥模拟盘 (公开BTC数据模拟UP/DOWN价)
│ ├── telegram_push.py # 通用 Telegram 推送助手
│ ├── daily-review-stats.py
│ └── fetch-github-repo.sh
⚠️
archive/directory andreviews/directory do not exist locally —— In the file tree of an early version of this document, it claimed they existed (and also listed 23 retrospectives), which is a documentation/reality drift; it has been corrected to the actual structure above:
- Old version engine source codeis not kept locally, only textual archives remain → references/archive.md
- Daily retrospectives were never written to disk in
reviews/, retrospective conclusions are scattered inreferences/lessons.md/pitfalls.mdandreports/
Last updated: 2026-09-10 — engine v5.7→v6.0 Rename (align files/SKILL/references across the board, fix the outdated "no neutral" comment in the engine) + bump SKILL.md version to 6.0.0 + change the performance snapshot to the honest post-review framing + add v5.9/v5.10/v6.0 changelog + add a division-of-labor note with coin-vp-scanner + Fix the unclosed code block in the file tree and archive//reviews/ fake directory declaration + add archive.md and setup-from-scratch.md + monthly compressed log archive committed to the repo