From c9296c8c67b92e8c2a43106d124274aa7b5a701c Mon Sep 17 00:00:00 2001 From: Dmitri Karpovich Date: Fri, 19 Jul 2024 22:55:30 +0200 Subject: [PATCH 1/2] [bybit] Optimize getting of tickers --- .../bybit/service/BybitMarketDataService.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/xchange-bybit/src/main/java/org/knowm/xchange/bybit/service/BybitMarketDataService.java b/xchange-bybit/src/main/java/org/knowm/xchange/bybit/service/BybitMarketDataService.java index 2ed9c05527..b76da91999 100644 --- a/xchange-bybit/src/main/java/org/knowm/xchange/bybit/service/BybitMarketDataService.java +++ b/xchange-bybit/src/main/java/org/knowm/xchange/bybit/service/BybitMarketDataService.java @@ -3,7 +3,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; import org.knowm.xchange.bybit.BybitAdapters; import org.knowm.xchange.bybit.BybitExchange; import org.knowm.xchange.bybit.dto.BybitCategory; @@ -65,11 +64,19 @@ public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOExce @Override public List getTickers(Params params) throws IOException { - if (!(params instanceof BybitCategory)) { + // get category + BybitCategory category; + if (params == null) { + category = BybitCategory.SPOT; + } + else if (!(params instanceof BybitCategory)) { throw new IllegalArgumentException("Params must be instance of BybitCategory"); } - BybitCategory category = (BybitCategory) params; - if (category.equals(BybitCategory.OPTION)) { + else { + category = (BybitCategory) params; + } + + if (category == BybitCategory.OPTION) { throw new NotYetImplementedForExchangeException("category OPTION not yet implemented"); } BybitResult> response = getTickers(category); From 07964a7096f688d0ce62c0b394ea2a752040101a Mon Sep 17 00:00:00 2001 From: Dmitri Karpovich Date: Fri, 19 Jul 2024 22:56:26 +0200 Subject: [PATCH 2/2] [bybit] Disable logging for tests --- xchange-bybit/src/test/resources/logback.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xchange-bybit/src/test/resources/logback.xml b/xchange-bybit/src/test/resources/logback.xml index da2d1b62c3..2a586567a6 100644 --- a/xchange-bybit/src/test/resources/logback.xml +++ b/xchange-bybit/src/test/resources/logback.xml @@ -17,7 +17,7 @@ - - + + \ No newline at end of file