import pandas_datareader.data as web
import pandas as pd
import numpy as np
all_data={}
fund = 14400
for ticker in ['CONG','CLIRW','MDLQ','ECC', 'ANDAW']
try:
all_data = web.get_data_yahoo(ticker,'01/01/2017',interval='w')
sp = pd.DataFrame(all_data)
if (sp['Close'][-1]>sp['Open'][-1]) and (sp['Close'][-2]>sp['Open'][-2]) and (sp['Close'][-3]>sp['Open'][-3]) and (sp['Close'][-1]>sp['Close'][-2]) and (sp['Close'][-2]>sp['Close'][-3]) :
print(ticker,' ','%.2f'%sp['Close'][-1],' ',sp['Volume'][-1]//10000,' ',fund//sp['Close'][-1])
except:
print ("Cant find ", ticker)
这段代码可以打印一些我关心的符号信息,但是找不到某些符号但是市场上确实存在符号。如何解决?