Commit Graph
17 Commits
Author SHA1 Message Date
jackyu66git c04d8ca0da fix: 修正注释位置 && 清理废弃的 GetHLSize 2026-05-04 22:52:45 +08:00
jackyu66git 9d942e9dee fix: HL size 动态格式化(从 Meta 取 szDecimals)
- 新增 HyperLiquidTrade.GetSize(),从 HL Meta.Universe 获取
  每个币的 SzDecimals 运行时格式化订单数量
- 替代硬编码的 exchange.GetHLSize() switch case
- trader.go 中 placeOrder/placeOrderAt 两处调用切换为新方法
- 新增 TryEntry 价格<=0 检查,过滤异常数据
2026-05-04 22:50:24 +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 411365b66e fix: correct HL fee parsing (OrderStatus not statuses[]) and add productType to BG fills query 2026-05-04 20:06:27 +08:00
jackyu66git 6e9b982c66 config: lower threshold 0.10->0.05, arb 0.03->0.02, amount 0->0 2026-05-04 19:31:08 +08:00
jackyu66git 6baae85eaa feat: actual exchange fees for entry orders
- BitgetTrade: added GetTradeFee() queries /mix/order/fills
- HyperLiquidTrade: added GetTradeFee() parses MarketOpen response
- trader.placeOrder() now returns (errMsg, actualFeeUSD)
- executeEntry uses actual fee from exchange, falls back to estimate
2026-05-04 18:35:33 +08:00
jackyu66git 0aa9923067 fix: full arb table + net profit columns in price view
- ArbTable: removed slice(0,10) cap, shows all 42 opps (21x2)
- PriceTable: added net_bg_to_hl and net_hl_to_bg columns
- Backend SSE: sends net profit for both directions per coin
2026-05-04 18:26:49 +08:00
jackyu66git 5f6578c179 feat: add 17 new cross-exchange pairs (BG↔HL)
Added: ALGO, PYTH, SAND, ADA, HBAR, IOTA, MINA, FET, WLD,
       SUI, APT, NEAR, FIL, DYDX, JUP, TIA, MOVE

Removed: pixel and VET (fake 195% spreads on testnet)

Also updated GetHLSize() to handle szDecimals for all new coins.
2026-05-04 18:05:53 +08:00
jackyu66git 49da6fd35b fix: HL balance now reads spot USDC via SpotUserState
HL testnet USDC lives in the spot account, not the perp clearinghouse.
GetBalance() was calling UserState() (perp clearinghouseState), which
returned /usr/bin/bash. Switched to SpotUserState() and parse USDC.total - USDC.hold.

Also cleaned up .gitignore to exclude .env, binary, logs, data/.
2026-05-04 17:48:14 +08:00
jackyu66git 156ce22474 feat: HL EVM signing via sonirico/go-hyperliquid SDK - testnet orders work 2026-05-04 16:21:57 +08:00
jackyu66git 8b8d4140f9 refactor: HL EVM signing via sonirico/go-hyperliquid SDK 2026-05-04 16:15:51 +08:00
jackyu66git c5c4c7394f fix: HL testnet - add API wallet address to signed orders, 3-param constructor 2026-05-04 15:39:31 +08:00
jackyu66git e5ea78ffd2 feat: real trading mode, auto-stop after 5 trades, HL testnet support
- config.json: test_mode=false, ready for sim/testnet trading
- trader.go: auto-stop after 5 real trades, exchange response logging,
  Stop()/Start() API, shuttingDown flag for graceful stop
- dashboard.go: POST /api/stop + POST /api/start endpoints,
  trading status in SSE stats
- exchange/hyperliquid.go: switch HL WS to testnet endpoint
- exchange/hyperliquid_trade.go: switch REST to testnet endpoint,
  support base64 + 32-byte EVM private keys
- main.go: listen on trader.StopCh (graceful, no process exit)
- scanner.go: trim TrackedCoins to only 6 core coins (DOGE/LINK/ONDO/OP/WIF/ARB)
- .gitignore: ignore main binary
2026-05-04 14:31:52 +08:00
jackyu66git cf6548c37f fix: 4 bugfixes for production readiness
1. GetHLSize: add minimum size checks (prevent size=0 when price > amount)
2. executeEntry: orphan position warning when leg1 close also fails after leg2
3. checkExit: keep position as close_failed on failure, retryClose on each Tick
4. persistTrade: sync instead of goroutine (prevent data loss on exit)
2026-05-03 23:13:44 +08:00
jackyu66git 915b316ca7 fix: HL size floor, random scan jitter 50-250ms
- GetHLSize: change rounding from Sprintf (round-to-nearest)
  to math.Floor (floor), consistent with GetBitgetSize
- Scan interval: fixed 200ms → random 50-250ms to avoid
  lock-step with HyperLiquid's ~200ms allMids push cycle
- README: update architecture diagram, trading logic, config note
2026-05-03 22:25:01 +08:00
jackyu66git b08d8490fc fix: data race, scale-in PnL, nonce mutex, dead code, hourly check
- 🔴 Data race: Add GetPositionsCopy() returning deep copies (no shared
  ArbPosition pointers). Use it in dashboard broadcastLoop + handleStatus.
- 🟡 Scale-in PnL: Track LongEntryPrices/ShortEntryPrices on ArbPosition,
  compute weighted average (harmonic mean) at exit for accurate PnL.
- 🟢 CalcNetProfit: Delete dead code from exchange/helpers.go.
- 🟢 HL nonce: Add sync.Mutex around lastNonce++ (thread safety).
- 🟢 Hourly check: Change from 5-second window to minute window.
- 🟢 ExitPrice: Test mode closeLeg already handled by checkExit.
2026-05-03 18:31:14 +08:00
jackyu66git 719f0a061d Initial commit 2026-05-03 16:54:36 +08:00