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:
Ryan O'Hara-Reid
2022-03-11 12:00:46 +11:00
committed by GitHub
parent b17df4463d
commit 5e0cdc50d7
2 changed files with 21 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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})