Sha256: 937d05736ac4c517949509fdb424478cc9a307acef951b1f3d5ea4bdf464fae5

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require "bitfinex_api/version"
require 'httparty'
require 'active_support/core_ext/hash'


module BitfinexApi

  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_api-0.0.1 lib/bitfinex_api.rb