use of org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrencyInfo in project XChange by knowm.
the class CmcMarketDataServiceRaw method getCmcMultipleCurrencyInfo.
public Map<String, CmcCurrencyInfo> getCmcMultipleCurrencyInfo(List<Currency> currencyList) throws IOException {
List<String> currencyCodes = currencyList.stream().map(Currency::getCurrencyCode).collect(Collectors.toList());
String commaSeparatedCurrencyCodes = StringUtils.join(currencyCodes, ",");
CmcCurrencyInfoResponse response = null;
try {
response = cmcAuthenticated.getCurrencyInfo(apiKey, commaSeparatedCurrencyCodes);
} catch (HttpStatusIOException ex) {
CmcErrorAdapter.adapt(ex);
}
return response.getData();
}
use of org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrencyInfo in project XChange by knowm.
the class CmcMarketDataServiceRaw method getCmcCurrencyInfo.
public CmcCurrencyInfo getCmcCurrencyInfo(Currency currency) throws IOException {
String currencyCode = currency.getCurrencyCode();
CmcCurrencyInfoResponse response = null;
try {
response = cmcAuthenticated.getCurrencyInfo(apiKey, currencyCode);
} catch (HttpStatusIOException ex) {
CmcErrorAdapter.adapt(ex);
}
return response.getData().get(currencyCode);
}
use of org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrencyInfo in project XChange by knowm.
the class CurrencyInfoFetchIntegration method getCmcCurrencyInfoTest.
@Test
public void getCmcCurrencyInfoTest() throws Exception {
CmcCurrencyInfo currency = cmcMarketDataService.getCmcCurrencyInfo(Currency.BTC);
assertThat(currency).isNotNull();
assertThat(currency.getSymbol()).isEqualTo(Currency.BTC.getSymbol());
}
Aggregations