mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-04 23:16:54 +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:
@@ -653,16 +653,6 @@ func (e *Exchange) wsProcessOrderbook(assetType asset.Item, resp *WebsocketRespo
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
asks := make([]orderbook.Level, len(result.Asks))
|
||||
for i := range result.Asks {
|
||||
asks[i].Price = result.Asks[i][0].Float64()
|
||||
asks[i].Amount = result.Asks[i][1].Float64()
|
||||
}
|
||||
bids := make([]orderbook.Level, len(result.Bids))
|
||||
for i := range result.Bids {
|
||||
bids[i].Price = result.Bids[i][0].Float64()
|
||||
bids[i].Amount = result.Bids[i][1].Float64()
|
||||
}
|
||||
|
||||
if resp.Type == "snapshot" {
|
||||
return e.Websocket.Orderbook.LoadSnapshot(&orderbook.Book{
|
||||
@@ -672,14 +662,14 @@ func (e *Exchange) wsProcessOrderbook(assetType asset.Item, resp *WebsocketRespo
|
||||
LastUpdated: resp.OrderbookLastUpdated.Time(),
|
||||
LastUpdateID: result.UpdateID,
|
||||
LastPushed: resp.PushTimestamp.Time(),
|
||||
Asks: asks,
|
||||
Bids: bids,
|
||||
Asks: result.Asks.Levels(),
|
||||
Bids: result.Bids.Levels(),
|
||||
})
|
||||
}
|
||||
return e.Websocket.Orderbook.Update(&orderbook.Update{
|
||||
Pair: cp,
|
||||
Asks: asks,
|
||||
Bids: bids,
|
||||
Asks: result.Asks.Levels(),
|
||||
Bids: result.Bids.Levels(),
|
||||
Asset: assetType,
|
||||
UpdateID: result.UpdateID,
|
||||
UpdateTime: resp.OrderbookLastUpdated.Time(),
|
||||
|
||||
Reference in New Issue
Block a user