Class: Coinbase::Products
- Inherits:
-
Object
- Object
- Coinbase::Products
- Includes:
- Util
- Defined in:
- lib/coinbase/products.rb
Overview
Product APIs
Instance Method Summary collapse
-
#daily_stats(product_id) ⇒ Hash
Get 24 hr stats for the product.
-
#fetch(product_id) ⇒ Hash
Get market data for a specific currency pair.
-
#last_trade(product_id) ⇒ Hash
Get information about the last trade.
-
#list ⇒ Array of Hashes
Get a list of available currency pairs for trading.
-
#orderbook(product_id, level = 1) ⇒ Hash
Get a list of open orders for a product.
-
#price_history(product_id, options = {}) ⇒ Array
Get historic rates for a product.
-
#trade_history(product_id, paginate_options = {}) ⇒ Array of Hashes
List the latest trades for a product.
Methods included from Util
#base_uri, #build_query_params, #format_response, #pagination_params, #send_request
Instance Method Details
#daily_stats(product_id) ⇒ Hash
Get 24 hr stats for the product.
72 73 74 |
# File 'lib/coinbase/products.rb', line 72 def daily_stats(product_id) send_request("/products/#{product_id}/stats") end |
#fetch(product_id) ⇒ Hash
Get market data for a specific currency pair
19 20 21 |
# File 'lib/coinbase/products.rb', line 19 def fetch(product_id) send_request("/products/#{product_id}") end |
#last_trade(product_id) ⇒ Hash
Get information about the last trade
39 40 41 |
# File 'lib/coinbase/products.rb', line 39 def last_trade(product_id) send_request("/products/#{product_id}/ticker") end |
#list ⇒ Array of Hashes
Get a list of available currency pairs for trading.
11 12 13 |
# File 'lib/coinbase/products.rb', line 11 def list send_request('/products') end |
#orderbook(product_id, level = 1) ⇒ Hash
Get a list of open orders for a product
1 Only the best bid and ask 2 Top 50 bids and asks (aggregated) 3 Full order book (non aggregated)
31 32 33 |
# File 'lib/coinbase/products.rb', line 31 def orderbook(product_id, level = 1) send_request("/products/#{product_id}/book?level=#{level}") end |
#price_history(product_id, options = {}) ⇒ Array
Get historic rates for a product.
62 63 64 65 66 |
# File 'lib/coinbase/products.rb', line 62 def price_history(product_id, = {}) query = build_query_params() unless .blank? send_request("/products/#{product_id}/candles?#{query}") end |
#trade_history(product_id, paginate_options = {}) ⇒ Array of Hashes
List the latest trades for a product.
before [String] Request page before (newer) this pagination id (optional). after [String] Request page after (older) this pagination id (optional). limit [Integer] Number of results per request. Maximum 1000, default is 1000 (optional).
52 53 54 55 |
# File 'lib/coinbase/products.rb', line 52 def trade_history(product_id, = {}) query_params = build_query_params() send_request("/products/#{product_id}/trades?#{query_params}") end |