lib/utils.rb in SimBot-0.1.20 vs lib/utils.rb in SimBot-0.1.21
- old
+ new
@@ -101,9 +101,19 @@
response = RestClient.get('https://api.coinmarketcap.com/v2/ticker/1765/?convert=ETH')
hash = JSON.parse (response.body)
return hash['data']['quotes']['ETH']['price'].to_f.round(4)
end
+ # fetch binance order book
+ # @return [float] rate
+ def self.binane_order_book
+ response = RestClient.get('https://api.binance.com/api/v1/depth?symbol=BCCBTC&limit=100')
+ hash = JSON.parse(response.body)
+ bids = hash['bids']
+ asks = hash['asks']
+ { bids: bids, asks: asks }
+ end
+
# Try and read the existing pid from the pid file and signal the
# process. Returns true for a non blocking status.
# @param [Integer] pid
# @return [FalseClass and TrueClass]
def self.kill_process(pid)