OpenClaw
一套面向个人投资者的美股期权策略引擎。扫描器执行全量规则过滤,AI 策略副官完成叙事解读与信号排序,飞书 / Telegram 双推,人工在 IBKR 最终下单。
A US-options strategy engine for individual investors. The scanner runs full rule filtering; the AI Adjutant ranks signals and narrates market context; Lark / Telegram dual-push; human final execution in IBKR.
openclaw_scan.py
期权链扫描 · 规则过滤 · 输出紧凑 JSON。系统的数据与规则层,决定"哪些标的今天值得看"。
Options chain scanning · rule filtering · compact JSON output. The data and rules layer deciding "which tickers are worth considering today."
openclaw_analyze.py
AI 决策端。读入扫描 JSON,Python 层预处理后送 LLM,输出策略报告 + 飞书推送卡片。
AI decision layer. Reads scan JSON, Python pre-processes, sends to LLM, outputs strategy report + Lark push card.
openclaw_pipeline.py
编排器。串联 Scanner 和 Analyzer,管理双消息推送、历史归档、降级兜底、文件清理。
Orchestrator. Chains Scanner and Analyzer, manages dual-message push, history archiving, graceful degradation, file cleanup.
- 从 stdin 或
--scan-file读取扫描 JSON(支持历史回放) - Reads scan JSON from stdin or
--scan-file(historical replay supported) - 生成消息 1(今日商机报告)→ 归档元数据 → 推送消息 1(间隔 1.5s 防限流)
- Generate Msg 1 (today's opportunity report) → archive metadata → push Msg 1 (1.5s gap to avoid rate limit)
- 加载近 14 天历史 → 生成消息 2(AI 时序分析)→ AI 失败降级为数值对比 fallback
- Load 14-day history → generate Msg 2 (AI trend analysis) → fallback to numeric comparison on AI failure
cleanup_old_files清理超过保留期的归档文件(默认 730 天)cleanup_old_filespurges archives beyond retention window (default 730 days)
--margin-used 传入当前使用率(%);≥ 55% 时禁止新开仓。未传入时由 Flex EOD 数据估算;仍缺失则跳过并标注需人工确认。--margin-used (%); ≥ 55% blocks new positions. If absent, estimated from Flex EOD data; still missing → gate skipped and flagged for manual confirmation.m.gate_score 供 AI 解读。m.gate_score for AI reference.跳过原因编码(Skip Codes)
Skip Codes
gld_vix_gate
VIX < 22 时禁止开 GLD 的 Put;VIX > 22 或地缘事件触发才允许。VIX < 18 绝对禁止。
Put on GLD blocked when VIX < 22; allowed only when VIX > 22 or geo-event triggered. VIX < 18 is absolute prohibition.
btc_above_ma50
COIN / HOOD 等加密标的要求 BTC 收盘价在 50 日均线上方,否则阻断信号输出。
Crypto-linked tickers (COIN / HOOD etc.) require BTC closing above its 50-day MA, otherwise signal blocked.
btc_drop_8_block
BTC 当日跌幅超 8% 时立即阻断 HOOD 等加密相关标的,防止在极端行情下开仓。
BTC single-day drop >8% immediately blocks HOOD and crypto-adjacent tickers to avoid opening in panic conditions.
require_above_ma200
TSLA 等标的要求股价在 200 日均线上方;跌破则阻断信号,降低趋势做空风险。
Tickers like TSLA require price above 200-day MA. Break below blocks the signal to reduce shorting into a downtrend.
oi_min_5000
CRCL / HOOD 等新标的要求候选合约中至少一个 OI ≥ 5000,确保流动性充足。
New tickers (CRCL / HOOD etc.) require at least one candidate contract with OI ≥ 5,000 to ensure adequate liquidity.
crypto_bucket_cap_4pct
IBIT / COIN / MSTR / HOOD / CRCL / MARA 合计名义暴露不超过账户净值 4%。
IBIT / COIN / MSTR / HOOD / CRCL / MARA combined notional exposure capped at 4% of account NLV.
- VIX / Gate / 信号密度 → 今日整体可交易性判断
- VIX / Gate / signal density → today's overall tradability
- 跨信号比较,综合年化 · 层级 · 相关性排序
- Cross-signal comparison, ranking by yield · tier · correlation
- 战术节奏:VIX 25-30 → 缩量 ×0.7;加密重叠 → 只选一个
- Tactical cadence: VIX 25-30 → scale ×0.7; crypto overlap → pick one only
- 边缘观察:IVR 差 2 点未触发 · 财报后解锁队列
- Near-miss watch: IVR 2 pts short · post-earnings unlock queue
- 信号密度方向与 VIX 走向相关性分析
- Signal density direction vs. VIX trend correlation
- 账户演变:NLV 曲线 · Put 名义占比动态
- Account evolution: NLV curve · Put notional % dynamics
- 异常模式:连续 0 信号 · 板块聚集 · 财报密集期
- Anomaly patterns: consecutive zero-signal days · sector clustering · earnings-dense periods
- temperature=0.5,描述现象,不直接改阈值建议
- temperature=0.5, describes phenomena without directly suggesting threshold changes
snapshot · market_narrative · ranked_signalstactical · stress_lite · portfolio_greeks_comment- ranked_signals 写回 signals_archive.jsonl 供时序引用
- ranked_signals written back to signals_archive.jsonl for trend reference
- 思维链 <think>...</think> 引导分析后剥离,不污染报告
- Chain-of-thought <think>...</think> guides analysis then stripped from report
- 第1轮:生成问题清单(DTE / Delta 扩大 / Vega 方向)
- Round 1: Generate question list (DTE / delta expansion / Vega direction)
- 第2轮:逐一深度建议,输出 positions_to_watch
- Round 2: Deep suggestions per question, outputs positions_to_watch
- 组合 Greeks:Delta / Vega 方向 + 行业集中度分析
- Portfolio Greeks: Delta/Vega direction + sector concentration analysis
- 接货超 $60K → 标注 NRA 遗产税红线警告
- Assignment >$60K → flags NRA estate tax red-line warning
| 层级 | Tier | 典型标的 | Examples | IVR 门槛 | IVR Min | 年化最低 | Min Yield | 财报窗口 | Earnings Block | 结构要求 | Structure |
|---|---|---|---|---|---|---|---|---|---|---|---|
| A+ | A+ | SPY · QQQ · EWJ · IWM | 25-30% | 25-30% | 8-10% | 8-10% | 无(ETF) | None (ETF) | CSP / Spread | CSP / Spread | |
| A | A | AAPL · MSFT · MA · JPM · LLY | 30-45% | 30-45% | 10-13% | 10-13% | 前 7-10 天 | T-7 to T-10 | CSP · Wheel | CSP · Wheel | |
| B | B | GLD · V · XLU · COST · LMT | 26-38% | 26-38% | 7-12% | 7-12% | 前 10 天 | T-10 | CSP | CSP | |
| C | C | META · NVDA · TSLA · COIN · AMD | 55-85% | 55-85% | 15-25% | 15-25% | 前 14 天 | T-14 | 强制 Bull Put Spread | Mandatory Bull Put Spread | |
| D | D | TSLA · COIN · SMCI · HOOD | 65-80% | 65-80% | 15% | 15% | 前 14 天 | T-14 | Spread 宽 $15-30 | Spread width $15-30 | |
20tickers 模式下扫描,安全垫须达 22-24%。
C/D tier tickers have hard lot caps: MSTR ≤ 1, TSLA ≤ 2. D-tier tickers only scanned in 20tickers mode; safety cushion must be 22-24%.
✓ 适合的用户
✓ Good Fit
- 已有卖 Put / Wheel / CSP 实盘经验,理解期权基本原理
- Prior live experience with selling puts / Wheel / CSP; understands options fundamentals
- IBKR Portfolio Margin 账户,净值建议 $100K+
- IBKR Portfolio Margin account, NLV recommended $100K+
- 希望将"选标的·看时机"系统化,同时保留人工下单决策权
- Wants to systematize ticker selection and timing while retaining manual order authority
- 能自行配置 Python 环境、.env 文件、API Key 和 cron 调度
- Can self-configure Python env, .env files, API keys, and cron scheduling
- 规则不稳定的执行者:希望把"这次要不要例外"变成硬规则
- Inconsistent rule followers who want "should I make an exception this time" removed from the decision
- 多标的覆盖但精力有限:每天花 5-10 分钟审阅后下单
- Multi-ticker coverage with limited time: 5-10 min daily review before ordering
✕ 不适合的用户
✕ Poor Fit
- 期待系统自动下单、不需要人工介入
- Expects auto-execution with no human involvement
- 不理解期权原理,只想跟信号"照单执行"
- Doesn't understand options mechanics; just wants to copy signals blindly
- 账户资金过小($20K 以下,一手 CSP 就撑满比例)
- Account too small (below $20K — one CSP contract fills the notional cap)
- 无法自行部署 Python 脚本和配置环境变量
- Cannot self-deploy Python scripts or configure environment variables
- 期望系统帮助做多头 / 买 Call 等方向性策略
- Wants help with long-side / buy-call directional strategies
- 对延迟行情不可接受(CBOE Delayed 存在数分钟延迟)
- Cannot tolerate delayed quotes (CBOE Delayed has a few-minute lag)
运行时 / 依赖
Runtime / Dependencies
- Python 3.11+
requests · pandas · numpyyfinance · ib_insync- SQLite
iv_history.db(IVR 历史) - SQLite
iv_history.db(IVR history)
LLM 接口
LLM Interface
- OpenAI 兼容接口(可替换)
- OpenAI-compatible API (swappable)
- 主模型 + 逗号分隔 fallback 列表
- Primary model + comma-separated fallback list
- DeepSeek / GPT / Claude 等均可
- DeepSeek / GPT / Claude all compatible
期权数据链
Options Data Chain
- IBKR Gateway(首选)
- CBOE Delayed(次选)
- Alpaca Paper → Tradier
- yfinance(最终回退)
账户集成
Account Integration
- IBKR Flex EOD Report
- NLV · 持仓暴露 · Put 名义
- NLV · position exposure · put notional
- 加密池占比 · 饱和度检查
- Crypto bucket % · saturation check
通知推送
Push Notifications
- 飞书 interactive 卡片(lark_md)
- Lark interactive card (lark_md)
- Telegram Bot API
- Bark iOS Push
- AI 失败 → 原始摘要降级
- AI fail → raw summary fallback
并发 & 存储
Concurrency & Storage
- ThreadPoolExecutor(默认 2 线程)
- ThreadPoolExecutor (default 2 threads)
- scan_history 目录归档元数据
- scan_history directory archives metadata
- signals_archive.jsonl 时序数据
- signals_archive.jsonl for time-series data
- 默认保留 730 天,自动清理
- Default 730-day retention, auto-purge
.env 环境变量(LLM Key · Tradier · Finnhub · 飞书 Webhook),在 Python 环境中运行,通过 cron 定时调度。支持 --scope full 全量和 --scope 20tickers 精选两种扫描模式。
Deployment: Configure .env variables (LLM Key · Tradier · Finnhub · Lark Webhook), run in Python environment, schedule via cron. Supports --scope full (all tickers) and --scope 20tickers (curated) scan modes.
"规则引擎负责纪律,AI 负责叙事,人类负责决定。三者各司其职,才是可以长期运行的系统。"
"The rules engine owns discipline. The AI owns narrative. The human owns the decision. Each in its lane — that's a system that runs indefinitely."
本文档仅作系统功能介绍,不构成任何投资建议。期权交易存在本金全部损失的重大风险。过往信号统计不代表未来收益。交易者须自行评估风险承受能力,并对一切投资决策承担完全责任。 This document is for system feature presentation only and does not constitute investment advice. Options trading involves substantial risk of total capital loss. Past signal statistics do not represent future returns. Traders must independently assess their own risk tolerance and bear full responsibility for all investment decisions.
OpenClaw v4.4 · 2025 · Private Use Only