Files
Rekey 9351dec226 refactor: migrate API keys to config, extend Kline intervals, add DB extensions
Security:
- Move hardcoded Binance API key/secret from rest.ts to env.yaml (exchange config segment)
- Add ExchangeConfig validation in config/validators.ts
- Export typed exchange config from config/index.ts
- Update AGENTS/07-caveats.md to reflect the new policy

Kline intervals (add 3m / 2h / 6h / 8h / 1mon):
- TypeScript: update KlineInterval type, KLINE_INTERVAL_MS mapping, build_aggregates_sql refresh chain
- Python: sync KlineInterval Literal type, INTERVAL_TO_TABLE and INTERVAL_MS mappings, db_test table list
- SQL: add 5 continuous aggregate materialized views (klines_3m/2h/6h/8h/1mon) with indexes
- SQL: extend default kline_intervals in trading_pairs table
- SQL: add cross-sectional query indexes for klines_1d and klines_1w

DB:
- Enable pg_prewarm extension (backtest warmup)
- Enable pg_stat_statements extension (slow query monitoring)

Other:
- data/run/exchange.ts: graceful pgsql shutdown after backfill completes
- Config path: load from data/env.yaml (symlink) instead of project root
2026-06-14 18:45:01 +08:00

607 B

注意事项

  • 所有 API Key 统一在 env.yaml 中管理,禁止在代码中硬编码。新增交易所时在 exchange 段添加对应子配置即可。
  • env.yaml 包含明文密钥和数据库密码且被 git 追踪,注意安全,不要提交到公开仓库。
  • 未安装 Python 依赖(如 pydantic),engine/ 目录有独立的 .venv/
  • db/pgsql/.gitignore 中,这是 TimescaleDB 数据目录(Docker volume 映射)。
  • KLINE_INTERVAL_MS 常量定义了两处:data/exchanges/rest.tsdata/types/kline.ts 的类型定义。新增周期需同步。