Skip to content

Commit 303ff84

Browse files
author
shazbert
committed
cranktakular: nits
1 parent 82fbbbd commit 303ff84

File tree

9 files changed

+14
-26
lines changed

9 files changed

+14
-26
lines changed

exchanges/binance/binance.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ func (e *Exchange) GetExchangeInfo(ctx context.Context) (ExchangeInfo, error) {
118118
}
119119

120120
// GetOrderBook returns full orderbook information
121-
//
122-
// OrderBookDataRequestParams contains the following members
123-
// symbol: string of currency pair
124-
// limit: returned limit amount
125121
func (e *Exchange) GetOrderBook(ctx context.Context, pair currency.Pair, limit int) (*OrderBookResponse, error) {
126122
params := url.Values{}
127123
symbol, err := e.FormatSymbol(pair, asset.Spot)

exchanges/binance/binance_websocket.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ func (e *Exchange) SeedLocalCacheWithBook(p currency.Pair, orderbookNew *OrderBo
461461
t := orderbookNew.Timestamp.Time()
462462
if t.IsZero() {
463463
t = time.Now() // Time not provided for this REST book.
464+
} else {
465+
fmt.Println("Using server time for orderbook", p)
464466
}
465467
newOrderBook := orderbook.Book{
466468
Pair: p,

exchanges/binanceus/binanceus_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ func (a *AggregatedTrade) toTradeData(p currency.Pair, exchange string, aType as
162162
}
163163
}
164164

165-
// OrderbookItem stores an individual orderbook item
166-
type OrderbookItem struct {
167-
Price float64
168-
Quantity float64
169-
}
170-
171165
// OrderBookData is resp data from orderbook endpoint
172166
type OrderBookData struct {
173167
LastUpdateID int64 `json:"lastUpdateId"`

exchanges/binanceus/binanceus_wrapper.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,12 +318,10 @@ func (e *Exchange) UpdateOrderbook(ctx context.Context, pair currency.Pair, asse
318318
if err := e.CurrencyPairs.IsAssetEnabled(assetType); err != nil {
319319
return nil, err
320320
}
321-
322321
orderbookNew, err := e.GetOrderBookDepth(ctx, pair, 1000)
323322
if err != nil {
324323
return nil, err
325324
}
326-
327325
if err := (&orderbook.Book{
328326
Exchange: e.Name,
329327
Pair: pair,

exchanges/btcmarkets/btcmarkets_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ type tempOrderbook struct {
5252
Bids orderbook.LevelsArrayPriceAmount `json:"bids"`
5353
}
5454

55-
// OBData stores orderbook data
56-
type OBData struct {
57-
Price float64
58-
Volume float64
59-
}
60-
6155
// Orderbook holds current orderbook information returned from the exchange
6256
type Orderbook struct {
6357
MarketID currency.Pair

exchanges/gateio/gateio_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3558,3 +3558,13 @@ func TestWebsocketSubmitOrders(t *testing.T) {
35583558
_, err = e.WebsocketSubmitOrders(request.WithVerbose(t.Context()), []*order.Submit{sub, &cpy})
35593559
require.NoError(t, err)
35603560
}
3561+
3562+
func TestUnmarshalJSONOrderbookLevels(t *testing.T) {
3563+
t.Parallel()
3564+
var ob OrderbookLevels
3565+
require.NoError(t, ob.UnmarshalJSON([]byte(`[{"p":"123.45","s":"0.001"}]`)))
3566+
assert.Equal(t, 123.45, ob[0].Price)
3567+
assert.Equal(t, 0.001, ob[0].Amount)
3568+
3569+
require.Error(t, ob.UnmarshalJSON([]byte(`["p":"123.45","s":"0.001"]`)))
3570+
}

exchanges/gateio/gateio_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ func (e *Exchange) UpdateOrderbookWithLimit(ctx context.Context, p currency.Pair
678678
Exchange: e.Name,
679679
Asset: a,
680680
ValidateOrderbook: e.ValidateOrderbook,
681-
Pair: p.Upper(),
681+
Pair: p,
682682
LastUpdateID: o.ID,
683683
LastUpdated: o.Update.Time(),
684684
LastPushed: o.Current.Time(),

exchanges/orderbook/orderbook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ func TestLevelsArrayPriceAmountUnmarshalJSON(t *testing.T) {
566566
t.Parallel()
567567

568568
var asks LevelsArrayPriceAmount
569-
err := asks.UnmarshalJSON([]byte(`[[1,2],[3,4]]`))
569+
err := asks.UnmarshalJSON([]byte(`[[1,2],["3","4"]]`))
570570
require.NoError(t, err)
571571
assert.Len(t, asks, 2)
572572
assert.Equal(t, 1.0, asks[0].Price)

exchanges/poloniex/poloniex_types.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ type OrderbookResponse struct {
4141
Seq int64 `json:"seq"`
4242
}
4343

44-
// OrderbookItem holds data on an individual item
45-
type OrderbookItem struct {
46-
Price float64
47-
Amount float64
48-
}
49-
5044
// OrderbookAll contains the full range of orderbooks
5145
type OrderbookAll struct {
5246
Data map[string]Orderbook

0 commit comments

Comments
 (0)