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 Summary
Constructors Constructor Description DataService()
-
Method Summary
Modifier and Type Method Description CallResult<io.vavr.collection.Seq<CoinbaseError>,io.vavr.collection.Seq<Currency>>
getCurrencies()
List Coinbase known currencies.CallResult<java.util.List<CoinbaseError>,java.util.List<Currency>>
getCurrenciesAsJava()
List Coinbase known currencies.CallResult<io.vavr.collection.Seq<CoinbaseError>,ExchangeRates>
getExchangeRates(java.lang.String currency)
Get current exchange rates for the given currency.CallResult<java.util.List<CoinbaseError>,ExchangeRates>
getExchangeRatesAsJava(java.lang.String currency)
Get current exchange rates for the given currency.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.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.CallResult<io.vavr.collection.Seq<CoinbaseError>,Time>
getTime()
Get the Coinbase API server time.CallResult<java.util.List<CoinbaseError>,Time>
getTimeAsJava()
Get the Coinbase API server time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
DataService
public DataService()
-
-
Method Details
-
getTimeAsJava
Get the Coinbase API server time.- Returns:
- a
CallResult
containing aTime
if it's ok, a list ofCoinbaseError
otherwise. - Throws:
JCoinbaseException
- on unknown errors
-
getTime
Get the Coinbase API server time.- Returns:
- a
CallResult
containing aTime
if it's ok, a Seq ofCoinbaseError
otherwise. - Throws:
JCoinbaseException
- on unknown errors
-
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 ofCurrency
if it's ok, a list ofCoinbaseError
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 ofCurrency
if it's ok, a Seq ofCoinbaseError
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 anExchangeRates
object if it's ok, a List ofCoinbaseError
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 anExchangeRates
object if it's ok, a Seq ofCoinbaseError
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 currencytargetCurrency
- the currency to determine price value- Returns:
- a
CallResult
containing anPrice
object if it's ok, a List ofCoinbaseError
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 currencytargetCurrency
- the currency to determine price value- Returns:
- a
CallResult
containing anPrice
object if it's ok, a Seq ofCoinbaseError
otherwise. - Throws:
JCoinbaseException
- on unknown errors
-