docs: update README for async entry, entering status, 50ms scan

- Architecture diagram: async goroutine entry path
- Trading Logic: async entry, entering status protection
- Config note: floor rounding on both exchanges
This commit is contained in:
jackyu66git
2026-05-03 23:00:18 +08:00
parent b55ff111a4
commit cdcf0acea6
+10 -7
View File
@@ -24,11 +24,12 @@ PriceStore ─────────┼─────────────
└─────────┬─────────┘
┌───────────────▼────────────────┐
│ Trader (trading logic only)
│ TryEntry / Tick / Exit
Maker fees, scale-in, stop
Synchronous entry (no goroutine)
NO display/stat calculations
│ Trader
TryEntry (async goroutine)
→ placeOrder (REST)
Tick / Exit / Scale-in
Maker fees only
│ NO display/stat calculations │
└───────────────┬────────────────┘
┌─────────▼─────────┐
@@ -97,7 +98,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 **50ms**. At this rate the scanner catches every HyperLiquid ~200ms push without any jitter.
> **Note:** Scan interval is fixed at **50ms** (not configurable). Order sizes round DOWN (`math.Floor`) on both Bitget and HyperLiquid for consistency.
## Fee Model
@@ -115,8 +116,10 @@ Round trip (2 legs entry + 2 legs exit): **0.07%** total fees.
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)
- **Async goroutine** — `TryEntry` returns immediately, `executeEntry` runs in background
- Direction sanity check (0.1% tolerance) prevents entry on reversed spreads
- `entering` status prevents `checkExit` / `checkScaleIn` during leg placement
- `entering` map prevents duplicate entries on the same coin
3. **Scale-in** adds another leg-worth when spread widens another 0.10%
4. **Exit** conditions (whichever hits first):
- Spread converges to ≤ 0.02% → **价差收敛,止盈平仓**