← 返回 Skills 市场
jinboh68-prog

Ev Calculator

作者 jinboh68-prog · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
183
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ev-calculator
功能描述
🎯 EV 期望值计算器 - 交易决策必备工具
使用说明 (SKILL.md)

🎯 EV 期望值计算器

定价: 0.01 USDC (x402支付) 作者: Rich (@samhuang2025)


简介

计算交易/投注的期望值(Expected Value),判断是否具有正期望。

核心功能

  • ✅ 基础EV计算
  • ✅ Polymarket概率计算
  • ✅ 赔率转换
  • ✅ 套利边界检测

核心公式

基础版

EV = p × win - (1-p) × loss
  • p = 胜率
  • win = 赢的金额
  • loss = 输的金额

简化版(对称盈亏)

EV = p × b - (1-p) × 1

其中 b = 盈亏比

Polymarket版

EV = 你的概率 - 市场概率

判断标准

EV值 含义 行动
EV > 0 正期望值,能赚 ✅ 可以玩
EV = 0 不亏不赚 ⚪ 观望
EV \x3C 0 负期望值,必亏 ❌ 不玩

使用方法

1. 基础EV计算

def calculate_ev(p, win, loss):
    """
    计算期望值
    
    Args:
        p: 胜率 (0-1)
        win: 赢的金额
        loss: 输的金额
    
    Returns:
        EV值 (正=赚,负=亏)
    """
    return p * win - (1 - p) * loss

2. Polymarket概率

def polymarket_ev(your_prob, market_price):
    """
    计算Polymarket的EV
    
    Args:
        your_prob: 你判断的真实概率 (0-1)
        market_price: 市场定价 (0-1)
    
    Returns:
        edge (你的概率 - 市场概率)
    """
    return your_prob - market_price

3. 盈亏比计算

def win_loss_ratio(win_pct, loss_pct):
    """计算盈亏比"""
    return win_pct / loss_pct

实战案例

案例1:抛硬币

  • 正面赢 $1.10
  • 反面输 $1.00
  • 概率各 50%
EV = 0.5 × 1.10 - 0.5 × 1.00 = +$0.05

✅ 每赌一次期望赚5分

案例2:Polymarket

  • 你判断 Trump 赢 = 60%
  • 市场定价 YES = 40%
  • 买入成本 = $0.40
EV = 0.60 - 0.40 = +0.20 (20% edge)

✅ 每投$1期望赚$0.20

案例3:彩票套利(Winfall Roll-down)

  • 正常时期:期望拿回$0.55
  • Roll-down时期:期望拿回$1.18
正常EV = 0.55 - 1.00 = -$0.45 (亏)
套利EV = 1.18 - 1.00 = +$0.18 (赚)

快速查询表

对称盈亏(赢亏相等)

胜率 EV 评价
45% -10% 远离
48% -4% 避开
50% 0% 公平
52% +4% 可以
55% +10% 不错
60% +20% 很好
70% +40% 极佳

Polymarket Edge

市场定价 你的判断 Edge
30% 45% +15%
40% 55% +15%
50% 65% +15%
60% 75% +15%

代码实现

#!/usr/bin/env python3
"""EV Calculator"""

import argparse
import json

def calculate_ev(p, win, loss):
    return p * win - (1 - p) * loss

def polymarket_ev(your_prob, market_price):
    edge = your_prob - market_price
    ev_dollar = edge / market_price if market_price > 0 else 0
    return edge, ev_dollar

def main():
    parser = argparse.ArgumentParser(description="EV Calculator")
    parser.add_argument("--p", type=float, help="胜率 (0-1)")
    parser.add_argument("--win", type=float, help="赢的金额")
    parser.add_argument("--loss", type=float, help="输的金额")
    parser.add_argument("--market", type=float, help="市场定价 (Polymarket)")
    parser.add_argument("--your", type=float, help="你的判断概率")
    parser.add_argument("--json", action="store_true")
    
    args = parser.parse_args()
    
    if args.p and args.win and args.loss:
        ev = calculate_ev(args.p, args.win, args.loss)
        result = {
            "type": "basic",
            "ev": ev,
            "verdict": "✅ 正期望" if ev > 0 else "❌ 负期望" if ev \x3C 0 else "⚪ 持平"
        }
    elif args.market and args.your:
        edge, ev = polymarket_ev(args.your, args.market)
        result = {
            "type": "polymarket",
            "market_price": args.market,
            "your_prob": args.your,
            "edge": edge,
            "ev_per_dollar": ev,
            "verdict": "✅ 正期望" if edge > 0 else "❌ 负期望"
        }
    
    if args.json:
        print(json.dumps(result, indent=2))
    else:
        print(f"\
🎯 EV计算结果")
        print(f"=" * 30)
        if result["type"] == "basic":
            print(f"胜率: {args.p*100:.0f}% | 赢: ${args.win} | 亏: ${args.loss}")
            print(f"EV: ${result['ev']:.2f}")
        else:
            print(f"市场定价: {args.market*100:.0f}% | 你的判断: {args.your*100:.0f}%")
            print(f"Edge: {result['edge']*100:.0f}%")
            print(f"每$期望赚: ${result['ev_per_dollar']:.2f}")
        print(f"\
{result['verdict']}")

