Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,8 +25,8 @@ def get_nse_stock_price(stock_name: str) -> dict:
|
|
| 25 |
- "Price Change" (float): The price difference from the previous close.
|
| 26 |
- "% Change" (float): The percentage change from the previous close.
|
| 27 |
"""
|
| 28 |
-
|
| 29 |
-
stock = yf.Ticker(
|
| 30 |
data = stock.history(period='5d') # Get last 5 days to handle non-trading days
|
| 31 |
|
| 32 |
if data.empty:
|
|
|
|
| 25 |
- "Price Change" (float): The price difference from the previous close.
|
| 26 |
- "% Change" (float): The percentage change from the previous close.
|
| 27 |
"""
|
| 28 |
+
stock_name = stock_name.upper() # Ensure uppercase
|
| 29 |
+
stock = yf.Ticker(stock_name + ".NS")
|
| 30 |
data = stock.history(period='5d') # Get last 5 days to handle non-trading days
|
| 31 |
|
| 32 |
if data.empty:
|