Commit Graph

101 Commits

Author SHA1 Message Date
root
4d5ebbb1b3 feat: strategy-plaza frontend - cards overview + detail tabs 2026-03-07 06:32:29 +00:00
root
9eeb9a2434 fix: update ALT gate thresholds display in signals-v53fast page 2026-03-04 04:20:23 +00:00
root
7accb8ed88 fix: update ALT gate threshold display - SOL 0.4%, XRP 0.25% 2026-03-04 04:08:07 +00:00
root
83494dc66c feat: add entry_ts and exit_ts columns to trade history tables (paper-v53 & paper-v53fast) 2026-03-04 03:06:58 +00:00
root
98a88d7c19 fix: signals-v53fast use correct strategy=v53_fast; label CVD as 5m/30m realtime 2026-03-04 02:01:50 +00:00
root
84d8535066 feat: v53fast frontend - orange banner, OBI/accel indicators, distinct from v53 2026-03-04 01:53:36 +00:00
root
c8416b4916 feat: add v53_fast strategy - 5m/30m CVD + OBI positive scoring + accel independent trigger 2026-03-04 01:44:09 +00:00
root
3352489ce9 fix: add SL sanity check on open_position; add entry_ts display in paper-v53 positions 2026-03-04 01:15:09 +00:00
root
d2ddc3ea46 feat: unify v53 frontend - single strategy, no ALT/BTC tab split; update main.py display_score 2026-03-03 16:03:25 +00:00
root
546fae39d0 fix: expose display_score/gate_passed as top-level fields in /api/signals/latest for v53_btc 2026-03-03 15:45:09 +00:00
root
67f68f8756 fix: BTC shows alt_score_ref as display score, not gated-zero score 2026-03-03 15:39:15 +00:00
root
dfcf4f43c4 fix: show 4-layer scores for BTC too (removed !isBTC guard) 2026-03-03 15:34:21 +00:00
root
f87edc0339 feat: add ALT gate-control card to signals-v53 and paper-v53 latest signals 2026-03-03 15:27:03 +00:00
root
224ca20666 fix: add LatestSignals component to paper-v53 page 2026-03-03 14:28:19 +00:00
root
18af5bb711 feat: add V5.3 signal + paper frontend pages and sidebar nav 2026-03-03 14:09:49 +00:00
dev-worker
8bd5f8fa84 fix: 模拟盘前端ActivePositions组件自行fetch config计算paper1R 2026-03-02 17:37:03 +00:00
dev-worker
31e6e19ea6 fix: V3全面审阅修复 — 12项问题
P0-1: 风控Fail-Closed(状态文件缺失/过期/异常→拒绝开仓)
P0-2: 1R基准跨模块统一(position_sync+risk_guard从live_config动态读)
P0-3: close_all紧急全平校验返回值+二次验仓
P0-4: Coinbase Premium单位修复(premium_pct/100→比例值)
P1-3: 正向funding计入净PnL(不再只扣负值)
P1-4: 数据新鲜度检查落地(查signal_indicators最新ts)
P1-6: live表DDL补全到SCHEMA_SQL(live_config/live_events/live_trades)
P2-1: _get_risk_usd()加60秒缓存
P2-3: 模拟盘前端*200→从config动态算paper1R
P2-4: XRP/SOL跳过Coinbase Premium采集(无数据源)
P3-2: SQL参数化(fetch_pending_signals用ANY替代f-string)
额外: pnl_r公式修正(gross-fee+funding,funding正负都正确计入)
2026-03-02 17:28:23 +00:00
dev-worker
18506f2a44 fix: P1/P2/P3剩余6项全部修复
P1-3: 前端持仓USDT从config读riskUsd(不再硬编码*2)
P1-4: 平仓兜底不盲目取最后成交,无明确平仓记录则延后结算
P2-1: LISTEN连接断线自动重建+重新LISTEN
P2-2: 余额风控LOW_BALANCE自动恢复(余额回升则解除暂停)
P2-3: fetch_pending_signals改用asyncio.to_thread避免阻塞事件循环
P3-1: dashboard页面改用新auth体系(authFetch+useAuth+/api/auth/me)
2026-03-02 16:19:03 +00:00
root
b0a463a22c feat: 实盘配置面板 (live_config)
DB:
- live_config表(key/value/label/updated_at)
- 默认7项: 1R金额/初始本金/风险比例/最大持仓/杠杆/策略/环境

