# digital-oracle

Adopt this skill: https://proskills.md/skills/other/komako-workshop-digital-oracle

Page: https://proskills.md/skills/other/komako-workshop-digital-oracle
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: SKILL.md
size: 8069
upstream: https://github.com/komako-workshop/digital-oracle/blob/HEAD/SKILL.md

```text
---
name: digital-oracle
version: 1.0.3
description: "Answer prediction questions using market trading data, not opinions. Use when the user asks probability questions about geopolitics, economics, markets, industries, or any topic where real money is being traded on the outcome. Examples: 'What's the probability of WW3?', 'Will there be a recession?', 'Is AI in a bubble?', 'When will the Russia-Ukraine war end?', 'Is it a good time to buy gold?', 'Will SPY drop 5% this month?', 'Is NVDA options premium overpriced?'. The skill reads prices from prediction markets, commodities, equities, options chains, derivatives, yield curves, and currencies, then cross-validates multiple signals to produce a structured probability report."
metadata: { "openclaw": { "emoji": "📈", "requires": { "bins": ["uv"] } } }
---

# digital-oracle

> Markets are efficient. Price contains all public information. Reading price = reading market consensus.

## Methodology

**Answer questions using only market trading data — no news, opinions, or statistical reports as causal evidence.** If something is true, some market has already priced it in.

Five iron rules:

1. **Trading data only** — prices, volume, open interest, spreads, premiums. Never cite analyst opinions.
2. **Explicit reasoning from price to judgment** — explain clearly "why this price answers this question."
3. **Multi-signal cross-validation** — never conclude from a single signal. At least 3 independent dimensions.
4. **Label the time horizon of each signal** — options price 3 months, equipment orders price 3 years — don't mix them in the same vote.
5. **Structured output** — the final report must follow the Step 5 template: layered signal tables → contradiction analysis → probability scenarios → signal consistency assessment. Do not substitute prose for structured reporting.

## Workflow

### Step 1: Understand the question

Decompose the user's question into:
- **Core variable**: What event or trend?
- **Time window**: Is the user asking about 3 months, 1 year, or 5 years?
- **Priceability**: Is there real money being traded on this outcome?

### Step 2: Select signals

Based on question type, select from the signal menu below. **Don't use just one category — cover at least 3.**

#### Geopolitical conflict / War risk
- Polymarket: Search for related event contracts (ceasefire, invasion, regime change, declaration of war)
- Kalshi: Search for related binary contracts
- Safe-haven assets: Gold (GC=F), silver (SI=F), Swiss franc (USDCHF=X)
- Conflict proxies: Crude oil (CL=F), natural gas (NG=F), wheat (ZW=F), defense ETF (ITA), defense stocks
- Risk ratios: Copper/Gold ratio (risk-off indicator), Gold/Silver ratio
- CFTC COT: Institutional positioning changes in crude/gold/wheat (which direction is smart money betting)
- BIS: Central bank policy rate trends in relevant countries
- FearGreedProvider: CNN Fear & Greed Index (composite of 7 price signals)
- Web search: VIX, MOVE index, sovereign CDS, war risk premiums, BDI freight rates, high-yield OAS
- Currencies: Currency pairs of relevant countries (e.g. USDRUB=X, USDCNY=X)
- Country ETFs: Asset flows in relevant countries (e.g. FXI, EWY)

#### Economic recession / Macro cycle
- Treasury: Yield curve shape (10Y-2Y spread, 10Y-3M spread), real rates, breakeven inflation
- YahooPriceProvider: SPY, copper (HG=F), crude oil (CL=F), price trends
- Risk ratios: Copper/Gold ratio
- CFTC COT: Speculative net positions in copper/crude (is managed money bullish or bearish)
- BIS: Credit-to-GDP gap (credit overheating = late cycle), policy rate directions
- World Bank: GDP growth rate historical trends, cross-country comparisons
- Deribit: BTC futures basis (risk appetite proxy)
- CoinGecko: Crypto total market cap + BTC dominance (risk appetite proxy)
- FearGreedProvider: CNN Fear & Greed Index (7 price signals composite → 0-100)
- Kalshi `KXFED` series: FOMC rate-decision contracts. (Use this for the rate path — CMEFedWatchProvider is currently 403-blocked by CME's bot protection from every host tested.)
- Polymarket: Recession-related contracts, central bank rate path
- Currencies: DXY/dollar strength, emerging market currencies
- Web search: High-yield bond spread (HY OAS), TED spread, MOVE index, TTF gas, BDI freight rates

#### Industry cycle / Bubble assessment
- YahooPriceProvider: Industry leader stock trends, sector ETFs
- Find the industry's "single-purpose commodity" (e.g. GPU rental price → AI, rebar → construction)
- Upstream equipment maker orders/stock price (e.g. ASML → semiconductors)
- Leader company valuation discount (e.g. TSMC vs peers → Taiwan Strait risk pricing)
- EDGAR: Industry leader insider trading cadence (Form 4) — concentrated selling = bearish signal
- CFTC COT: Institutional positioning changes in related commodities
- CoinGecko: For crypto industry, look at BTC/ETH/altcoin market cap distribution
- Web search: VC funding concentration, leveraged ETF concentration, margin debt levels
- Deribit: Implied volatility of related crypto assets

#### Asset pricing / Whether to buy
- YahooPriceProvider: Target asset price trend (daily/weekly/monthly)
- Relative price changes of correlated assets (divergence between two commodities = structural signal)
- Treasury: Risk-free rate as valuation anchor
- YFinance: Options chain (IV, put/call ratio, max pain, Greeks, implied move)
- EDGAR: Insider selling cadence (heavy Form 4 selling = insiders bearish)
- CFTC COT: Speculative vs commercial net position divergence for commodity assets
- CoinGecko: For crypto assets, check market cap, ATH/ATL distance, 24h volatility
- Deribit: Crypto options chain (implied volatility = market's expected range)
- Polymarket/Kalshi: Probability pricing of related events
- FearGreedProvider: CNN Fear & Greed composite score (momentum, breadth, VIX, put/call, junk bond demand, volatility, safe haven)
- Web search: VIX, corporate bond issuance volume, analyst rating distribution

#### Stock/Options analysis / Crash probability
- YFinance: Options chain → ATM IV (expected volatility), IV skew (upside/downside fear asymmetry), put/call ratio (bull/bear sentiment), max pain (market maker profit zone), implied move (expected price range), Greeks (delta ≈ ITM probability)
- YahooPriceProvider: Underlying historical price → realized volatility (compare vs implied volatility to judge options premium)
- Kalshi: SPY/NASDAQ price range markets → direct probability pricing
- CFTC COT: S&P 500/VIX futures positioning → institutional direction
- Defensive rotation: XLY (cyclical) vs XLP (defensive) vs XLU (utilities) relative performance → market defensiveness
- Treasury: Yield curve shape → recession signal
- FearGreedProvider: CNN Fear & Greed Index
- Web search: VIX level, margin debt level, leveraged ETF concentration

#### China A-share: individual stock / ETF / sector
Mainland listings are quoted in CNY on exchanges no US venue prices, so the usual
Polymarket/Kalshi/CFTC layer has nothing to say about them. Route these to Eastmoney.

- Eastmoney `get_quote`: Live quote for a 6-digit code → last, change %, turnover rate, PE(TTM), PB, market cap. Pass the bare code (`600519`, `000977`) — `to_secid` resolves the exchange.
- Eastmoney `get_fund_flow`: **The signal with actual skin in the game.** Daily net inflow split by order size — extra-large / large (together = 主力, institutional) vs medium / small (retail). Institutions buying while retail sells is a different tape than the reverse, and price alone cannot show it.
- Eastmoney `list_sector_fund_flow`: Industry or concept boards ranked by institutional net inflow → which sector money is rotating into. Answers "which sector is seeing inflows" directly.
- Eastmoney `get_history`: OHLCV with forward adjustment (`adjust="forward"`) → realized volatility, trend, volume confirmation.
- YahooPriceProvider: Same listings via `600519.SS` / `000977.SZ` suffixes — useful as a cross-check, and the only way to put an A-share on the same axis as
```

