diff --git a/README.md b/README.md index 77712c9..91b4893 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,15 @@ PriceStore ─────────┼───────────── ┌───────────────▼────────────────┐ │ Trader: TryEntry / Tick / Exit │ │ Maker fees, scale-in, stop │ + │ Synchronous entry (no goroutine)│ └───────────────┬────────────────┘ │ ┌─────────▼─────────┐ + │ SpreadWindowTracker│ + │ (opportunity life) │ + └─────────┬─────────┘ + │ + ┌─────────▼─────────┐ │ Notifier: TG │ │ 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 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% 4. **Exit** conditions (whichever hits first): - 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 → **超时平仓** 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 All notifications sent to Telegram (via `TELEGRAM_BOT_TOKEN`):