API:
- GET /api/live/config — 读取全部配置
- PUT /api/live/config — 批量更新配置

前端:
- L1.5配置面板(L1止血和L2账户之间)
- 标题栏醒目显示 1R = $X.XX
- 7列网格: 图标+标签+值
- 编辑模式: 点编辑→改值→保存/取消
- 各项格式化: $前缀/%后缀/x后缀
2026-03-02 10:55:52 +00:00
root
d7788d3766 feat: L7事件流 — live_events表+API+前端+三模块事件写入
DB:
- live_events表(id/ts/level/category/symbol/message/detail)

后端:
- GET /api/live/events?limit=30&level=all|critical|warn|info&category=all|trade|risk
- log_live_event() 异步辅助函数

事件源:
- live_executor: 开仓成功写event(trade/info, 含滑点/score)
- position_sync: 平仓写event(trade, 含PnL拆解)
- risk_guard: 熔断/禁仓/恢复写event(risk/critical|warn|info)

前端L7:
- 5秒轮询, 最近30条事件
- 按级别筛选(全部/严重/警告/信息)
- 彩色分类标签(trade绿/risk红/system灰/reconciliation紫)
- 时间线布局, 最大高度56带滚动
2026-03-02 10:22:40 +00:00
root
fb0c3806b5 feat: PnL五项拆解 (gross/fee/funding/slippage/net)
后端:
- /api/live/trades 返回 gross_pnl_r, fee_r, funding_r, slippage_r, net_pnl_r
- gross = 方向盈亏(含TP1半仓锁定)
- fee_r = 实际手续费/risk_usd
- funding_r = 不利资金费/risk_usd
- slippage_r = 滑点损失估算
- net = pnl_r(已是净值)

前端L10:
- 表头改为: Gross | Fee | FR | Slip | Net
- 颜色: gross绿/红, fee橙, FR紫, slip灰, net加粗绿/红
- 每笔交易一目了然:赚了多少、扣了多少、净剩多少
2026-03-02 10:13:51 +00:00
root
cb869926e2 feat: 完整11层实盘页面 + 补充API
前端(/live page.tsx 594行):
- L0: 顶部固定风险条(sticky) - 交易状态/R预算/对账/清算/连亏
- L1: 一键止血区 - 全平/禁新仓/恢复(双重确认)
- L2: 账户概览8卡片 - 权益/保证金/杠杆/今日PnL/总PnL/成本/胜率PF
- L3: 当前持仓(WS实时) - 含清算距离/滑点/裸奔/延迟/OrderID
- L4: 执行质量面板 - 滑点/延迟P50/P95按币种分组
- L5: 对账面板 - 本地vs币安持仓+挂单+差异列表
- L6: 风控状态 - 规则检查+熔断原因+恢复条件
- L8: 实盘vs模拟盘对照 - signal_id匹配+入场差/R差
- L9: 权益曲线+回撤 - 双Area叠加
- L10: 历史交易 - 含成交价/滑点/费用+筛选
- L11: 系统健康 - PM2进程状态+数据新鲜度

后端新增API:
- /api/live/account: 币安账户数据
- /api/live/health: PM2进程+数据新鲜度
- /api/live/reconciliation: 对账(本地vs币安)
- /api/live/execution-quality: 执行质量统计
- /api/live/paper-comparison: 实盘vs模拟盘
2026-03-02 09:38:14 +00:00
root
1ef1f97b5d feat: /live 实盘交易前端页面
- 风控状态面板: 实时显示(正常/警告/熔断)、已实现R+未实现R+合计、连亏次数
- 紧急操作: 全平(双重确认)、禁止开仓、恢复交易
- 总览卡片: 盈亏R+USDT、胜率、持仓数、PF、手续费、资金费
- 当前持仓: WebSocket实时价格、滑点/裸奔/延迟指标、OrderID
- 权益曲线: Recharts AreaChart
- 历史交易: 含成交价/滑点/费用列、币种/盈亏筛选
- 详细统计: 滑点P50/P95/均值、按币种分组
- 导航栏: 新增实盘入口(Bolt图标)

风格与模拟盘一致: 白底+slate+emerald/red配色
2026-03-02 09:28:07 +00:00
root
a7dec3fe14 fix: frontend use DB risk_distance + add entry time with ms
- Both paper pages now read risk_distance from API (not hardcoded 2.0*0.7*ATR)
- Added entry timestamp display (精确到毫秒) in active positions
- Applies to both V5.1 and V5.2 paper pages
2026-03-02 07:13:52 +00:00
root
984019d9ab fix: paper latest signals use signal-history with strategy filter + layer scores
- V5.1 paper: signal-history?strategy=v51_baseline
- V5.2 paper: signal-history?strategy=v52_8signals
- API now returns factors in signal-history
- Each signal shows layer score badges below
2026-03-02 03:08:19 +00:00
root
5b704a0a0e feat: paper pages show per-strategy signals with layer scores
- V5.1 paper reads /api/signals/latest?strategy=v51_baseline
- V5.2 paper reads /api/signals/latest?strategy=v52_8signals
- Each coin shows layer score badges (方向/拥挤/环境/确认/辅助)
- V5.2 additionally shows FR and 清算 badges
2026-03-02 02:59:39 +00:00
root
7ebdb98643 feat: store and serve indicators per strategy
- signal_indicators table: added strategy column
- Each strategy gets its own row per cycle
- API /api/signals/latest?strategy=v51_baseline|v52_8signals
- API /api/signals/signal-history?strategy=...
- V5.1 page reads v51_baseline data, V5.2 reads v52_8signals
- Now V5.1 and V5.2 show truly independent scores
2026-03-02 02:52:17 +00:00
root
1a45c5725a fix: V5.2 tier labels - no light tier, <75=不开仓, 75-84=标准, ≥85=加仓 2026-03-02 01:12:12 +00:00
root
05673c0850 fix: V5.2 scoring uses strategy weights, total capped at 100
Backend:
- Each layer score scaled by strategy config weights
- direction: 0~40, crowding: 0~18, FR: 0~5, environment: 0~12
- confirmation: 0~15, liquidation: 0~5, auxiliary: 0~5
- total_score clamped to 0~100
- factors include max field for frontend

Frontend:
- V5.2 signals page reads max from factors
2026-03-02 00:34:22 +00:00
root
5849bf6522 refactor: completely separate V5.1 and V5.2 pages
- /signals: V5.1 ONLY, 5-layer scoring, no FR/Liq
- /signals-v52: V5.2 ONLY, 7-layer scoring with FR/Liq
- /paper: V5.1 ONLY, no strategy tabs/badges
- /paper-v52: V5.2 ONLY, with FR/Liq display
- Sidebar: V5.1 and V5.2 separate sections
- V5.2 weights: 40+18+5+12+15+5+5=100 (no more >100)
- Zero cross-contamination between V5.1 and V5.2
2026-03-02 00:25:07 +00:00
root
01b1992643 feat: save factors to signal_indicators + show FR/Liq on signals page
- DB: added factors JSONB column to signal_indicators
- Backend: save_indicator now includes factors JSON
- API: /api/signals/latest returns factors field
- Frontend: signals page shows FR and 清算 score bars
2026-03-01 23:57:55 +00:00
root
ec198db504 fix: always show FR/Liq scores for V5.2 trades in history 2026-03-01 23:18:48 +00:00
root
7d2bb9f392 fix: FR/Liq scoring bugs + compact UI
Backend:
- FR threshold: 0.001→0.0003 (extreme), 0.0003→0.00005 (moderate)
- Liquidation SQL: side='SELL'/'BUY' → 'LONG'/'SHORT' (was never matching!)

Frontend:
- FR/Liq scores now inline in score column (compact)
- Removed bulky green badge buttons from position cards
2026-03-01 23:14:07 +00:00
root
ee90b8dcfa feat: sidebar navigation with V5.1/V5.2 separate entries
- Sidebar: 信号/模拟盘 section headers
- Three paper trade entries: 全部持仓, V5.1模拟盘, V5.2模拟盘 (NEW badge)
- Paper page reads strategy from URL query params
- Suspense boundary for useSearchParams
2026-03-01 12:25:40 +00:00
root
778cf8cce1 feat: V5.2 frontend differentiation - strategy tabs, side-by-side scores, visual badges
- Paper page: prominent strategy tabs (全部/V5.1/V5.2) at top
- Paper trades: strategy column with color-coded badges (blue=V5.1, green=V5.2)
- Paper positions: FR/Liq scores displayed prominently for V5.2
- Signals page: side-by-side V5.1 vs V5.2 score comparison cards
- Signals page title updated to 'V5.1 vs V5.2'
- New API endpoint for strategy comparison data
- Layout: local font fallback for build stability
2026-03-01 12:21:19 +00:00
root
7ba53a5005 Update paper UI for strategy filters and FR/liquidation details 2026-03-01 11:55:03 +00:00
root
4b841bc5f4 fix: floating PnL now accounts for half-position after TP1
Before: unrealR = full position × price move (wrong after TP1)
After: unrealR = 0.5×TP1_locked + 0.5×current_float (correct)

This fixes the display showing >1R floating profit that never
materializes in final PnL because only half position remains.
2026-03-01 09:48:46 +00:00
root
bda42e669a feat: stats panel with per-symbol tabs (ALL/BTC/ETH/XRP/SOL) - full stats for each coin 2026-03-01 01:37:02 +00:00
root
83dc456119 feat: signal page add detailed 5-layer explanation section 2026-02-28 14:33:33 +00:00
root
404cc683e0 fix: latest signals pass symbol without USDT suffix to signal-history API 2026-02-28 13:31:14 +00:00
root
71192d4209 fix: latest signals use signal-history API (last triggered signal, not realtime eval) 2026-02-28 13:20:24 +00:00
root
374615dea7 feat: paper page show latest signal per coin 2026-02-28 12:45:47 +00:00
root
95fec35d97 fix: paper balance font-size auto-fit (text-base instead of text-lg) 2026-02-28 12:38:52 +00:00
root
1d2304261b feat: paper frontend use aggTrade WS for real-time price (every tick instead of 1s) 2026-02-28 12:30:11 +00:00
root
d0e626a437 feat: paper summary add balance + pnl_usdt 2026-02-28 12:00:19 +00:00
root
7b901a2390 feat: paper_monitor.py - WebSocket realtime TP/SL + frontend WS price feed (1s update) 2026-02-28 11:55:40 +00:00
root
66810701fb feat: paper trading signal flip - reverse signal closes existing position then opens new 2026-02-28 11:45:48 +00:00
root
f90df6f3b5 feat: paper positions show real-time price + unrealized PnL (R + USDT) 2026-02-28 11:40:11 +00:00
root
59910fe9cd fix: paper page use useAuth() instead of manual localStorage check 2026-02-28 11:24:29 +00:00
root
282aed138a feat: paper trading switch + config API + max positions limit 2026-02-28 11:13:39 +00:00