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:
@@ -24,10 +24,11 @@ PriceStore ─────────┼─────────────
|
|||||||
└─────────┬─────────┘
|
└─────────┬─────────┘
|
||||||
│
|
│
|
||||||
┌───────────────▼────────────────┐
|
┌───────────────▼────────────────┐
|
||||||
│ Trader (trading logic only) │
|
│ Trader │
|
||||||
│ TryEntry / Tick / Exit │
|
│ TryEntry (async goroutine) │
|
||||||
│ Maker fees, scale-in, stop │
|
│ → placeOrder (REST) │
|
||||||
│ Synchronous entry (no goroutine)│
|
│ Tick / Exit / Scale-in │
|
||||||
|
│ Maker fees only │
|
||||||
│ NO display/stat calculations │
|
│ 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) |
|
| `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) |
|
| `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
|
## 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
|
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)
|
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)
|
- 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
|
- 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%
|
3. **Scale-in** adds another leg-worth when spread widens another 0.10%
|
||||||
4. **Exit** conditions (whichever hits first):
|
4. **Exit** conditions (whichever hits first):
|
||||||
- Spread converges to ≤ 0.02% → **价差收敛,止盈平仓**
|
- Spread converges to ≤ 0.02% → **价差收敛,止盈平仓**
|
||||||
|
|||||||
Reference in New Issue
Block a user