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:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/kline"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/margin"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/order"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/orderbook"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/sharedtestvalues"
|
||||
"github.com/thrasher-corp/gocryptotrader/exchanges/subscription"
|
||||
testexch "github.com/thrasher-corp/gocryptotrader/internal/testing/exchange"
|
||||
@@ -1120,14 +1121,8 @@ func TestFetchTradablePairs(t *testing.T) {
|
||||
|
||||
func TestGetOrderBook(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, err := e.GetOrderBook(t.Context(),
|
||||
OrderBookDataRequestParams{
|
||||
Symbol: currency.NewBTCUSDT(),
|
||||
Limit: 1000,
|
||||
})
|
||||
if err != nil {
|
||||
t.Error("Binance GetOrderBook() error", err)
|
||||
}
|
||||
_, err := e.GetOrderBook(t.Context(), currency.NewBTCUSDT(), 1000)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestGetMostRecentTrades(t *testing.T) {
|
||||
@@ -2102,30 +2097,30 @@ func TestWsDepthUpdate(t *testing.T) {
|
||||
require.NoError(t, testexch.Setup(e), "Test instance Setup must not error")
|
||||
e.setupOrderbookManager(t.Context())
|
||||
seedLastUpdateID := int64(161)
|
||||
book := OrderBook{
|
||||
Asks: []OrderbookItem{
|
||||
{Price: 6621.80000000, Quantity: 0.00198100},
|
||||
{Price: 6622.14000000, Quantity: 4.00000000},
|
||||
{Price: 6622.46000000, Quantity: 2.30000000},
|
||||
{Price: 6622.47000000, Quantity: 1.18633300},
|
||||
{Price: 6622.64000000, Quantity: 4.00000000},
|
||||
{Price: 6622.73000000, Quantity: 0.02900000},
|
||||
{Price: 6622.76000000, Quantity: 0.12557700},
|
||||
{Price: 6622.81000000, Quantity: 2.08994200},
|
||||
{Price: 6622.82000000, Quantity: 0.01500000},
|
||||
{Price: 6623.17000000, Quantity: 0.16831300},
|
||||
book := OrderBookResponse{
|
||||
Asks: []orderbook.Level{
|
||||
{Price: 6621.80000000, Amount: 0.00198100},
|
||||
{Price: 6622.14000000, Amount: 4.00000000},
|
||||
{Price: 6622.46000000, Amount: 2.30000000},
|
||||
{Price: 6622.47000000, Amount: 1.18633300},
|
||||
{Price: 6622.64000000, Amount: 4.00000000},
|
||||
{Price: 6622.73000000, Amount: 0.02900000},
|
||||
{Price: 6622.76000000, Amount: 0.12557700},
|
||||
{Price: 6622.81000000, Amount: 2.08994200},
|
||||
{Price: 6622.82000000, Amount: 0.01500000},
|
||||
{Price: 6623.17000000, Amount: 0.16831300},
|
||||
},
|
||||
Bids: []OrderbookItem{
|
||||
{Price: 6621.55000000, Quantity: 0.16356700},
|
||||
{Price: 6621.45000000, Quantity: 0.16352600},
|
||||
{Price: 6621.41000000, Quantity: 0.86091200},
|
||||
{Price: 6621.25000000, Quantity: 0.16914100},
|
||||
{Price: 6621.23000000, Quantity: 0.09193600},
|
||||
{Price: 6621.22000000, Quantity: 0.00755100},
|
||||
{Price: 6621.13000000, Quantity: 0.08432000},
|
||||
{Price: 6621.03000000, Quantity: 0.00172000},
|
||||
{Price: 6620.94000000, Quantity: 0.30506700},
|
||||
{Price: 6620.93000000, Quantity: 0.00200000},
|
||||
Bids: []orderbook.Level{
|
||||
{Price: 6621.55000000, Amount: 0.16356700},
|
||||
{Price: 6621.45000000, Amount: 0.16352600},
|
||||
{Price: 6621.41000000, Amount: 0.86091200},
|
||||
{Price: 6621.25000000, Amount: 0.16914100},
|
||||
{Price: 6621.23000000, Amount: 0.09193600},
|
||||
{Price: 6621.22000000, Amount: 0.00755100},
|
||||
{Price: 6621.13000000, Amount: 0.08432000},
|
||||
{Price: 6621.03000000, Amount: 0.00172000},
|
||||
{Price: 6620.94000000, Amount: 0.30506700},
|
||||
{Price: 6620.93000000, Amount: 0.00200000},
|
||||
},
|
||||
LastUpdateID: seedLastUpdateID,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user