diff --git a/xchange-core/src/main/java/org/knowm/xchange/utils/OrderValuesHelper.java b/xchange-core/src/main/java/org/knowm/xchange/utils/OrderValuesHelper.java index d6d87390b0b..3631f1222d8 100644 --- a/xchange-core/src/main/java/org/knowm/xchange/utils/OrderValuesHelper.java +++ b/xchange-core/src/main/java/org/knowm/xchange/utils/OrderValuesHelper.java @@ -90,6 +90,11 @@ public BigDecimal adjustPrice(BigDecimal price, RoundingMode roundingMode) { if (scale != null) { result = result.setScale(scale, roundingMode); } + + BigDecimal stepSize = metaData.getPriceStepSize(); + if (stepSize != null && stepSize.signum() != 0) { + result = BigDecimalUtils.roundToStepSize(result, stepSize, roundingMode); + } return result; } } diff --git a/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/KrakenStreamingService.java b/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/KrakenStreamingService.java index d6c2ee1ff15..08282f9106c 100644 --- a/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/KrakenStreamingService.java +++ b/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/KrakenStreamingService.java @@ -47,7 +47,7 @@ public class KrakenStreamingService extends JsonNettyStreamingService { private static final String EVENT = "event"; private static final String WEBSOCKET_REQUESTS_PER_SECOND = "Kraken_Websocket_Requests_Per_Second"; - private final Map channels = new ConcurrentHashMap<>(); + private final Map channels = new ConcurrentHashMap<>(); private final ObjectMapper mapper = StreamingObjectMapperHelper.getObjectMapper(); private final boolean isPrivate; private final Supplier authData; @@ -167,7 +167,7 @@ protected void handleMessage(JsonNode message) { } statusMessage.setChannelName(channelName); - Integer channelId = statusMessage.getChannelID(); + Long channelId = statusMessage.getChannelID(); switch (statusMessage.getStatus()) { case subscribed: LOG.info("Channel name={}, id={} has been subscribed", channelName, channelId); @@ -229,7 +229,7 @@ protected void handleMessage(JsonNode message) { protected String getChannelNameFromMessage(JsonNode message) throws IOException { String channelName = null; if (message.has("channelID")) { - int channelId = message.get("channelID").asInt(); + long channelId = message.get("channelID").asLong(); return channels.getOrDefault(channelId, String.valueOf(channelId)); } if (message.has("channelName")) { @@ -238,9 +238,9 @@ protected String getChannelNameFromMessage(JsonNode message) throws IOException } if (message.isArray()) { - if (message.get(0).isInt()) { - LOG.trace("Taking channelName from ID from first field INT)."); - int channelId = message.get(0).asInt(); + if (message.get(0).isLong()) { + LOG.trace("Taking channelName from ID from first field LONG)."); + long channelId = message.get(0).asLong(); return channels.getOrDefault(channelId, String.valueOf(channelId)); } if (message.get(1).isTextual()) { @@ -390,4 +390,4 @@ static Integer parseOrderBookSize(Object[] args) { } return null; } -} +} \ No newline at end of file diff --git a/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/dto/KrakenSubscriptionStatusMessage.java b/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/dto/KrakenSubscriptionStatusMessage.java index c0e058b787b..63746763a9d 100644 --- a/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/dto/KrakenSubscriptionStatusMessage.java +++ b/xchange-stream-kraken/src/main/java/info/bitrich/xchangestream/kraken/dto/KrakenSubscriptionStatusMessage.java @@ -10,7 +10,7 @@ */ public class KrakenSubscriptionStatusMessage extends KrakenEvent { - private final Integer channelID; + private final Long channelID; private final Integer reqid; private final KrakenSubscriptionStatus status; private final String pair; @@ -21,7 +21,7 @@ public class KrakenSubscriptionStatusMessage extends KrakenEvent { @JsonCreator public KrakenSubscriptionStatusMessage( @JsonProperty("event") KrakenEventType event, - @JsonProperty("channelID") Integer channelID, + @JsonProperty("channelID") Long channelID, @JsonProperty("reqid") Integer reqid, @JsonProperty("status") KrakenSubscriptionStatus status, @JsonProperty("pair") String pair, @@ -36,7 +36,7 @@ public KrakenSubscriptionStatusMessage( this.errorMessage = errorMessage; } - public Integer getChannelID() { + public Long getChannelID() { return channelID; } @@ -67,4 +67,4 @@ public String getChannelName() { public void setChannelName(String channelName) { this.channelName = channelName; } -} +} \ No newline at end of file