46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/**
|
|
* PM2:四路子代理 agent.py(可选,与中控分开管理)
|
|
*
|
|
* 每个 app 在对应 crypto_monitor_* 目录启动,以加载该目录 .env 中的 API 密钥。
|
|
* Python 解释器使用 manual_trading_hub/.venv(须已 pip install -r requirements.txt)。
|
|
*
|
|
* 启动:
|
|
* pm2 start ecosystem.agents.config.cjs
|
|
*
|
|
* 仅启动部分账户可编辑下方 apps 数组,或:
|
|
* pm2 start ecosystem.agents.config.cjs --only manual-agent-binance
|
|
*/
|
|
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");
|
|
|
|
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),
|
|
],
|
|
};
|