perf: scan interval 50ms fixed

HL allMids pushes ~200ms, scan at 50ms catches every update
within 1 tick. Async entry goroutine means no blocking.
This commit is contained in:
jackyu66git
2026-05-03 22:47:44 +08:00
parent 721abc02a9
commit b55ff111a4
2 changed files with 6 additions and 7 deletions
+3 -4
View File
@@ -19,8 +19,7 @@ PriceStore ─────────┼─────────────
└──────────────┘
┌─────────▼─────────┐
│ ScanBGHL (50-250ms
│ random jitter) │
│ ScanBGHL (50ms)
│ BG ↔ HL only │
└─────────┬─────────┘
@@ -98,7 +97,7 @@ Then open [http://localhost:8888](http://localhost:8888) for the Web dashboard.
| `BITGET_API_KEY` / `BITGET_API_SECRET` / `BITGET_PASSPHRASE` | — | Bitget API credentials (test mode skips) |
| `HL_PRIVATE_KEY` / `HL_ADDRESS` | — | HyperLiquid wallet credentials (test mode skips) |
> **Note:** Scan interval is fixed at **50-250ms random jitter** (not configurable). This prevents lock-step with HyperLiquid's ~200ms push cycle.
> **Note:** Scan interval is fixed at **50ms**. At this rate the scanner catches every HyperLiquid ~200ms push without any jitter.
## Fee Model
@@ -113,7 +112,7 @@ Round trip (2 legs entry + 2 legs exit): **0.07%** total fees.
## Trading Logic
1. **Scanner** runs every 50-250ms (random jitter to avoid lock-step with exchange push cycles), checks all 6 coins for BG ↔ HL spread
1. **Scanner** runs every 50ms, checks all 6 coins for BG ↔ HL spread
2. **Entry** when net profit ≥ `TRADE_THRESHOLD` (after full round-trip fees)
- Uses scan-time prices directly (no re-read from store to avoid WS jitter)
- Synchronous execution in the scanner tick (no goroutine delay)