Skip to content

Commit

Permalink
Merge pull request #4854 from bigscoop/gate-stream-fix-orderbook
Browse files Browse the repository at this point in the history
[gateio-stream] Fix getting of orderbook
  • Loading branch information
timmolter authored Apr 26, 2024
2 parents 31cd4f5 + 47733ed commit 345d120
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public OrderBook toOrderBook(GateioOrderBookNotification notification) {
Stream<LimitOrder> asks = orderBookPayload.getAsks().stream()
.map(priceSizeEntry -> new LimitOrder(OrderType.ASK, priceSizeEntry.getSize(), orderBookPayload.getCurrencyPair(), null, null, priceSizeEntry.getPrice()));

Stream<LimitOrder> bids = orderBookPayload.getAsks().stream()
Stream<LimitOrder> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}


Expand Down

0 comments on commit 345d120

Please sign in to comment.