中控增加下单,关键位,系统设置
This commit is contained in:
@@ -1,28 +1,52 @@
|
||||
/**
|
||||
* PM2:多账户交易中控 hub.py(Ubuntu / Linux)
|
||||
* PM2:中控 hub + 四路子代理 agent(一次启动全部)
|
||||
*
|
||||
* 前置:
|
||||
* cd manual_trading_hub
|
||||
* cp .env.example .env # 按需修改 HUB_PORT、HUB_BRIDGE_TOKEN 等
|
||||
* python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
||||
* source .venv/bin/activate && pip install -r requirements.txt
|
||||
* cp .env.example .env
|
||||
*
|
||||
* 启动:
|
||||
* 启动(hub + 全部 agent):
|
||||
* pm2 start ecosystem.config.cjs
|
||||
* pm2 save && pm2 startup
|
||||
*
|
||||
* 常用:
|
||||
* pm2 logs manual-trading-hub
|
||||
* pm2 restart manual-trading-hub
|
||||
* 仅中控:pm2 start ecosystem.config.cjs --only manual-trading-hub
|
||||
* 仅某 agent:pm2 start ecosystem.config.cjs --only manual-agent-binance
|
||||
*
|
||||
* 子代理(agent)见 ecosystem.agents.config.cjs 或 scripts/后台运行-Ubuntu.md
|
||||
* 快捷:bash scripts/pm2_hub.sh start
|
||||
*/
|
||||
const path = require("path");
|
||||
|
||||
const HUB_DIR = __dirname;
|
||||
const REPO_ROOT = path.join(HUB_DIR, "..");
|
||||
const PY = path.join(HUB_DIR, ".venv", "bin", "python");
|
||||
const AGENT = path.join(HUB_DIR, "agent.py");
|
||||
const RUN_SH = path.join(HUB_DIR, "scripts", "run_hub.sh");
|
||||
|
||||
function agentApp(name, exchangeDir, exchange, port) {
|
||||
return {
|
||||
name,
|
||||
cwd: path.join(REPO_ROOT, exchangeDir),
|
||||
script: AGENT,
|
||||
interpreter: PY,
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: "400M",
|
||||
env: {
|
||||
EXCHANGE: exchange,
|
||||
PORT: String(port),
|
||||
HOST: "127.0.0.1",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
agentApp("manual-agent-binance", "crypto_monitor_binance", "binance", 15200),
|
||||
agentApp("manual-agent-okx", "crypto_monitor_okx", "okx", 15201),
|
||||
agentApp("manual-agent-gate", "crypto_monitor_gate", "gate", 15202),
|
||||
agentApp("manual-agent-gate-bot", "crypto_monitor_gate_bot", "gate", 15203),
|
||||
{
|
||||
name: "manual-trading-hub",
|
||||
cwd: HUB_DIR,
|
||||
@@ -32,9 +56,6 @@ module.exports = {
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: "512M",
|
||||
// 环境变量优先写在 manual_trading_hub/.env(由 run_hub.sh 加载)
|
||||
// 也可在此覆盖,例如:
|
||||
// env: { HUB_PORT: "5100", HUB_DISABLED_IDS: "1" },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user