Update README: spread window monitoring, synchronous entry
- Add SpreadWindowTracker to architecture diagram - Document synchronous entry logic (no goroutine, scan-time prices) - Add Spread Window Monitoring section with log example
This commit is contained in:
@@ -26,9 +26,15 @@ PriceStore ─────────┼─────────────
|
|||||||
┌───────────────▼────────────────┐
|
┌───────────────▼────────────────┐
|
||||||
│ Trader: TryEntry / Tick / Exit │
|
│ Trader: TryEntry / Tick / Exit │
|
||||||
│ Maker fees, scale-in, stop │
|
│ Maker fees, scale-in, stop │
|
||||||
|
│ Synchronous entry (no goroutine)│
|
||||||
└───────────────┬────────────────┘
|
└───────────────┬────────────────┘
|
||||||
│
|
│
|
||||||
┌─────────▼─────────┐
|
┌─────────▼─────────┐
|
||||||
|
│ SpreadWindowTracker│
|
||||||
|
│ (opportunity life) │
|
||||||
|
└─────────┬─────────┘
|
||||||
|
│
|
||||||
|
┌─────────▼─────────┐
|
||||||
│ Notifier: TG │
|
│ Notifier: TG │
|
||||||
│ Dashboard: :8888 │
|
│ Dashboard: :8888 │
|
||||||
└───────────────────┘
|
└───────────────────┘
|
||||||
@@ -94,6 +100,9 @@ Round trip (2 legs entry + 2 legs exit): **0.07%** total fees.
|
|||||||
|
|
||||||
1. **Scanner** runs every 500ms, checks all 6 coins for BG ↔ HL spread
|
1. **Scanner** runs every 500ms, 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)
|
||||||
|
- Synchronous execution in the scanner tick (no goroutine delay)
|
||||||
|
- Direction sanity check (0.1% tolerance) prevents entry on reversed spreads
|
||||||
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% → **价差收敛,止盈平仓**
|
||||||
@@ -101,6 +110,23 @@ Round trip (2 legs entry + 2 legs exit): **0.07%** total fees.
|
|||||||
- Position held over 30 minutes → **超时平仓**
|
- Position held over 30 minutes → **超时平仓**
|
||||||
5. **Direction**: BG → HL (buy BG, sell HL) or HL → BG (buy HL, sell BG)
|
5. **Direction**: BG → HL (buy BG, sell HL) or HL → BG (buy HL, sell BG)
|
||||||
|
|
||||||
|
## Spread Window Monitoring
|
||||||
|
|
||||||
|
`SpreadWindowTracker` runs every scan tick and measures how long each coin's spread stays above the trade threshold:
|
||||||
|
|
||||||
|
- Records window **start time** when netProfit first hits threshold
|
||||||
|
- Tracks real **peak netProfit** during the window
|
||||||
|
- Logs window **duration + peak** when spread converges below threshold (sub-100ms windows filtered as noise)
|
||||||
|
- Covers both directions (BG→HL and HL→BG) independently
|
||||||
|
- Uses the same `netProfit()` fee model as the scanner for exact consistency
|
||||||
|
|
||||||
|
Log output example:
|
||||||
|
|
||||||
|
```
|
||||||
|
[SpreadWindow] ONDO BG->HL exceeded threshold for 1.4s (peak net=+0.1520%)
|
||||||
|
[SpreadWindow] OP HL->BG exceeded threshold for 3.2s (peak net=+0.1310%)
|
||||||
|
```
|
||||||
|
|
||||||
## Notifications
|
## Notifications
|
||||||
|
|
||||||
All notifications sent to Telegram (via `TELEGRAM_BOT_TOKEN`):
|
All notifications sent to Telegram (via `TELEGRAM_BOT_TOKEN`):
|
||||||
|
|||||||
Reference in New Issue
Block a user