mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-19 07:26:49 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user