Class: BTCT::CampBxAPI

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

Instance Method Summary collapse

Instance Method Details

#nameObject



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

def name
  "CampBX"
end

#topObject



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

def top
  ob = JSON.parse open("http://campbx.com/api/xdepth.php").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