Class DataService

java.lang.Object
com.github.badpop.jcoinbase.service.data.DataService

public class DataService
extends java.lang.Object
This service allows you to request coinbase public data.
  • Constructor Details

    • DataService

      public DataService()
  • Method Details

    • getTimeAsJava

      public CallResult<java.util.List<CoinbaseError>,​Time> getTimeAsJava()
      Get the Coinbase API server time.
      Returns:
      a CallResult containing a Time if it's ok, a list of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getTime

      public CallResult<io.vavr.collection.Seq<CoinbaseError>,​Time> getTime()
      Get the Coinbase API server time.
      Returns:
      a CallResult containing a Time if it's ok, a Seq of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getCurrenciesAsJava

      public CallResult<java.util.List<CoinbaseError>,​java.util.List<Currency>> getCurrenciesAsJava()
      List Coinbase known currencies. Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code (e.g. BTC).
      Returns:
      a CallResult containing a List of Currency if it's ok, a list of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getCurrencies

      public CallResult<io.vavr.collection.Seq<CoinbaseError>,​io.vavr.collection.Seq<Currency>> getCurrencies()
      List Coinbase known currencies. Currency codes will conform to the ISO 4217 standard where possible. Currencies which have or had no representation in ISO 4217 may use a custom code (e.g. BTC).
      Returns:
      a CallResult containing a Seq of Currency if it's ok, a Seq of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getExchangeRatesAsJava

      public CallResult<java.util.List<CoinbaseError>,​ExchangeRates> getExchangeRatesAsJava​(java.lang.String currency)
      Get current exchange rates for the given currency.
      Parameters:
      currency - the currency code. For example : BTC, USD, EUR, ETH, ...
      Returns:
      a CallResult containing an ExchangeRates object if it's ok, a List of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getExchangeRates

      public CallResult<io.vavr.collection.Seq<CoinbaseError>,​ExchangeRates> getExchangeRates​(java.lang.String currency)
      Get current exchange rates for the given currency.
      Parameters:
      currency - the currency code. For example : BTC, USD, EUR, ETH, ...
      Returns:
      a CallResult containing an ExchangeRates object if it's ok, a Seq of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getPriceAsJava

      public CallResult<java.util.List<CoinbaseError>,​Price> getPriceAsJava​(Price.PriceType priceType, java.lang.String baseCurrency, java.lang.String targetCurrency)
      Get the total price to buy one currency with an other currency (e.g. BTC-USD to buy Bitcoin with USD).
      Parameters:
      priceType - the price type to get (BUY, SELL or SPOT)
      baseCurrency - the base currency
      targetCurrency - the currency to determine price value
      Returns:
      a CallResult containing an Price object if it's ok, a List of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors
    • getPrice

      public CallResult<io.vavr.collection.Seq<CoinbaseError>,​Price> getPrice​(Price.PriceType priceType, java.lang.String baseCurrency, java.lang.String targetCurrency)
      Get the total price to buy one currency with an other currency (e.g. BTC-USD to buy Bitcoin with USD).
      Parameters:
      priceType - the price type to get (BUY, SELL or SPOT)
      baseCurrency - the base currency
      targetCurrency - the currency to determine price value
      Returns:
      a CallResult containing an Price object if it's ok, a Seq of CoinbaseError otherwise.
      Throws:
      JCoinbaseException - on unknown errors