Commit Graph

6 Commits

Author SHA1 Message Date
root
f6156a2cfe Add strategy-aware paper trade schema and API endpoints 2026-03-01 11:55:00 +00:00
root
45bad25156 fix(P0): pnl_r calculation + cooldown bypass + partition month bug
P0-1: Reverse signal now bypasses cooldown - evaluate_signal always
      outputs direction, main loop checks direction+score>=60 for
      closing positions against trend (not blocked by COOLDOWN_MS)

P0-2: pnl_r unified to (exit-entry)/risk_distance across all exit
      scenarios (tp, sl, sl_be, timeout) in both paper_monitor.py
      and signal_engine.py. Old hardcoded values (1.5R/2.25R) were
      ~2x too high vs actual risk_distance basis.

P1-1: ensure_partitions month calculation fixed from timedelta(30d)
      to proper month arithmetic. Also fixed UTC timezone for
      partition boundaries.

docs: V52-TODO.md with full audit backlog for V5.2
2026-03-01 09:29:32 +00:00
root
4f54e36d1a feat: dual-write agg_trades to local PG + Cloud SQL
- db.py: add Cloud SQL connection pool (CLOUD_PG_ENABLED env toggle)
- agg_trades_collector: flush_buffer writes to both local and cloud
- Cloud SQL write failure is non-fatal (log warning, don't block local)
2026-03-01 07:16:03 +00:00
root
022ead6d6c feat: paper_trades store score_factors JSONB (direction/crowding/environment/confirmation/auxiliary breakdown) 2026-02-28 13:45:26 +00:00
root
e054db112d feat: paper trading - backend (table+signal_engine integration+5 APIs) + frontend page 2026-02-28 11:10:28 +00:00
root
4168c1dd88 refactor: SQLite→PostgreSQL migration - db.py连接层 + main/collector/signal-engine/backfill全部改PG
Phase 1: 核心数据表(agg_trades/rate_snapshots/signal*)迁PG
auth.py暂保留SQLite(低频,不影响性能)
- db.py: psycopg2同步池 + asyncpg异步池 + PG schema + 分区管理
- main.py: 全部改asyncpg查询
- collector: psycopg2 + execute_values批量写入
- signal-engine: psycopg2同步读写
- backfill: psycopg2 + ON CONFLICT DO NOTHING
2026-02-27 16:15:16 +00:00