mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-03 23:16:53 +00:00
orderbook: consolidate slice array types to orderbook package (#1992)
* orderbook: consolidate slice array types to orderbook package * Update exchanges/bybit/bybit_types.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * linter: fix and add test * cranktakular: nits * cranktakular: nits * Update exchanges/orderbook/orderbook_types.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * Update exchanges/gateio/gateio_test.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * gk: nits consolidation * gk: rm unifySpotOrderbook func * gk: nit but different * linter: fix * gk: nits * glorious: nits * Update exchanges/binance/binance.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/binance/binance_cfutures.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * Update exchanges/binanceus/binanceus.go Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io> * thrasher-:nits * thrasher-: more nit --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> Co-authored-by: Adrian Gallagher <adrian.gallagher@thrasher.io>
This commit is contained in:
@@ -300,23 +300,14 @@ func (e *Exchange) handleWSOrderbook(msg []byte) error {
|
||||
}
|
||||
|
||||
obUpdate := &orderbook.Book{
|
||||
Bids: make(orderbook.Levels, len(wsOrderBookResp.Data.Bids)),
|
||||
Asks: make(orderbook.Levels, len(wsOrderBookResp.Data.Asks)),
|
||||
Bids: wsOrderBookResp.Data.Bids.Levels(),
|
||||
Asks: wsOrderBookResp.Data.Asks.Levels(),
|
||||
Pair: p,
|
||||
LastUpdated: wsOrderBookResp.Data.Microtimestamp.Time(),
|
||||
Asset: asset.Spot,
|
||||
Exchange: e.Name,
|
||||
ValidateOrderbook: e.ValidateOrderbook,
|
||||
}
|
||||
|
||||
for i := range wsOrderBookResp.Data.Asks {
|
||||
obUpdate.Asks[i].Price = wsOrderBookResp.Data.Asks[i][0].Float64()
|
||||
obUpdate.Asks[i].Amount = wsOrderBookResp.Data.Asks[i][1].Float64()
|
||||
}
|
||||
for i := range wsOrderBookResp.Data.Bids {
|
||||
obUpdate.Bids[i].Price = wsOrderBookResp.Data.Bids[i][0].Float64()
|
||||
obUpdate.Bids[i].Amount = wsOrderBookResp.Data.Bids[i][1].Float64()
|
||||
}
|
||||
filterOrderbookZeroBidPrice(obUpdate)
|
||||
return e.Websocket.Orderbook.LoadSnapshot(obUpdate)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user