We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 63d0586 commit f646d4bCopy full SHA for f646d4b
topStocks.py
@@ -11,7 +11,8 @@ def get_top_stocks(symbols):
11
try:
12
top_stocks = symbols.split()
13
tickers = yf.Tickers(symbols)
14
- for stock in top_stocks:
+ while top_stocks:
15
+ stock = top_stocks.pop()
16
info = tickers.tickers[stock].info
17
stock_info = {
18
'symbol': stock,
@@ -20,7 +21,7 @@ def get_top_stocks(symbols):
20
21
'previousClose': info.get('previousClose', 'N/A'),
22
'sector': info.get('sector', 'N/A')
23
}
- stock_data.append(stock_info)
24
+ stock_data.push(stock_info)
25
except Exception as e:
26
print(f"Error fetching {symbols}: {e}")
27
time.sleep(5)
0 commit comments