Merge pull request #43 from scoobybejesus/patch-11

Move thumb to end of xmrtall
This commit is contained in:
jw 2019-07-27 08:35:23 +01:00 committed by GitHub
commit 3fae43a364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 21 deletions

View File

@ -692,27 +692,6 @@ def tall(bot, trigger):
def xmrtall(bot, trigger):
stringtosend = ''
# Bithumb (Note: Must calculate BTCXMR price from BTCKRW and XMRKRW)
try:
xmr_r = requests.get(thumbxmrurl)
btc_r = requests.get(thumbbtcurl)
xmrjson = xmr_r.json()
btcjson = btc_r.json()
# No last price in api. Must average buy and sell price.
thumbXMRbuy = float(xmrjson['data']['buy_price'])
thumbXMRsell = float(xmrjson['data']['sell_price'])
thumbXMRkrw = (thumbXMRbuy + thumbXMRsell)/2
# Same for BTC
thumbBTCbuy = float(btcjson['data']['buy_price'])
thumbBTCsell = float(btcjson['data']['sell_price'])
thumbBTCkrw = (thumbBTCbuy + thumbBTCsell)/2
# Finally, price in BTC, and volume in XMR
thumbBTCxmr = thumbXMRkrw/thumbBTCkrw
thumbXMRVol = float(xmrjson['data']['volume_1day'])
stringtosend = "Bithumb last: {0:.6f} BTC on {1:.2f} XMR volume | ".format(thumbBTCxmr,thumbXMRVol)
except:
bot.say("Error - bithumb korea is worst korea.")
# Polo
try:
r=requests.get(polourl)
@ -787,6 +766,28 @@ def xmrtall(bot, trigger):
# except:
# bot.say("Something borked -.--=≡≡卍 (<-- this is a ninja star, nothing naziish)")
# Bithumb (Note: Must calculate BTCXMR price from BTCKRW and XMRKRW)
try:
xmr_r = requests.get(thumbxmrurl)
btc_r = requests.get(thumbbtcurl)
xmrjson = xmr_r.json()
btcjson = btc_r.json()
# No last price in api. Must average buy and sell price.
thumbXMRbuy = float(xmrjson['data']['buy_price'])
thumbXMRsell = float(xmrjson['data']['sell_price'])
thumbXMRkrw = (thumbXMRbuy + thumbXMRsell)/2
# Same for BTC
thumbBTCbuy = float(btcjson['data']['buy_price'])
thumbBTCsell = float(btcjson['data']['sell_price'])
thumbBTCkrw = (thumbBTCbuy + thumbBTCsell)/2
# Finally, price in BTC, and volume in XMR
thumbBTCxmr = thumbXMRkrw/thumbBTCkrw
thumbXMRVol = float(xmrjson['data']['volume_1day'])
stringtosend = "Bithumb last: {0:.6f} BTC on {1:.2f} XMR volume | ".format(thumbBTCxmr,thumbXMRVol)
except:
bot.say("Error - bithumb korea is worst korea.")
# Tux
# try:
# r = requests.get('https://tuxexchange.com/api?method=getticker')