Commit Graph
14 Commits
Author SHA1 Message Date
jackyu66gitandClaude Opus 4.6 d38782490c feat: 重构为三所价差异动监控系统
删除 HyperLiquid + 全部交易功能,构建自适应 surge 检测器。
- 新增 surge_detector.go: 每币独立滚动窗口基线,检测三所价差异常飙升
- 新增 SpreadCard/SurgeCard 前端组件
- 保留 momentum/trend/cumulative/trend_filter 扫描功能
- 更新文档和配置以反映新系统

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 02:01:18 +08:00
jackyu66gitandClaude Opus 4.6 559d7bb870 feat: 趋势过滤信号记录系统 + 实时涨跌方向判断
- 新增 TrendFilter 信号记录(enter/exit),按完整信号和高分信号两档分类
- 信号持久化到 data/trend_signals_cache.json,开机自动恢复
- 新增 /api/trend-signals API + SSE trend_signal 实时广播
- 前端新增完整信号卡片和高分信号卡片,移除旧趋势检测卡片
- 评分加入 1h 涨跌方向和实时 drift 惩罚,下跌币不触发信号
- OKX 交易所支持(累积变动、动量、趋势检测)
- 修复 trend_filter.go 编译错误

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 22:24:59 +08:00
jackyu66gitandClaude Opus 4.6 b7767c95ae feat: 添加OKX行情接入+趋势检测+累积变动系统+界面重构
- 新增OKX WebSocket行情连接器,扩展4交易所价格监控
- 新增z-score趋势检测引擎(TrendDetector),识别价格异动/趋势启动
- 新增累积变动跟踪(CumulativeTracker),基于1min/5min多交易所共识
- 趋势事件和累积变动事件持久化到SQLite
- 新增Binance/OKX动量检测字段,扩展前端动量卡片至15列
- 迁移至macOS(darwin-arm64),更新前端依赖
- Dashboard网格重构:非交易卡片置顶,交易卡片置底
- TrackedCoin添加OK字段,添加ExBinance/ExOKX常量
- 前端新增趋势检测卡片、趋势历史卡片、累积变动卡片

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-06 13:26:05 +08:00
jackyu66gitandClaude Opus 4.7 2f4d7869a9 fix: 重启后加仓数据恢复 + scale_count/amount_usd 实时持久化
- restoreOpenPositions 从 orders 表 count 加仓次数,正确设置 ScaleLevels 和 AmountUSD
- 加仓时立即持久化 amount_usd 和 scale_count 到 trades 表(不等到平仓)
- PnL 图表支持单笔交易显示(原点+累计PnL连线)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 03:19:26 +08:00
jackyu66gitandClaude Opus 4.7 f97ac16b1c feat: 实际成交价追踪 + reduceOnly保护 + 数据库增强
- Bitget GetTradeFee 返回实际成交均价(weighted avg fill price)及手续费, 支持最多5次重试
- HyperLiquid ParseFillFromResponse 提取订单成交均价, 新增 GetSize/GetBalance 方法
- 开仓/加仓/平仓均从交易所获取实际成交价替代WS估算价
- HL 平仓使用 reduceOnly 防止反向开仓
- 所有 OrderID 保存到数据库 orders 表
- 加仓零成交检测及实际手续费获取
- PnL 计算修正为按USD计算手续费
- 新增 GetAllClosedTrades / GetClosedStats 数据库查询
- 服务器重启 restore 未完成交易修复(DBTradeID 缺失)
- 黑名单强平添加 USD PnL/手续费预计算

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 02:59:18 +08:00
jackyu66git 9163d7fd30 切换到实盘环境
- HL: WS/REST 从 testnet 切换到 mainnet
- BG: 删除 paptrading header(实盘 key 不以 bg_ 前缀区分)
- config: 调整交易参数
- scanner: 更新跟踪币种列表
2026-05-04 22:24:30 +08:00
jackyu66git 06a7e37836 fix: persist positions to DB before goroutine so restarts don't lose open trades 2026-05-04 20:16:44 +08:00
jackyu66git f29e78a435 fix: db migration tab char corrupted, restore historical trades 2026-05-04 13:50:49 +08:00
jackyu66git ddaa5badd2 fix: 重启后总PnL回到0的问题 + 前端PnL图表公式统一
- trader.go: NewTrader 启动时从DB GetAllClosedTrades() 加载所有已平仓交易到 closedTrades
- trader.go: 新增 safeFloat/safeStr 辅助函数处理DB空指针
- db/trade_repo.go: 新增 GetAllClosedTrades() 方法
- frontend: PnL图表标题和曲线改用 2*AmountUSD*NetPnl/100 公式,与后端Stats一致
2026-05-04 06:23:35 +08:00
jackyu66git 5aedcb6566 修复 scale-in 后 leg.EntryPrice 不更新 + 重启恢复时加载 scale prices
- trader.go: scale-in 后用 weightedAvgPrice 更新 LongLeg/ShortLeg.EntryPrice
- trader.go: restoreOpenPositions 从 orders 表加载 scale prices 重建完整价格切片
- db/trade_repo.go: 新增 GetScalePrices(tradeID) 方法
- README: v1.2.1 版本记录
2026-05-04 06:06:37 +08:00
jackyu66git a9a21de5a2 refactor: 逐批次实时写入DB,删除persistTrade 2026-05-04 05:29:04 +08:00
jackyu66git 0288dc8284 feat: 手续费改为逐笔USD累算 + Vite React前端 + system_orders表 + README 2026-05-04 04:34:27 +08:00
jackyu66git 505137bcb0 feat(web): trade detail modal with prices, fees, timestamps
- Click any trade row in history table to open detail modal
- Modal shows 6 sections: 概览, 时间, 价差, 手续费, 多仓, 空仓
- Entries and exits displayed with 6 decimal precision
- Fee entry/exit and total fee displayed
- Open/close timestamps with full date-time format
- Duration, scale count, total amount, exit reason
- Orders sub-table if available
- Escape key and overlay click to close
2026-05-03 18:59:28 +08:00
jackyu66git b09314f317 Phase 1: SQLite persistence layer
- Add modernc.org/sqlite (pure Go, no CGO)
- db/ package: trades, orders, config_log tables + CRUD
- Trade persistence: every closed trade saved to SQLite
- Restart recovery: open positions restored from DB
- Automatic migration on startup
2026-05-03 17:28:08 +08:00