def most_stable_coins(n, dfh, start_interval): print(f'\nMost Stable Coins Since {start_interval}\n') # Find 10 coins whose average normalized price are most stable starting from "2021-01-1", till now for (c, v) in dfh.find(n=n, start=start_interval, key=lambda dataframe: cp.normalize(dataframe['price']).std(), descending=False): print(f'{c}:\t{v:.6}')
def most_traded_coins(n, dfh, start_interval): print(f'\nMost Traded Coins Since {start_interval}\n') # Find 10 coins whose average normalized price is the highest starting from "2021-01-1", till now for (c, v) in dfh.find(n=n, start=start_interval, key=lambda dataframe: cp.normalize(dataframe['real_volume']).mean(), descending=True): print(f'{c}:\t{v:.6}')
import coinpy as cp dfs = cp.DataFramesHolder(path='../Data') dfs.select_frames(['BTC', 'ADA', 'ETH', 'XLM', 'UNI']) dfs.select_interval(start="2021-03-25", end="2021-08-01") dfs.create_feature(name='price', key=lambda dataframe: cp.normalize((dataframe['open'] + dataframe['close']) / 2)) dfs.select_col(['price']) dfs.portfolio_value(coin_name=['BTC', 'ETH', 'ADA', 'XLM'], alloc=[.1, .6, .1, .1, .1]) dfs.plot(title='Portfolio value')