Initial eth_hedge_sim: P0 market, auth UI, one-click deploy.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# eth_hedge_sim
|
||||
|
||||
独立自动对冲**模拟盘**:OKX 实盘只读行情 + 本地虚拟资金撮合。
|
||||
与现网 `crypto_monitor` **无代码、进程、密钥共用**。
|
||||
|
||||
仓库:<https://git.bz121.com/dekun/eth_hedge_sim.git>
|
||||
|
||||
## 文档
|
||||
|
||||
- [开发方案](docs/开发方案.md)
|
||||
- [代码结构](docs/代码结构.md)
|
||||
|
||||
## 访问(测试机)
|
||||
|
||||
- 地址:`http://47.236.184.99:5155`
|
||||
- 默认登录:见服务器 `/opt/eth_hedge_sim/.env` 的 `AUTH_USERNAME` / `AUTH_PASSWORD`(示例 `admin` / `admin123`)
|
||||
- 登录页可填写 **API 地址**(同机部署填 `http://47.236.184.99:5155` 或留当前域名)
|
||||
|
||||
## 一键部署 / 更新(禁止 scp 传代码)
|
||||
|
||||
服务器目录:`/opt/eth_hedge_sim`
|
||||
更新方式:**只允许 `git pull`**,然后构建并 `pm2 startOrReload` 本项目进程。
|
||||
|
||||
### 服务器上
|
||||
|
||||
```bash
|
||||
# 首次
|
||||
export REPO_URL=https://git.bz121.com/dekun/eth_hedge_sim.git
|
||||
bash /opt/eth_hedge_sim/deploy/bootstrap.sh
|
||||
# 若尚未 clone:
|
||||
# git clone "$REPO_URL" /opt/eth_hedge_sim && bash /opt/eth_hedge_sim/deploy/bootstrap.sh
|
||||
|
||||
# 日常更新
|
||||
bash /opt/eth_hedge_sim/deploy/pull_and_restart.sh
|
||||
```
|
||||
|
||||
### 本机触发远程更新
|
||||
|
||||
```bash
|
||||
pip install paramiko
|
||||
set DEPLOY_PASS=*** # Windows PowerShell: $env:DEPLOY_PASS='***'
|
||||
python scripts/deploy_remote.py
|
||||
```
|
||||
|
||||
PM2 进程名:`eth-hedge-api`(端口 **5155**)。禁止 `pm2 restart all`。
|
||||
|
||||
## 本地开发
|
||||
|
||||
```bash
|
||||
python -m venv .venv
|
||||
.venv\Scripts\activate
|
||||
pip install -r requirements.txt
|
||||
copy .env.example .env
|
||||
|
||||
python scripts/smoke_market.py
|
||||
cd backend
|
||||
uvicorn app.main:app --host 0.0.0.0 --port 5155 --reload
|
||||
|
||||
# 另开终端
|
||||
cd frontend
|
||||
npm ci
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 硬规则摘要
|
||||
|
||||
- 模拟阶段零交易类 API
|
||||
- 永续市价;期权只吃买卖一;滑点 = 1×手续费
|
||||
- 仓位:永续 1 ETH,期权 2 ETH 名义
|
||||
- 部署更新只用 git pull,不用 scp
|
||||
Reference in New Issue
Block a user