Class: BTCT::BitstampAPI

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

Instance Method Summary collapse

Instance Method Details

#nameObject



7
8
9
# File 'lib/btct/bitstamp.rb', line 7

def name
  "Bitstamp"
end

#topObject



11
12
13
14
15
16
# File 'lib/btct/bitstamp.rb', line 11

def top
  ob = JSON.parse Bitstamp::Net.get('/order_book/').body_str
  bid = ob["bids"].sort { |x, y| x[0].to_f <=> y [0].to_f }.last
  ask = ob["asks"].sort { |x, y| x[0].to_f <=> y [0].to_f }.first
  return Quote.new(bid[0], bid[1], name), Quote.new(ask[0], ask[1], name)
end