Fix new krak trigger option

This commit is contained in:
root 2017-08-09 00:06:59 +00:00
parent 148d486b2c
commit c2c8ed4f67
1 changed files with 3 additions and 5 deletions

View File

@ -19,7 +19,7 @@ krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT'
krakbtceur = 'https://api.kraken.com/0/public/Ticker?pair=XBTEUR' krakbtceur = 'https://api.kraken.com/0/public/Ticker?pair=XBTEUR'
krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD' krakusd = 'https://api.kraken.com/0/public/Ticker?pair=XMRUSD'
krakeur = 'https://api.kraken.com/0/public/Ticker?pair=XMREUR' krakeur = 'https://api.kraken.com/0/public/Ticker?pair=XMREUR'
kraktrig = 'https://api.kraken.com/0/public/Ticker?pair=XBT' #append coin/trigger in function below kraktrig = 'https://api.kraken.com/0/public/Ticker?pair=' #append coin/trigger in function below
okcquar = 'https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=quarter' okcquar = 'https://www.okcoin.com/api/v1/future_ticker.do?symbol=btc_usd&contract_type=quarter'
krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD' krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD'
bitflyerurl = 'https://api.bitflyer.jp/v1/ticker' bitflyerurl = 'https://api.bitflyer.jp/v1/ticker'
@ -96,11 +96,9 @@ def krak(bot, trigger):
else: else:
coin = trigger.group(2).upper() coin = trigger.group(2).upper()
try: try:
kraktrig = kraktrig[:-1] #Didn't test. It's meant to delete the "'" from end of string. Delete this line if unneeded. r=requests.get(kraktrig+coin+'XBT')
kraktrig = kraktrig.append(coin)+"'" #Again, delete the +"'" at the end, if unneeded.
r=requests.get(kraktrig)
j=r.json() j=r.json()
stringtosay += coin + " at {0:.2f} on {1:.2f} 24 h BTC volume. ".format(float(j['result']['X'+str(coin)+'XXBT']['c'][0]), float(j['result']['X'+str(coin)+'XXBT']['v'][1])) stringtosay += "{0} at {1:.2f} on {2:.2f} 24 h {0} volume. ".format(coin, float(j['result']['X'+str(coin)+'XXBT']['c'][0]), float(j['result']['X'+str(coin)+'XXBT']['v'][1]))
except: except:
bot.say("Error connecting to Kraken") bot.say("Error connecting to Kraken")
# if len(coin) > 5 or len(coin) < 2: # if len(coin) > 5 or len(coin) < 2: