Skip to content

Commit

Permalink
[general] Add WalletFeature to some created wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
bigscoop committed Dec 14, 2024
1 parent 494027c commit c0cbc11
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -122,7 +123,11 @@ public Wallet toWallet(List<BitgetBalanceDto> bitgetBalanceDtos) {
List<Balance> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -203,7 +204,11 @@ public Wallet toWallet(List<CoinexBalanceInfo> coinexBalanceInfos) {
List<Balance> 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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Wallet.WalletFeature> walletFeatures =
new HashSet<>(Arrays.asList(Wallet.WalletFeature.TRADING, Wallet.WalletFeature.FUNDING));
private final Set<Wallet.WalletFeature> walletFeatures = EnumSet.of(WalletFeature.TRADING, WalletFeature.FUNDING);

public CoinmateStreamingAccountService(CoinmateStreamingService coinmateStreamingService) {
this.coinmateStreamingService = coinmateStreamingService;
Expand Down

0 comments on commit c0cbc11

Please sign in to comment.