Skip to content

Commit

Permalink
fix gateio orderbook error
Browse files Browse the repository at this point in the history
  • Loading branch information
liujun committed Apr 26, 2024
1 parent 826b450 commit a671329
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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 @@ -35,7 +35,8 @@ public GateioStreamingMarketDataService(GateioStreamingService service) {
@Override
public Observable<OrderBook> getOrderBook(CurrencyPair currencyPair, Object... args) {
Integer orderBookLevel = (Integer) ArrayUtils.get(args, 0, MAX_DEPTH_DEFAULT);
Duration updateSpeed = (Duration) ArrayUtils.get(args, 1, UPDATE_INTERVAL_DEFAULT);
Integer updateTime = Integer.parseInt(ArrayUtils.get(args, 1, UPDATE_INTERVAL_DEFAULT).toString());
Duration updateSpeed = Duration.ofMillis(updateTime);
return service
.subscribeChannel(Config.SPOT_ORDERBOOK_CHANNEL, new Object[]{currencyPair, orderBookLevel, updateSpeed})
.map(GateioOrderBookNotification.class::cast)
Expand Down

0 comments on commit a671329

Please sign in to comment.