module Bitstamper::Rest::Public::Ticker

Public Instance Methods

daily_ticker(currency_pair: "btcusd", options: {}) click to toggle source
# File lib/bitstamper/rest/public/ticker.rb, line 6
def daily_ticker(currency_pair: "btcusd", options: {})
  ticker(currency_pair: currency_pair, interval: :daily, options: options)
end
hourly_ticker(currency_pair: "btcusd", options: {}) click to toggle source
# File lib/bitstamper/rest/public/ticker.rb, line 10
def hourly_ticker(currency_pair: "btcusd", options: {})
  ticker(currency_pair: currency_pair, interval: :hourly, options: options)
end
ticker(currency_pair: "btcusd", interval: :daily, options: {}) click to toggle source
# File lib/bitstamper/rest/public/ticker.rb, line 14
def ticker(currency_pair: "btcusd", interval: :daily, options: {})
  path        =   case interval.to_sym
    when :daily
      !currency_pair.to_s.empty? ? "/v2/ticker/#{::Bitstamper::Utilities.fix_currency_pair(currency_pair)}" : "/ticker"
    when :hourly
      !currency_pair.to_s.empty? ? "/v2/ticker_hour/#{::Bitstamper::Utilities.fix_currency_pair(currency_pair)}" : "/ticker_hour"
  end

  response    =   get(path, options: options)

  ::Bitstamper::Models::Ticker.new(response.merge("currency_pair" => currency_pair)) if response
end