def get_top_symbols(tsym='BTC', limit=20): if limit: coins = pd.DataFrame(top.get_top_coins(tsym='BTC', limit=limit)) else: coins = pd.DataFrame(top.get_top_coins(tsym='BTC')) symbols = list(coins['SYMBOL'].values[1:]) return symbols
def get_top_coin_names(tsym='BTC', limit=20): if limit: coins = pd.DataFrame(top.get_top_coins(tsym='BTC', limit=limit)) else: coins = pd.DataFrame(top.get_top_coins(tsym='BTC')) symbols = [coin.split()[0] for coin in list(coins['FULLNAME'].values[1:])] return symbols
def store_top_n(n): coins = top.get_top_coins('USD', limit = n) #Iterate through list of coins count = 0 for i in coins: count += 1 print(count) #Currently we're normalizing the data before we store it download_dir = "normalized_2k_min_data/06-06/" + i["SYMBOL"] + ".csv" #Open directory csv = open(download_dir, "w") #Write the header columnTitleRow = "time, price\n" csv.write(columnTitleRow) #Get the data to add data = get_past_day_price(i["SYMBOL"]) price = normalize(data["price"]) #Normalize Prices time = data["time"] #Loop through time and price data for j in range(len(price)): row = time[j] + "," + str(price[j]) + "\n" csv.write(row) return 0
def list_top_n(n): coins = top.get_top_coins('USD', limit = n) download_dir = "coin_list_" + str(n) + ".csv" csv = open(download_dir, "w") #csv.write("symbol" + "\n") for i in coins: print(i["SYMBOL"]) csv.write(i["SYMBOL"]) csv.write("\n") return 0
def test_get_top_coins(): topcoin = top.get_top_coins('USD') assert len(topcoin) == 21 btc = topcoin[1] assert btc['SYMBOL'] == 'BTC' assert btc['SUPPLY'] == 17296550 assert btc['FULLNAME'] == 'Bitcoin (BTC)' assert btc['NAME'] == 'Bitcoin' assert btc['ID'] == '1182' assert btc['VOLUME24HOURTO'] == 178522647.1706209
def top_n(n): coins = top.get_top_coins('USD', limit = n) price_matrix = np.zeros((1441,1)) count = 0 for i in coins: count += 1 #print(price_matrix.shape) price_matrix = np.c_[price_matrix, get_past_day_price(i["SYMBOL"])] #print(price_matrix) print(count) return price_matrix