Remove alt currency stuff

This commit is contained in:
jwinterm 2018-07-28 07:43:56 -07:00
parent 1d7c101d82
commit c8d6553595
2 changed files with 94 additions and 502 deletions

296
price.py
View File

@ -13,7 +13,6 @@ prevamnt, prevtime = 0, 0
trexurl = "https://bittrex.com/api/v1.1/public/getmarketsummary?market=btc-"
cryptopiaurl = "https://www.cryptopia.co.nz/api/GetMarkets"
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'
finexusd = 'https://api.bitfinex.com/v1/pubticker/XMRUSD'
krakbtc = 'https://api.kraken.com/0/public/Ticker?pair=XMRXBT'
@ -552,28 +551,11 @@ def pepexmr(bot, trigger):
@sopel.module.commands('tall')
def tall(bot, trigger):
stringtosend = ''
fixerurl = 'http://api.fixer.io/latest?base=USD'
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'
# btccurl = 'https://pro-data.btcc.com/data/pro/ticker?symbol=XBTCNY'
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'
# gdaxurl = 'https://api.coinbase.com/v2/exchange-rates?currency=BTC'
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
try:
stampresult = requests.get(stampurl)
@ -581,15 +563,7 @@ def tall(bot, trigger):
except:
stampjson = False
if stampjson:
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']))
stringtosend += "Bitstamp last: ${0:,.2f}, vol: {1:,.1f} | ".format(float(stampjson['last']), float(stampjson['volume']))
# Gemini
try:
gemiresult = requests.get(gemiurl)
@ -598,7 +572,7 @@ def tall(bot, trigger):
gemijson = False
if gemijson:
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:
pass
# Gdax
@ -610,7 +584,7 @@ def tall(bot, trigger):
except:
gdaxjson = False
if gdaxjson:
stringtosend += "GDAX price: {0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume)
stringtosend += "GDAX last: ${0:,.2f}, vol: {1:,.1f} | ".format(gdaxprice, gdaxvolume)
# Bitfinex
try:
finexresult = requests.get(finexurl)
@ -619,7 +593,7 @@ def tall(bot, trigger):
finexjson = False
try:
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
@ -631,23 +605,7 @@ def tall(bot, trigger):
except:
thumbjson = False
if thumbjson:
stringtosend += "Bithumb last: {0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price'])/float(usdkrw), 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']))
stringtosend += "Bithumb last: ₩{0:,.2f}, vol: {1:,.1f} | ".format(float(thumbjson['data']['buy_price']), float(thumbjson['data']['volume_1day']))
# Bitflyer
try:
bitflyerresult = requests.get(bitflyerurl)
@ -655,7 +613,7 @@ def tall(bot, trigger):
except:
bitflyerjson = False
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
bot.say(stringtosend[:-2])
@ -788,224 +746,6 @@ def usd(bot, trigger):
except:
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')
def price(bot, trigger):
@ -1014,30 +754,6 @@ def price(bot, trigger):
except:
bot.say("C-cex sucks")
@sopel.module.commands('commodity', 'com')
def commodity(bot, trigger):
commodity_key = 'B1ZnykTmG6_A1vkwzt9u'
input_com = trigger.group(2).upper()
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:
r=requests.get("https://www.quandl.com/api/v3/datasets/COM/{0}.json?&api_key={1}".format(commodity, commodity_key))
j=r.json()
last=j['dataset']['data'][0][1]
bot.say("Last price on {0} was ${1:.3f} per {2}.".format(commodity, last, unit))
except:
bot.say("Monerobux fails again...")
@sopel.module.commands('xmy')
def xmy(bot, trigger):
try:

View File

@ -535,6 +535,10 @@ def vitalik(bot, trigger):
def wat(bot, trigger):
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')
def yoda(bot, trigger):
bot.say("The optimism is strong in this one")
@ -567,134 +571,6 @@ def wave(bot, trigger):
def scamdouble(bot, trigger):
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')
def whaleornot(bot, trigger):