Module: Bitstamper::Rest::Public::Ticker
- Included in:
- Client
- Defined in:
- lib/bitstamper/rest/public/ticker.rb
Instance Method Summary collapse
- #daily_ticker(currency_pair: "btcusd", options: {}) ⇒ Object
- #hourly_ticker(currency_pair: "btcusd", options: {}) ⇒ Object
- #ticker(currency_pair: "btcusd", interval: :daily, options: {}) ⇒ Object
Instance Method Details
#daily_ticker(currency_pair: "btcusd", options: {}) ⇒ Object
6 7 8 |
# File 'lib/bitstamper/rest/public/ticker.rb', line 6 def daily_ticker(currency_pair: "btcusd", options: {}) ticker(currency_pair: currency_pair, interval: :daily, options: ) end |
#hourly_ticker(currency_pair: "btcusd", options: {}) ⇒ Object
10 11 12 |
# File 'lib/bitstamper/rest/public/ticker.rb', line 10 def hourly_ticker(currency_pair: "btcusd", options: {}) ticker(currency_pair: currency_pair, interval: :hourly, options: ) end |
#ticker(currency_pair: "btcusd", interval: :daily, options: {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# 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: ) ::Bitstamper::Models::Ticker.new(response.merge("currency_pair" => currency_pair)) if response end |