Merge remote-tracking branch 'jwinterm/master' into shill
This commit is contained in:
commit
bb4a073849
21
network.py
21
network.py
|
@ -2,7 +2,10 @@ import sopel.module
|
||||||
import requests
|
import requests
|
||||||
import re
|
import re
|
||||||
|
|
||||||
networkurl = "http://node.xmrbackb.one:18081/getinfo"
|
# networkurl = "http://node.marty.cf:18019/getinfo"
|
||||||
|
# networkurl = "http://node.xmrbackb.one:18081/getinfo"
|
||||||
|
# networkurl = "http://opennode.minemonero.pro:18081/getinfo"
|
||||||
|
networkurl = "http://node.xmr.pt:18081/getinfo"
|
||||||
|
|
||||||
@sopel.module.commands('fork', 'forkening')
|
@sopel.module.commands('fork', 'forkening')
|
||||||
def fork(bot, trigger):
|
def fork(bot, trigger):
|
||||||
|
@ -13,7 +16,7 @@ def fork(bot, trigger):
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
height=j["height"]
|
height=j["height"]
|
||||||
forkheight=1400000
|
forkheight=1686275
|
||||||
if forkheight > height:
|
if forkheight > height:
|
||||||
bot.say("The current block height is {0:,}. Fork height is {1:,}. {2:,} blocks to go, happening in approximately {3:.2f} hours.".format(height,forkheight,forkheight-height,(forkheight-height)/30.0))
|
bot.say("The current block height is {0:,}. Fork height is {1:,}. {2:,} blocks to go, happening in approximately {3:.2f} hours.".format(height,forkheight,forkheight-height,(forkheight-height)/30.0))
|
||||||
else:
|
else:
|
||||||
|
@ -48,7 +51,7 @@ def btcmempool(bot, trigger):
|
||||||
def mempool(bot, trigger):
|
def mempool(bot, trigger):
|
||||||
try:
|
try:
|
||||||
# r=requests.get('http://node.moneroworld.com:18081/getinfo')
|
# r=requests.get('http://node.moneroworld.com:18081/getinfo')
|
||||||
r=requests.get('http://node.xmrbackb.one:18081/getinfo')
|
r=requests.get(networkurl)
|
||||||
j=r.json()
|
j=r.json()
|
||||||
bot.say("The current number of txs in Monero's mempool is {0}".format(j['tx_pool_size']))
|
bot.say("The current number of txs in Monero's mempool is {0}".format(j['tx_pool_size']))
|
||||||
except:
|
except:
|
||||||
|
@ -76,6 +79,18 @@ def mine(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Mining is for suckers.")
|
bot.say("Mining is for suckers.")
|
||||||
|
|
||||||
|
@sopel.module.commands('solo')
|
||||||
|
def solo(bot, trigger):
|
||||||
|
try:
|
||||||
|
r=requests.get('https://supportxmr.com/api/network/stats')
|
||||||
|
j=r.json()
|
||||||
|
diff=float(j['difficulty'])
|
||||||
|
hashrate=float(trigger.group(2))
|
||||||
|
timetoblock=(diff/hashrate)
|
||||||
|
bot.say("At {:.0f} h/s with network diff of {:.2e} your expected time for find a block is {:.2e} s or {:.2f} days.".format(hashrate, diff, timetoblock, timetoblock/(60*60*24)))
|
||||||
|
except:
|
||||||
|
bot.say("Mining is for suckers.")
|
||||||
|
|
||||||
@sopel.module.commands('b2x')
|
@sopel.module.commands('b2x')
|
||||||
def b2x(bot, trigger):
|
def b2x(bot, trigger):
|
||||||
bot.say("Fuck off \\x")
|
bot.say("Fuck off \\x")
|
||||||
|
|
704
price.py
704
price.py
|
@ -3,6 +3,7 @@ import sopel.module
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
import datetime
|
||||||
# from apikey import commodity_key
|
# from apikey import commodity_key
|
||||||
|
|
||||||
polourl = "https://poloniex.com/public?command=returnTicker"
|
polourl = "https://poloniex.com/public?command=returnTicker"
|
||||||
|
@ -12,7 +13,6 @@ prevamnt, prevtime = 0, 0
|
||||||
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-"
|
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-"
|
||||||
cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarkets"
|
cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarkets"
|
||||||
bitsquareurl = "https://market.bitsquare.io/api/ticker/?market=xmr_btc"
|
bitsquareurl = "https://market.bitsquare.io/api/ticker/?market=xmr_btc"
|
||||||
fixerurl = 'http://api.fixer.io/latest?base=USD'
|
|
||||||
finexbtc = 'https://api.bitfinex.com/v1/pubticker/XMRBTC'
|
finexbtc = 'https://api.bitfinex.com/v1/pubticker/XMRBTC'
|
||||||
finexusd = 'https://api.bitfinex.com/v1/pubticker/XMRUSD'
|
finexusd = 'https://api.bitfinex.com/v1/pubticker/XMRUSD'
|
||||||
krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT'
|
krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT'
|
||||||
|
@ -25,30 +25,73 @@ krakusdt = 'http://api.kraken.com/0/public/Ticker?pair=USDTUSD'
|
||||||
bitflyerurl = 'https://api.bitflyer.jp/v1/ticker'
|
bitflyerurl = 'https://api.bitflyer.jp/v1/ticker'
|
||||||
thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in KRW
|
thumbxmrurl = 'https://api.bithumb.com/public/ticker/xmr' # measured natively in KRW
|
||||||
thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW
|
thumbbtcurl = 'https://api.bithumb.com/public/ticker/btc' # measured natively in KRW
|
||||||
|
binanceurl = 'https://api.binance.com/api/v1/ticker/24hr'
|
||||||
|
localmonerousd = 'https://localmonero.co/api/ticker?currencyCode=USD'
|
||||||
|
ogreurl = 'https://tradeogre.com/api/v1/markets'
|
||||||
|
|
||||||
|
@sopel.module.commands('stock')
|
||||||
|
def stock(bot, trigger):
|
||||||
|
if trigger.group(2):
|
||||||
|
ticker = trigger.group(2).upper()
|
||||||
|
else: ticker = 'WOW'
|
||||||
|
try:
|
||||||
|
r = requests.get('https://api.iextrading.com/1.0/stock/{}/batch?types=quote,news,chart&range=1m&last=10'.format(ticker))
|
||||||
|
j = r.json()
|
||||||
|
name = j['quote']['companyName']
|
||||||
|
exchange = j['quote']['primaryExchange']
|
||||||
|
date = j['quote']['latestTime']
|
||||||
|
high = j['quote']['high']
|
||||||
|
low = j['quote']['low']
|
||||||
|
last = j['quote']['latestPrice']
|
||||||
|
bot.say("{} ({}) trading at {} on {} had a high of {:.2f}, a low of {:.2f}, and last price of {:.2f}".format(name, ticker, exchange, date, high, low, last))
|
||||||
|
except:
|
||||||
|
bot.say("Can't find {}".format(ticker))
|
||||||
|
|
||||||
@sopel.module.commands('bcc', 'bitcointrash')
|
@sopel.module.commands('forksum')
|
||||||
def bcc(bot, trigger):
|
def forksum(bot, trigger):
|
||||||
url = 'https://api.coinmarketcap.com/v1/ticker/?bcc'
|
url = 'https://api.coinmarketcap.com/v1/ticker/?bch'
|
||||||
try:
|
try:
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
for i in j:
|
for i in j:
|
||||||
try:
|
try:
|
||||||
|
if i['id'] == 'bitcoin':
|
||||||
|
btcprice = float(i['price_usd'])
|
||||||
if i['id'] == 'bitcoin-cash':
|
if i['id'] == 'bitcoin-cash':
|
||||||
coin = i
|
bcashprice = float(i['price_usd'])
|
||||||
|
if i['id'] == 'bitcoin-gold':
|
||||||
|
bgoldprice = float(i['price_usd'])
|
||||||
except: pass
|
except: pass
|
||||||
symbol = coin['symbol']
|
bot.say("The sum of USD price of BTC, BCH, and BTG is ${:.2f}".format(btcprice+bcashprice+bgoldprice))
|
||||||
name = coin['name']
|
|
||||||
rank = coin['rank']
|
|
||||||
price_usd = float(coin['price_usd'])
|
|
||||||
price_btc = float(coin['price_btc'])
|
|
||||||
volume_usd = float(coin['24h_volume_usd'])
|
|
||||||
percent_change_24h = float(coin['percent_change_24h'])
|
|
||||||
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / ฿{4:.8f}. 24h volume ${5:,.0f} changed {6}%.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h))
|
|
||||||
except:
|
except:
|
||||||
bot.say("Error parsing ticker")
|
bot.say("Error parsing ticker")
|
||||||
|
|
||||||
|
@sopel.module.commands('ath')
|
||||||
|
def ath(bot, trigger):
|
||||||
|
with open('/root/.sopel/modules/ath.log', 'r') as f:
|
||||||
|
text = f.read()
|
||||||
|
btcath = float(text.split(' ')[0])
|
||||||
|
btcathdate = text.split(' ')[1]
|
||||||
|
usdath = float(text.split(' ')[2])
|
||||||
|
usdathdate = text.split(' ')[3]
|
||||||
|
update = False
|
||||||
|
url = 'https://api.coinmarketcap.com/v1/ticker/monero'
|
||||||
|
r = requests.get(url)
|
||||||
|
j = r.json()
|
||||||
|
price_btc = float(j[0]['price_btc'])
|
||||||
|
price_usd = float(j[0]['price_usd'])
|
||||||
|
if price_btc > btcath:
|
||||||
|
btcath = price_btc
|
||||||
|
update = True
|
||||||
|
btcathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d')
|
||||||
|
if price_usd > usdath:
|
||||||
|
usdath = price_usd
|
||||||
|
update = True
|
||||||
|
usdathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d')
|
||||||
|
if update == True:
|
||||||
|
with open('/root/.sopel/modules/ath.log', 'w') as f:
|
||||||
|
f.write("{} {} {} {}".format(btcath, btcathdate, usdath, usdathdate))
|
||||||
|
bot.say("BTC ath = {} on {}. USD ath = ${} on {}".format(btcath, btcathdate, usdath, usdathdate))
|
||||||
|
|
||||||
@sopel.module.commands('bfx', 'bitfinex')
|
@sopel.module.commands('bfx', 'bitfinex')
|
||||||
def bfx(bot, trigger):
|
def bfx(bot, trigger):
|
||||||
|
@ -70,6 +113,26 @@ def bfx(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Error getting data")
|
bot.say("Error getting data")
|
||||||
|
|
||||||
|
@sopel.module.commands('gecko', 'cg', 'gec')
|
||||||
|
def gecko(bot, trigger):
|
||||||
|
if not trigger.group(2):
|
||||||
|
coin = "monero"
|
||||||
|
else:
|
||||||
|
coin = trigger.group(2)
|
||||||
|
try:
|
||||||
|
r = requests.get('https://api.coingecko.com/api/v3/coins/'+coin)
|
||||||
|
j = r.json()
|
||||||
|
coinid = j['id']
|
||||||
|
mcaprank = j['market_cap_rank']
|
||||||
|
geckorank = j['coingecko_rank']
|
||||||
|
btcprice = j['market_data']['current_price']['btc']
|
||||||
|
usdprice = j['market_data']['current_price']['usd']
|
||||||
|
athbtc = j['market_data']['ath']['btc']
|
||||||
|
athusd = j['market_data']['ath']['usd']
|
||||||
|
bot.say("{} ({}) is #{:.0f} by mcap and #{:.0f} by coingecko rank. Current price is {:.8f} BTC / ${:.3f}. ATH price is {:.8f} BTC / ${:.3f}.".format(coin, coinid, mcaprank, geckorank, btcprice, usdprice, athbtc, athusd))
|
||||||
|
except:
|
||||||
|
bot.say("Couldn't find {} on le gecko".format(coin))
|
||||||
|
|
||||||
@sopel.module.commands('krak', 'kraken')
|
@sopel.module.commands('krak', 'kraken')
|
||||||
def krak(bot, trigger):
|
def krak(bot, trigger):
|
||||||
stringtosay = ''
|
stringtosay = ''
|
||||||
|
@ -104,32 +167,11 @@ def krak(bot, trigger):
|
||||||
stringtosay += "{0} at {1:.8f} 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]))
|
stringtosay += "{0} at {1:.8f} 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:
|
|
||||||
# bot.say("Coin ticker is too long or short")
|
|
||||||
# elif coin == "PIVX":
|
|
||||||
# bot.say("Masternodes + PoS...what could possibly go wrong?")
|
|
||||||
# else:
|
|
||||||
try:
|
try:
|
||||||
bot.say(stringtosay)
|
bot.say(stringtosay)
|
||||||
except:
|
except:
|
||||||
bot.say("Error getting data")
|
bot.say("Error getting data")
|
||||||
|
|
||||||
# THIS WAS COPIED FROM THE POLO FUNCTION, AND IS UNUSED, AT LEAST FOR NOW
|
|
||||||
# label="BTC_" + coin
|
|
||||||
# try:
|
|
||||||
# ticker=j[label]
|
|
||||||
# last=float(ticker['last'])
|
|
||||||
# change=float(ticker['percentChange'])
|
|
||||||
# vol=float(ticker['baseVolume'])
|
|
||||||
# if change >= 0:
|
|
||||||
# sign = '+'
|
|
||||||
# else:
|
|
||||||
# sign = ''
|
|
||||||
# bot.say("{0} at {1:.8f} BTC; {2}{3:.2f}% over 24 hours on {4:.3f} BTC volume".format(coin, last, sign, change*100, vol))
|
|
||||||
# except:
|
|
||||||
# bot.say("ERROR!")
|
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.commands('usdt')
|
@sopel.module.commands('usdt')
|
||||||
def usdt(bot, trigger):
|
def usdt(bot, trigger):
|
||||||
try:
|
try:
|
||||||
|
@ -278,6 +320,23 @@ def trex(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Error retrieving data from Bittrex")
|
bot.say("Error retrieving data from Bittrex")
|
||||||
|
|
||||||
|
@sopel.module.commands('tradeogre', 'ogre')
|
||||||
|
def ogre(bot, trigger):
|
||||||
|
if not trigger.group(2):
|
||||||
|
pair = 'BTC-XMR'
|
||||||
|
else:
|
||||||
|
pair = 'BTC-'+trigger.group(2).upper()
|
||||||
|
try:
|
||||||
|
r = requests.get(ogreurl)
|
||||||
|
j = r.json()
|
||||||
|
for i in j:
|
||||||
|
if pair == i.keys()[0]:
|
||||||
|
last=float(i[pair]['price'])
|
||||||
|
vol=float(i[pair]['volume'])
|
||||||
|
bot.say("{0} on Tradeogre at {1:.8f} BTC on {2:.3f} BTC volume".format(pair, last, vol))
|
||||||
|
except:
|
||||||
|
bot.say("Error retrieving data from Ogre")
|
||||||
|
|
||||||
@sopel.module.commands('bsq', 'bitsquare')
|
@sopel.module.commands('bsq', 'bitsquare')
|
||||||
def bsq(bot, trigger):
|
def bsq(bot, trigger):
|
||||||
try:
|
try:
|
||||||
|
@ -290,6 +349,36 @@ def bsq(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Error retrieving data from Bitsquare")
|
bot.say("Error retrieving data from Bitsquare")
|
||||||
|
|
||||||
|
@sopel.module.commands('binance')
|
||||||
|
def binance(bot, trigger):
|
||||||
|
try:
|
||||||
|
if not trigger.group(2):
|
||||||
|
coin = 'XMR'
|
||||||
|
pair = 'BTC'
|
||||||
|
else:
|
||||||
|
coin = trigger.group(2).split(' ')[0].upper()
|
||||||
|
try:
|
||||||
|
if len(trigger.group(2).split(' ')[1]) > 1:
|
||||||
|
pair = trigger.group(2).split(' ')[1].upper()
|
||||||
|
else:
|
||||||
|
pair = "BTC"
|
||||||
|
except:
|
||||||
|
pair = "BTC"
|
||||||
|
r = requests.get(binanceurl)
|
||||||
|
j = r.json()
|
||||||
|
found = False
|
||||||
|
for i in j:
|
||||||
|
if i["symbol"] == coin+pair:
|
||||||
|
last=float(i['lastPrice'])
|
||||||
|
change=float(i['priceChangePercent'])
|
||||||
|
vol=float(i['volume'])
|
||||||
|
bot.say("{0} on Binance at {1:.8f} {2}; {3:.2f}% over 24 hours on {4:.3f} {2} volume".format(coin, last, pair, change, vol*last))
|
||||||
|
found = True
|
||||||
|
if found == False:
|
||||||
|
bot.say("Too scammy even for Binance")
|
||||||
|
except:
|
||||||
|
bot.say("Error retrieving data from Binance")
|
||||||
|
|
||||||
@sopel.module.commands('cryptopia', 'shitopia', 'topia', 'ctop')
|
@sopel.module.commands('cryptopia', 'shitopia', 'topia', 'ctop')
|
||||||
def cryptopia(bot, trigger):
|
def cryptopia(bot, trigger):
|
||||||
try:
|
try:
|
||||||
|
@ -322,25 +411,35 @@ def cryptopia(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('cmc', 'coinmarketcap')
|
@sopel.module.commands('cmc', 'coinmarketcap')
|
||||||
def cmc(bot, trigger):
|
def cmc(bot, trigger):
|
||||||
|
# try:
|
||||||
|
# if trigger.group(2).lower() == 'trx':
|
||||||
|
# bot.say("Fuck off with your scams scammer")
|
||||||
|
# return
|
||||||
|
# except:
|
||||||
|
# pass
|
||||||
try:
|
try:
|
||||||
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500')
|
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=1500')
|
||||||
j = r.json()
|
j = r.json()
|
||||||
except:
|
except:
|
||||||
bot.say("Can't connect to API")
|
bot.say("Can't connect to API")
|
||||||
if not trigger.group(2):
|
if not trigger.group(2):
|
||||||
symbol = 'XMR'
|
c1 = 'XMR'
|
||||||
|
else:
|
||||||
|
if ' ' in trigger.group(2):
|
||||||
|
c1 = trigger.group(2).split(' ')[0].upper()
|
||||||
|
c2 = trigger.group(2).split(' ')[1].upper()
|
||||||
else:
|
else:
|
||||||
if trigger.group(2).isdigit():
|
if trigger.group(2).isdigit():
|
||||||
rank = trigger.group(2)
|
rank = trigger.group(2)
|
||||||
elif trigger.group(2) == 'random':
|
elif trigger.group(2) == 'random':
|
||||||
rank = random.randint(1,500)
|
rank = random.randint(1,1500)
|
||||||
else:
|
else:
|
||||||
symbol = trigger.group(2)
|
c1 = trigger.group(2).upper()
|
||||||
symbol = symbol.upper()
|
|
||||||
try:
|
try:
|
||||||
|
if not 'c2' in locals():
|
||||||
for i in j:
|
for i in j:
|
||||||
try:
|
try:
|
||||||
if i['symbol'] == symbol:
|
if i['symbol'] == c1:
|
||||||
coin = i
|
coin = i
|
||||||
except: pass
|
except: pass
|
||||||
try:
|
try:
|
||||||
|
@ -358,8 +457,94 @@ def cmc(bot, trigger):
|
||||||
total_supply = float(coin['total_supply'])
|
total_supply = float(coin['total_supply'])
|
||||||
percent_change_24h = float(coin['percent_change_24h'])
|
percent_change_24h = float(coin['percent_change_24h'])
|
||||||
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / ฿{4:.8f}. 24h volume ${5:,.0f} changed {6}%. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h, market_cap_usd, available_supply, total_supply))
|
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / ฿{4:.8f}. 24h volume ${5:,.0f} changed {6}%. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h, market_cap_usd, available_supply, total_supply))
|
||||||
|
else:
|
||||||
|
for i in j:
|
||||||
|
try:
|
||||||
|
if i['symbol'] == c1:
|
||||||
|
coin = i
|
||||||
|
if i['symbol'] == c2:
|
||||||
|
c2coin = i
|
||||||
|
except: pass
|
||||||
|
symbol = coin['symbol']
|
||||||
|
c2symbol = c2coin['symbol']
|
||||||
|
name = coin['name']
|
||||||
|
rank = coin['rank']
|
||||||
|
price_usd = float(coin['price_usd'])
|
||||||
|
price_btc = float(coin['price_btc'])
|
||||||
|
c2price_btc = float(c2coin['price_btc'])
|
||||||
|
volume_usd = float(coin['24h_volume_usd'])
|
||||||
|
market_cap_usd = float(coin['market_cap_usd'])
|
||||||
|
available_supply = float(coin['available_supply'])
|
||||||
|
total_supply = float(coin['total_supply'])
|
||||||
|
percent_change_24h = float(coin['percent_change_24h'])
|
||||||
|
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / {4:.8f} {1}/{5}. 24h volume ${6:,.0f}. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc/c2price_btc, c2symbol, volume_usd, market_cap_usd, available_supply, total_supply))
|
||||||
except:
|
except:
|
||||||
bot.say("Error parsing ticker")
|
bot.say("Error parsing ticker")
|
||||||
|
try:
|
||||||
|
if c1 == 'XMR':
|
||||||
|
with open('/root/.sopel/modules/ath.log', 'r') as f:
|
||||||
|
text = f.read()
|
||||||
|
btcath = float(text.split(' ')[0])
|
||||||
|
btcathdate = text.split(' ')[1]
|
||||||
|
usdath = float(text.split(' ')[2])
|
||||||
|
usdathdate = text.split(' ')[3]
|
||||||
|
update = False
|
||||||
|
if price_btc > btcath:
|
||||||
|
btcath = price_btc
|
||||||
|
update = True
|
||||||
|
btcathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d')
|
||||||
|
if price_usd > usdath:
|
||||||
|
usdath = price_usd
|
||||||
|
update = True
|
||||||
|
usdathdate = datetime.datetime.fromtimestamp(int(coin['last_updated'])).strftime('%Y-%m-%d')
|
||||||
|
if update == True:
|
||||||
|
with open('/root/.sopel/modules/ath.log', 'w') as f:
|
||||||
|
f.write("{} {} {} {}".format(btcath, btcathdate, usdath, usdathdate))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
@sopel.module.commands('top')
|
||||||
|
def top(bot, trigger):
|
||||||
|
topXstring = ""
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
r = requests.get('https://api.coinmarketcap.com/v1/global/')
|
||||||
|
j = r.json()
|
||||||
|
usd_total_mkt_cap = float(j['total_market_cap_usd'])
|
||||||
|
total_mcap_short = int(int(round(usd_total_mkt_cap,-9))/int(1e9))
|
||||||
|
rounded_total_mcap = str(total_mcap_short)+"B"
|
||||||
|
topXstring += "Total market cap $" + rounded_total_mcap + " | "
|
||||||
|
except:
|
||||||
|
bot.say("Can't connect to coinmarketcap API")
|
||||||
|
if not trigger.group(2):
|
||||||
|
limit = 20
|
||||||
|
else:
|
||||||
|
limit = int(trigger.group(2))
|
||||||
|
if limit > 20:
|
||||||
|
bot.say("Too high! Max is 20!")
|
||||||
|
elif limit < 1:
|
||||||
|
bot.say("Dude...")
|
||||||
|
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit={}'.format(limit))
|
||||||
|
j = r.json()
|
||||||
|
for i in j:
|
||||||
|
symbol = i['symbol']
|
||||||
|
name = i['name']
|
||||||
|
rank = i['rank']
|
||||||
|
price_usd = float(i['price_usd'])
|
||||||
|
price_btc = float(i['price_btc'])
|
||||||
|
market_cap_usd = float(i['market_cap_usd'])
|
||||||
|
if market_cap_usd >= 1e9:
|
||||||
|
if market_cap_usd >= 1e10:
|
||||||
|
market_cap_short = int(int(round(market_cap_usd,-9))/int(1e9))
|
||||||
|
else:
|
||||||
|
market_cap_short = float(round(market_cap_usd,-8)/1e9)
|
||||||
|
rounded_mcap = str(market_cap_short)+"B"
|
||||||
|
else:
|
||||||
|
rounded_mcap = "tiny"
|
||||||
|
topXstring += "{0}. {1} ${2} | ".format(rank, symbol, rounded_mcap) #TODO: add price_usd, rounded
|
||||||
|
bot.say(topXstring[:-2])
|
||||||
|
except:
|
||||||
|
bot.say("The use is 'top' and then a digit 1 - 20")
|
||||||
|
|
||||||
@sopel.module.commands('okc', 'okcoin')
|
@sopel.module.commands('okc', 'okcoin')
|
||||||
def okc(bot, trigger):
|
def okc(bot, trigger):
|
||||||
|
@ -422,28 +607,11 @@ def pepexmr(bot, trigger):
|
||||||
@sopel.module.commands('tall')
|
@sopel.module.commands('tall')
|
||||||
def tall(bot, trigger):
|
def tall(bot, trigger):
|
||||||
stringtosend = ''
|
stringtosend = ''
|
||||||
fixerurl = 'http://api.fixer.io/latest?base=USD'
|
|
||||||
stampurl = 'https://www.bitstamp.net/api/ticker/'
|
stampurl = 'https://www.bitstamp.net/api/ticker/'
|
||||||
btceurl = 'https://btc-e.com/api/3/ticker/btc_usd'
|
|
||||||
finexurl = 'https://api.bitfinex.com/v1/pubticker/BTCUSD'
|
finexurl = 'https://api.bitfinex.com/v1/pubticker/BTCUSD'
|
||||||
# btccurl = 'https://pro-data.btcc.com/data/pro/ticker?symbol=XBTCNY'
|
|
||||||
btccurl = 'https://data.btcchina.com/data/ticker?market=btccny'
|
btccurl = 'https://data.btcchina.com/data/ticker?market=btccny'
|
||||||
huobiurl = 'http://api.huobi.com/staticmarket/ticker_btc_json.js'
|
|
||||||
gemiurl = 'https://api.gemini.com/v1/pubticker/btcusd'
|
gemiurl = 'https://api.gemini.com/v1/pubticker/btcusd'
|
||||||
# gdaxurl = 'https://api.coinbase.com/v2/exchange-rates?currency=BTC'
|
|
||||||
gdaxurl = 'https://api.gdax.com/products/BTC-USD/ticker'
|
gdaxurl = 'https://api.gdax.com/products/BTC-USD/ticker'
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdcny = fixerjson['rates']['CNY']
|
|
||||||
usdeur = fixerjson['rates']['EUR']
|
|
||||||
usdjpy = fixerjson['rates']['JPY']
|
|
||||||
usdkrw = fixerjson['rates']['KRW']
|
|
||||||
except:
|
|
||||||
usdcny = 7
|
|
||||||
usdkrw = 1100
|
|
||||||
usdjpy = 112
|
|
||||||
# Bitstamp
|
# Bitstamp
|
||||||
try:
|
try:
|
||||||
stampresult = requests.get(stampurl)
|
stampresult = requests.get(stampurl)
|
||||||
|
@ -451,15 +619,7 @@ def tall(bot, trigger):
|
||||||
except:
|
except:
|
||||||
stampjson = False
|
stampjson = False
|
||||||
if stampjson:
|
if stampjson:
|
||||||
stringtosend += "Bitstamp last: {0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume']))
|
stringtosend += "Bitstamp last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume']))
|
||||||
# BTC-E
|
|
||||||
# try:
|
|
||||||
# btceresult = requests.get(btceurl)
|
|
||||||
# btcejson = btceresult.json()
|
|
||||||
# except:
|
|
||||||
# btcejson = False
|
|
||||||
# if btcejson:
|
|
||||||
# stringtosend += "BTC-E last: {0:,.2f}, vol: {1:,.1f} | ".format(float(btcejson['btc_usd']['last']), float(btcejson['btc_usd']['vol_cur']))
|
|
||||||
# Gemini
|
# Gemini
|
||||||
try:
|
try:
|
||||||
gemiresult = requests.get(gemiurl)
|
gemiresult = requests.get(gemiurl)
|
||||||
|
@ -468,25 +628,42 @@ def tall(bot, trigger):
|
||||||
gemijson = False
|
gemijson = False
|
||||||
if gemijson:
|
if gemijson:
|
||||||
try:
|
try:
|
||||||
stringtosend += "Gemini last: {0:,.2f}, vol: {1:,.1f} | ".format(float(gemijson['last']), float(gemijson['volume']['BTC']))
|
stringtosend += "Gemini last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(gemijson['last']), float(gemijson['volume']['BTC']))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
# Gdax
|
# Gdax
|
||||||
try:
|
try:
|
||||||
gdaxresult = requests.get(gdaxurl)
|
gdaxresult = requests.get(gdaxurl)
|
||||||
gdaxjson = gdaxresult.json()
|
gdaxjson = gdaxresult.json()
|
||||||
|
gdaxprice = float(gdaxjson['price'])
|
||||||
|
gdaxvolume = float(gdaxjson['volume'])
|
||||||
except:
|
except:
|
||||||
gdaxjson = False
|
gdaxjson = False
|
||||||
if gdaxjson:
|
if gdaxjson:
|
||||||
stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(float(gdaxjson['price']), float(gdaxjson['volume']))
|
stringtosend += "CBP last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume)
|
||||||
|
# Binance
|
||||||
|
try:
|
||||||
|
binanceresult = requests.get(binanceurl)
|
||||||
|
binancejson = binanceresult.json()
|
||||||
|
for i in binancejson:
|
||||||
|
if i["symbol"] == "BTCUSDT":
|
||||||
|
binanceprice = float(i['lastPrice'])
|
||||||
|
binancevolume = float(i['volume'])
|
||||||
|
except:
|
||||||
|
binancejson = False
|
||||||
|
if binancejson:
|
||||||
|
stringtosend += "Binance last: ${0:,.2f}, vol: {1:,.1f} | ".format(binanceprice, binancevolume)
|
||||||
# Bitfinex
|
# Bitfinex
|
||||||
try:
|
try:
|
||||||
finexresult = requests.get(finexurl)
|
finexresult = requests.get(finexurl)
|
||||||
finexjson = finexresult.json()
|
finexjson = finexresult.json()
|
||||||
except:
|
except:
|
||||||
finexjson = False
|
finexjson = False
|
||||||
|
try:
|
||||||
if finexjson:
|
if finexjson:
|
||||||
stringtosend += "Bitfinex last: {0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume']))
|
stringtosend += "Bitfinex last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(finexjson['last_price']), float(finexjson['volume']))
|
||||||
|
except:
|
||||||
|
stringtosend += "Finex sucks | "
|
||||||
# Bitthumb
|
# Bitthumb
|
||||||
try:
|
try:
|
||||||
thumbresult = requests.get(thumbbtcurl)
|
thumbresult = requests.get(thumbbtcurl)
|
||||||
|
@ -496,23 +673,7 @@ def tall(bot, trigger):
|
||||||
except:
|
except:
|
||||||
thumbjson = False
|
thumbjson = False
|
||||||
if thumbjson:
|
if thumbjson:
|
||||||
stringtosend += "Bithumb last: {0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price'])/float(usdkrw), float(thumbjson['data']['volume_1day']))
|
stringtosend += "Bithumb last: ₩{0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price']), float(thumbjson['data']['volume_1day']))
|
||||||
# BTCC
|
|
||||||
# try:
|
|
||||||
# btccresult = requests.get(btccurl)
|
|
||||||
# btccjson = btccresult.json()
|
|
||||||
# except:
|
|
||||||
# btccjson = False
|
|
||||||
# if btccjson:
|
|
||||||
# stringtosend += "BTCC last: {0:,.2f}, vol: {1:,.1f} | ".format(float(btccjson['ticker']['last'])/usdcny, float(btccjson['ticker']['vol']))
|
|
||||||
# Huobi
|
|
||||||
try:
|
|
||||||
huobiresult = requests.get(huobiurl)
|
|
||||||
huobijson = huobiresult.json()
|
|
||||||
except:
|
|
||||||
huobijson = False
|
|
||||||
if huobijson:
|
|
||||||
stringtosend += "Huobi last: {0:,.2f}, vol: {1:,.1f} | ".format(float(huobijson['ticker']['last'])/usdcny, float(huobijson['ticker']['vol']))
|
|
||||||
# Bitflyer
|
# Bitflyer
|
||||||
try:
|
try:
|
||||||
bitflyerresult = requests.get(bitflyerurl)
|
bitflyerresult = requests.get(bitflyerurl)
|
||||||
|
@ -520,12 +681,12 @@ def tall(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bitflyerjson = False
|
bitflyerjson = False
|
||||||
if bitflyerjson:
|
if bitflyerjson:
|
||||||
stringtosend += "Bitflyer last: {0:,.2f}, vol: {1:,.1f} | ".format(float(bitflyerjson['ltp'])/usdjpy, float(bitflyerjson['volume_by_product']))
|
stringtosend += "Bitflyer last: ¥{0:,.2f}, vol: {1:,.1f} | ".format(float(bitflyerjson['ltp']), float(bitflyerjson['volume_by_product']))
|
||||||
# Send the tickers to IRC
|
# Send the tickers to IRC
|
||||||
bot.say(stringtosend)
|
bot.say(stringtosend[:-2])
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.commands('xmrtall')
|
@sopel.module.commands('xmrtall', 'xmr')
|
||||||
def xmrtall(bot, trigger):
|
def xmrtall(bot, trigger):
|
||||||
stringtosend = ''
|
stringtosend = ''
|
||||||
|
|
||||||
|
@ -558,27 +719,6 @@ def xmrtall(bot, trigger):
|
||||||
last=float(xmr['last'])
|
last=float(xmr['last'])
|
||||||
# change=float(xmr['percentChange'])
|
# change=float(xmr['percentChange'])
|
||||||
vol=float(xmr['baseVolume'])
|
vol=float(xmr['baseVolume'])
|
||||||
# '''remove?
|
|
||||||
# if change >= 0:
|
|
||||||
# sign = '+'
|
|
||||||
# else:
|
|
||||||
# sign = ''
|
|
||||||
# face = ''
|
|
||||||
# if change > 0.10:
|
|
||||||
# face = u'\u263d'.encode('utf8')
|
|
||||||
# if 0.10 >= change > 0.05:
|
|
||||||
# face = u'\u2661'.encode('utf8')
|
|
||||||
# if 0.05 >= change > 0.02:
|
|
||||||
# face = u'\u263a'.encode('utf8')
|
|
||||||
# if 0.02 >= change > -0.02:
|
|
||||||
# face = u'\u2694'.encode('utf8')
|
|
||||||
# if -0.02 >= change > -0.05:
|
|
||||||
# face = u'\u2639'.encode('utf8')
|
|
||||||
# if -0.05 >= change > -0.1:
|
|
||||||
# face = u'\u2620'.encode('utf8')
|
|
||||||
# if change < -0.1:
|
|
||||||
# face = u'\u262d'.encode('utf8')
|
|
||||||
# '''
|
|
||||||
stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol)
|
stringtosend += "Poloniex last: {0:.6f} BTC on {1:.2f} BTC volume | ".format(last, vol)
|
||||||
except:
|
except:
|
||||||
bot.say("Something borked ¯\(º_o)/¯")
|
bot.say("Something borked ¯\(º_o)/¯")
|
||||||
|
@ -599,6 +739,20 @@ def xmrtall(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Something borked ¤\( `⌂´ )/¤")
|
bot.say("Something borked ¤\( `⌂´ )/¤")
|
||||||
|
|
||||||
|
# Binance
|
||||||
|
try:
|
||||||
|
r = requests.get(binanceurl)
|
||||||
|
j = r.json()
|
||||||
|
found = False
|
||||||
|
for i in j:
|
||||||
|
if i["symbol"] == "XMRBTC":
|
||||||
|
last=float(i['lastPrice'])
|
||||||
|
vol=float(i['volume'])
|
||||||
|
stringtosend += ("Binance last: {0:.6f} on {1:.2f} BTC volume | ".format(last, vol*last))
|
||||||
|
found = True
|
||||||
|
except:
|
||||||
|
bot.say("Borka borka ┌∩┐(◣_◢)┌∩┐")
|
||||||
|
|
||||||
# Trex
|
# Trex
|
||||||
geturl = trexurl+'xmr'
|
geturl = trexurl+'xmr'
|
||||||
try:
|
try:
|
||||||
|
@ -622,7 +776,7 @@ def xmrtall(bot, trigger):
|
||||||
for i in j["Data"]:
|
for i in j["Data"]:
|
||||||
if i["Label"] == coin+"/"+pair:
|
if i["Label"] == coin+"/"+pair:
|
||||||
last=float(i['LastPrice'])
|
last=float(i['LastPrice'])
|
||||||
# change=float(i['Change'])
|
change=float(i['Change'])
|
||||||
vol=float(i['Volume'])
|
vol=float(i['Volume'])
|
||||||
stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last)
|
stringtosend += "Cryptopia last: {0:.6f} {1} on {2:.2f} {1} volume | ".format(last, pair, vol*last)
|
||||||
found = True
|
found = True
|
||||||
|
@ -632,22 +786,22 @@ def xmrtall(bot, trigger):
|
||||||
bot.say("Something borked ( -.-)ノ-=≡≡卍")
|
bot.say("Something borked ( -.-)ノ-=≡≡卍")
|
||||||
|
|
||||||
# Tux
|
# Tux
|
||||||
try:
|
# try:
|
||||||
r = requests.get('https://tuxexchange.com/api?method=getticker')
|
# r = requests.get('https://tuxexchange.com/api?method=getticker')
|
||||||
j = r.json()
|
# j = r.json()
|
||||||
if not trigger.group(2):
|
# if not trigger.group(2):
|
||||||
ticker='XMR'
|
# ticker='XMR'
|
||||||
else:
|
# else:
|
||||||
ticker=trigger.group(2).upper()
|
# ticker=trigger.group(2).upper()
|
||||||
coin=j['BTC_{}'.format(ticker)]
|
# coin=j['BTC_{}'.format(ticker)]
|
||||||
last=float(coin['last'])
|
# last=float(coin['last'])
|
||||||
vol=float(coin['baseVolume'])
|
# vol=float(coin['baseVolume'])
|
||||||
# change=float(coin['percentChange'])
|
# change=float(coin['percentChange'])
|
||||||
stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume.".format(last, vol)
|
# stringtosend += "Tux last: {0:.6f} BTC on {1:.2f} BTC volume. ".format(last, vol)
|
||||||
except:
|
# except:
|
||||||
bot.say("Something borked ( ︶︿︶)_╭∩╮")
|
# bot.say("Something borked ( ︶︿︶)_╭∩╮")
|
||||||
#Finally... print to IRC
|
#Finally... print to IRC
|
||||||
bot.say(stringtosend)
|
bot.say(stringtosend[:-2])
|
||||||
|
|
||||||
|
|
||||||
@sopel.module.commands('usd')
|
@sopel.module.commands('usd')
|
||||||
|
@ -660,253 +814,73 @@ def usd(bot, trigger):
|
||||||
except:
|
except:
|
||||||
bot.say("Failed to retrieve price.")
|
bot.say("Failed to retrieve price.")
|
||||||
|
|
||||||
@sopel.module.commands('aud')
|
|
||||||
def aud(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdaud = fixerjson['rates']['AUD']
|
|
||||||
except:
|
|
||||||
usdaud = 1.35
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdaud
|
|
||||||
bot.say("Monero price in AUD = ${0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('cny')
|
|
||||||
def cny(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdcny = fixerjson['rates']['CNY']
|
|
||||||
except:
|
|
||||||
usdjpy = 6.8
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdcny
|
|
||||||
bot.say("Monero price in CNY = ¥{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('jpy')
|
|
||||||
def jpy(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdjpy = fixerjson['rates']['JPY']
|
|
||||||
except:
|
|
||||||
usdjpy = 110
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdjpy
|
|
||||||
bot.say("Monero price in JPY = ¥{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('eur')
|
|
||||||
def eur(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdeur = fixerjson['rates']['EUR']
|
|
||||||
except:
|
|
||||||
usdeur = 0.95
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdeur
|
|
||||||
bot.say("Monero price in EUR = €{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('cad')
|
|
||||||
def cad(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdcad = fixerjson['rates']['CAD']
|
|
||||||
except:
|
|
||||||
usdcad = 1.35
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdcad
|
|
||||||
bot.say("Monero price in CAD = ${0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('gbp')
|
|
||||||
def gbp(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdgbp = fixerjson['rates']['GBP']
|
|
||||||
except:
|
|
||||||
usdgbp = 0.81
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdgbp
|
|
||||||
bot.say("Monero price in GBP = £{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('inr')
|
|
||||||
def inr(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdthb = fixerjson['rates']['INR']
|
|
||||||
except:
|
|
||||||
usdthb = 64
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdthb
|
|
||||||
bot.say("Monero price in INR = ₹{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('thb')
|
|
||||||
def thb(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdthb = fixerjson['rates']['THB']
|
|
||||||
except:
|
|
||||||
usdthb = 1.35
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdthb
|
|
||||||
bot.say("Monero price in THB = ฿{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('zar')
|
|
||||||
def zar(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdzar = fixerjson['rates']['ZAR']
|
|
||||||
except:
|
|
||||||
usdzar = 13.05
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdzar
|
|
||||||
bot.say("Monero price in ZAR = R{0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('nzd')
|
|
||||||
def nzd(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
fixerresult = requests.get(fixerurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdnzd = fixerjson['rates']['NZD']
|
|
||||||
except:
|
|
||||||
usdnzd = 1.405
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdnzd
|
|
||||||
bot.say("Monero price in NZD = ${0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('ntd')
|
|
||||||
def ntd(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
ntdurl = r'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("USDTWD")&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='
|
|
||||||
fixerresult = requests.get(ntdurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdntd = float(fixerjson['query']['results']['rate']['Rate'])
|
|
||||||
except:
|
|
||||||
bot.say("Failed to get NTD value")
|
|
||||||
usdntd = 32
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdntd
|
|
||||||
bot.say("Monero price in NTD = ${0:,.2f}".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('ugx')
|
|
||||||
def ugx(bot, trigger):
|
|
||||||
# Get conversion rate
|
|
||||||
try:
|
|
||||||
ugxurl = r'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("USDUGX")&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback='
|
|
||||||
fixerresult = requests.get(ntdurl)
|
|
||||||
fixerjson = fixerresult.json()
|
|
||||||
usdugx = florat(fixerjson['query']['results']['rate']['Rate'])
|
|
||||||
except:
|
|
||||||
usdugx = 3200
|
|
||||||
try:
|
|
||||||
r=requests.get('https://api.coinmarketcap.com/v1/ticker/monero/')
|
|
||||||
j=r.json()
|
|
||||||
price=float(j[0]['price_usd'])*usdugx
|
|
||||||
bot.say("Monero price in UGX = {0:,.2f} shillings".format(price))
|
|
||||||
except:
|
|
||||||
bot.say("Failed to retrieve price.")
|
|
||||||
|
|
||||||
@sopel.module.commands('log')
|
|
||||||
def log(bot, trigger):
|
|
||||||
volurl='https://c-cex.com/t/volume_btc.json'
|
|
||||||
try:
|
|
||||||
r=requests.get(volurl)
|
|
||||||
j=r.json()
|
|
||||||
last=float(j['ticker']['log']['last'])
|
|
||||||
vol=float(j['ticker']['log']['vol'])
|
|
||||||
bot.say("Last price on c-cex for LOG at {0:.8f} BTC on {1:.3f} BTC volume.".format(last, vol))
|
|
||||||
except:
|
|
||||||
bot.say("C-cex sucks")
|
|
||||||
|
|
||||||
@sopel.module.commands('price')
|
@sopel.module.commands('price')
|
||||||
def price(bot, trigger):
|
def price(bot, trigger):
|
||||||
try:
|
try:
|
||||||
bot.say("1 XMR = $1,000 USD (Offer valid in participating locations)")
|
bot.say("1 XMR = $12,345 USD (Offer valid in participating locations)")
|
||||||
except:
|
except:
|
||||||
bot.say("C-cex sucks")
|
bot.say("C-cex sucks")
|
||||||
|
|
||||||
@sopel.module.commands('commodity', 'com')
|
@sopel.module.commands('comm')
|
||||||
def commodity(bot, trigger):
|
def comm(bot, trigger):
|
||||||
commodity_key = 'B1ZnykTmG6_A1vkwzt9u'
|
commurl = 'https://api.commoprices.com/v1/wrb/'
|
||||||
input_com = trigger.group(2).upper()
|
apitoken = '?api_token=9gdRSeoek4N0AnZHUvP0TSIR74jmyQpsjz5HuGRjfDmsCDxppYiG76GuxaF1'
|
||||||
if input_com == ('AU' or 'GOLD' or 'XAU'):
|
|
||||||
commodity = 'AU_EIB'
|
|
||||||
unit = 'oz'
|
|
||||||
elif input_com == ('AG' or 'SILVER' or 'XAG'):
|
|
||||||
commodity = 'AG_USD'
|
|
||||||
unit = 'oz'
|
|
||||||
elif input_com == ('PT' or 'PLATINUM' or 'XPT'):
|
|
||||||
commodity = 'WLD_PLATINUM'
|
|
||||||
unit = 'oz'
|
|
||||||
elif input_com == ('COFFEE'):
|
|
||||||
commodity = 'COFFEE_BRZL'
|
|
||||||
unit = 'lb'
|
|
||||||
try:
|
try:
|
||||||
r=requests.get("https://www.quandl.com/api/v3/datasets/COM/{0}.json?&api_key={1}".format(commodity, commodity_key))
|
r = requests.get(commurl+apitoken)
|
||||||
j=r.json()
|
data = r.json()['data']
|
||||||
last=j['dataset']['data'][0][1]
|
for i in data:
|
||||||
bot.say("Last price on {0} was ${1:.3f} per {2}.".format(commodity, last, unit))
|
if trigger.group(2).lower() in i['name'].lower():
|
||||||
|
print(i)
|
||||||
|
code = i['code']
|
||||||
except:
|
except:
|
||||||
bot.say("Monerobux fails again...")
|
bot.say("Error getting data or commodity not priced")
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
r2 = requests.get(commurl+code+'/data/'+apitoken)
|
||||||
|
j = r2.json()
|
||||||
|
bot.say("{0} last price at {1:.2f} {2} on {3}".format(j['data']['info']['name'], j['data']['request']['dataseries'][-1][1], j['data']['info']['original_price_unit']['name'], j['data']['request']['dataseries'][-1][0]))
|
||||||
|
except:
|
||||||
|
bot.say("Error parsing some shit")
|
||||||
|
|
||||||
|
@sopel.module.commands('xmy')
|
||||||
|
def xmy(bot, trigger):
|
||||||
|
try:
|
||||||
|
r = requests.get('https://api.coinmarketcap.com/v1/ticker?limit=500')
|
||||||
|
j = r.json()
|
||||||
|
except:
|
||||||
|
bot.say("Can't connect to API")
|
||||||
|
symbol = 'XMY'
|
||||||
|
try:
|
||||||
|
for i in j:
|
||||||
|
try:
|
||||||
|
if i['symbol'] == symbol:
|
||||||
|
coin = i
|
||||||
|
except: pass
|
||||||
|
try:
|
||||||
|
if i['rank'] == str(rank):
|
||||||
|
coin = i
|
||||||
|
except: pass
|
||||||
|
symbol = coin['symbol']
|
||||||
|
name = coin['name']
|
||||||
|
rank = coin['rank']
|
||||||
|
price_usd = float(coin['price_usd'])
|
||||||
|
price_btc = float(coin['price_btc'])
|
||||||
|
volume_usd = float(coin['24h_volume_usd'])
|
||||||
|
market_cap_usd = float(coin['market_cap_usd'])
|
||||||
|
available_supply = float(coin['available_supply'])
|
||||||
|
total_supply = float(coin['total_supply'])
|
||||||
|
percent_change_24h = float(coin['percent_change_24h'])
|
||||||
|
bot.say("{0} ({1}) is #{2}. Last price ${3:.2f} / ฿{4:.8f}. 24h volume ${5:,.0f} changed {6}%. Market cap ${7:,.0f}. Available / total coin supply {8:,.0f} / {9:,.0f}.".format(name, symbol, rank, price_usd, price_btc, volume_usd, percent_change_24h, market_cap_usd, available_supply, total_supply))
|
||||||
|
except:
|
||||||
|
bot.say("Error parsing ticker")
|
||||||
|
|
||||||
|
@sopel.module.commands('localmonero', 'localxmr', 'lxmr', 'lm', 'street')
|
||||||
|
def localmonero(bot, trigger):
|
||||||
|
try:
|
||||||
|
r = requests.get(localmonerousd)
|
||||||
|
j = r.json()
|
||||||
|
stringtosay = "LocalMonero XMR/USD 12h-avg: ${0:.2f}, 24h-avg: ${0:.2f}.".format(float(j['USD']['avg_12h']), float(j['USD']['avg_24h']))
|
||||||
|
bot.say(stringtosay)
|
||||||
|
except:
|
||||||
|
bot.say("Error getting data")
|
||||||
|
|
2
test.py
2
test.py
|
@ -1,7 +1,7 @@
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
url = 'https://api.coinmarketcap.com/v1/ticker/?bcc'
|
url = 'https://api.coinmarketcap.com/v1/ticker/?bch'
|
||||||
|
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
j = r.json()
|
j = r.json()
|
||||||
|
|
183
trifling.py
183
trifling.py
|
@ -11,6 +11,16 @@ from threading import Timer
|
||||||
def fourmatter(bot, trigger):
|
def fourmatter(bot, trigger):
|
||||||
bot.say('Irish I be fookin <3 Milo')
|
bot.say('Irish I be fookin <3 Milo')
|
||||||
|
|
||||||
|
# @sopel.module.commands('allah')
|
||||||
|
# def allah(bot, trigger):
|
||||||
|
# bot.say('allah is doing')
|
||||||
|
# bot.say('sun is not doing allah is doing')
|
||||||
|
# bot.say('to accept Islam say that i bear witness that there is no deity worthy of worship except Allah and Muhammad peace be upon him is his slave and messenger')
|
||||||
|
|
||||||
|
@sopel.module.commands('ada', 'hoskinson')
|
||||||
|
def ada(bot, trigger):
|
||||||
|
bot.say('DO YOU KNOW WHO I AM?')
|
||||||
|
|
||||||
@sopel.module.commands('aminorex')
|
@sopel.module.commands('aminorex')
|
||||||
def aminorex(bot, trigger):
|
def aminorex(bot, trigger):
|
||||||
bot.say('if i could replace my wife with a robot... i might seriously think about it')
|
bot.say('if i could replace my wife with a robot... i might seriously think about it')
|
||||||
|
@ -43,6 +53,10 @@ def bear(bot, trigger):
|
||||||
def brothers(bot, trigger):
|
def brothers(bot, trigger):
|
||||||
bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html'.encode('utf8'))
|
bot.say(u'http://www.trollaxor.com/2011/11/brief-history-of-ascii-penis.html'.encode('utf8'))
|
||||||
|
|
||||||
|
@sopel.module.commands('bp', 'bps', 'bulletproof', 'bulletproofs')
|
||||||
|
def bulletproofs(bot, trigger):
|
||||||
|
bot.say(u'https://www.youtube.com/watch?v=Kk8eJh4i8Lo'.encode('utf8'))
|
||||||
|
|
||||||
@sopel.module.commands('buyorsell')
|
@sopel.module.commands('buyorsell')
|
||||||
def buyorsell(bot, trigger):
|
def buyorsell(bot, trigger):
|
||||||
draw = random.random()
|
draw = random.random()
|
||||||
|
@ -87,6 +101,10 @@ def dash(bot, trigger):
|
||||||
def dealwithit(bot, trigger):
|
def dealwithit(bot, trigger):
|
||||||
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8'))
|
bot.say(u'(•_•) ( •_•)>⌐■-■ (⌐■_■)'.encode('utf8'))
|
||||||
|
|
||||||
|
@sopel.module.commands('Deathtobitcoin', 'Deathtobitcoin2')
|
||||||
|
def deathtobitcoin2(bot, trigger):
|
||||||
|
bot.say('Devs, moderators, whoever you fucking are, please put my money back with interest. Or make my money appear in my wallet with interest!')
|
||||||
|
|
||||||
@sopel.module.commands('diiorio')
|
@sopel.module.commands('diiorio')
|
||||||
def diiorio(bot, trigger):
|
def diiorio(bot, trigger):
|
||||||
bot.say(u'http://www.contravex.com/2016/06/29/from-the-scammer-files-anthony-di-iorio/'.encode('utf8'))
|
bot.say(u'http://www.contravex.com/2016/06/29/from-the-scammer-files-anthony-di-iorio/'.encode('utf8'))
|
||||||
|
@ -104,8 +122,8 @@ def ded(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('donate', 'donation')
|
@sopel.module.commands('donate', 'donation')
|
||||||
def donate(bot, trigger):
|
def donate(bot, trigger):
|
||||||
bot.say('XMR: 45SkxgDmcLmW5ByS7w9AG78JuJRvCoVKCdGJWnd4US95CBUAtvdGAdM2oHgZgTGjkEAUcwdqcryM819aqdeiKxHSQC8HkmS', trigger.nick)
|
bot.say('XMR: 41kroikMqj9YdcXMDt7HH7LFkhBPURMXXKtwAVu8bNA8ci9BF15tYAoQsHHotUPQuAUd9ene3sUXuJHePnZq6kcBUoQk5n8', trigger.nick)
|
||||||
bot.say('BTC: 14X8aMUtuxH2HWLtsNAxxN7j9uqQNUdMzB', trigger.nick)
|
bot.say('BTC: 1PFjRGE61szAZqM89f73CpZT54xH98tHkC', trigger.nick)
|
||||||
|
|
||||||
@sopel.module.commands('dump')
|
@sopel.module.commands('dump')
|
||||||
def dump(bot, trigger):
|
def dump(bot, trigger):
|
||||||
|
@ -182,7 +200,10 @@ def hero(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('hotline')
|
@sopel.module.commands('hotline')
|
||||||
def hotline(bot, trigger):
|
def hotline(bot, trigger):
|
||||||
|
if random.random() > 0.3:
|
||||||
bot.say(u'☎ Call 1-800-273-8255 to reach the National Suicide Prevention Lifeline ☎' .encode('utf8'))
|
bot.say(u'☎ Call 1-800-273-8255 to reach the National Suicide Prevention Lifeline ☎' .encode('utf8'))
|
||||||
|
else:
|
||||||
|
bot.say('http://pixel.nymag.com/imgs/daily/vulture/2015/10/20/drake-dance/drake-4.w529.h352.gif')
|
||||||
|
|
||||||
@sopel.module.commands('news')
|
@sopel.module.commands('news')
|
||||||
def news(bot, trigger):
|
def news(bot, trigger):
|
||||||
|
@ -216,7 +237,7 @@ def jaxx(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('john_alan')
|
@sopel.module.commands('john_alan')
|
||||||
def joshua(bot, trigger):
|
def joshua(bot, trigger):
|
||||||
bot.say(u'I like smooth.')
|
bot.say(u'Ps the coverage blackspot I reported 37 times in 2016/2017 is STILL DOWN. If I were running Virigin Mobile I’d be so ashamed of myself.')
|
||||||
|
|
||||||
@sopel.module.commands('jwinterm')
|
@sopel.module.commands('jwinterm')
|
||||||
def jwinterm(bot, trigger):
|
def jwinterm(bot, trigger):
|
||||||
|
@ -242,6 +263,10 @@ def lambo(bot, trigger):
|
||||||
def lenny(bot, trigger):
|
def lenny(bot, trigger):
|
||||||
bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8'))
|
bot.say(u'( ͡° ͜ʖ ͡°)'.encode('utf8'))
|
||||||
|
|
||||||
|
@sopel.module.commands('lietome')
|
||||||
|
def lietome(bot, trigger):
|
||||||
|
bot.say(u'https://www.youtube.com/watch?v=R5AsQbLHWbw'.encode('utf8'))
|
||||||
|
|
||||||
@sopel.module.commands('livermore')
|
@sopel.module.commands('livermore')
|
||||||
def livermore(bot, trigger):
|
def livermore(bot, trigger):
|
||||||
bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator'.encode('utf8'))
|
bot.say(u'https://en.wikipedia.org/wiki/Reminiscences_of_a_Stock_Operator'.encode('utf8'))
|
||||||
|
@ -262,6 +287,10 @@ def major(bot, trigger):
|
||||||
def masternode(bot, trigger):
|
def masternode(bot, trigger):
|
||||||
bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg')
|
bot.say('http://hadoopilluminated.com/hadoop_illuminated/images/hdfs3.jpg')
|
||||||
|
|
||||||
|
@sopel.module.commands('monerov', 'v')
|
||||||
|
def monerov(bot, trigger):
|
||||||
|
bot.say(u"🔒🔒🔒 MoneroV is more secured than others. That's why it is better invest on moneroV. 💰💰💰".encode('utf8'))
|
||||||
|
|
||||||
@sopel.module.commands('moon')
|
@sopel.module.commands('moon')
|
||||||
def moon(bot, trigger):
|
def moon(bot, trigger):
|
||||||
bot.say(u'┗(°0°)┛'.encode('utf8'))
|
bot.say(u'┗(°0°)┛'.encode('utf8'))
|
||||||
|
@ -280,7 +309,7 @@ def needmoney(bot, trigger):
|
||||||
|
|
||||||
@sopel.module.commands('nioc')
|
@sopel.module.commands('nioc')
|
||||||
def nioc(bot, trigger):
|
def nioc(bot, trigger):
|
||||||
bot.say(u'If I had a monero for every time I went to the salt mines...I would have a lot of moneros'.encode('utf8'))
|
bot.say(u'https://ifunny.co/fun/laeIohx56'.encode('utf8'))
|
||||||
|
|
||||||
@sopel.module.commands('nomnomnom')
|
@sopel.module.commands('nomnomnom')
|
||||||
def nomnomnom(bot, trigger):
|
def nomnomnom(bot, trigger):
|
||||||
|
@ -290,6 +319,10 @@ def nomnomnom(bot, trigger):
|
||||||
def noom(bot, trigger):
|
def noom(bot, trigger):
|
||||||
bot.say(u'┏(.0.)┓'.encode('utf8'))
|
bot.say(u'┏(.0.)┓'.encode('utf8'))
|
||||||
|
|
||||||
|
@sopel.module.commands('notbad', 'dorian')
|
||||||
|
def notbad(bot, trigger):
|
||||||
|
bot.say(u'(´ー`) http://hackingdistributed.com/images/2014-01-01-bitcoin/dorian1.jpg (´ー`)'.encode('utf8'))
|
||||||
|
|
||||||
odboptions = [
|
odboptions = [
|
||||||
"FBI don't you be watching me",
|
"FBI don't you be watching me",
|
||||||
"Ooo baby I like it raw",
|
"Ooo baby I like it raw",
|
||||||
|
@ -328,6 +361,10 @@ def pony(bot, trigger):
|
||||||
def primer(bot, trigger):
|
def primer(bot, trigger):
|
||||||
bot.say("The point is not how much i made, point is fluffy did this on purpose, more than 10 people were in on it. His commit access needs to be revoked asap!")
|
bot.say("The point is not how much i made, point is fluffy did this on purpose, more than 10 people were in on it. His commit access needs to be revoked asap!")
|
||||||
|
|
||||||
|
@sopel.module.commands('praise')
|
||||||
|
def praise(bot, trigger):
|
||||||
|
bot.say("https://praisemonero.com")
|
||||||
|
|
||||||
@sopel.module.commands('pubg')
|
@sopel.module.commands('pubg')
|
||||||
def pubg(bot, trigger):
|
def pubg(bot, trigger):
|
||||||
bot.say("https://i.redd.it/o6o5gqmetacz.jpg")
|
bot.say("https://i.redd.it/o6o5gqmetacz.jpg")
|
||||||
|
@ -518,6 +555,10 @@ def vitalik(bot, trigger):
|
||||||
def wat(bot, trigger):
|
def wat(bot, trigger):
|
||||||
bot.say("https://www.destroyallsoftware.com/talks/wat")
|
bot.say("https://www.destroyallsoftware.com/talks/wat")
|
||||||
|
|
||||||
|
@sopel.module.commands('wow')
|
||||||
|
def wow(bot, trigger):
|
||||||
|
bot.say("Let he who is without win cast the first 💎: http://wownero.org")
|
||||||
|
|
||||||
@sopel.module.commands('yoda')
|
@sopel.module.commands('yoda')
|
||||||
def yoda(bot, trigger):
|
def yoda(bot, trigger):
|
||||||
bot.say("The optimism is strong in this one")
|
bot.say("The optimism is strong in this one")
|
||||||
|
@ -550,134 +591,6 @@ def wave(bot, trigger):
|
||||||
def scamdouble(bot, trigger):
|
def scamdouble(bot, trigger):
|
||||||
bot.say("{} is a scammer and bitcoin is a scam".format(trigger.nick))
|
bot.say("{} is a scammer and bitcoin is a scam".format(trigger.nick))
|
||||||
|
|
||||||
@sopel.module.commands('asp')
|
|
||||||
def asp(bot, trigger):
|
|
||||||
polourl = "https://poloniex.com/public?command=returnTicker"
|
|
||||||
stampurl = 'https://www.bitstamp.net/api/ticker/'
|
|
||||||
cmcurl = "https://api.coinmarketcap.com/v1/ticker/monero/"
|
|
||||||
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-ans"
|
|
||||||
|
|
||||||
try:
|
|
||||||
r=requests.get(cmcurl)
|
|
||||||
j=r.json()
|
|
||||||
xmrbtc_price=float(j[0]['price_btc'])
|
|
||||||
except:
|
|
||||||
bot.say("Error connecting to CoinMarketCap")
|
|
||||||
try:
|
|
||||||
r = requests.get(trexurl)
|
|
||||||
j = r.json()
|
|
||||||
ans=j['result'][0]
|
|
||||||
last=float(ans['Last'])
|
|
||||||
value_ans = float(last*231.6)
|
|
||||||
except:
|
|
||||||
print ("Error retrieving data from Bittrex")
|
|
||||||
try:
|
|
||||||
r=requests.get(polourl)
|
|
||||||
j=r.json()
|
|
||||||
except:
|
|
||||||
bot.say("Error connecting to Poloniex")
|
|
||||||
|
|
||||||
label_dash="BTC_DASH"
|
|
||||||
label_decred="BTC_DCR"
|
|
||||||
label_factom="BTC_FCT"
|
|
||||||
label_golem="BTC_GNT"
|
|
||||||
label_maidsafecoin="BTC_MAID"
|
|
||||||
label_augur="BTC_REP"
|
|
||||||
label_stellar="BTC_STR"
|
|
||||||
label_nem="BTC_XEM"
|
|
||||||
label_ripple="BTC_XRP"
|
|
||||||
label_zcash="BTC_ZEC"
|
|
||||||
label_nxt="BTC_NXT"
|
|
||||||
label_sia="BTC_SC"
|
|
||||||
label_dgb="BTC_DGB"
|
|
||||||
label_sys="BTC_SYS"
|
|
||||||
|
|
||||||
# Bitstamp
|
|
||||||
try:
|
|
||||||
stampresult = requests.get(stampurl)
|
|
||||||
stampjson = stampresult.json()
|
|
||||||
except:
|
|
||||||
stampjson = False
|
|
||||||
if stampjson:
|
|
||||||
stamp_price = float(stampjson['last'])
|
|
||||||
# Poloniex
|
|
||||||
try:
|
|
||||||
ticker_dash=j[label_dash]
|
|
||||||
ticker_decred=j[label_decred]
|
|
||||||
ticker_factom=j[label_factom]
|
|
||||||
ticker_golem=j[label_golem]
|
|
||||||
ticker_maidsafecoin=j[label_maidsafecoin]
|
|
||||||
ticker_augur=j[label_augur]
|
|
||||||
ticker_stellar=j[label_stellar]
|
|
||||||
ticker_nem=j[label_nem]
|
|
||||||
ticker_ripple=j[label_ripple]
|
|
||||||
ticker_zcash=j[label_zcash]
|
|
||||||
ticker_nxt=j[label_nxt]
|
|
||||||
ticker_sia=j[label_sia]
|
|
||||||
ticker_dgb=j[label_dgb]
|
|
||||||
ticker_sys=j[label_sys]
|
|
||||||
last_dash=float(ticker_dash['last'])
|
|
||||||
last_decred=float(ticker_decred['last'])
|
|
||||||
last_factom=float(ticker_factom['last'])
|
|
||||||
last_golem=float(ticker_golem['last'])
|
|
||||||
last_maidsafecoin=float(ticker_maidsafecoin['last'])
|
|
||||||
last_augur=float(ticker_augur['last'])
|
|
||||||
last_stellar=float(ticker_stellar['last'])
|
|
||||||
last_nem=float(ticker_nem['last'])
|
|
||||||
last_ripple=float(ticker_ripple['last'])
|
|
||||||
last_zcash=float(ticker_zcash['last'])
|
|
||||||
last_nxt=float(ticker_nxt['last'])
|
|
||||||
last_sia=float(ticker_sia['last'])
|
|
||||||
last_dgb=float(ticker_dgb['last'])
|
|
||||||
last_sys=float(ticker_sys['last'])
|
|
||||||
value_dash = float(last_dash*18.84760476)
|
|
||||||
value_decred = float(last_decred*93.74095377)
|
|
||||||
value_factom = float(last_factom*207.78912373)
|
|
||||||
value_golem = float(last_golem*7374.44608569)
|
|
||||||
value_maidsafecoin = float(last_maidsafecoin*5973.05389222)
|
|
||||||
value_augur = float(last_augur*94.01892768)
|
|
||||||
value_stellar = float(last_stellar*318974.81202454)
|
|
||||||
value_stellar_h = float(8.34800202)
|
|
||||||
value_nem = float(last_nem*29892.11866946)
|
|
||||||
value_ripple = float(last_ripple*27962.37965895)
|
|
||||||
value_ripple_h = float(3.17485452)
|
|
||||||
value_zcash = float(last_zcash*16.47649534)
|
|
||||||
value_nxt = float(last_nxt*14932.63473053)
|
|
||||||
value_sia = float(last_sia*129377.43190662)
|
|
||||||
value_dgb = float(last_dgb*84177.21518989)
|
|
||||||
value_sys = float(last_sys*10523.26194748)
|
|
||||||
|
|
||||||
total = value_dash + value_decred + value_factom + value_golem + value_maidsafecoin + value_augur + value_stellar + value_nem + value_ripple + value_zcash
|
|
||||||
total_h = value_dash + value_decred + value_factom + value_golem + value_maidsafecoin + value_augur + value_stellar_h + value_nem + value_ripple_h + value_zcash
|
|
||||||
total_june = value_nxt + value_sia + value_dgb + value_sys + value_ans
|
|
||||||
xmr_totalvalue = float(total / xmrbtc_price)
|
|
||||||
asppercent = ((((stamp_price * total) / 14950)-1)*100) + ((((stamp_price * total_june) / 13240)-1)*100)
|
|
||||||
if asppercent >= 0:
|
|
||||||
aspsign = '+'
|
|
||||||
else:
|
|
||||||
aspsign = '-'
|
|
||||||
xmrpercent = ((((650*(xmrbtc_price*stamp_price)/14950)-1)*100)) + (((250*(xmrbtc_price*stamp_price)/13240)-1)*100)
|
|
||||||
if xmrpercent >= 0:
|
|
||||||
xmrsign = '+'
|
|
||||||
else:
|
|
||||||
xmrsign = '-'
|
|
||||||
asppercent_h = ((((stamp_price * total_h) / 14950)-1)*100) + ((((stamp_price * total_june) / 13240)-1)*100)
|
|
||||||
if asppercent_h >= 0:
|
|
||||||
aspsign_h = '+'
|
|
||||||
else:
|
|
||||||
aspsign_h = '-'
|
|
||||||
bot.say("{0} {1:.2f}BTC; {2} {3:.2f}BTC; {4} {5:.2f}BTC; {6} {7:.2f}BTC; {8} {9:.2f}BTC; {10} {11:.2f}BTC; {12} {13:.2f}[{14:.2f}]BTC; {15} {16:.2f}BTC; {17} {18:.2f}[{19:.2f}]BTC; {20} {21:.2f}BTC; {22} {23:.2f}BTC; {24} {25:.2f}BTC; {26} {27:.2f}BTC; {28} {29:.2f}BTC; {30} {31:.2f}BTC; ASP Total:{32:.2f}[{33:.2f}]BTC/{34:,.0f}USD/{35:,.1f}XMR (02-May+20-Jun outlay, 10BTC+5BTC/14,950USD+13,240USD/650XMR+250XMR) (Since begin ASP:{36}{37:.2f}[{38}{39:.2f}]% XMR:{40}{41:.2f}%, Harvested 11.52BTC)".format("DASH", value_dash, "DCR", value_decred, "FCT", value_factom, "GNT", value_golem, "MAID", value_maidsafecoin, "REP", value_augur, "STR", value_stellar, value_stellar_h, "XEM", value_nem, "XRP", value_ripple, value_ripple_h, "ZEC", value_zcash, "NXT", value_nxt, "SIA", value_sia, "DGB", value_dgb, "SYS", value_sys, "ANS", value_ans, total+total_june, total_h+total_june, stamp_price * (total + total_june), xmr_totalvalue, aspsign, asppercent, aspsign_h, asppercent_h, xmrsign, xmrpercent))
|
|
||||||
except:
|
|
||||||
bot.say("ERROR!")
|
|
||||||
|
|
||||||
@sopel.module.commands('wtfisasp')
|
|
||||||
def wtfisasp(bot, trigger):
|
|
||||||
bot.say("ASP means the Angry Shitcoin Portfolio, a list of the top 15 coins that piss me off as people mindlessly pour money into them.")
|
|
||||||
|
|
||||||
@sopel.module.commands('asprules')
|
|
||||||
def asprules(bot, trigger):
|
|
||||||
bot.say("1. Shitcoins only, eg. a premine, ICO, Corporate, APPCoin, Buzzwordy, Copycat, etc. . 2. Must have high volume, it needs staying power to be considered as the ASP is a longterm thing. 3. 1 BTC gets bought of each coin on the list, as this list is not fictional, laughable as that is. 4. No trading, buy and hold only. 5. Can be liquidated at my discretion, but preferably once it's fleeced users of 4> BTC in value or more, or almost nothing is left (<0.1 BTC in value). 5. Each shitcoin should preferably should have a poor/toxic community, and or dev group shilling, censoring, etc. . 6. I must literally hate the idea of this coins existence.")
|
|
||||||
|
|
||||||
@sopel.module.commands('whaleornot')
|
@sopel.module.commands('whaleornot')
|
||||||
def whaleornot(bot, trigger):
|
def whaleornot(bot, trigger):
|
||||||
|
|
||||||
|
@ -739,3 +652,9 @@ def whaleornot(bot, trigger):
|
||||||
@sopel.module.commands('trebuchet')
|
@sopel.module.commands('trebuchet')
|
||||||
def trebuchet(bot, trigger):
|
def trebuchet(bot, trigger):
|
||||||
bot.say("Can YOU use a counterweight to launch a 90 kg projectile over 300 meters? Yeah, I thought not.")
|
bot.say("Can YOU use a counterweight to launch a 90 kg projectile over 300 meters? Yeah, I thought not.")
|
||||||
|
|
||||||
|
@sopel.module.commands('baka')
|
||||||
|
def baka(bot, trigger):
|
||||||
|
bot.say(u'https://www.youtube.com/watch?v=n5n7CSGPzqw'.encode(utf8))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue