diff --git a/exchanges/ftx/ftx_test.go b/exchanges/ftx/ftx_test.go index 9b24791c..d36326e6 100644 --- a/exchanges/ftx/ftx_test.go +++ b/exchanges/ftx/ftx_test.go @@ -1042,6 +1042,18 @@ func TestUpdateOrderbook(t *testing.T) { if err != nil { t.Error(err) } + + cp = currency.NewPairWithDelimiter("ALGOBEAR", currency.USD.String(), "/") + _, err = f.UpdateOrderbook(context.Background(), cp, asset.Spot) + if err != nil { + t.Error(err) + } + + cp = currency.NewPairWithDelimiter("ASDBEAR", currency.USD.String(), "/") + _, err = f.UpdateOrderbook(context.Background(), cp, asset.Spot) + if err != nil { + t.Error(err) + } } func TestUpdateTicker(t *testing.T) { diff --git a/exchanges/ftx/ftx_wrapper.go b/exchanges/ftx/ftx_wrapper.go index 31b29952..db10affc 100644 --- a/exchanges/ftx/ftx_wrapper.go +++ b/exchanges/ftx/ftx_wrapper.go @@ -430,12 +430,21 @@ func (f *FTX) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType as if err != nil { return book, err } + for x := range tempResp.Bids { + // Bear tokens have illiquid books and contain negative place holders. + if tempResp.Bids[x].Size < 0 && strings.Contains(p.String(), "BEAR") { + continue + } book.Bids = append(book.Bids, orderbook.Item{ Amount: tempResp.Bids[x].Size, Price: tempResp.Bids[x].Price}) } for y := range tempResp.Asks { + // Bear tokens have illiquid books and contain negative place holders. + if tempResp.Asks[y].Size < 0 && strings.Contains(p.String(), "BEAR") { + continue + } book.Asks = append(book.Asks, orderbook.Item{ Amount: tempResp.Asks[y].Size, Price: tempResp.Asks[y].Price})