Class CoinbaseMarketDataService

    • Constructor Detail

      • CoinbaseMarketDataService

        public CoinbaseMarketDataService​(Exchange exchange)
        Constructor
        Parameters:
        exchange -
    • Method Detail

      • getTicker

        public Ticker getTicker​(CurrencyPair currencyPair,
                                Object... args)
                         throws IOException
        Description copied from interface: MarketDataService
        Get a ticker representing the current exchange rate
        Specified by:
        getTicker in interface MarketDataService
        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

        public OrderBook getOrderBook​(CurrencyPair currencyPair,
                                      Object... args)
        Description copied from interface: MarketDataService
        Get an order book representing the current offered exchange rates (market depth)
        Specified by:
        getOrderBook in interface MarketDataService
        args - Optional arguments. Exchange-specific
        Returns:
        The OrderBook, null if some sort of error occurred. Implementers should log the error.
      • getTrades

        public Trades getTrades​(CurrencyPair currencyPair,
                                Object... args)
        Description copied from interface: MarketDataService
        Get the trades recently performed by the exchange
        Specified by:
        getTrades in interface MarketDataService
        args - Optional arguments. Exchange-specific
        Returns:
        The Trades, null if some sort of error occurred. Implementers should log the error.
      • 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 currency to buy the given quantity BTC.
        Throws:
        IOException
        See Also:
        coinbase.com/api/doc/1.0/prices/buy.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 quantity BTC.
        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 currency to sell the given quantity BTC.
        Throws:
        IOException
        See Also:
        coinbase.com/api/doc/1.0/prices/sell.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