Class: BTCT::BtceAPI

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

Instance Method Summary collapse

Instance Method Details

#nameObject



5
6
7
# File 'lib/btct/btce.rb', line 5

def name
  "BTC-E"
end

#topObject



9
10
11
12
13
14
# File 'lib/btct/btce.rb', line 9

def top
  ob = JSON.parse open("https://btc-e.com/api/2/btc_usd/depth").read
  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