Add SpreadWindowTracker to measure opportunity duration
- New SpreadWindowTracker in types.go watches BG↔HL spread for all tracked coins, both directions - Logs duration when spread stays above trade threshold then converges - Wired into main loop after each scan tick - Filters sub-100ms windows as noise
This commit is contained in:
@@ -51,6 +51,9 @@ func main() {
|
||||
dashboard := NewDashboard(store, trader, database, ":8888")
|
||||
go dashboard.Run()
|
||||
|
||||
// Spread window tracker — measures how long spreads stay above threshold
|
||||
spreadTracker := NewSpreadWindowTracker()
|
||||
|
||||
// P3-4: wire real-time trade event broadcast
|
||||
trader.OnTradeEvent = dashboard.BroadcastEvent
|
||||
if trader.IsConfigured() {
|
||||
@@ -170,6 +173,10 @@ func main() {
|
||||
dashboard.UpdateScan(makerOpps)
|
||||
t2 := time.Now()
|
||||
|
||||
// Track spread window durations (how long each opportunity stays alive)
|
||||
snap := store.GetAll()
|
||||
spreadTracker.Tick(snap, cfg.TradeThreshold)
|
||||
|
||||
for _, opp := range makerOpps {
|
||||
if opp.NetProfit < cfg.ArbThreshold {
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user