Page:
系统开发/部署与配置
Pages
人物/孙宇晨
人物/段永平
人物
公司/公司研究模板
公司/围城
公司/坟场/恒大集团
公司/坟场
公司/集市
知识/业绩归因
知识/交易成本
知识/信息比率
知识/信息系数
知识/凯利公式
知识/分层回测
知识/前视偏差
知识/协方差矩阵
知识/卡玛比率
知识/去极值
知识/参数近邻稳定性
知识/因子中性化
知识/因子暴露
知识/均值方差优化
知识/基准
知识/复习与Anki说明
知识/复权
知识/夏普比率
知识/多因子模型
知识/市场冲击
知识/年化收益率
知识/幸存者偏差
知识/换手率
知识/数据窥探
知识/最大回撤
知识/杠杆
知识/标准化
知识/样本内/样本外
知识/波动率
知识/流动性
知识/滑点
知识/索提诺比率
知识/组合优化
知识/胜率与盈亏比
知识/过拟合
知识/阿尔法与贝塔
知识/预测基本定律
知识/风险平价
知识/风险模型
知识/风险预算
知识/T+1与涨跌停
知识
策略/背刺
策略/蜂群
系统开发/数据导入
系统开发/踩坑记录
系统开发/部署与配置
系统开发/项目简介
Home
人物
公司
策略
系统开发
Clone
Table of Contents
This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
部署与配置
数据库(黑群晖 Docker)
- 容器:
postgres-server,端口 5438(宿主)→ 5432(容器) - 超级用户:sally(不是 postgres!)
- 数据库:
quant_db,另有默认库mydb - 进 psql:
sudo docker exec -it postgres-server psql -U sally -d quant_db
账号
| 账号 | 用途 | 权限 |
|---|---|---|
| sally | 超级用户 | 全部 |
| xiaoqiang | 小强只读查询 | quant_db 只读 |
| xiaoqiang_w | importer 写库 | 全部表/视图/序列 owner |
⚠️ 表/视图/序列的 owner 必须转给 xiaoqiang_w,否则 importer 的
DDL(CREATE INDEX 等)会报 must be owner。转换 SQL 见 系统开发/踩坑记录。
Python 环境(小强容器 openclaw-1)
- 系统 Python 3.11 受 PEP 668 保护,不能直接 pip install
- 专用 venv:
/opt/quant-venv(root 创建) - 跑脚本一律用:
/opt/quant-venv/bin/python - 依赖:tushare / pandas / psycopg2-binary / sqlalchemy / python-dotenv
.env 配置
路径:/home/node/quanxiel/quantitative_data/.env(不入 git)
QUANT_DB_HOST=192.168.27.11
QUANT_DB_PORT=5438
QUANT_DB_NAME=quant_db
QUANT_DB_USER=xiaoqiang_w
QUANT_DB_PASSWORD=***
TUSHARE_TOKEN=***
- 密码含特殊字符时写 .env 用 heredoc
<<'EOF'防转义 - 改 .env 后无需重启,config.py 每次加载
目录权限
仓库目录必须 node 用户可写(importer 要写日志):
sudo docker exec -u root openclaw-1 bash -c 'chown -R node:node /home/node/quanxiel'