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
Modifier and Type Method Description CoinbasePrice
getCoinbaseBuyPrice()
Unauthenticated resource that tells you the total price in USD to buy 1 Bitcoin.CoinbasePrice
getCoinbaseBuyPrice(BigDecimal quantity)
Unauthenticated resource that tells you the total price in USD to buy some quantity of Bitcoin.CoinbasePrice
getCoinbaseBuyPrice(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.CoinbaseSpotPriceHistory
getCoinbaseHistoricalSpotRates()
Unauthenticated resource that displays historical spot rates for Bitcoin in USD.CoinbaseSpotPriceHistory
getCoinbaseHistoricalSpotRates(Integer page)
Unauthenticated resource that displays historical spot rates for Bitcoin in USD.CoinbasePrice
getCoinbaseSellPrice()
Unauthenticated resource that tells you the total amount in USD you can get if you sell 1 Bitcoin.CoinbasePrice
getCoinbaseSellPrice(BigDecimal quantity)
Unauthenticated resource that tells you the total amount in USD you can get if you sell some quantity Bitcoin.CoinbasePrice
getCoinbaseSellPrice(BigDecimal quantity, String currency)
Unauthenticated resource that tells you the total amount you can get if you sell some quantity Bitcoin.CoinbaseMoney
getCoinbaseSpotRate(String currency)
Unauthenticated resource that tells you the current price of Bitcoin.OrderBook
getOrderBook(CurrencyPair currencyPair, Object... args)
Get an order book representing the current offered exchange rates (market depth)Ticker
getTicker(CurrencyPair currencyPair, Object... args)
Get a ticker representing the current exchange rateTrades
getTrades(CurrencyPair currencyPair, Object... args)
Get the trades recently performed by the exchangeMethods inherited from class org.knowm.xchange.coinbase.service.CoinbaseBaseService
createCoinbaseToken, createCoinbaseUser, createCoinbaseUser, getCoinbaseCurrencies, handleResponse
Methods inherited from class org.knowm.xchange.service.BaseExchangeService
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
getCandleStickData, getFundingRate, getFundingRates, getOrderBook, getOrderBook, getTicker, getTickers, getTrades, getTrades
-
Constructor Details
-
CoinbaseMarketDataService
Constructor- Parameters:
exchange
-
-
-
Method Details
-
getTicker
Description copied from interface:MarketDataService
Get a ticker representing the current exchange rate- Specified by:
getTicker
in 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
- - Indication that a networking error occurred while fetching JSON data
-
getOrderBook
Description copied from interface:MarketDataService
Get an order book representing the current offered exchange rates (market depth)- Specified by:
getOrderBook
in interfaceMarketDataService
args
- Optional arguments. Exchange-specific- Returns:
- The OrderBook, null if some sort of error occurred. Implementers should log the error.
-
getTrades
Description copied from interface:MarketDataService
Get the trades recently performed by the exchange- Specified by:
getTrades
in interfaceMarketDataService
args
- Optional arguments. Exchange-specific- Returns:
- The Trades, null if some sort of error occurred. Implementers should log the error.
-
getCoinbaseCurrencyExchangeRates
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
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
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
quantity
BTC. - Throws:
IOException
- See Also:
- coinbase.com/api/doc/1.0/prices/buy.html
-
getCoinbaseBuyPrice
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
currency
to buy the givenquantity
BTC. - Throws:
IOException
- See Also:
- coinbase.com/api/doc/1.0/prices/buy.html
-
getCoinbaseSellPrice
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
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
quantity
BTC. - Throws:
IOException
- See Also:
- coinbase.com/api/doc/1.0/prices/sell.html
-
getCoinbaseSellPrice
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
currency
to sell the givenquantity
BTC. - Throws:
IOException
- See Also:
- coinbase.com/api/doc/1.0/prices/sell.html
-
getCoinbaseSpotRate
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
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
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
-