Ev Calculator

🎯 EV 期望值计算器 - 交易决策必备工具

MIT-0 · Free to use, modify, and redistribute. No attribution required.
0 · 17 · 0 current installs · 0 all-time installs
MIT-0
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
medium confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

Current versionv1.0.0
Download zip
latestvk97dwnv27d9j4ke64egwppsved836qe8

License

MIT-0
Free to use, modify, and redistribute. No attribution required.

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 < 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 < 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"\n🎯 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"\n{result['verdict']}")

if __name__ == "__main__":
    main()

风险提示

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

相关资源

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

更新日志

  • 2026-03-20: 初始版本

Files

4 total
Select a file
Select a file to preview.

Comments

Loading comments…