Files
winning-wallet-finder/日常使用.md
T
gavindiaz 3141c392de docs: update 3 docs with critical findings from author's research
AGENT.md:
- Expanded dimension 4 (niche analysis): ITF tennis/tier-3 esports = real edge,
  5min BTC/scalping = never follow, long holds (>7d) kill compounding
- Added edge disappearance warning (ArbTraderRookie wiped mid-analysis)
- Added 5 new AI agent rules: don't use copy_pnl alone, niche awareness,
  edge fragility, win rate is survivorship-biased, small capital = concentrate

日常使用.md:
- Added emergency exit procedure (host/flatten_positions.py)
- Added edge disappearance detection and response procedure

问题排查与踩坑记录.md:
- Added gotcha 7.11: win rate is survivorship-biased (90.6% shown = 48.3% real)
- Added gotcha 7.12: edge can vanish (wallet wiped from API mid-analysis)
- Added gotcha 7.13: long holds kill compounding (leegunner + lifetime
  but - to copy due to 7.6-day holds)
- Added gotcha 7.14: emergency exit tool (flatten_positions.py)
2026-07-21 09:10:58 +08:00

17 KiB
Raw Blame History

日常使用手册

部署完成后,每天只需花 5 分钟看一眼。大部分时间什么都不用做。

配合 DEPLOY.md(部署指南)、USAGE.md(项目逻辑)、mihomo代理部署教程.md(代理)一起看。


自动运行的部分(不用管)

任务 频率 做什么
paper bot 24/7 模拟跟单,直连
live bot 24/7 真钱跟单,走代理
mihomo 代理 24/7 日本节点绕 geo-block
dashboard 24/7 网页展示实时账本
daily.sh 每天 02:00 UTC10:00 北京) 刷新钱包池、打分、回测、推 Gitea
代理健康检查 每 5 分钟 节点挂了自动换

每日检查流程(约 5 分钟)

第 1 步:看 dashboard

浏览器打开 http://45.207.206.36:18080/先关掉本地 Clash 系统代理,否则打不开)

