Search in sources :

Example 1 with CmcQuote

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

the class CmcAdapter method adaptTicker.

public static Ticker adaptTicker(CmcTicker ticker, CurrencyPair currencyPair) {
    Date timestamp = ticker.getLastUpdated();
    CmcQuote cmcQuote = ticker.getQuote().get(currencyPair.counter.getCurrencyCode());
    BigDecimal price = cmcQuote.getPrice();
    BigDecimal volume24h = cmcQuote.getVolume24h();
    return new Ticker.Builder().currencyPair(currencyPair).timestamp(timestamp).open(price).last(price).bid(price).ask(price).high(price).low(price).vwap(price).volume(volume24h).build();
}
Also used : CmcQuote(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcQuote) CmcTicker(org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcTicker) Ticker(org.knowm.xchange.dto.marketdata.Ticker) Date(java.util.Date) BigDecimal(java.math.BigDecimal)

Aggregations

BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 CmcQuote (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcQuote)1 CmcTicker (org.knowm.xchange.coinmarketcap.pro.v1.dto.marketdata.CmcTicker)1 Ticker (org.knowm.xchange.dto.marketdata.Ticker)1