mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-22 15:10:13 +00:00
Bybit: Add subscription configuration for spot (#1601)
* Bybit: Subscription configuration for spot * Bybit: Enable candles ws sub by default * Orderbook: Use a RW mutex for depth * Orderbook: Fix race on depth.VerifyOrderbook Despite being protected by an ob level mutex, this needed to privatise and protect the option var.
This commit is contained in:
@@ -171,7 +171,7 @@ func (w *Orderbook) Update(u *orderbook.Update) error {
|
||||
}
|
||||
|
||||
var ret *orderbook.Base
|
||||
if book.ob.VerifyOrderbook {
|
||||
if book.ob.VerifyOrderbook() {
|
||||
// This is used here so as to not retrieve book if verification is off.
|
||||
// On every update, this will retrieve and verify orderbook depth.
|
||||
ret, err = book.ob.Retrieve()
|
||||
@@ -333,17 +333,12 @@ func (w *Orderbook) LoadSnapshot(book *orderbook.Base) error {
|
||||
|
||||
holder.updateID = book.LastUpdateID
|
||||
|
||||
err = holder.ob.LoadSnapshot(book.Bids,
|
||||
book.Asks,
|
||||
book.LastUpdateID,
|
||||
book.LastUpdated,
|
||||
book.UpdatePushedAt,
|
||||
false)
|
||||
err = holder.ob.LoadSnapshot(book.Bids, book.Asks, book.LastUpdateID, book.LastUpdated, book.UpdatePushedAt, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if holder.ob.VerifyOrderbook {
|
||||
if holder.ob.VerifyOrderbook() {
|
||||
// This is used here so as to not retrieve book if verification is off.
|
||||
// Checks to see if orderbook snapshot that was deployed has not been
|
||||
// altered in any way
|
||||
|
||||
Reference in New Issue
Block a user