From d5840aedaf86841f9f280c4809835028cac150a5 Mon Sep 17 00:00:00 2001 From: rizer1980 <4340180@gmail.com> Date: Wed, 8 Nov 2023 18:49:36 +0300 Subject: [PATCH 1/3] [kraken futures] fix, instruments to uppercase --- .../xchange/krakenfutures/KrakenFuturesAdapters.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xchange-krakenfutures/src/main/java/org/knowm/xchange/krakenfutures/KrakenFuturesAdapters.java b/xchange-krakenfutures/src/main/java/org/knowm/xchange/krakenfutures/KrakenFuturesAdapters.java index 3088531f59e..c8ca04c4517 100644 --- a/xchange-krakenfutures/src/main/java/org/knowm/xchange/krakenfutures/KrakenFuturesAdapters.java +++ b/xchange-krakenfutures/src/main/java/org/knowm/xchange/krakenfutures/KrakenFuturesAdapters.java @@ -34,7 +34,7 @@ /** @author Jean-Christophe Laruelle */ public class KrakenFuturesAdapters { - private static final String MULTI_COLLATERAL_PRODUCTS = "pf_"; + private static final String MULTI_COLLATERAL_PRODUCTS = "PF_"; private static final String ACCOUNT_TYPE = "multiCollateralMarginAccount"; public static Ticker adaptTicker( @@ -183,7 +183,7 @@ public static ExchangeMetaData adaptInstrumentsMetaData(KrakenFuturesInstruments Map currencies = new HashMap<>(); for (KrakenFuturesInstrument instrument : krakenFuturesInstruments.getInstruments()) { - if(instrument.getSymbol().contains("pf")){ + if(instrument.getSymbol().contains(MULTI_COLLATERAL_PRODUCTS)){ instruments.put(adaptInstrument(instrument.getSymbol()),new InstrumentMetaData.Builder() .volumeScale(instrument.getVolumeScale()) .priceScale(instrument.getTickSize().scale()) @@ -198,7 +198,7 @@ public static ExchangeMetaData adaptInstrumentsMetaData(KrakenFuturesInstruments public static Instrument adaptInstrument(String symbol) { String main_symbol = symbol.replace(MULTI_COLLATERAL_PRODUCTS,""); - return new FuturesContract(new CurrencyPair(main_symbol.substring(0, main_symbol.length() - 3).replace("xbt","btc")+"/"+main_symbol.substring(main_symbol.length()-3)),"PERP"); + return new FuturesContract(new CurrencyPair(main_symbol.substring(0, main_symbol.length() - 3).replace("XBT","BTC")+"/"+main_symbol.substring(main_symbol.length()-3)),"PERP"); } private static BigDecimal getMinimumAmountFromVolumeScale(Integer volumeScale){ @@ -215,7 +215,7 @@ private static BigDecimal getMinimumAmountFromVolumeScale(Integer volumeScale){ } public static String adaptKrakenFuturesSymbol(Instrument instrument) { - return MULTI_COLLATERAL_PRODUCTS+instrument.getBase().toString().replace("BTC","XBT").toLowerCase()+instrument.getCounter().toString().toLowerCase(); + return MULTI_COLLATERAL_PRODUCTS+instrument.getBase().toString().replace("BTC","XBT")+instrument.getCounter().toString(); } public static Trades adaptTrades(KrakenFuturesPublicFills krakenFuturesTrades, Instrument instrument) { From 28a67e9bd7e781ec7a2fe0836729f41fe41b7058 Mon Sep 17 00:00:00 2001 From: rizer1980 <4340180@gmail.com> Date: Thu, 9 Nov 2023 15:33:21 +0300 Subject: [PATCH 2/3] [okx] fix logback logger level [kraken futures] fix logback logger level [binance] fix logback logger level --- xchange-binance/src/test/resources/logback.xml | 2 +- xchange-okex/src/test/resources/logback.xml | 2 +- xchange-stream-krakenfutures/src/test/resources/logback.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xchange-binance/src/test/resources/logback.xml b/xchange-binance/src/test/resources/logback.xml index 8c86d2fa1c3..5809b573500 100644 --- a/xchange-binance/src/test/resources/logback.xml +++ b/xchange-binance/src/test/resources/logback.xml @@ -11,7 +11,7 @@ - + diff --git a/xchange-okex/src/test/resources/logback.xml b/xchange-okex/src/test/resources/logback.xml index 8c86d2fa1c3..5809b573500 100644 --- a/xchange-okex/src/test/resources/logback.xml +++ b/xchange-okex/src/test/resources/logback.xml @@ -11,7 +11,7 @@ - + diff --git a/xchange-stream-krakenfutures/src/test/resources/logback.xml b/xchange-stream-krakenfutures/src/test/resources/logback.xml index 8c86d2fa1c3..5809b573500 100644 --- a/xchange-stream-krakenfutures/src/test/resources/logback.xml +++ b/xchange-stream-krakenfutures/src/test/resources/logback.xml @@ -11,7 +11,7 @@ - + From ebf4aa75c9edd20fa07556b42f574067b14e5724 Mon Sep 17 00:00:00 2001 From: rizer1980 <4340180@gmail.com> Date: Thu, 9 Nov 2023 17:18:42 +0300 Subject: [PATCH 3/3] [kraken futures stream] fix, instrument to uppercase --- .../KrakenFuturesStreamingAdapters.java | 12 ++++++------ .../KrakenFuturesStreamingMarketDataService.java | 4 ++-- .../krakenfutures/KrakenFuturesStreamingService.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingAdapters.java b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingAdapters.java index 651927f8248..c54cc5b6d11 100644 --- a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingAdapters.java +++ b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingAdapters.java @@ -21,11 +21,11 @@ public static OrderBook adaptKrakenFuturesSnapshot(KrakenFuturesStreamingOrderBo List asks = new ArrayList<>(); List bids = new ArrayList<>(); - snapshot.getBids().forEach(krakenFuturesSnapShotOrder -> bids.add(new LimitOrder.Builder(Order.OrderType.BID, KrakenFuturesAdapters.adaptInstrument(snapshot.getProduct_id().toLowerCase())) + snapshot.getBids().forEach(krakenFuturesSnapShotOrder -> bids.add(new LimitOrder.Builder(Order.OrderType.BID, KrakenFuturesAdapters.adaptInstrument(snapshot.getProduct_id())) .limitPrice(krakenFuturesSnapShotOrder.getPrice()) .originalAmount(krakenFuturesSnapShotOrder.getQuantity()) .build())); - snapshot.getAsks().forEach(krakenFuturesSnapShotOrder -> asks.add(new LimitOrder.Builder(Order.OrderType.ASK, KrakenFuturesAdapters.adaptInstrument(snapshot.getProduct_id().toLowerCase())) + snapshot.getAsks().forEach(krakenFuturesSnapShotOrder -> asks.add(new LimitOrder.Builder(Order.OrderType.ASK, KrakenFuturesAdapters.adaptInstrument(snapshot.getProduct_id())) .limitPrice(krakenFuturesSnapShotOrder.getPrice()) .originalAmount(krakenFuturesSnapShotOrder.getQuantity()) .build())); @@ -35,7 +35,7 @@ public static OrderBook adaptKrakenFuturesSnapshot(KrakenFuturesStreamingOrderBo public static Ticker adaptTicker(KrakenFuturesStreamingTickerResponse tickerResponse) { return new Ticker.Builder() - .instrument(KrakenFuturesAdapters.adaptInstrument(tickerResponse.getProduct_id().toLowerCase())) + .instrument(KrakenFuturesAdapters.adaptInstrument(tickerResponse.getProduct_id())) .ask(tickerResponse.getAsk()) .bid(tickerResponse.getBid()) .last(tickerResponse.getLast()) @@ -50,7 +50,7 @@ public static Ticker adaptTicker(KrakenFuturesStreamingTickerResponse tickerResp public static FundingRate adaptFundingRate(KrakenFuturesStreamingTickerResponse tickerResponse) { return new FundingRate.Builder() - .instrument(KrakenFuturesAdapters.adaptInstrument(tickerResponse.getProduct_id().toLowerCase())) + .instrument(KrakenFuturesAdapters.adaptInstrument(tickerResponse.getProduct_id())) .fundingRate1h(tickerResponse.getRelative_funding_rate()) .fundingRate8h((tickerResponse.getRelative_funding_rate() == null) ? null @@ -62,7 +62,7 @@ public static FundingRate adaptFundingRate(KrakenFuturesStreamingTickerResponse public static Trade adaptTrade(KrakenFuturesStreamingTradeResponse trade) { return new Trade.Builder() .price(trade.getPrice()) - .instrument(KrakenFuturesAdapters.adaptInstrument(trade.getProduct_id().toLowerCase())) + .instrument(KrakenFuturesAdapters.adaptInstrument(trade.getProduct_id())) .timestamp(trade.getTime()) .type((trade.getSide().equals(KrakenFuturesStreamingOrderBookDeltaResponse.KrakenFuturesStreamingSide.sell) ? Order.OrderType.ASK : Order.OrderType.BID)) .id(trade.getUid()) @@ -82,7 +82,7 @@ public static List adaptUserTrades(KrakenFuturesStreamingFillsDeltaRe .feeCurrency(new Currency(krakenFuturesStreamingFill.getFee_currency())) .feeAmount(krakenFuturesStreamingFill.getFee_paid()) .type((krakenFuturesStreamingFill.isBuy()) ? Order.OrderType.BID : Order.OrderType.ASK) - .instrument(KrakenFuturesAdapters.adaptInstrument(krakenFuturesStreamingFill.getInstrument().toLowerCase())) + .instrument(KrakenFuturesAdapters.adaptInstrument(krakenFuturesStreamingFill.getInstrument())) .timestamp(krakenFuturesStreamingFill.getTime()) .build())); diff --git a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingMarketDataService.java b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingMarketDataService.java index 4b2898032ea..b8bc4ca9772 100644 --- a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingMarketDataService.java +++ b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingMarketDataService.java @@ -63,7 +63,7 @@ public Observable getTicker(Instrument instrument, Object... args) { return service.subscribeChannel(channelName) .filter(message-> message.has("feed") && message.has("product_id")) - .filter(message-> message.get("product_id").asText().toLowerCase().equals(KrakenFuturesAdapters.adaptKrakenFuturesSymbol(instrument))) + .filter(message-> message.get("product_id").asText().equals(KrakenFuturesAdapters.adaptKrakenFuturesSymbol(instrument))) .map(message-> KrakenFuturesStreamingAdapters.adaptTicker(objectMapper.treeToValue(message, KrakenFuturesStreamingTickerResponse.class))); } @@ -83,7 +83,7 @@ public Observable getFundingRate(Instrument instrument, Object... a return service.subscribeChannel(channelName) .filter(message-> message.has("feed") && message.has("product_id")) - .filter(message-> message.get("product_id").asText().toLowerCase().equals(KrakenFuturesAdapters.adaptKrakenFuturesSymbol(instrument))) + .filter(message-> message.get("product_id").asText().equals(KrakenFuturesAdapters.adaptKrakenFuturesSymbol(instrument))) .map(message-> KrakenFuturesStreamingAdapters.adaptFundingRate(objectMapper.treeToValue(message, KrakenFuturesStreamingTickerResponse.class))); } } diff --git a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingService.java b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingService.java index 820729163fe..78fa109c2de 100644 --- a/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingService.java +++ b/xchange-stream-krakenfutures/src/main/java/info/bitrich/xchangestream/krakenfutures/KrakenFuturesStreamingService.java @@ -38,11 +38,11 @@ protected String getChannelNameFromMessage(JsonNode message) { if(message.has("feed") && message.has("product_id")){ if(message.get("feed").asText().contains(ORDERBOOK)){ - channelName = ORDERBOOK+message.get("product_id").asText().toLowerCase(); + channelName = ORDERBOOK+message.get("product_id").asText(); } else if(message.get("feed").asText().contains(TICKER)){ - channelName = TICKER+message.get("product_id").asText().toLowerCase(); + channelName = TICKER+message.get("product_id").asText(); } else if(message.get("feed").asText().contains(TRADES)){ - channelName = TRADES+message.get("product_id").asText().toLowerCase(); + channelName = TRADES+message.get("product_id").asText(); } } // Fills