lib/utils.rb in SimBot-0.1.35 vs lib/utils.rb in SimBot-0.1.36
- old
+ new
@@ -6,10 +6,14 @@
# @return [FalseClass and Float]
def self.quote(market)
case market
when 'bchxrp'
bchxrp_price
+ when 'xrpzar'
+ xrpusd_price*14
+ when 'tusdzar'
+ bchxrp_price
when 'btczar'
btcusd_price*14
when 'bchbtc'
bchbtc_price
when 'btcxrp'
@@ -29,9 +33,17 @@
when 'btcbch'
1/bchbtc_price
else
false
end
+ end
+
+ # fetch btc/usd price from coin market cap
+ # @return [float] rate
+ def self.xrpusd_price
+ response = RestClient.get('https://api.coinmarketcap.com/v2/ticker/52/?convert=USD')
+ hash = JSON.parse(response.body)
+ hash['data']['quotes']['USD']['price'].to_f.round(4)
end
# fetch btc/usd price from coin market cap
# @return [float] rate
def self.btcusd_price