Spaces:
Running
Running
Update index.py
Browse files
index.py
CHANGED
|
@@ -21,7 +21,8 @@ def fetch_index(max_rows=200):
|
|
| 21 |
# ----------------------------------
|
| 22 |
# Fetch NIFTY 50 data
|
| 23 |
# ----------------------------------
|
| 24 |
-
df =
|
|
|
|
| 25 |
|
| 26 |
if df.empty:
|
| 27 |
return html_card("Error", "No data found for NIFTY 50 (^NSEI).")
|
|
@@ -31,17 +32,14 @@ def fetch_index(max_rows=200):
|
|
| 31 |
df.reset_index(inplace=True) # make Date a column
|
| 32 |
|
| 33 |
# Limit display rows
|
| 34 |
-
df_display = df
|
|
|
|
| 35 |
|
| 36 |
-
# ----------------------------------
|
| 37 |
-
# Generate TA-Lib indicators
|
| 38 |
-
# ----------------------------------
|
| 39 |
-
combined_df = talib_df(df_display)
|
| 40 |
|
| 41 |
# ----------------------------------
|
| 42 |
# Convert to HTML
|
| 43 |
# ----------------------------------
|
| 44 |
-
table_html =
|
| 45 |
classes="table table-striped table-bordered",
|
| 46 |
index=False
|
| 47 |
)
|
|
@@ -53,7 +51,7 @@ def fetch_index(max_rows=200):
|
|
| 53 |
"""
|
| 54 |
|
| 55 |
content = f"""
|
| 56 |
-
<h2>NIFTY 50
|
| 57 |
{html_card("Technical Analysis Table", scrollable_html)}
|
| 58 |
"""
|
| 59 |
|
|
|
|
| 21 |
# ----------------------------------
|
| 22 |
# Fetch NIFTY 50 data
|
| 23 |
# ----------------------------------
|
| 24 |
+
df = nse_index_df(index_name="NIFTY 50"):
|
| 25 |
+
|
| 26 |
|
| 27 |
if df.empty:
|
| 28 |
return html_card("Error", "No data found for NIFTY 50 (^NSEI).")
|
|
|
|
| 32 |
df.reset_index(inplace=True) # make Date a column
|
| 33 |
|
| 34 |
# Limit display rows
|
| 35 |
+
df_display = df
|
| 36 |
+
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# ----------------------------------
|
| 40 |
# Convert to HTML
|
| 41 |
# ----------------------------------
|
| 42 |
+
table_html = df_display.to_html(
|
| 43 |
classes="table table-striped table-bordered",
|
| 44 |
index=False
|
| 45 |
)
|
|
|
|
| 51 |
"""
|
| 52 |
|
| 53 |
content = f"""
|
| 54 |
+
<h2>NIFTY 50 </h2>
|
| 55 |
{html_card("Technical Analysis Table", scrollable_html)}
|
| 56 |
"""
|
| 57 |
|