独立的股票市场数据服务模块。
# 创建虚拟环境并安装依赖
./setup_venv.sh这个脚本会:
- 创建 Python 虚拟环境
- 安装共享基础设施模块
- 安装所有服务依赖(包括 WebSocket 支持库)
如果不使用虚拟环境脚本:
# 先安装共享基础设施模块
cd ../tdx-common-infra
pip install -e .
# 安装服务依赖
cd ../tdx-stock-service
pip install -r requirements.txt# 方式1: 使用启动脚本(会自动激活虚拟环境)
./run.sh
# 方式2: 手动激活虚拟环境后运行
source venv/bin/activate # 如果使用虚拟环境
python3 main.py
# 方式3: 直接运行(不推荐,需要确保依赖已安装)
python3 main.py服务将在 http://localhost:8001 启动。
启动后访问:
- Swagger UI: http://localhost:8001/docs
- ReDoc: http://localhost:8001/redoc
- 健康检查: http://localhost:8001/health
默认端口: 8001
可以通过环境变量 UVICORN_PORT 修改。