Skip to content

Commit f646d4b

Browse files
fixing some bugs
1 parent 63d0586 commit f646d4b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

topStocks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ def get_top_stocks(symbols):
1111
try:
1212
top_stocks = symbols.split()
1313
tickers = yf.Tickers(symbols)
14-
for stock in top_stocks:
14+
while top_stocks:
15+
stock = top_stocks.pop()
1516
info = tickers.tickers[stock].info
1617
stock_info = {
1718
'symbol': stock,
@@ -20,7 +21,7 @@ def get_top_stocks(symbols):
2021
'previousClose': info.get('previousClose', 'N/A'),
2122
'sector': info.get('sector', 'N/A')
2223
}
23-
stock_data.append(stock_info)
24+
stock_data.push(stock_info)
2425
except Exception as e:
2526
print(f"Error fetching {symbols}: {e}")
2627
time.sleep(5)

0 commit comments

Comments
 (0)