这是我用来存储我所有加密货币数据的代码。你知道吗
altcoins2=['BTC','DASH','LTC','NXT',
'STR','XMR','XRP','ETH',
'ETC','REP','ZEC','BCH',
'EOS','SNT','KNC','BAT','LOOM',
'DOGE','GNT','LSK','SC','ZRX']
actcoin_data = {}
for altcoin in altcoins2:
coinpair = 'USDT_{}'.format(altcoin)
crypto_price_df = CryptoData(coinpair)
crypto_price_df['weekday']=crypto_price_df.index.weekday
crypto_price_df['change']=crypto_price_df.close.diff()
actcoin_data[altcoin] = makeData(crypto_price_df)
数据存储为数据帧列表,即actu数据。你知道吗
现在我想让用户键入任何指标,例如,“rsi”。 每个数据帧中都有一列名为rsi,我想打印所有这些列。你知道吗
我用过:
indi = input("which indicator you want \n ")
#user types "rsi"
for altcoin in altcoins2:
print(actcoin_data[altcoin].{indi})
但它不起作用。有没有更好的办法?你知道吗
谢谢你的帮助。你知道吗
p.S.CryptoData函数用于从服务器下载数据,并使数据细化和生成数据帧。你知道吗
如果我能很好地理解你,那就做:
相关问题 更多 >
编程相关推荐