From 47733ed387a0975de3a4306723ec765b6c6d693a Mon Sep 17 00:00:00 2001 From: Dmitri Karpovich Date: Fri, 26 Apr 2024 10:09:37 +0200 Subject: [PATCH] [gateio-stream] Fix getting of orderbook --- .../bitrich/xchangestream/gateio/GateioStreamingAdapters.java | 2 +- .../gateio/GateioStreamingMarketDataServiceIntegration.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xchange-stream-gateio/src/main/java/info/bitrich/xchangestream/gateio/GateioStreamingAdapters.java b/xchange-stream-gateio/src/main/java/info/bitrich/xchangestream/gateio/GateioStreamingAdapters.java index 4b5dd913dc7..e3da0b187d4 100644 --- a/xchange-stream-gateio/src/main/java/info/bitrich/xchangestream/gateio/GateioStreamingAdapters.java +++ b/xchange-stream-gateio/src/main/java/info/bitrich/xchangestream/gateio/GateioStreamingAdapters.java @@ -94,7 +94,7 @@ public OrderBook toOrderBook(GateioOrderBookNotification notification) { Stream asks = orderBookPayload.getAsks().stream() .map(priceSizeEntry -> new LimitOrder(OrderType.ASK, priceSizeEntry.getSize(), orderBookPayload.getCurrencyPair(), null, null, priceSizeEntry.getPrice())); - Stream bids = orderBookPayload.getAsks().stream() + Stream bids = orderBookPayload.getBids().stream() .map(priceSizeEntry -> new LimitOrder(OrderType.BID, priceSizeEntry.getSize(), orderBookPayload.getCurrencyPair(), null, null, priceSizeEntry.getPrice())); return new OrderBook(Date.from(orderBookPayload.getTimestamp()), asks, bids); diff --git a/xchange-stream-gateio/src/test/java/info/bitrich/xchangestream/gateio/GateioStreamingMarketDataServiceIntegration.java b/xchange-stream-gateio/src/test/java/info/bitrich/xchangestream/gateio/GateioStreamingMarketDataServiceIntegration.java index e79c037e120..9b69d6517f5 100644 --- a/xchange-stream-gateio/src/test/java/info/bitrich/xchangestream/gateio/GateioStreamingMarketDataServiceIntegration.java +++ b/xchange-stream-gateio/src/test/java/info/bitrich/xchangestream/gateio/GateioStreamingMarketDataServiceIntegration.java @@ -33,6 +33,9 @@ void order_book() { assertThat(orderBook).hasNoNullFieldsOrProperties(); assertThat(orderBook.getBids()).hasSize(10); assertThat(orderBook.getAsks()).hasSize(10); + + // bids should be lower than asks + assertThat(orderBook.getBids().get(0).getLimitPrice()).isLessThan(orderBook.getAsks().get(0).getLimitPrice()); }