diff --git a/xchange-ascendex/src/main/java/org/knowm/xchange/ascendex/AscendexAdapters.java b/xchange-ascendex/src/main/java/org/knowm/xchange/ascendex/AscendexAdapters.java index f876c877a8c..f46666ea63d 100644 --- a/xchange-ascendex/src/main/java/org/knowm/xchange/ascendex/AscendexAdapters.java +++ b/xchange-ascendex/src/main/java/org/knowm/xchange/ascendex/AscendexAdapters.java @@ -2,10 +2,9 @@ import java.time.Instant; import java.util.ArrayList; -import java.util.Collections; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import org.knowm.xchange.ascendex.dto.account.AscendexCashAccountBalanceDto; @@ -89,7 +88,7 @@ public static AccountInfo adaptAccountInfo( return new AccountInfo( Wallet.Builder.from(balances) .id("spot") - .features(new HashSet<>(Collections.singletonList(Wallet.WalletFeature.TRADING))) + .features(EnumSet.of(Wallet.WalletFeature.TRADING)) .build()); } diff --git a/xchange-binance/src/main/java/org/knowm/xchange/binance/BinanceAdapters.java b/xchange-binance/src/main/java/org/knowm/xchange/binance/BinanceAdapters.java index 87b4c653967..e169f3d3a67 100644 --- a/xchange-binance/src/main/java/org/knowm/xchange/binance/BinanceAdapters.java +++ b/xchange-binance/src/main/java/org/knowm/xchange/binance/BinanceAdapters.java @@ -11,6 +11,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -374,7 +375,7 @@ public static Wallet adaptBinanceSpotWallet(BinanceAccountInformation binanceAcc return new Wallet.Builder() .balances(balances) .id("spot") - .features(Collections.singleton(Wallet.WalletFeature.TRADING)) + .features(EnumSet.of(Wallet.WalletFeature.TRADING)) .build(); } diff --git a/xchange-bitget/src/main/java/org/knowm/xchange/bitget/BitgetAdapters.java b/xchange-bitget/src/main/java/org/knowm/xchange/bitget/BitgetAdapters.java index 12d3d758730..817606deeac 100644 --- a/xchange-bitget/src/main/java/org/knowm/xchange/bitget/BitgetAdapters.java +++ b/xchange-bitget/src/main/java/org/knowm/xchange/bitget/BitgetAdapters.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import java.time.Instant; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -122,7 +123,11 @@ public Wallet toWallet(List bitgetBalanceDtos) { List balances = bitgetBalanceDtos.stream().map(BitgetAdapters::toBalance).collect(Collectors.toList()); - return Wallet.Builder.from(balances).id("spot").build(); + return Wallet.Builder + .from(balances) + .id("spot") + .features(EnumSet.of(Wallet.WalletFeature.TRADING)) + .build(); } public OrderBook toOrderBook(BitgetMarketDepthDto bitgetMarketDepthDto, Instrument instrument) { diff --git a/xchange-coinex/src/main/java/org/knowm/xchange/coinex/CoinexAdapters.java b/xchange-coinex/src/main/java/org/knowm/xchange/coinex/CoinexAdapters.java index 0220160819f..07af66b5079 100644 --- a/xchange-coinex/src/main/java/org/knowm/xchange/coinex/CoinexAdapters.java +++ b/xchange-coinex/src/main/java/org/knowm/xchange/coinex/CoinexAdapters.java @@ -4,6 +4,7 @@ import java.time.Instant; import java.util.Collection; import java.util.Date; +import java.util.EnumSet; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -203,7 +204,11 @@ public Wallet toWallet(List coinexBalanceInfos) { List balances = coinexBalanceInfos.stream().map(CoinexAdapters::toBalance).collect(Collectors.toList()); - return Wallet.Builder.from(balances).id("spot").build(); + return Wallet.Builder + .from(balances) + .id("spot") + .features(EnumSet.of(Wallet.WalletFeature.TRADING)) + .build(); } public String toString(OrderType orderType) { diff --git a/xchange-gateio-v4/src/main/java/org/knowm/xchange/gateio/service/GateioAccountService.java b/xchange-gateio-v4/src/main/java/org/knowm/xchange/gateio/service/GateioAccountService.java index 9b148434f1a..3e68068deb8 100644 --- a/xchange-gateio-v4/src/main/java/org/knowm/xchange/gateio/service/GateioAccountService.java +++ b/xchange-gateio-v4/src/main/java/org/knowm/xchange/gateio/service/GateioAccountService.java @@ -1,6 +1,7 @@ package org.knowm.xchange.gateio.service; import java.io.IOException; +import java.util.EnumSet; import java.util.List; import java.util.stream.Collectors; import org.apache.commons.lang3.Validate; @@ -43,7 +44,11 @@ public AccountInfo getAccountInfo() throws IOException { .build()) .collect(Collectors.toList()); - Wallet wallet = Wallet.Builder.from(balances).id("spot").build(); + Wallet wallet = Wallet.Builder + .from(balances) + .id("spot") + .features(EnumSet.of(Wallet.WalletFeature.TRADING)) + .build(); return new AccountInfo(wallet); diff --git a/xchange-stream-coinmate/src/main/java/info/bitrich/xchangestream/coinmate/v2/CoinmateStreamingAccountService.java b/xchange-stream-coinmate/src/main/java/info/bitrich/xchangestream/coinmate/v2/CoinmateStreamingAccountService.java index 46fa1e3c44c..0af4d404d1f 100644 --- a/xchange-stream-coinmate/src/main/java/info/bitrich/xchangestream/coinmate/v2/CoinmateStreamingAccountService.java +++ b/xchange-stream-coinmate/src/main/java/info/bitrich/xchangestream/coinmate/v2/CoinmateStreamingAccountService.java @@ -7,20 +7,19 @@ import info.bitrich.xchangestream.service.netty.StreamingObjectMapperHelper; import io.reactivex.rxjava3.core.Observable; import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; +import java.util.EnumSet; import java.util.List; import java.util.Map; import java.util.Set; import org.knowm.xchange.currency.Currency; import org.knowm.xchange.dto.account.Balance; import org.knowm.xchange.dto.account.Wallet; +import org.knowm.xchange.dto.account.Wallet.WalletFeature; public class CoinmateStreamingAccountService implements StreamingAccountService { private final CoinmateStreamingService coinmateStreamingService; - private final Set walletFeatures = - new HashSet<>(Arrays.asList(Wallet.WalletFeature.TRADING, Wallet.WalletFeature.FUNDING)); + private final Set walletFeatures = EnumSet.of(WalletFeature.TRADING, WalletFeature.FUNDING); public CoinmateStreamingAccountService(CoinmateStreamingService coinmateStreamingService) { this.coinmateStreamingService = coinmateStreamingService;