Sha256: 0f6de87e5b4e66a4f47f9ab10ca6eebbfe6471246f56a55fc3d5f41fd83625db

Contents?: true

Size: 620 Bytes

Versions: 1

Compression:

Stored size: 620 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bitfinex-0.0.1 lib/bitfinex.rb