require "bitfinex/version" require 'httparty' require 'active_support/core_ext/hash' module Bitfinex BASE_URL = 'https://api.bitfinex.com/v1' class Ticker def initialize currency_exchange ticker_url = BASE_URL + '/pubticker/' + currency_exchange @ticker = HTTParty.get(ticker_url).symbolize_keys end def high; @ticker[:high].to_f; end def low; @ticker[:low].to_f; end def average; @ticker[:mid].to_f; end def last; @ticker[:last_price].to_f; end def buy; @ticker[:ask].to_f; end def sell; @ticker[:bid].to_f; end def volume; @ticker[:volume].to_f; end end end