Search in sources :

Example 1 with CurrenciesResponse

use of org.knowm.xchange.kucoin.dto.response.CurrenciesResponse in project XChange by knowm.

the class KucoinAdapters method adaptCurrencyMetaData.

static HashMap<String, CurrencyMetaData> adaptCurrencyMetaData(List<CurrenciesResponse> list) {
    HashMap<String, CurrencyMetaData> stringCurrencyMetaDataMap = new HashMap<>();
    for (CurrenciesResponse currenciesResponse : list) {
        BigDecimal precision = currenciesResponse.getPrecision();
        BigDecimal withdrawalMinFee = null;
        BigDecimal withdrawalMinSize = null;
        if (currenciesResponse.getWithdrawalMinFee() != null) {
            withdrawalMinFee = new BigDecimal(currenciesResponse.getWithdrawalMinFee());
        }
        if (currenciesResponse.getWithdrawalMinSize() != null) {
            withdrawalMinSize = new BigDecimal(currenciesResponse.getWithdrawalMinSize());
        }
        WalletHealth walletHealth = getWalletHealth(currenciesResponse);
        CurrencyMetaData currencyMetaData = new CurrencyMetaData(precision.intValue(), withdrawalMinFee, withdrawalMinSize, walletHealth);
        stringCurrencyMetaDataMap.put(currenciesResponse.getCurrency(), currencyMetaData);
    }
    return stringCurrencyMetaDataMap;
}
Also used : CurrenciesResponse(org.knowm.xchange.kucoin.dto.response.CurrenciesResponse) WalletHealth(org.knowm.xchange.dto.meta.WalletHealth) CurrencyMetaData(org.knowm.xchange.dto.meta.CurrencyMetaData) HashMap(java.util.HashMap) BigDecimal(java.math.BigDecimal)

Example 2 with CurrenciesResponse

use of org.knowm.xchange.kucoin.dto.response.CurrenciesResponse in project XChange by knowm.

the class KucoinExchange method remoteInit.

@Override
public void remoteInit() throws IOException, ExchangeException {
    // fetch fee only if authenticated
    TradeFeeResponse fee = null;
    if (exchangeSpecification.getApiKey() != null) {
        fee = getMarketDataService().getKucoinBaseFee();
    }
    List<CurrenciesResponse> currenciesResponses = getMarketDataService().getKucoinCurrencies();
    List<SymbolResponse> symbolsResponse = getMarketDataService().getKucoinSymbols();
    this.exchangeMetaData = KucoinAdapters.adaptMetadata(this.exchangeMetaData, currenciesResponses, symbolsResponse, fee);
}
Also used : CurrenciesResponse(org.knowm.xchange.kucoin.dto.response.CurrenciesResponse) TradeFeeResponse(org.knowm.xchange.kucoin.dto.response.TradeFeeResponse) SymbolResponse(org.knowm.xchange.kucoin.dto.response.SymbolResponse)

Aggregations

CurrenciesResponse (org.knowm.xchange.kucoin.dto.response.CurrenciesResponse)2 BigDecimal (java.math.BigDecimal)1 HashMap (java.util.HashMap)1 CurrencyMetaData (org.knowm.xchange.dto.meta.CurrencyMetaData)1 WalletHealth (org.knowm.xchange.dto.meta.WalletHealth)1 SymbolResponse (org.knowm.xchange.kucoin.dto.response.SymbolResponse)1 TradeFeeResponse (org.knowm.xchange.kucoin.dto.response.TradeFeeResponse)1