- start_system.bat: CMD 批处理脚本,双击即可运行 - start_system.ps1: PowerShell 脚本,支持进程监控和优雅退出 两个脚本都会: 1. 激活 crypto_pred_312 conda 环境 2. 启动 API 服务 (端口 8000) 3. 启动自动交易程序
48 lines
1.3 KiB
Batchfile
48 lines
1.3 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
REM ============================================
|
|
REM 系统启动脚本 (Windows)
|
|
REM 启动 API 服务和自动交易程序
|
|
REM ============================================
|
|
|
|
echo [%date% %time%] 正在启动系统...
|
|
|
|
REM 检查 conda 环境
|
|
where conda >nul 2>&1
|
|
if %errorlevel% neq 0 (
|
|
echo [错误] 未找到 conda,请先安装 Anaconda 或 Miniconda
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM 激活 conda 环境
|
|
echo [%date% %time%] 激活 conda 环境: crypto_pred_312
|
|
call conda activate crypto_pred_312
|
|
if %errorlevel% neq 0 (
|
|
echo [错误] 无法激活 conda 环境 crypto_pred_312
|
|
echo 请先创建环境: conda create -n crypto_pred_312 python=3.12
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
REM 启动 API 服务 (后台运行)
|
|
echo [%date% %time%] 启动 API 服务...
|
|
start "API服务" cmd /c "python -m uvicorn api.main:app --host 0.0.0.0 --port 8000"
|
|
|
|
REM 等待 API 启动
|
|
timeout /t 3 /nobreak >nul
|
|
|
|
REM 启动自动交易程序 (后台运行)
|
|
echo [%date% %time%] 启动自动交易程序...
|
|
start "自动交易" cmd /c "python -u auto_trade_polymarket.py"
|
|
|
|
echo.
|
|
echo ============================================
|
|
echo 系统启动完成!
|
|
echo 前端访问: http://localhost:8000
|
|
echo 关闭窗口可停止对应服务
|
|
echo ============================================
|
|
echo.
|
|
|
|
pause
|