Class: BitfinexApi::Ticker

Inherits:
Object
  • Object
show all
Defined in:
lib/bitfinex_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(currency_exchange) ⇒ Ticker

Returns a new instance of Ticker.



11
12
13
14
# File 'lib/bitfinex_api.rb', line 11

def initialize currency_exchange
  ticker_url = BASE_URL + '/pubticker/' + currency_exchange
  @ticker = HTTParty.get(ticker_url).symbolize_keys
end

Instance Method Details

#averageObject



18
# File 'lib/bitfinex_api.rb', line 18

def average; @ticker[:mid].to_f; end

#buyObject



20
# File 'lib/bitfinex_api.rb', line 20

def buy; @ticker[:ask].to_f; end

#highObject



16
# File 'lib/bitfinex_api.rb', line 16

def high; @ticker[:high].to_f; end

#lastObject



19
# File 'lib/bitfinex_api.rb', line 19

def last; @ticker[:last_price].to_f; end

#lowObject



17
# File 'lib/bitfinex_api.rb', line 17

def low; @ticker[:low].to_f; end

#sellObject



21
# File 'lib/bitfinex_api.rb', line 21

def sell; @ticker[:bid].to_f; end

#volumeObject



22
# File 'lib/bitfinex_api.rb', line 22

def volume; @ticker[:volume].to_f; end