prediction-market-strategy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prediction Market Strategy

预测市场策略

Binary prediction markets price contracts as probabilities. This skill covers the strategy, sizing, and validation layer that applies across all venues and market types. API mechanics live in
kalshi-api
/
polymarket-api
; contract semantics and settlement live in
kalshi-weather-markets
/
kalshi-crypto-index-markets
. This is the strategy/sizing/validation layer that applies across all of them.
二元预测市场将合约价格等同于概率。本技能涵盖适用于所有平台和市场类型的策略、头寸规模计算与验证层。API相关机制请参考
kalshi-api
/
polymarket-api
;合约语义与结算规则请参考
kalshi-weather-markets
/
kalshi-crypto-index-markets
。本文档是适用于上述所有场景的策略/头寸规模/验证层内容。

Core Thesis

核心逻辑

Price = implied probability. A contract priced at $0.18 claims an 18% chance of resolving YES. Brackets in a series sum to just above $1.00 — the overround is the house margin (roughly 5–8% for weather markets on Kalshi).
Takers systematically lose; makers systematically win. Across 300k+ Kalshi contracts, the average pre-fee return is ≈ −20%, concentrated in takers (market-order users) and in longshot buyers. Makers (resting limit orders) earn positive returns. On Polymarket (588M+ trades), the top ~1% of accounts capture ~76.5% of profit, predominantly by resting limit orders. This is the foundational result.
Favorite–longshot bias is the durable mechanism. Cheap longshots are systematically overpriced: a $0.05 contract historically wins ~2%; sub-$0.10 contracts lose ~60% of stake to buyers. Favorites are fairly- to slightly-underpriced. The repeatable expression is selling the overpriced longshot tail, maker-side — resting NO bids on brackets priced ~$0.05–$0.20, diversified across many events to survive the rare hit. This is structural/behavioral, not a forecasting edge.
Forecast skill ≠ trading edge. A good weather or event forecast is largely redundant with the market price at decision time. Markets aggregate information efficiently enough that even a measurably better model produces near-zero net edge after fees unless it finds systematic mispricings (which are behavioral, not informational). The exception is official-label ML in lightly-traded markets — but that is bounded by fill-rate and capacity, not forecast accuracy.

价格=隐含概率。定价为0.18美元的合约意味着其最终结算为YES的概率是18%。同一组中的多个合约价格总和略高于1.00美元——超出部分即为平台的利润率(Kalshi上天气市场的利润率约为5-8%)。
Taker(吃单方)持续亏损;Maker(挂单方)持续盈利。在Kalshi的30多万份合约中,扣除手续费前的平均回报率约为-20%,亏损主要集中在Taker(市价单用户)和冷门合约买家身上。Maker(挂出限价单的用户)则获得正收益。在Polymarket(超5.88亿笔交易)中,排名前1%的账户赚取了约76.5%的利润,主要通过挂出限价单实现。这是核心结论。
Favorite–longshot bias是持久有效的机制。低价冷门合约的定价系统性偏高:定价0.05美元的合约历史胜率约为2%;定价低于0.10美元的合约会让买家损失约60%的本金。热门合约的定价则基本合理甚至略偏低。可重复盈利的操作方式是在Maker端卖出定价偏高的冷门尾部合约——在定价约0.05-0.20美元的合约组挂出NO方向的限价单,通过分散投资于多个事件来应对罕见的冷门合约命中情况。这是由市场结构和投资者行为决定的,而非基于预测优势。
预测能力≠交易优势。优秀的天气或事件预测在决策时刻基本已被市场价格反映。市场的信息聚合效率足够高,即使你的模型确实更优,扣除手续费后也几乎无法获得净收益,除非能发现系统性定价偏差(这类偏差源于投资者行为,而非信息差)。例外情况是在交易量较低的市场中使用官方认证的ML模型——但此时收益上限由成交率和容量决定,而非预测准确度。

Strategy Catalog

策略目录

