dekun 0cf3756b09 Harden LIVE opens with slot claim and exchange reconcile.
Prevent duplicate opens by atomically claiming an opening slot, verifying exchange perp is flat before live orders, setting leverage from ledger, and preferring exchange position size when closing perps.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-26 22:39:27 +08:00

比特骆驼自动化对冲系统(eth_hedge_sim

产品名:比特骆驼自动化对冲系统
工程仓库 / 目录名:eth_hedge_sim(与产品名分离,部署路径不变)。

独立自动对冲系统:OKX / 币安行情 + 本地 SIM 撮合,可选 LIVE 实盘。
与现网 crypto_monitor 无代码、进程、密钥共用

仓库:https://git.bz121.com/dekun/eth_hedge_sim.git

运行环境

约定
操作系统 Ubuntu 22.04 LTS
进程管理 PM2eth-hedge-api
安装目录 /opt/eth_hedge_sim
端口 5155

文档

访问(测试机)

  • 反代:https://dc.hyf2.cc → 本机 5155PM2: eth-hedge-api
  • 登录账号:见服务器 /opt/eth_hedge_sim/.envAUTH_USERNAME / AUTH_PASSWORD
  • 可在「系统设置」修改用户名/密码;前端固定同源 API,无 API 地址配置项

一键部署 / 更新(禁止 scp 传代码)

目标机:Ubuntu 22.04,目录 /opt/eth_hedge_sim
更新方式:只允许 git pull,然后构建并 pm2 startOrReload 本项目进程。

推荐:curl 一键管理器(菜单)

curl -fsSL https://git.bz121.com/dekun/eth_hedge_sim/raw/branch/main/deploy/manage.sh | bash

菜单:

  1. 一键部署
  2. 一键卸载(仅停删 eth-hedge-api,移走目录并备份 .env
  3. 更新(git pull + 构建 + reload
  4. 退出

已安装后也可:

bash /opt/eth_hedge_sim/deploy/manage.sh

从开发机触发远程更新(可选)

在能 SSH 到 Ubuntu 服务器的机器上:

pip install paramiko
export DEPLOY_PASS='***'
python scripts/deploy_remote.py

PM2 进程名:eth-hedge-api(端口 5155)。禁止 pm2 restart all

服务器上本地开发 / 调试(Ubuntu 22.04

cd /opt/eth_hedge_sim
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

python scripts/smoke_market.py
cd backend
uvicorn app.main:app --host 0.0.0.0 --port 5155 --reload

# 另开终端
cd /opt/eth_hedge_sim/frontend
npm ci
npm run dev

硬规则摘要

  • 模拟阶段零交易类 API
  • 永续市价;期权只吃买卖一;滑点 = 1×手续费
  • 仓位:永续 1 ETH,期权 2 ETH 名义
  • 部署更新只用 git pull,不用 scp
  • 部署环境固定为 Ubuntu 22.04
S
Description
模拟盘测试,ETH永续与合约的对冲
Readme 7.8 MiB
Languages
Python 70%
TypeScript 23.9%
CSS 3.3%
Shell 2.5%
JavaScript 0.2%
Other 0.1%