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
This commit is contained in:
jackyu66git
2026-05-03 22:25:01 +08:00
parent 6a4b046742
commit 915b316ca7
3 changed files with 31 additions and 11 deletions
+11 -2
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"log"
"math/rand"
"os"
"os/signal"
"strings"
@@ -113,10 +114,16 @@ func main() {
// Main loop
lastHour := -1
scannerTick := time.NewTicker(time.Duration(cfg.ScanIntervalMs) * time.Millisecond)
// Random jitter 50-250ms to avoid lock-step with exchange push cycles
jitterMin, jitterMax := 50, 250
randInterval := func() time.Duration {
return time.Duration(jitterMin+rand.Intn(jitterMax-jitterMin+1)) * time.Millisecond
}
scannerTick := time.NewTimer(randInterval())
statusTick := time.NewTicker(30 * time.Second)
log.Printf("[Monitor] Scanner running every %dms", cfg.ScanIntervalMs)
log.Printf("[Monitor] Scanner running every %d-%dms (random jitter)", jitterMin, jitterMax)
runLoop := true
for runLoop {
@@ -202,6 +209,8 @@ func main() {
notifier.SendTradeSummary(positions, now.Format("2006-01-02 15:04"))
lastHour = hour
}
scannerTick.Reset(randInterval())
}
}