Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[general] Add WalletFeature to some created wallets #4984

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading