fix ogre
This commit is contained in:
parent
e8ed5316cb
commit
ab05ba5b60
10
price.py
10
price.py
|
@ -285,16 +285,16 @@ def trex(bot, trigger):
|
||||||
@sopel.module.commands('tradeogre', 'ogre')
|
@sopel.module.commands('tradeogre', 'ogre')
|
||||||
def ogre(bot, trigger):
|
def ogre(bot, trigger):
|
||||||
if not trigger.group(2):
|
if not trigger.group(2):
|
||||||
coin = 'XMR'
|
pair = 'BTC-XMR'
|
||||||
else:
|
else:
|
||||||
coin = trigger.group(2).upper()
|
coin = 'BTC-'+trigger.group(2).upper()
|
||||||
try:
|
try:
|
||||||
r = requests.get(ogreurl)
|
r = requests.get(ogreurl)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
for i in j:
|
for i in j:
|
||||||
if "BTC-"+coin == i.key():
|
if pair == i.keys():
|
||||||
last=float(i['price'])
|
last=float(i[pair]['price'])
|
||||||
vol=float(i['volume'])
|
vol=float(i[pair]['volume'])
|
||||||
bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol))
|
bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol))
|
||||||
except:
|
except:
|
||||||
bot.say("Error retrieving data from Ogre")
|
bot.say("Error retrieving data from Ogre")
|
||||||
|
|
Loading…
Reference in New Issue