Class CoinbaseMarketDataService
- java.lang.Object
-
- org.knowm.xchange.service.BaseExchangeService
-
- org.knowm.xchange.coinbase.service.CoinbaseBaseService
-
- org.knowm.xchange.coinbase.service.CoinbaseMarketDataService
-
- All Implemented Interfaces:
BaseService,MarketDataService
public class CoinbaseMarketDataService extends CoinbaseBaseService implements MarketDataService
- Author:
- jamespedwards42
-
-
Field Summary
-
Fields inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
coinbase, signatureCreator
-
Fields inherited from class org.knowm.xchange.service.BaseExchangeService
exchange
-
-
Constructor Summary
Constructors Constructor Description CoinbaseMarketDataService(Exchange exchange)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CoinbasePricegetCoinbaseBuyPrice()Unauthenticated resource that tells you the total price in USD to buy 1 Bitcoin.CoinbasePricegetCoinbaseBuyPrice(BigDecimal quantity)Unauthenticated resource that tells you the total price in USD to buy some quantity of Bitcoin.CoinbasePricegetCoinbaseBuyPrice(BigDecimal quantity, String currency)Unauthenticated resource that tells you the total price to buy some quantity of Bitcoin.Map<String,BigDecimal>getCoinbaseCurrencyExchangeRates()Unauthenticated resource that returns BTC to fiat (and vice versus) exchange rates in various currencies.CoinbaseSpotPriceHistorygetCoinbaseHistoricalSpotRates()Unauthenticated resource that displays historical spot rates for Bitcoin in USD.CoinbaseSpotPriceHistorygetCoinbaseHistoricalSpotRates(Integer page)Unauthenticated resource that displays historical spot rates for Bitcoin in USD.CoinbasePricegetCoinbaseSellPrice()Unauthenticated resource that tells you the total amount in USD you can get if you sell 1 Bitcoin.CoinbasePricegetCoinbaseSellPrice(BigDecimal quantity)Unauthenticated resource that tells you the total amount in USD you can get if you sell some quantity Bitcoin.CoinbasePricegetCoinbaseSellPrice(BigDecimal quantity, String currency)Unauthenticated resource that tells you the total amount you can get if you sell some quantity Bitcoin.CoinbaseMoneygetCoinbaseSpotRate(String currency)Unauthenticated resource that tells you the current price of Bitcoin.OrderBookgetOrderBook(CurrencyPair currencyPair, Object... args)TickergetTicker(CurrencyPair currencyPair, Object... args)TradesgetTrades(CurrencyPair currencyPair, Object... args)-
Methods inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
createCoinbaseToken, createCoinbaseUser, createCoinbaseUser, getCoinbaseCurrencies, handleResponse
-
Methods inherited from class org.knowm.xchange.service.BaseExchangeService
getClientConfig, verifyOrder, verifyOrder, verifyOrder
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.knowm.xchange.service.marketdata.MarketDataService
getTickers
-
-
-
-
Constructor Detail
-
CoinbaseMarketDataService
public CoinbaseMarketDataService(Exchange exchange)
Constructor- Parameters:
exchange-
-
-
Method Detail
-
getTicker
public Ticker getTicker(CurrencyPair currencyPair, Object... args) throws IOException
- Specified by:
getTickerin interfaceMarketDataService- Parameters:
args- Optional Boolean. If true an additional call to retrieve the spot price history will be made and used to populate the 24 hour high and low values for the Ticker.- Returns:
- A Ticker with Coinbase's current buy price as the best ask, sell price as the best bid, spot price as the last value, and can optionally use the spot price history to find the 24 hour high and low.
- Throws:
IOException
-
getOrderBook
public OrderBook getOrderBook(CurrencyPair currencyPair, Object... args)
- Specified by:
getOrderBookin interfaceMarketDataService
-
getTrades
public Trades getTrades(CurrencyPair currencyPair, Object... args)
- Specified by:
getTradesin interfaceMarketDataService
-
getCoinbaseCurrencyExchangeRates
public Map<String,BigDecimal> getCoinbaseCurrencyExchangeRates() throws IOException
Unauthenticated resource that returns BTC to fiat (and vice versus) exchange rates in various currencies.- Returns:
- Map of lower case directional currency pairs, i.e. btc_to_xxx and xxx_to_btc, to exchange rates.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/currencies/exchange_rates.html
-
getCoinbaseBuyPrice
public CoinbasePrice getCoinbaseBuyPrice() throws IOException
Unauthenticated resource that tells you the total price in USD to buy 1 Bitcoin.- Returns:
- The price to buy 1 BTC.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/buy.html
-
getCoinbaseBuyPrice
public CoinbasePrice getCoinbaseBuyPrice(BigDecimal quantity) throws IOException
Unauthenticated resource that tells you the total price in USD to buy some quantity of Bitcoin.- Parameters:
quantity- The quantity of Bitcoin you would like to buy (default is 1 if null).- Returns:
- The price to buy the given
quantityBTC. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/buy.html
-
getCoinbaseBuyPrice
public CoinbasePrice getCoinbaseBuyPrice(BigDecimal quantity, String currency) throws IOException
Unauthenticated resource that tells you the total price to buy some quantity of Bitcoin.- Parameters:
quantity- The quantity of Bitcoin you would like to buy (default is 1 if null).currency- Default is USD. Right now this is the only value allowed.- Returns:
- The price in the desired
currencyto buy the givenquantityBTC. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/buy.html
-
getCoinbaseSellPrice
public CoinbasePrice getCoinbaseSellPrice() throws IOException
Unauthenticated resource that tells you the total amount in USD you can get if you sell 1 Bitcoin.- Returns:
- The price to sell 1 BTC.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/sell.html
-
getCoinbaseSellPrice
public CoinbasePrice getCoinbaseSellPrice(BigDecimal quantity) throws IOException
Unauthenticated resource that tells you the total amount in USD you can get if you sell some quantity Bitcoin.- Parameters:
quantity- The quantity of Bitcoin you would like to sell (default is 1 if null).- Returns:
- The price to sell the given
quantityBTC. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/sell.html
-
getCoinbaseSellPrice
public CoinbasePrice getCoinbaseSellPrice(BigDecimal quantity, String currency) throws IOException
Unauthenticated resource that tells you the total amount you can get if you sell some quantity Bitcoin.- Parameters:
quantity- The quantity of Bitcoin you would like to sell (default is 1 if null).currency- Default is USD. Right now this is the only value allowed.- Returns:
- The price in the desired
currencyto sell the givenquantityBTC. - Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/sell.html
-
getCoinbaseSpotRate
public CoinbaseMoney getCoinbaseSpotRate(String currency) throws IOException
Unauthenticated resource that tells you the current price of Bitcoin. This is usually somewhere in between the buy and sell price, current to within a few minutes.- Parameters:
currency- ISO 4217 currency code. Default is USD if null.- Returns:
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/spot_rate.html
-
getCoinbaseHistoricalSpotRates
public CoinbaseSpotPriceHistory getCoinbaseHistoricalSpotRates() throws IOException
Unauthenticated resource that displays historical spot rates for Bitcoin in USD. This is a paged resource and will return the first page by default.- Returns:
- One thousand historical spot prices representing page 1.
- Throws:
IOException- See Also:
- coinbase.com/api/doc/1.0/prices/historical.html
-
getCoinbaseHistoricalSpotRates
public CoinbaseSpotPriceHistory getCoinbaseHistoricalSpotRates(Integer page) throws IOException
Unauthenticated resource that displays historical spot rates for Bitcoin in USD.- Parameters:
page- Optional parameter to request a desired page of results. Will return page 1 if the supplied page is null or less than 1.- Returns:
- One thousand historical spot prices for the given page.
- Throws:
IOException
-
-