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.
- Explicit reasoning from price to judgment — explain clearly "why this price answers this question."
- Multi-signal cross-validation — never conclude from a single signal. At least 3 independent dimensions.
- Label the time horizon of each signal — options price 3 months, equipment orders price 3 years — don't mix them in the same vote.
- 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 (xauusd), silver (xagusd), Swiss franc (usdchf)
- Conflict proxies: Crude oil (cl.c), natural gas (ng.c), wheat (zw.c), defense ETF (ita.us), 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
- Web search: VIX, MOVE index, sovereign CDS, war risk premiums, BDI freight rates
- Currencies: Currency pairs of relevant countries (e.g. usdrub, usdcny)
- Country ETFs: Asset flows in relevant countries (e.g. fxi.us, ewy.us)
Economic recession / Macro cycle
- - Treasury: Yield curve shape (10Y-2Y spread, 10Y-3M spread), real rates, breakeven inflation
- Stooq: SPY, copper (hg.c), crude oil, BDI freight rate 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)
- 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
Industry cycle / Bubble assessment
- - Stooq: 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
- Deribit: Implied volatility of related crypto assets
Asset pricing / Whether to buy
- - Stooq: 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
- Web search: 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)
- Stooq: 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
- Web search: VIX level, margin debt level, leveraged ETF concentration
Available trading symbols directory: See references/symbols.md
Provider API reference: See references/providers.md
Step 3: Fetch data
Use digital-oracle's Python providers to fetch structured data, calling all sources in parallel with gather() (including web search):
CODEBLOCK0
All 12 Providers:
| Provider | Data Type | Purpose | Dependency |
|---|
| PolymarketProvider | Prediction market contracts | Event probability pricing | stdlib |
| KalshiProvider |
Binary contracts | US regulated event contracts | stdlib |
| StooqProvider | Price history | Stocks/ETFs/FX/Commodities | stdlib |
| DeribitProvider | Crypto derivatives | Futures term structure, options IV | stdlib |
| USTreasuryProvider | Treasury yields | Yield curves, inflation expectations | stdlib |
| WebSearchProvider | Web search | VIX/MOVE/CDS supplementary data | stdlib |
| CftcCotProvider | Futures positioning | Institutional direction (smart money) | stdlib |
| CoinGeckoProvider | Crypto spot | BTC/ETH price, market cap, dominance | stdlib |
| EdgarProvider | SEC filings | Insider trades Form 4, filing search | stdlib |
| BisProvider | Central bank data | Policy rates, credit-to-GDP gap | stdlib |
| WorldBankProvider | Development indicators | GDP, population, trade, macro data | stdlib |
|
YFinanceProvider |
US options chains |
IV, Greeks, put/call ratio, max pain |
yfinance |
11 out of 12 providers have zero external dependencies. YFinanceProvider requires pip install yfinance.
WebSearchProvider usage:
- -
web.search("query") → returns WebSearchResult (search summary) — render with INLINECODE4 - INLINECODE5 → returns
WebPageContent (page body extraction) - Search engine is DuckDuckGo, zero API keys needed
Data not available on Stooq — use web search instead: VIX, MOVE, CDS spreads, TTF natural gas, BDI freight rates, war risk premiums, IMF forecasts — these need to be fetched from financial web pages. They are still trading data and comply with the methodology.
Step 4: Contradiction analysis
This is the key to report quality. Don't just summarize data — find contradictions:
- - Are different markets saying different things? e.g. gold says "disaster" but equities say "fine" — explain why both can be right simultaneously
- Is there divergence within the same asset class? e.g. copper up but iron ore down — that divergence itself is a signal
- Do short-term and long-term signals contradict? e.g. defense stocks price a 10-year trend but prediction markets only look 1 year ahead — not a contradiction, different time frames
- Does market pricing contradict intuition? e.g. CNY strengthening while Taiwan Strait risk rises — smart money doesn't believe in near-term conflict
Principles when signals diverge: Don't "vote by majority" — instead:
- 1. Check the time dimension first — different signals price different future windows:
- Short-term (3-12mo): Prediction market contracts, VIX/MOVE, price reaction patterns, executive selling
- Medium-term (1-3yr): Leader revenue consensus, CapEx plans, VC concentration, leverage concentration
- Long-term (3-10yr): Equipment maker orders, irreversible capital allocation, ultra-long infrastructure investment
- Short-term bearish + long-term bullish ≠ contradiction, = S-curve inflection
- 2. Look for "two things happening at once" — old economy Japanification + new economy boom can coexist in the same economy
- "Direction right but timing wrong" — long-term signals bullish but short-term overheated → conclusion isn't "buy/don't buy" but "wait for a pullback"
Step 5: Output report
Must follow this structure. You can adjust the number of layers and wording, but the four main sections (data summary, synthesis, probability estimates, signal consistency assessment) cannot be omitted or merged into prose paragraphs:
CODEBLOCK1
Notes
- - Polymarket
slug_contains search is fuzzy — filter results by title keywords after fetching - Stooq futures symbols use
.c suffix (e.g. hg.c, ng.c, zw.c, cl.c), not INLINECODE13 - Stooq has limited European stock coverage (e.g. Rheinmetall unavailable) — supplement with web search
- Prediction market contracts vary in liquidity — contracts with volume < $100K should be discounted
- Different signals update at different frequencies: prediction markets real-time, Stooq daily delayed, Treasury weekly
- CFTC COT updates Tuesday, published Friday. commodity_name uses uppercase ("GOLD", "CRUDE OIL", "S&P 500")
- CoinGecko free API has rate limits (~10-30 req/min) — don't pack too many CoinGecko calls in gather
- EDGAR requires
EdgarProvider(user_email="you@example.com") — SEC requires email in User-Agent, otherwise 403. First call parses ticker→CIK mapping, slightly slow - BIS data updates infrequently (monthly/quarterly) — suitable for long-term trends, not short-term trading
- World Bank GDP data typically lags 1-2 years — latest year may return INLINECODE15
- YFinance requires
uv pip install yfinance (auto-installs pandas). After-hours IV may be inaccurate (bid/ask = 0) — use during market hours - YFinance
get_chain() auto-computes Black-Scholes Greeks (pure stdlib math.erf, no scipy needed) - Absolute value of put delta ≈ probability of that strike being ITM at expiration (rough estimate)
- Put/Call ratio > 1.5 is typically bearish, but as a contrarian indicator, extreme values (> 3) may signal a bottom
- Max pain is the strike price maximizing market maker profit — actual expiration price often converges toward max pain
- When reporting dollar amounts, use
USD instead of $ to avoid markdown renderers interpreting $...$ as LaTeX
数字神谕
市场是有效的。价格包含所有公开信息。解读价格 = 解读市场共识。
方法论
仅使用市场交易数据回答问题——不以新闻、观点或统计报告作为因果证据。 如果某件事是真的,某个市场已经将其定价。
五条铁律:
- 1. 仅限交易数据——价格、成交量、持仓量、价差、溢价。绝不引用分析师观点。
- 从价格到判断的显式推理——清晰解释为什么这个价格回答了这个问题。
- 多信号交叉验证——绝不从单一信号得出结论。至少3个独立维度。
- 标注每个信号的时间跨度——期权价格反映3个月,设备订单反映3年——不要在同一投票中混用。
- 结构化输出——最终报告必须遵循步骤5模板:分层信号表 → 矛盾分析 → 概率情景 → 信号一致性评估。不要用散文替代结构化报告。
工作流程
步骤1:理解问题
将用户的问题分解为:
- - 核心变量:什么事件或趋势?
- 时间窗口:用户问的是3个月、1年还是5年?
- 可定价性:这个结果是否有真金白银在交易?
步骤2:选择信号
根据问题类型,从下方信号菜单中选择。不要只用一个类别——至少覆盖3个。
地缘政治冲突/战争风险
- - Polymarket:搜索相关事件合约(停火、入侵、政权更迭、宣战)
- Kalshi:搜索相关二元合约
- 避险资产:黄金(xauusd)、白银(xagusd)、瑞士法郎(usdchf)
- 冲突代理:原油(cl.c)、天然气(ng.c)、小麦(zw.c)、国防ETF(ita.us)、国防股
- 风险比率:铜/金比(风险规避指标)、金/银比
- CFTC COT:原油/黄金/小麦的机构持仓变化(聪明钱押注方向)
- BIS:相关国家央行政策利率趋势
- 网络搜索:VIX、MOVE指数、主权CDS、战争风险溢价、BDI运费
- 货币:相关国家的货币对(如usdrub、usdcny)
- 国家ETF:相关国家的资产流动(如fxi.us、ewy.us)
经济衰退/宏观周期
- - 国债:收益率曲线形态(10Y-2Y利差、10Y-3M利差)、实际利率、盈亏平衡通胀率
- Stooq:SPY、铜(hg.c)、原油、BDI运费趋势
- 风险比率:铜/金比
- CFTC COT:铜/原油的投机净持仓(管理资金看涨还是看跌)
- BIS:信贷/GDP缺口(信贷过热=周期后期)、政策利率方向
- 世界银行:GDP增长率历史趋势、跨国比较
- Deribit:BTC期货基差(风险偏好代理)
- CoinGecko:加密货币总市值+BTC主导地位(风险偏好代理)
- Polymarket:衰退相关合约、央行利率路径
- 货币:DXY/美元强度、新兴市场货币
- 网络搜索:高收益债券利差(HY OAS)、TED利差、MOVE指数
行业周期/泡沫评估
- - Stooq:行业龙头股趋势、行业ETF
- 找到该行业的单一用途商品(如GPU租赁价格→AI、螺纹钢→建筑)
- 上游设备制造商订单/股价(如ASML→半导体)
- 龙头公司估值折价(如台积电vs同行→台湾海峡风险定价)
- EDGAR:行业龙头内幕交易节奏(Form 4)——集中卖出=看跌信号
- CFTC COT:相关商品机构持仓变化
- CoinGecko:对于加密行业,查看BTC/ETH/山寨币市值分布
- 网络搜索:VC资金集中度、杠杆ETF集中度
- Deribit:相关加密资产的隐含波动率
资产定价/是否买入
- - Stooq:目标资产价格趋势(日/周/月)
- 相关资产的相对价格变化(两种商品之间的背离=结构性信号)
- 国债:无风险利率作为估值锚
- YFinance:期权链(IV、看跌/看涨比、最大痛点、希腊字母、隐含波动)
- EDGAR:内幕卖出节奏(大量Form 4卖出=内幕人士看跌)
- CFTC COT:商品资产的投机vs商业净持仓背离
- CoinGecko:对于加密资产,检查市值、ATH/ATL距离、24小时波动率
- Deribit:加密期权链(隐含波动率=市场预期范围)
- Polymarket/Kalshi:相关事件的概率定价
- 网络搜索:公司债券发行量、分析师评级分布
股票/期权分析/崩盘概率
- - YFinance:期权链→ATM IV(预期波动率)、IV偏斜(上行/下行恐惧不对称)、看跌/看涨比(多空情绪)、最大痛点(做市商盈利区)、隐含波动(预期价格范围)、希腊字母(delta≈ITM概率)
- Stooq:标的历史价格→已实现波动率(与隐含波动率比较判断期权溢价)
- Kalshi:SPY/纳斯达克价格范围市场→直接概率定价
- CFTC COT:标普500/VIX期货持仓→机构方向
- 防御性轮动:XLY(周期性)vs XLP(防御性)vs XLU(公用事业)相对表现→市场防御性
- 国债:收益率曲线形态→衰退信号
- 网络搜索:VIX水平、保证金债务水平、杠杆ETF集中度
可用交易代码目录: 参见 references/symbols.md
提供商API参考: 参见 references/providers.md
步骤3:获取数据
使用数字神谕的Python提供商获取结构化数据,通过gather()并行调用所有来源(包括网络搜索):
python
from digital_oracle import (
PolymarketProvider, PolymarketEventQuery,
KalshiProvider, KalshiMarketQuery,
StooqProvider, PriceHistoryQuery,
DeribitProvider, DeribitFuturesCurveQuery,
USTreasuryProvider, YieldCurveQuery,
WebSearchProvider,
CftcCotProvider, CftcCotQuery,
CoinGeckoProvider, CoinGeckoPriceQuery,
EdgarProvider, EdgarInsiderQuery,
BisProvider, BisRateQuery,
WorldBankProvider, WorldBankQuery,
YFinanceProvider, OptionsChainQuery, # 需要 uv pip install yfinance
gather,
)
pm = PolymarketProvider()
kalshi = KalshiProvider()
stooq = StooqProvider()
deribit = DeribitProvider()
treasury = USTreasuryProvider()
web = WebSearchProvider()
cftc = CftcCotProvider()
coingecko = CoinGeckoProvider()
edgar = EdgarProvider(user_email=you@example.com) # SEC要求在User-Agent中包含邮箱,否则403
bis = BisProvider()
wb = WorldBankProvider()
yf = YFinanceProvider() # 需要 uv pip install yfinance
result = gather({
pmevents: lambda: pm.listevents(PolymarketEventQuery(slug_contains=..., limit=10)),
yieldcurve: lambda: treasury.latestyield_curve(),
gold: lambda: stooq.get_history(PriceHistoryQuery(symbol=xauusd, limit=30)),
# 机构持仓
goldcot: lambda: cftc.listreports(CftcCotQuery(commodity_name=GOLD, limit=4)),
# 加密市场情绪
crypto: lambda: coingecko.getprices(CoinGeckoPriceQuery(coinids=(bitcoin, ethereum))),
# 内幕交易
insider: lambda: edgar.getinsidertransactions(EdgarInsiderQuery(ticker=AAPL, limit=10)),
# 央行政策利率
rates: lambda: bis.getpolicyrates(BisRateQuery(countries=(US, CN), start_year=2023)),
# GDP数据
gdp: lambda: wb.get_indicator(WorldBankQuery(indicator=NY.GDP.MKTP.CD, countries=(US, CN))),
# 期权链(含希腊字母)
spyoptions: lambda: yf.getchain(OptionsChainQuery(ticker=SPY, expiration=2026-04-17)),
# 网络搜索与结构化提供商并行运行
vix: lambda: web.search(VIX index current level),
hy_spread: lambda: web.search(US high yield bond spread OAS),
})
部分失败不影响其他结果
curve = result.get(yield_curve)
vix
info = result.getor(vix, None) # WebSearchResult — 使用 .text() 渲染
期权数据使用
chain = result.get_or