Binance websocket orderbook sync fix (#619)

* add Cost param to Kraken GetOrderInfo output

* fmt

* faulty resp.Time handling in Binance GetOrderInfo method

* add orderBookProcess

* Update exchanges/binance/binance_websocket.go

Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>

* fmt

* comment change

* add param for log

Co-authored-by: Vazha Bezhanishvili <vazha.bezhanishvili@elegro.eu>
Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
Vazha
2021-01-14 01:49:54 +02:00
committed by GitHub
parent 764661a5fb
commit 8d598d30da
2 changed files with 15 additions and 14 deletions

View File

@@ -84,21 +84,28 @@ func (b *Binance) WsConnect() error {
Delay: pingDelay,
})
go b.orderBookProcess()
return nil
}
// orderBookProcess prepare orderbook handling
func (b *Binance) orderBookProcess() {
enabledPairs, err := b.GetEnabledPairs(asset.Spot)
if err != nil {
return err
log.Errorf(log.ExchangeSys, "%s orderBookProcess, GetEnabledPairs error: %s", b.Name, err)
return
}
for i := range enabledPairs {
err = b.SeedLocalCache(enabledPairs[i])
if err != nil {
return err
log.Errorf(log.ExchangeSys, "%s orderBookProcess, SeedLocalCache error: %s", b.Name, err)
return
}
}
go b.wsReadData()
b.setupOrderbookManager()
return nil
}
func (b *Binance) setupOrderbookManager() {
@@ -899,7 +906,7 @@ bufferEmpty:
}
}
o.Unlock()
// reset underlying bools
// disable rest orderbook synchronisation
_ = o.stopFetchingBook(pair)
_ = o.completeInitialSync(pair)
return nil