mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-18 07:26:50 +00:00
ftx: Add filter for negative orderbook values on bear tokens [REST] (#898)
* ftx: Add filter for negative values on bear tokens * ftx: string comparison after issue found
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user