Strategies evaluated on Kalshi/Polymarket weather and event markets. "Real" means it survived correct settlement + fees in testing; others are flagged so you don't re-chase them.
StrategyVerdictMechanismKey Catch
Favorite–longshot fade, maker-side✅ DurableRest maker NO bids on ~$0.05–$0.20 brackets; behavioral tail overpricingRare longshot hit; measure fill-rate forward
Bracket YES-only (forecast-driven)✅ Works, fee-sensitiveBuy YES when calibrated model says bracket is materially underpricedRequires net_edge > θ gate; not raw win-rate
Market-making / liquidity provision⚠️ Structurally favored, infra-heavyTwo-sided quotes, capture spread + maker rebatesInventory risk, adverse selection, queue priority
Overround / dutching arbitrage⚠️ Real in theory, marginal in practiceSum-to->$1.00 across brackets; buy the underpriced residualLegs must fill simultaneously; Kalshi fills are sequential
Cross-venue arb (Kalshi ↔ Polymarket)❌ Blocked for mostSimultaneous position in equivalent contracts on two venuesTransfer time/cost destroys edge; geo-lock
Latency / news front-running (crypto/index hourlies)❌ HFT gameReact to public feeds before market repricesSub-100ms requirement; co-location; not retail
Near-certainty intraday repricing⚠️ Information/latency edgeMarkets slow to reprice near-certain contracts; capture the residualRequires real-time feed + automation
Copy-the-sharps❌ Survivorship illusionMirror apparent winning accountsNo reliable signal on public data; past winners regress
Bottom line: Two strategies survive correct accounting — the behavioral tail fade (maker-side) and the forecast-driven YES entry past the θ gate. Everything else is either HFT-scale, infrastructure-heavy, or dissolves under correct settlement + fees.

以下策略均在Kalshi/Polymarket的天气和事件市场中进行过评估。标注“Real”表示该策略在经过结算验证和手续费核算后依然有效;其他策略已标记,避免你重复尝试。
策略结论机制关键注意事项
Maker端的Favorite–longshot偏差对冲✅ 持久有效在定价约0.05-0.20美元的合约组挂出Maker方向的NO限价单;利用行为导致的尾部合约定价偏高罕见的冷门合约命中事件;需跟踪实际成交率
仅YES方向的合约组策略(基于预测)✅ 有效,但对手续费敏感当校准后的模型显示合约组定价明显偏低时买入YES要求净收益>θ阈值;而非单纯的胜率
做市/流动性提供⚠️ 结构上占优,但需要 heavy 基础设施双向报价,赚取点差+Maker返佣库存风险、逆向选择、队列优先级问题
超额定价/对冲套利⚠️ 理论可行,但实际收益微薄合约组总价>1.00美元;买入定价偏低的剩余合约必须同时成交所有腿;Kalshi的成交是顺序进行的
跨平台套利(Kalshi ↔ Polymarket)❌ 多数用户无法实现在两个平台同时持有等价合约头寸转账时间/成本会抵消收益;地域限制
低延迟/消息抢跑(加密货币/指数小时合约)❌ 高频交易游戏在市场重新定价前响应公开消息要求延迟低于100ms;需托管服务器;不适合零售用户
近乎确定性的日内重新定价⚠️ 信息/低延迟优势市场对近乎确定的合约重新定价速度较慢;赚取剩余收益需要实时行情 feed + 自动化操作
模仿高手❌ 幸存者偏差复制看似盈利的账户操作公开数据无法提供可靠信号;过往赢家会回归均值
结论: 经过正确核算后,只有两种策略可行——行为尾部对冲(Maker端)和超过θ阈值的基于预测的YES方向入场。其他策略要么属于高频交易规模、需要 heavy 基础设施,要么在经过结算和手续费核算后收益消失。

Fee-Aware Sizing & Edge Gates

考虑手续费的头寸规模与收益阈值

All selection is on fee-adjusted net edge. Raw win-rate, return on notional, and % correct are not selection metrics.
所有交易筛选均基于扣除手续费后的净收益。原始胜率、名义回报率和正确率均不作为筛选指标。

Net Edge Formula

净收益公式

python
net_edge = p_model - ask - kalshi_fee(ask)
python
net_edge = p_model - ask - kalshi_fee(ask)

Kalshi taker fee: ceil(0.07 * price * (1 - price) * 100) / 100 per contract

Kalshi taker手续费: ceil(0.07 * price * (1 - price) * 100) / 100 每份合约

Polymarket fee: 0 (no explicit taker fee; spread is the cost)

Polymarket手续费: 0(无显性taker手续费;点差即为成本)


Select a trade only when `net_edge > θ`.

仅当`net_edge > θ`时才选择进行交易。

Expected-Edge Gate (θ)

预期收益阈值(θ)

Account sizeθ (Kalshi)Rationale
< $2,00015%Small account; fee drag is proportionally higher
≥ $2,00020%Standard gate covering fee + execution uncertainty
Polymarket~5%No explicit taker fee; spread and gas are the cost
账户规模θ(Kalshi)理由
< $2,00015%小账户;手续费占比相对更高
≥ $2,00020%标准阈值,覆盖手续费+执行不确定性
Polymarket~5%无显性taker手续费;点差和gas费为主要成本

Limit Price Posting

限价单定价

When placing maker orders, post your bid θ below model fair value:
limit_price_cents = floor((p_model - θ) × 100)
This ensures you only fill when the market moves in your favor by at least θ.
挂出Maker订单时,限价应比模型公允价值低θ:
limit_price_cents = floor((p_model - θ) × 100)
这确保只有当市场对你有利的变动幅度至少达到θ时才会成交。

Fractional-Kelly Sizing

Fractional-Kelly头寸规模法

python
f_star = edge / (1 - entry_price)          # full Kelly fraction
stake = min(kelly_frac * f_star * bankroll, max_bet_fraction * bankroll)
contracts = stake / entry_price
python
f_star = edge / (1 - entry_price)          # 完整Kelly比例
stake = min(kelly_frac * f_star * bankroll, max_bet_fraction * bankroll)
contracts = stake / entry_price

Defaults: kelly_frac=0.25 (quarter-Kelly), max_bet_fraction=0.015

默认值: kelly_frac=0.25(四分之一Kelly), max_bet_fraction=0.015


The 1.5% bankroll cap is the binding constraint for most trades. Quarter-Kelly is aggressive enough to compound but mild enough to survive a bad run of correlated hits.

1.5%的账户资金上限是多数交易的约束条件。四分之一Kelly比例既足够激进以实现复利增长,又足够温和以应对连续的关联亏损。

Exposure Caps (observed defaults)

风险暴露上限(观测到的默认值)

CapValue
Per-contract bankroll limit1.5% of account
Single-city / single-event5% of account
Total open exposure20–25% of account
Max slippage as fraction of edge50%
上限数值
单份合约的账户资金限制账户资金的1.5%
单一城市/单一事件账户资金的5%
总未平仓暴露账户资金的20–25%
滑点占收益的最大比例50%

Slippage Is Part of Selection

滑点是筛选的一部分

Walk the real NO/YES ladder to your full size to compute the depth-weighted entry price. If the walk pushes
net_edge
below θ — or slippage exceeds 50% of the edge — skip the trade. Phantom penny levels (≤2¢ asks that don't persist across snapshots and lack trade-print corroboration) must be excluded from the ladder before walking it.
遍历真实的NO/YES订单簿至目标头寸规模,计算深度加权的入场价格。如果遍历后
net_edge
低于θ——或滑点超过收益的50%——则放弃该交易。在遍历订单簿前,必须排除幽灵便士档位(≤2美分的卖单,无法在连续快照中持续存在且无交易记录佐证)。

Maker vs. Taker

Maker vs. Taker

Resting a limit order (maker) captures the spread instead of paying it, avoids (or reduces) the taker fee, and is the execution mode used by profitable accounts. The maker edge compounds the structural longshot fade. Market orders (taker) should be used only when the fill probability of a limit order is unacceptably low relative to the opportunity.
All sizing functions are in
scripts/sizing.py
. Run directly for a worked example.

挂出限价单(Maker)可以赚取点差而非支付点差,避免(或减少)taker手续费,是盈利账户采用的执行方式。Maker优势会放大结构性的冷门合约对冲收益。市价单(Taker)仅应在限价单成交概率相对于机会而言低得不可接受时使用。
所有头寸规模计算函数均位于
scripts/sizing.py
中。直接运行即可查看示例。

Backtesting Methodology

回测方法论

Cardinal Rule: Settle on the Venue's Own Result

核心规则:使用平台自身的结算结果

Never re-derive settlement from a third-party source. Use the venue's
result
field (Kalshi:
result: "yes"/"no"
; Polymarket: settlement transaction). Any derived truth that merely correlates with the venue's resolution can flip ~10% of outcomes and manufacture double-digit fake edges.
永远不要从第三方来源推导结算结果。使用平台的
result
字段(Kalshi:
result: "yes"/"no"
;Polymarket: 结算交易记录)。任何仅与平台结算结果相关的推导真相可能会翻转约10%的结果,并制造出两位数的虚假收益。

Method Checklist

方法检查清单

  • Use venue
    result
    for settlement — never self-computed truth
  • Use
    close_time
    (or settlement date from the ticker), not date-of-crawl
  • Decision features cut at the city/event's own local decision time — no UTC mismatch
  • Entry prices from a decision-time snapshot, not near-close prices (which have already converged)
  • Walk the real ladder to your size; cap by top-of-book depth; deduplicate fills
  • Fee-deducted PnL only — never notional
  • Temporal holdout or expanding-window walk-forward only — no shuffled CV
  • Forward paper-trading before live capital: log model p, decision-time ask, and outcome; compare to the backtest Brier/accuracy
  • 使用平台
    result
    字段进行结算——绝不使用自行计算的结果
  • 使用
    close_time
    (或行情中的结算日期),而非抓取日期
  • 决策特征截止到城市/事件的本地决策时间——避免UTC时间不匹配
  • 入场价格来自决策时刻的快照,而非临近收盘价格(后者已收敛)
  • 遍历真实订单簿至目标规模;按最优档位深度限制;去重成交记录
  • 仅计算扣除手续费后的盈亏——绝不使用名义金额
  • 仅使用时间外样本或滚动窗口向前测试——不使用打乱的交叉验证
  • 投入真实资金前先进行模拟交易:记录模型概率p、决策时刻卖价和结果;与回测的Brier评分/准确率进行对比

Phantom-Edge Hall of Fame

虚假收益案例集

Each of these produced a plausible-looking backtest that dissolved on closer inspection.
BugSymptomFix
Wrong settlement sourceRe-derived truth flipped ~10% of outcomes → fake +18% fade edgeUse venue
result
Bracket off-by-one2°F inclusive brackets {floor,cap} treated as 1°F half-open → +1640% phantom backtestRead contract spec carefully
Phantom penny asks≤2¢ spoofed levels over-credited depth 23× (250k vs ~9k real fills)Count only depth that persists across snapshots AND is corroborated by trade prints
strike_type
misread
Inferring greater/less from ticker → 44% of shadow trades wrong directionRead
strike_type
from the API — never infer
Shadow/live conflationReplaying a log mixing shadow + live positions → phantom $14K/contract winsTrack PnL from live fills only (PositionStore); never replay in-memory
Flat/uncalibrated priorMisconfigured forecast center → $121.93 live loss in one dayAll decisions require a signed, calibrated prior
Stale running-extreme seedPoisoned persisted
day_max
made every low bracket look already-won
Reset/rebuild running-extreme state on startup; never inherit
Clock-mismatch look-aheadFilling at an 18:00Z book snapshot with features cut at 14:00 LST leaked future info for non-Eastern citiesDecide and fill at each market's own local decision time
以下案例均产生了看似合理的回测结果,但经仔细检查后收益消失。
问题症状修复方案
错误的结算来源自行推导的结果翻转了约10%的交易 → 虚假的+18%对冲收益使用平台
result
字段
合约组档位错误将2°F包含区间{floor,cap}视为1°F半开区间 → **+1640%**的虚假回测收益仔细阅读合约规格
幽灵便士卖单≤2美分的虚假档位被多计算了23倍深度(25万 vs 约9千真实成交)仅统计在连续快照中持续存在且有交易记录佐证的深度
strike_type
解读错误
从行情中推断大于/小于方向 → **44%**的影子交易方向错误从API读取
strike_type
——绝不自行推断
影子/实盘交易混淆回放混合影子交易和实盘头寸的日志 → 虚假的**$14K/每份合约**盈利仅跟踪实盘成交的盈亏(PositionStore);绝不回放内存中的记录
扁平/未校准的先验预测中心配置错误 → 单日实盘亏损**$121.93**所有决策均需经过签名的校准先验
过期的极值种子已污染的持久化
day_max
导致所有低档位合约看起来已获胜
启动时重置/重建极值状态;绝不继承旧状态
时钟不匹配的前瞻偏差使用18:00Z的订单簿快照,而特征截止到14:00 LST,为非东部城市泄露了未来信息在每个市场的本地决策时刻进行决策和成交

Forward Paper-Trading

模拟交易

Before committing live capital: run the full pipeline in shadow mode. Log model
p
, decision-time ask, and realized settlement. Compare the resulting Brier score and accuracy to the backtest figures. A gap > 2–3 Brier points sustained over 100+ samples indicates data leakage or a distribution shift that must be diagnosed before going live.

投入真实资金前:以影子模式运行完整流程。记录模型概率
p
、决策时刻卖价和实际结算结果。将得到的Brier评分和准确率与回测数据进行对比。如果在100+样本中差距持续超过2-3个Brier点,则表明存在数据泄露或分布偏移,必须在投入实盘前诊断并解决。

Why Forecast Skill ≠ Trading Edge

为什么预测能力≠交易优势

A good forecast is a necessary but not sufficient condition for a trading edge.
  1. Markets aggregate information. By decision time, the market price already reflects NWS model output, recent actuals, and whatever edge the sharp accounts have extracted. Your forecast must be measurably better than the market — not just accurate.
  2. Brier score is not edge. A 0.07 OOS Brier score (better than climatology) is consistent with zero net edge if the market is priced at 0.07 too.
  3. The actual edge is behavioral. The longshot overpricing is not informational — it's behavioral (retail overconfidence in cheap contracts). You capture it by being the liquidity provider on the tail, regardless of your forecast quality in those brackets.
  4. Forecast-driven YES entries work only at the margin. When your calibrated model says a bracket is materially underpriced (> θ net edge after fees), buying YES is valid. But this is a small subset of decision points, and the fill rate on thin tails constrains capacity.
The practical implication: build and validate your forecast for its own sake (it improves NO-bid targeting and limits exposure in adverse conditions), but do not assume forecast accuracy translates to trading returns without a separate, correct, fee-inclusive backtest.

优秀的预测是获得交易优势的必要非充分条件。
  1. 市场聚合信息。到决策时刻,市场价格已反映了NWS模型输出、最新实际数据以及高手账户已提取的所有优势。你的预测必须明显优于市场——而非仅仅准确。
  2. Brier评分≠收益。0.07的样本外Brier评分(优于气候学预测)如果市场定价也偏差0.07,则对应零净收益。
  3. 实际收益源于行为偏差。冷门合约定价偏高并非源于信息差——而是源于投资者行为(零售用户对低价合约过度自信)。你通过成为尾部合约的流动性提供者来获取收益,无论你在这些档位的预测质量如何。
  4. 基于预测的YES方向入场仅在边际有效。当你的校准模型显示合约组明显定价偏低(扣除手续费后净收益>θ)时,买入YES是有效的。但这只是决策点中的一小部分,且尾部合约的低成交率限制了收益容量。
实际意义:为预测本身构建并验证模型(它有助于优化NO方向限价单的定价,并在不利条件下限制风险暴露),但不要假设预测准确度会直接转化为交易收益——必须单独进行正确的、包含手续费的回测。

Evidence & Literature

证据与文献

Foundational Results

核心结论

  • Whelan, Makers and Takers: The Economics of the Kalshi Prediction Market (CEPR VoxEU; GWU/UCD working papers). 300k+ Kalshi contracts. Average pre-fee return ≈ −20%, concentrated in takers and longshot buyers. Makers earn positive returns. The foundational result: winners provide liquidity, losers take it.
  • Large-N Polymarket maker-taker study (588M+ trades, SSRN). Top ~1% of accounts capture ~76.5% of profit, predominantly by resting limit orders. Confirms the maker edge generalizes across venues.
  • Gupta, Who Profits in Binary Prediction Markets? Maker–Taker Dynamics, Behavioral Bias, and Sentiment Arbitrage on Kalshi (SSRN). Microstructure + behavioral-bias treatment of who wins and why.
  • Whelan,《Makers and Takers: The Economics of the Kalshi Prediction Market》(CEPR VoxEU;GWU/UCD工作论文)。基于30多万份Kalshi合约。扣除手续费前的平均回报率约为-20%,亏损集中在Taker和冷门合约买家。Maker获得正收益。核心结论:赢家提供流动性,输家消耗流动性。
  • 大规模Polymarket Maker-Taker研究(超5.88亿笔交易,SSRN)。排名前1%的账户赚取了约76.5%的利润,主要通过挂出限价单实现。证实Maker优势在不同平台均成立。
  • Gupta,《Who Profits in Binary Prediction Markets? Maker–Taker Dynamics, Behavioral Bias, and Sentiment Arbitrage on Kalshi》(SSRN)。从微观结构和行为偏差角度分析谁能盈利及原因。

Favorite–Longshot Bias

Favorite–longshot偏差

  • Classic betting-market literature (Thaler, Ziemba): longshots win less often than their price implies across most wagering markets.
  • Kalshi-specific: ~$0.05 contract historically wins ~2%; sub-$0.10 contracts lose ~60% of stake to buyers. Favorites are fairly- to slightly-underpriced.
  • The tradeable expression: NO-side maker bid on cheap brackets, diversified.
  • 经典博彩市场文献(Thaler、Ziemba):在大多数博彩市场中,冷门合约的胜率低于其价格隐含的概率。
  • Kalshi特定数据:定价约0.05美元的合约历史胜率约为2%;定价低于0.10美元的合约会让买家损失约60%的本金。热门合约定价基本合理甚至略偏低。
  • 可交易的操作方式:在冷门合约的NO方向挂出Maker限价单,分散投资。

Internal Validation (bracket-model skill)

内部验证(合约组模型能力)

  • Fee-inclusive rotating-CV backtest on Kalshi weather markets: ~+1.7–3.3% taker ROI / +7.9–9% maker ROI on the longshot fade.
  • Realized hit-rate on brackets priced ~10%: ~3–7% → ~+6.7¢/contract gross; maker economics improve this further.
  • 在Kalshi天气市场上进行的包含手续费的滚动交叉验证回测:冷门合约对冲策略的Taker回报率约为+1.7–3.3% / Maker回报率约为+7.9–9%。
  • 定价约10%的合约实际命中率:约3–7% → 每份合约毛收益约+6.7美分;Maker机制会进一步提升收益。

What the Evidence Does NOT Support

证据不支持的结论

  • That a good weather or event forecast beats the market at decision time (redundant with the price — see Lessons above).
  • That retail-visible cross-venue or intra-venue arbitrage is repeatably profitable net of fees/geo/lockup.
  • That the edge concentrates where your forecast is most accurate (it tracks market thinness/retail-ness instead).
Verify specific figures against primary sources before sizing — magnitudes vary by sample window and venue.

  • 优秀的天气或事件预测在决策时刻能战胜市场(已被价格反映——见上文经验教训)。
  • 零售用户可见的跨平台或平台内套利能在扣除手续费/地域/锁定成本后持续盈利。
  • 收益集中在你的预测最准确的领域(实际收益与市场流动性/零售用户占比相关)。
在确定头寸规模前,请对照原始来源验证具体数据——数值会因样本窗口和平台而异。

Files

文件

References

参考文档

  • references/strategy-catalog.md
    — Full strategy verdicts with evidence and catches
  • references/sizing-and-edge-gates.md
    — Complete fee-aware sizing rules and gate derivations
  • references/backtesting-methodology.md
    — Settle-on-venue-result rule, phantom-edge hall of fame, method checklist
  • references/evidence-and-literature.md
    — Primary sources: Whelan, Polymarket 588M, Gupta, favorite-longshot magnitudes
  • references/strategy-catalog.md
    — 完整的策略结论,包含证据和注意事项
  • references/sizing-and-edge-gates.md
    — 完整的考虑手续费的头寸规模规则和阈值推导
  • references/backtesting-methodology.md
    — 以平台结算结果为准的规则、虚假收益案例集、方法检查清单
  • references/evidence-and-literature.md
    — 原始来源:Whelan、Polymarket 5.88亿交易、Gupta、热门-冷门偏差数据

Scripts

脚本

  • scripts/sizing.py
    kalshi_fee
    ,
    net_edge
    ,
    theta_for_account
    ,
    limit_price_cents
    ,
    kelly_contracts
    ,
    slippage_ok
    — pure stdlib, runs offline
  • scripts/sizing.py
    kalshi_fee
    net_edge
    theta_for_account
    limit_price_cents
    kelly_contracts
    slippage_ok
    — 纯标准库实现,可离线运行