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>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
047571921e
commit
b7767c95ae
@@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -1277,12 +1276,11 @@ func (t *Trader) placeOrder(leg *PositionLeg, side string, store *PriceStore) (s
|
||||
leg.OrderID = resp
|
||||
log.Printf("[ExRes] HL %s %s: size=%s", side, leg.Coin, szStr)
|
||||
|
||||
// Parse actual fill price, OID, and estimate fee from HL response
|
||||
fillPrice, _, oid, parseErr := t.hyperliquid.ParseFillFromResponse(resp)
|
||||
// Parse actual fill price from HL response
|
||||
fillPrice, _, parseErr := t.hyperliquid.ParseFillFromResponse(resp)
|
||||
if parseErr == nil && fillPrice > 0 {
|
||||
leg.EntryPrice = fillPrice
|
||||
leg.OrderID = strconv.FormatInt(oid, 10)
|
||||
log.Printf("[Fill] HL %s %s: actual fillPrice=%.6f oid=%d", side, leg.Coin, fillPrice, oid)
|
||||
log.Printf("[Fill] HL %s %s: actual fillPrice=%.6f", side, leg.Coin, fillPrice)
|
||||
}
|
||||
fee, fetchErr := t.hyperliquid.EstimateFeeFromResponse(resp, takerFees[ExHyperLiquid])
|
||||
if fetchErr != nil {
|
||||
@@ -1535,12 +1533,11 @@ func (t *Trader) closeLeg(leg *PositionLeg) string {
|
||||
log.Printf("[ExRes] HL close %s %s: size=%s → response=%s", side, leg.Coin, leg.Size, resp)
|
||||
leg.OrderID = resp
|
||||
|
||||
// Parse actual fill price and OID from HL close response
|
||||
fillPrice, _, oid, parseErr := t.hyperliquid.ParseFillFromResponse(resp)
|
||||
// Parse actual fill price from HL close response
|
||||
fillPrice, _, parseErr := t.hyperliquid.ParseFillFromResponse(resp)
|
||||
if parseErr == nil && fillPrice > 0 {
|
||||
leg.ExitPrice = fillPrice
|
||||
leg.OrderID = strconv.FormatInt(oid, 10)
|
||||
log.Printf("[Fill] HL close %s: actual exitPrice=%.6f oid=%d", leg.Coin, fillPrice, oid)
|
||||
log.Printf("[Fill] HL close %s: actual exitPrice=%.6f", leg.Coin, fillPrice)
|
||||
}
|
||||
}
|
||||
leg.Closed = true
|
||||
@@ -1759,12 +1756,11 @@ func (t *Trader) placeOrderAt(leg *PositionLeg, side string, store *PriceStore,
|
||||
}
|
||||
leg.OrderID = oid
|
||||
|
||||
// Parse actual fill price and OID from HL response
|
||||
fillPrice, _, oidNum, parseErr := t.hyperliquid.ParseFillFromResponse(oid)
|
||||
// Parse actual fill price from HL response
|
||||
fillPrice, _, parseErr := t.hyperliquid.ParseFillFromResponse(oid)
|
||||
if parseErr == nil && fillPrice > 0 {
|
||||
leg.EntryPrice = fillPrice
|
||||
leg.OrderID = strconv.FormatInt(oidNum, 10)
|
||||
log.Printf("[Fill] HL scale %s %s: actual fillPrice=%.6f oid=%d", side, leg.Coin, fillPrice, oidNum)
|
||||
log.Printf("[Fill] HL scale %s %s: actual fillPrice=%.6f", side, leg.Coin, fillPrice)
|
||||
}
|
||||
|
||||
// Estimate fee from HL response
|
||||
|
||||
Reference in New Issue
Block a user