Search in sources :

Example 1 with CmcTickerResponse

use of org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerResponse in project XChange by knowm.

the class CmcMarketDataServiceRaw method getCmcLatestQuotes.

public Map<String, CmcTicker> getCmcLatestQuotes(Set<Currency> baseCurrencySet, Set<Currency> convertCurrencySet) throws IOException {
    List<String> baseSymbols = baseCurrencySet.stream().map(c -> c.getCurrencyCode()).collect(Collectors.toList());
    String commaSeparatedBaseSymbols = StringUtils.join(baseSymbols, ",");
    List<String> convertSymbols = convertCurrencySet.stream().map(c -> c.getCurrencyCode()).collect(Collectors.toList());
    String commaSeparatedConvertCurrencies = StringUtils.join(convertSymbols, ",");
    CmcTickerResponse response = null;
    try {
        response = cmcAuthenticated.getLatestQuotes(apiKey, commaSeparatedBaseSymbols, commaSeparatedConvertCurrencies);
    } catch (HttpStatusIOException ex) {
        CmcErrorAdapter.adapt(ex);
    }
    return response.getData();
}
Also used : CmcCurrencyInfoResponse(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcCurrencyInfoResponse) CmcTickerResponse(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerResponse) Set(java.util.Set) IOException(java.io.IOException) CmcErrorAdapter(org.knowm.xchange.coinmarketcap.pro.v1.CmcErrorAdapter) CmcCurrencyMapResponse(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcCurrencyMapResponse) Exchange(org.knowm.xchange.Exchange) Collectors(java.util.stream.Collectors) StringUtils(org.apache.commons.lang3.StringUtils) CmcCurrency(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrency) CmcCurrencyInfo(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrencyInfo) List(java.util.List) Currency(org.knowm.xchange.currency.Currency) CmcTicker(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcTicker) CmcTickerListResponse(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerListResponse) Map(java.util.Map) CurrencyPair(org.knowm.xchange.currency.CurrencyPair) HttpStatusIOException(si.mazi.rescu.HttpStatusIOException) CmcTickerResponse(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerResponse) HttpStatusIOException(si.mazi.rescu.HttpStatusIOException)

Aggregations

IOException (java.io.IOException)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Exchange (org.knowm.xchange.Exchange)1 CmcErrorAdapter (org.knowm.xchange.coinmarketcap.pro.v1.CmcErrorAdapter)1 CmcCurrency (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrency)1 CmcCurrencyInfo (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcCurrencyInfo)1 CmcTicker (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcTicker)1 CmcCurrencyInfoResponse (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcCurrencyInfoResponse)1 CmcCurrencyMapResponse (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcCurrencyMapResponse)1 CmcTickerListResponse (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerListResponse)1 CmcTickerResponse (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.response.CmcTickerResponse)1 Currency (org.knowm.xchange.currency.Currency)1 CurrencyPair (org.knowm.xchange.currency.CurrencyPair)1 HttpStatusIOException (si.mazi.rescu.HttpStatusIOException)1