## File: README.md
upstream: https://github.com/komako-workshop/digital-oracle/blob/HEAD/README.md

````text
[English](README.en.md) | **中文**

# Digital Oracle 📈

Digital Oracle 是一款让 AI Agent 基于从海量金融数据中，挖掘出宏观事件发展趋势的开源 Skill。

适用于 OpenClaw / Claude Code / Cursor / Codex。

我们生活在一个噪音极度泛滥的时代。社交媒体上充斥着情绪化的预测 — 有人说房价要崩了，有人说黄金要上天，有人说明天就打仗。这些观点往往顺应人群情绪，而不是基于客观数据的理性分析。

但交易数据不一样。

价格是绝对理性的 — 当一个人要把自己的钱押在某个结果上时，他会比发一条短视频认真很多。

这就是有效市场理论的核心洞察：**所有公开信息都已经被价格消化了。一切信息都在 K 线里。**

Digital Oracle 把这个洞察变成了一个可执行的工具。它接入了 13 个权威金融数据源 — **从 Polymarket 和 Kalshi 这样的预测市场，到美国国债收益率曲线、CFTC 机构持仓、SEC 内部人交易、各国央行利率、加密衍生品，以及 A 股的拆单资金流与板块轮动。**

它不看报纸不读新闻，不消费文章、短视频、播客，只通过从金融数据中挖掘出的价值信号，来回答房价涨跌、黄金走势、比特币周期、军事冲突概率这类问题，并给出结构化的概率估计和推理链。

某种意义上，这就是新时代的数字先知。

## 能回答什么问题？

- "WW3 的概率是多少？"
- "中国房价还会跌多久？"
- "AI 是不是泡沫？"
- "现在适合买黄金吗？"
- "比特币到底了吗？"
- "NVDA 期权溢价是不是太高了？"

只要有市场在定价这件事，Digital Oracle 就能给出一个基于交易数据的概率估计。

## 数据源

| Provider | 数据类型 | 用途 |
|----------|---------|------|
| Polymarket | 预测市场合约 | 事件概率定价 |
| Kalshi | SEC 监管二元合约 | 美国政治/经济事件 |
| Stooq | 股票/ETF/外汇/商品 | 价格历史和趋势 |
| Deribit | 加密衍生品 | 期货 term structure、期权 IV |
| US Treasury | 国债收益率 | 利率曲线、通胀预期 |
| CFTC COT | 期货持仓 | 机构仓位方向（smart money） |
| CoinGecko | 加密现货 | BTC/ETH 价格、市值 |
| SEC EDGAR | 内部人交易 | Form 4 买卖信号 |
| BIS | 央行数据 | 政策利率、信贷/GDP 缺口 |
| World Bank | 发展指标 | GDP、人口、贸易 |
| Yahoo Finance | US 期权链 | IV、Greeks、put/call ratio |
| Eastmoney | A 股行情与资金流 | 个股/ETF 行情、K 线、拆单量级资金流、板块轮动 |
| Web Search | 网页搜索 | VIX、CDS 等补充数据 |

所有 API 均免费、无需 API Key。

## 安装

### OpenClaw

```bash
clawhub install digital-oracle
```

### 其他 AI Agent（Claude Code / Cursor / Codex / ...）

直接告诉你的 Agent：

> 安装这个开源项目并读取 SKILL.md 作为你的工作指令：https://github.com/komako-workshop/digital-oracle

Agent 会自行 clone 代码、阅读方法论、调用 provider。

### 前置依赖

- [uv](https://docs.astral.sh/uv/) — Python 包管理器，skill 运行时用它执行 Python 脚本
- 13 个数据源中有 12 个零外部依赖（纯 Python 标准库）。期权链分析需要额外安装：

```bash
uv pip install yfinance
```

## 工作原理

1. **理解问题** — 拆解核心变量、时间窗口、可定价性
2. **选择信号** — 根据问题类型选择 3+ 个独立数据源
3. **并行拉取** — 用 `gather()` 同时调用多个 provider
4. **矛盾推理** — 找不同市场之间的分歧，解释为什么它们可以同时正确
5. **输出报告** — 结构化的多层信号表格 + 概率估计 + 场景分析

## 项目结构

```
digital-oracle/
├── SKILL.md                # Skill 定义（OpenClaw 读取这个文件）
├── digital_oracle/         # Python 源码
│   ├── concurrent.py       # 并行执行工具
│   ├── http.py             # HTTP 客户端抽象
│   ├── snapshots.py        # HTTP 响应录制/回放（测试用）
│   └── providers/          # 13 个数据 provider
├── references/             # API 速查
│   ├── providers.md        # Provider API 参考
│   └── symbols.md          # 交易符号目录
├── scripts/                # Demo 脚本
└── tests/                  # 单元测试 + fixtures
```

## 设计原则

- **零依赖优先** — 12/13 个 provider 只用 Python 标准库，无需 `pip install`
- **依赖注入** — 所有 provider 接受可选的 `http_client` 参数，方便测试
- **部分失败容忍** — 一个数据源挂了不影响其他结果
- **快照测试** — 录制真实 HTTP 响应，CI 里无网络也能跑测试

## License

MIT © 2026 komako-workshop — see [LICENSE](LICENSE).
````
