从 yahoo Finance 下载 ohlcv for nvidia 读取,我正在为信号购买/dontbuy 创建一个列,当我尝试定义哪些通过 avg>volume 测试时,一切要么全部“购买”,要么不购买。
df=pd.read_csv('NVDA.csv',dtype={'label':str})
df['Price%delta']=((df['Close']/df['Open'])*100)
df['Avg_volume']=df['Volume'].rolling(7).mean()
df['Signal']=0
for index, row in df.iterrows():
if row['Volume'] > row['Avg_volume']:
df['Signal']='Buy'
else:
df['Signal']='Dont Buy'
慕斯709654
当年话下
慕工程0101907
相关分类