I'm trying to find an efficient way of validating if each element in a list is a stock ticker. The code below works but its too slow I'm looking for a faster way, Thanks in advance I can clarify anything if needed
tickers_post = re.findall("[A-Z]{3,4}", str(post)) # RegEx to extract tickers from a list
def tickerData(tic):
yf.Ticker(tic).info
count = len(tickers_post) -1
while count >= 0:
try:
tickerData(str(tickers_post[count]))
except:
print('Not a ticker:' + tickers_post[count])
tickers_post.pop(count)
count = count - 1
Print(ticker_post)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…