dashboard 顶部现在有 3 个自动面板,一眼看完不用 SSH:

  1. 系统健康面板:

    • 4 个服务状态(Paper/Live/Dashboard/代理)全绿 = 正常
    • CASH≠CHAIN: 正常 = 账本对得上
    • 心跳: X分X秒前 = bot 最后更新时间(>1 小时可能有问题,见紧急处理)
  2. 每日流水线面板:

    • ✓ 正常 + 上次运行时间 = daily.sh 今天跑成功了
    • 钱包池数量(76 skilled / 12 sharps
  3. 钱包建议面板:

    • 已淘汰 = 当前跟的但不在 watch_sharps 里了 -> 必须换(见下方"换跟单钱包")
    • ⬆️ 建议加 = 排名靠前但没跟的 -> 可以考虑
    • = 不用动

然后点右上角按钮切到 LIVE 模式,看交易数据:

  • 现金:还剩多少能下单
  • 已实现盈亏:赚了还是亏了
  • 开放订单:有没有卡住的仓位
  • 账本漂移:是不是 $0.00(不是 = 有问题,见紧急处理)

如果 dashboard 三个面板全绿 + LIVE 数据正常,第 2-4 步可以跳过。

第 2 步:看日志有没有异常

SSH 上服务器,跑:

# live bot 最近 1 小时有没有报错
journalctl -u copybot-live --since "1 hour ago" --no-pager | grep -E "⚠|ERROR|FAIL|CASH≠CHAIN"

# 代理正常吗
/opt/mihomo-healthcheck.sh && echo "代理正常" || echo "代理异常"
  • 没有 输出 = 正常
  • CASH≠CHAIN = 见下方紧急处理
  • 代理异常 = 见下方紧急处理

第 3 步:看 daily.sh 有没有跑成功

# 看今天的日志末尾
tail -10 /opt/winning-wallet-finder/live/daily.log

预期末尾看到 done -> watch_sharps.json + dashboard.html

如果没跑或报错,手动跑:

cd /opt/winning-wallet-finder/live && bash daily.sh

第 4 步:看钱包池有没有大变化(可选)

cat /opt/winning-wallet-finder/live/watch_sharps.json | python3 -m json.tool | grep -E "name|copy_pnl"

如果排名靠前的钱包变了,或者你正在跟的钱包被淘汰了,考虑换(见下方"换跟单钱包")。


定期任务

换跟单钱包(每周看一次)

去哪看

方法 1(推荐):dashboard 面板

打开 http://45.207.206.36:18080/,顶部"钱包建议"面板直接显示:

当前跟的          排名    copy_pnl    信念胜率    状态
Vahan88          #1      +3486       86%        ✅ 正常
Kruto2027        #2      +2247       69%        ✅ 正常
0xbadaf319       #3      +1010       80%        ✅ 正常
1kto1m           #5      +719        98%        ✅ 正常
LSB1             #6      +706        91%        ✅ 正常

建议加:
⬆️ BikesAreTheBikes · #4 · +813 · 21%
  • 已淘汰 = 当前跟的但不在 watch_sharps 里了 -> 必须踢
  • ⬆️ 建议 = watch_sharps 排名前 6 但没跟的 -> 可以考虑加
  • 正常 = 不用动

方法 2:命令行看原始数据

# 看 watch_sharps 排名(12 个可复制钱包)
cat /opt/winning-wallet-finder/live/watch_sharps.json | python3 -m json.tool | grep -E "name|copy_pnl|conv_win"

# 看你当前跟的 5 个
python3 -c "import json; [print(w['name']) for w in json.load(open('/opt/winning-wallet-finder/config.live.json'))['wallets']]"

什么时候要换

  • dashboard 面板里有 已淘汰 -> 必须踢,换成 ⬆️ 建议的
  • 某个钱包连续亏钱(看 dashboard 的"最近结算"盈亏列)-> 考虑踢
  • ⬆️ 建议的钱包 copy_pnl 明显高于你跟的最差的 -> 考虑优化

怎么换

改哪两个文件

文件 位置 改什么
config.live.json /opt/winning-wallet-finder/config.live.json live bot 跟的钱包
copybot.paper.json /opt/winning-wallet-finder/live/copybot.paper.json paper bot 跟的钱包

两个文件必须改一致(paper 和 live 跟同一批钱包,结果才可比)。

换的脚本(踢旧的 + 加新的,paper 和 live 一起改):

cd /opt/winning-wallet-finder

python3 <<'PYEOF'
import json

# === 在这里配置:保留哪些、加哪些 ===
keep_names = {"Kruto2027", "0xbadaf319", "1kto1m"}       # 保留的
add_names = ("Vahan88", "LSB1")                            # 新加的

# 从 watch_sharps.json 查新钱包地址
sharps = json.load(open("live/watch_sharps.json"))
addr_map = {}
for w in sharps:
    if w.get("name") in add_names:
        addr_map[w["name"]] = w["wallet"]

# 改 paper 配置和 live 配置
for cfg_path in ["live/copybot.paper.json", "config.live.json"]:
    cfg = json.load(open(cfg_path))
    old = [w["name"] for w in cfg["wallets"]]
    new = [w for w in cfg["wallets"] if w["name"] in keep_names]
    for name in add_names:
        if name in addr_map:
            new.append({"wallet": addr_map[name], "name": name,
                         "class": "volume", "floor": 25.0})
    cfg["wallets"] = new
    json.dump(cfg, open(cfg_path, "w"), indent=2)
    print(f"{cfg_path}: {old} -> {[w['name'] for w in new]}")
PYEOF

# 修权限
chown wwf:wwf live/copybot.paper.json config.live.json

# 重启两个 bot
systemctl restart copybot-paper
systemctl restart copybot-live
sleep 10

# 验证
journalctl -u copybot-paper --since "10 seconds ago" --no-pager | grep "watching"
journalctl -u copybot-live --since "10 seconds ago" --no-pager | grep "watching"

改之前把 keep_namesadd_names 换成你实际的值。新钱包 floor 先设 $25,明天 daily.sh 会自动算真实 p80 门槛。

改完后的操作

  1. 上面脚本已经自动重启了两个 bot
  2. 验证两个 bot 都 watching 5 wallets
  3. 刷新 dashboard"钱包建议"面板应该全是 正常

手动兑现已结算仓位

bot 只自动跟单买卖,不自动 redeem(兑现)。已结算的仓位需要手动去 Polymarket 网站兑现。

  1. 浏览器登录 https://polymarket.comMetaMask
  2. 看 Portfolio 里有没有 "Redeem" 按钮
  3. 点兑现,钱回到存款钱包
  4. 兑现后更新 bankroll(见下方"充钱后更新 bankroll"

充钱后更新 bankroll

从交易所充 USDC 到存款钱包后,bot 不会自动认。需要手动更新:

# 1. 停 bot
systemctl stop copybot-live

# 2. 查链上实际 pUSD 余额
export LIVE_PRIVATE_KEY=$(grep LIVE_PRIVATE_KEY /etc/copybot/live.env | cut -d= -f2-)
export HTTPS_PROXY=http://127.0.0.1:7890
python3 -c "from polymarket import SecureClient; c=SecureClient.create(private_key='$LIVE_PRIVATE_KEY'); b=c.get_balance_allowance(asset_type='COLLATERAL'); print('链上 pUSD: %.2f' % (b.balance/1e6)); c.close()"

# 3. 把上面的数字填进去(替换 X.XX)
sed -i 's/"bankroll_usd": [0-9.]*/"bankroll_usd": X.XX/' /opt/winning-wallet-finder/config.live.json

# 4. 清 state
rm -f /opt/winning-wallet-finder/copybot_state.live.json
rm -f /opt/winning-wallet-finder/copybot_fills.live.jsonl
rm -f /opt/winning-wallet-finder/live/copybot_live_real.json

# 5. 重启
systemctl start copybot-live
sleep 10
journalctl -u copybot-live --since "15 seconds ago" --no-pager | grep -E "bankroll|armed"

紧急处理

CASH≠CHAIN(账本与链上不一致)

怎么发现dashboard 显示"账本漂移"不为 $0.00,或日志有 ⚠ CASH≠CHAIN

原因:in-play 赛事的订单成交了但 bot 没追踪到(已修复大部分情况,但极端情况可能还会出现)

处理:跟"充钱后更新 bankroll"流程一样--停 bot、查链上余额、改 bankroll、清 state、重启。

systemctl stop copybot-live
export LIVE_PRIVATE_KEY=$(grep LIVE_PRIVATE_KEY /etc/copybot/live.env | cut -d= -f2-)
export HTTPS_PROXY=http://127.0.0.1:7890
python3 -c "from polymarket import SecureClient; c=SecureClient.create(private_key='$LIVE_PRIVATE_KEY'); b=c.get_balance_allowance(asset_type='COLLATERAL'); print('链上 pUSD: %.2f' % (b.balance/1e6)); c.close()"

# 用查到的数字替换 X.XX
sed -i 's/"bankroll_usd": [0-9.]*/"bankroll_usd": X.XX/' /opt/winning-wallet-finder/config.live.json
rm -f /opt/winning-wallet-finder/copybot_state.live.json /opt/winning-wallet-finder/copybot_fills.live.jsonl /opt/winning-wallet-finder/live/copybot_live_real.json
systemctl start copybot-live

钱不会丢,在链上。清 state 只是重置 bot 的账本,让它在正确的余额上重新开始。

代理挂了

怎么发现/opt/mihomo-healthcheck.sh 返回异常,或 live bot 日志报连接超时

处理

# 1. 看 mihomo 活着吗
systemctl status mihomo

# 2. 没活就启动
systemctl start mihomo
sleep 5

# 3. 看当前节点
curl -s http://127.0.0.1:9090/proxies/GLOBAL | python3 -c "import sys,json; print('当前:', json.load(sys.stdin).get('now'))"

# 4. 测代理通不通
HTTPS_PROXY=http://127.0.0.1:7890 python3 /opt/winning-wallet-finder/host/geocheck.py | tail -1

# 5. 不通就手动换节点
curl -s -X PUT http://127.0.0.1:9090/proxies/GLOBAL \
  -H "Content-Type: application/json" \
  -d '{"name":"🇯🇵日本高速06|BGP|CTCU"}'

# 6. live bot 会自动重启(Requires=mihomo.service

RTDS 断了(⚠ rtds down

怎么发现:日志有 ⚠ rtds down,或 24h lag 变大(从 ~3 秒变成 ~17 秒以上),slip 变差

原因:实时 WebSocket 连接断了(网络抖动 / 代理切换 / 服务器重启),bot 退回到 60 秒轮询模式

影响:检测延迟从 ~3 秒变成 ~17 秒,滑点变差。$5 测试资金无所谓,加大资金后延迟 = 滑点 = 亏钱

处理:重启 live bot 重连 WebSocket

systemctl restart copybot-live
sleep 10
journalctl -u copybot-live --since "15 seconds ago" --no-pager | grep -E "rtds|armed"

预期看到 rtds: connected - activity/trades stream up (T0 detection),不再是 rtds down

dashboard 打不开

怎么发现:浏览器访问 http://45.207.206.36:18080/ 超时或拒绝连接

原因:dashboard 服务挂了,或端口没监听

处理

# 1. 看服务状态
systemctl status copybot-dashboard --no-pager | head -10

# 2. 看端口在不在
ss -tlnp | grep 18080

# 3. 不在就重启
systemctl restart copybot-dashboard
sleep 3
ss -tlnp | grep 18080

重启后端口在监听就能打开。如果还是不行,看日志:

journalctl -u copybot-dashboard --since "5 minutes ago" --no-pager | tail -20

live bot 崩了

怎么发现dashboard 不更新,或 systemctl status copybot-live 不是 active

处理

# 看报错
journalctl -u copybot-live --since "30 minutes ago" --no-pager | tail -30

# 大部分情况重启就行
systemctl restart copybot-live
sleep 10
journalctl -u copybot-live --since "15 seconds ago" --no-pager | grep -E "armed|bankroll|watching|rtds"

paper bot 崩了

journalctl -u copybot-paper --since "30 minutes ago" --no-pager | tail -30
systemctl restart copybot-paper

紧急退出(一键清仓所有 live 仓位)

什么时候用:发现严重问题需要立刻清仓(bot 失控 / edge 消失 / 需要紧急撤资)

# 停 bot 防止它继续下单
systemctl stop copybot-live

# 一键市价卖出所有仓位
cd /opt/winning-wallet-finder
export LIVE_PRIVATE_KEY=$(grep LIVE_PRIVATE_KEY /etc/copybot/live.env | cut -d= -f2-)
export HTTPS_PROXY=http://127.0.0.1:7890
python3 host/flatten_positions.py

⚠️ 这是真钱操作,市价卖出可能有滑点损失。只在紧急情况用。

edge 消失(钱包突然不交易或从 API 消失)

怎么发现:某个跟单钱包连续 1 周没有 FOLLOW 信号,或 watch_sharps 里突然找不到

原因:作者研究发现 edge 可能随时消失(钱包可能被 Polymarket 封禁、改变策略、或信息源断了)

处理

  1. 确认钱包是否还在 watch_sharps.json 里
  2. 如果不在了 -> 从跟单配置里踢掉,从 bench 里选替补
  3. 如果还在但不交易 -> 观察 1 周,无改善则踢掉
  4. 赚钱了定期取出来,不要假设 edge 永久存在

更新代码

本地改完代码推到 Gitea 后,在服务器上拉:

cd /opt/winning-wallet-finder
git fetch origin
git reset --hard origin/main

# 如果改了 copybot.py,重启两个 bot
systemctl restart copybot-paper
systemctl restart copybot-live

git reset --hard 会丢弃服务器上的本地改动(bot 自动 commit 的 state 文件等)。如果 bot 在跑,拉之前先 systemctl stop copybot-paper copybot-live,拉完再 systemctl start


常用命令速查

看日志

journalctl -u copybot-live -f          # live bot 实时日志
journalctl -u copybot-paper -f         # paper bot 实时日志
journalctl -u copybot-dashboard -f     # dashboard 日志
journalctl -u mihomo -f                # 代理日志
tail -f /opt/winning-wallet-finder/live/daily.log  # daily.sh 日志

Ctrl+C 退出日志查看,不会停服务

服务管理

systemctl status copybot-live          # 看状态
systemctl restart copybot-live         # 重启
systemctl stop copybot-live            # 停
systemctl start copybot-live           # 启动

代理管理

# 看当前节点
curl -s http://127.0.0.1:9090/proxies/GLOBAL | python3 -c "import sys,json; print('当前:', json.load(sys.stdin).get('now'))"

# 换节点
curl -s -X PUT http://127.0.0.1:9090/proxies/GLOBAL -H "Content-Type: application/json" -d '{"name":"节点名"}'

# 测代理
HTTPS_PROXY=http://127.0.0.1:7890 python3 /opt/winning-wallet-finder/host/geocheck.py | tail -1

# 手动健康检查
/opt/mihomo-healthcheck.sh && echo "正常" || echo "异常"

查链上余额

export LIVE_PRIVATE_KEY=$(grep LIVE_PRIVATE_KEY /etc/copybot/live.env | cut -d= -f2-)
export HTTPS_PROXY=http://127.0.0.1:7890
python3 -c "from polymarket import SecureClient; c=SecureClient.create(private_key='$LIVE_PRIVATE_KEY'); b=c.get_balance_allowance(asset_type='COLLATERAL'); print('链上 pUSD: %.2f' % (b.balance/1e6)); c.close()"

改配置

nano /opt/winning-wallet-finder/config.live.json           # live 跟单钱包/金额
nano /opt/winning-wallet-finder/live/copybot.paper.json    # paper 跟单钱包/金额
nano /etc/copybot/live.env                                 # 私钥/代理/确认短语
nano /etc/copybot/paper.env                                # Alchemy RPC

改完记得重启对应服务。

一键健康检查

# 如果 healthcheck.sh 还在 /tmp(可能重启后没了),重新创建见 DEPLOY.md
# 简化版检查:
echo "=== 服务状态 ==="
systemctl is-active copybot-paper copybot-live copybot-dashboard mihomo
echo "=== 代理 ==="
/opt/mihomo-healthcheck.sh && echo "正常" || echo "异常"
echo "=== live bot 最近心跳 ==="
journalctl -u copybot-live --since "5 minutes ago" --no-pager | tail -3
echo "=== daily.sh 今天跑了没 ==="
tail -3 /opt/winning-wallet-finder/live/daily.log

文件位置速查

文件 位置 用途
项目代码 /opt/winning-wallet-finder/ git clone 来的
live 配置 /opt/winning-wallet-finder/config.live.json 跟单钱包/金额
paper 配置 /opt/winning-wallet-finder/live/copybot.paper.json 跟单钱包/金额
live 环境变量 /etc/copybot/live.env 私钥/代理/确认短语
paper 环境变量 /etc/copybot/paper.env Alchemy RPC
systemd 服务 /etc/systemd/system/copybot-*.service 4 个服务定义
mihomo 配置 /etc/mihomo/config.yaml 代理订阅
健康检查脚本 /opt/mihomo-healthcheck.sh 代理自动轮换
钱包候选列表 /opt/winning-wallet-finder/live/watch_sharps.json 11 个可复制钱包
钱包池 /opt/winning-wallet-finder/live/watch_skilled.json 82 个有 edge 的钱包
dashboard http://45.207.206.36:18080/ 浏览器访问
daily.sh 日志 /opt/winning-wallet-finder/live/daily.log 每日流水线日志

浏览器入口

入口 地址 看什么
实时 dashboard http://45.207.206.36:18080/ bot 现金/持仓/成交(PAPER/LIVE 可切换)
原始 JSON (paper) Gitea raw URL paper bot 的 feed
原始 JSON (live) Gitea raw URL live bot 的 feed
Polymarket https://polymarket.com MetaMask 登录看真实仓位/兑现
Gitea 仓库 https://code.aifunny.ltd/gavindiaz/winning-wallet-finder 代码/文档