def get_coin_info(self, symbol): try: infos = cryptocompy_coin.get_coin_list(coins=symbol) except KeyError: raise UnknownCoin name = infos[symbol]['CoinName'] return CryptoCurrency(name, symbol)
def __init__(self, cmc_api_key='6d7f5365-d3c4-4210-804e-c3c36302499d'): self.___CMC_API_KEY = cmc_api_key self.___cmc = cmc.CoinMarketCapAPI(self.___CMC_API_KEY, sandbox=False) # THIS API CALL COSTS CREDITS # self.___fiat_data = self.___cmc.fiat_map().data self.coin_list = coin.get_coin_list(coins='all') self.___coin_symbols___ = list(self.coin_list.keys())
def test_get_coin_list(): coins = cryptocompy_coin.get_coin_list(coins='all') assert len(coins) == 3098 assert 'BTC' in coins.keys() assert 'ETH' in coins.keys() btc = coins['BTC'] assert btc assert btc['Id'] == '1182' assert btc['Name'] == 'BTC' assert btc['Symbol'] == 'BTC' assert btc['CoinName'] == 'Bitcoin'
def getCoins(): coinData = coin.get_coin_list(coins='all') print(coinData) symbolDict = {} # symbol name for i in coinData: symbolDict[i] = coinData[i]['CoinName'] ''' with open('coin.csv' , 'w' , newline = "", encoding='utf-8') as datacsv: csvwriter = csv.writer(datacsv, dialect = ("excel")) csvwriter.writerow(["symbol", "coinName"]) for i in symbolDict: data = [] data.append(i) data.append(symbolDict[i]) csvwriter.writerow(data) ''' return symbolDict
def inputArgs(): sysArguments = [] if len(sys.argv) > 1: test = True for i in range(1, len(sys.argv)): sysArguments.append(sys.argv[i].upper()) print(sysArguments, "\n") try: coins = coin.get_coin_list(coins=sysArguments) # print(coins) except KeyError: print( """That Is Not A Valid Crypto Symbol Or The Coin Is Not Available On Most Major Exchanges. Please Enter A Valid Symbol After python crypto.py Example: python crypto.py btc ltc eth""") exit() fullNames = [] if test == True: for j in range(0, len(sysArguments)): print(coins[sysArguments[j]]["CoinName"]) fullName = coins[sysArguments[j]]['CoinName'] fullNames.append(fullName) #Match symbol with full name of coin for future data. nameSymbolPair = [] counter = 0 for elem in sysArguments: temp = [elem, fullNames[counter]] counter += 1 nameSymbolPair.append(temp) #Initialize queries queries = [] for elem in nameSymbolPair: print(elem) if elem[0] == "HOT": queries.append('Holochain') else: queries.append('"${0}" OR "{1}"'.format(elem[0], elem[1])) counter += 1 counts(queries, nameSymbolPair) sentiment(queries, nameSymbolPair)
def get_coins_list(self): res = cryptocompy_coin.get_coin_list() for symbol, coins in res.items(): name = coins['CoinName'] yield CryptoCurrency(name, symbol)
def get_all_symbols(): coin_list = coin.get_coin_list() all_coin_names = [c['Symbol'] for c in coin_list.values()] return all_coin_names
def get_all_coins(): all_coins = coin.get_coin_list() return all_coins
def get_all_coin_names(): coin_list = coin.get_coin_list() all_coin_names = [c['CoinName'] for c in coin_list.values()] return all_coin_names
def test_get_specific_coins(coins_asked, coins_recieved): coins = cryptocompy_coin.get_coin_list(coins=coins_asked) assert set(coins.keys()) == set(coins_recieved)
from cryptocompy import coin, price, mining, top coin_list = coin.get_coin_list(coins="all") print(len(coin_list)) for c in coin_list: print(c) symbols = list(coin_list.keys()) print("symbols = ", symbols)
def get_coin_info(self, symbol): infos = cryptocompy_coin.get_coin_list(coins=symbol) name = infos[symbol]['CoinName'] return CryptoCurrency(name, symbol)
def get_crypto_compy_coin_list(): coins = coin.get_coin_list(coins='all') symbols = list(coins.keys()) return (symbols)
l1 = list[0:split] l2 = list[split:] for key, value in zip(l1, l2): print("{0:<40s} {1}".format(key, value)) def clear(): os.system('cls' if os.name == 'nt' else 'clear') clear() print("\t*****************************") print("\t*\tCRYPTOCURRENCY\t *") print("\t*****************************") cryptocurrencies = coin.get_coin_list(coins='all') cryptocurrencies_names = get_crypto_name(cryptocurrencies) cryptocurrencies_acronym = cryptocurrencies.keys() symbols = {'USD': '$', 'EUR': '€'} while True: print("\n - Entrez le nom ou l'acronym de la cryptomonnaie que vous voulez") print(" (ex : 'BTC' or 'Bitcoin')") print(" - Enter 'list' to list cryptocurrency") print(" - Enter 'exit' to exit") input_cryptocurrency = input("> ") if input_cryptocurrency == 'list': cryptocurrencies_fullname = list(get_crypto_full_name(cryptocurrencies))