if __name__ == "__main__":
    main()

风险提示

  • EV是基于历史数据的期望,不代表未来
  • 实际执行需考虑滑点、费率、资金费等摩擦成本
  • 慎用小样本数据,容易产生偏差

相关资源

  • 配套Skill: kelly-formula-crypto (凯利公式仓位管理)
  • MEMORY.md: Polymarket交易系统完整指南

更新日志

  • 2026-03-20: 初始版本
安全使用建议
This skill's code is a straightforward EV calculator and is coherent with its description. Two things to check before installing/using: (1) The SKILL.md metadata declares a paid endpoint (x402) and a recipient wallet — confirm how the platform enforces payment and whether your inputs would be sent to that external endpoint when invoked (and whether payment is taken automatically). (2) Avoid sending sensitive secrets or PII to the skill if you are unsure whether the agent will make API calls to the external endpoint. If you only need local calculations, run the included scripts locally (they have no networking) and verify results there. If you plan to use the hosted/paid behavior, verify the endpoint's domain and reputation and confirm the payment flow (cost, refund, what data is transmitted) with the platform or skill author.
功能分析
Type: OpenClaw Skill Name: ev-calculator Version: 1.0.0 The ev-calculator skill is a legitimate tool for calculating expected value (EV) and Kelly criterion positions for trading and betting. The Python script (scripts/ev_calculator.py) contains standard mathematical logic with no network, file system, or sensitive data access, and the SKILL.md instructions are consistent with the stated purpose of the tool.
能力评估
Purpose & Capability
The name, description, README and Python script all implement EV calculations (basic EV, Polymarket edge, Kelly guidance). No unrelated binaries or credentials are requested. The only extra capability in the metadata is a payment endpoint/wallet for micro-payments, which can be a legitimate monetization mechanism for a paid skill.
Instruction Scope
SKILL.md and README provide purely local usage instructions and include the full Python CLI. However the skill header declares an external endpoint (https://kelly-formula-crypto.vercel.app/api/ev), auth_type 'x402', price, currency and wallet and lists capability 'api_call' — this implies the runtime may perform external API calls and payment operations, though the included Python script itself does not call that endpoint. This mismatch is worth awareness but not necessarily malicious.
Install Mechanism
No install spec; this is an instruction+script-only skill. No remote downloads or package installs are specified (requirements.txt is empty). Low install risk.
Credentials
The skill declares no required environment variables, keys, or config paths. The payment header includes a public wallet address for receiving micro-payments; no secrets are requested. Credential demands are proportionate to an offline calculator plus optional monetization metadata.
Persistence & Privilege
always:false and default autonomous invocation are used. The skill does not request elevated or persistent system privileges, nor does it modify other skill configurations. Autonomous invocation is normal and not by itself a concern.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ev-calculator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ev-calculator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
ev-calculator 1.0.0 - 首发上线,提供EV(期望值)计算功能,支持基础交易和Polymarket场景 - 覆盖基础EV、Polymarket概率、赔率转换、套利边界检测四大功能 - 提供清晰的判断标准和实用案例,含快速查询表 - 代码开源,支持命令行运行和JSON输出 - x402 支付,USDC 付费能力集成
元数据
Slug ev-calculator
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Ev Calculator 是什么?

🎯 EV 期望值计算器 - 交易决策必备工具. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 183 次。

如何安装 Ev Calculator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ev-calculator」即可一键安装,无需额外配置。

Ev Calculator 是免费的吗?

是的,Ev Calculator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Ev Calculator 支持哪些平台?

Ev Calculator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Ev Calculator?

由 jinboh68-prog(@jinboh68-prog)开发并维护,当前版本 v1.0.0。

💬 留言讨论