eshan6704 commited on
Commit
8ec0b15
·
verified ·
1 Parent(s): c0e38c4

Update index.py

Browse files
Files changed (1) hide show
  1. index.py +6 -8
index.py CHANGED
@@ -21,7 +21,8 @@ def fetch_index(max_rows=200):
21
  # ----------------------------------
22
  # Fetch NIFTY 50 data
23
  # ----------------------------------
24
- df = nse_preopen_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.head(max_rows)
 
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 = combined_df.to_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 (^NSEI) — Daily (OHLCV + Indicators + Patterns)</h2>
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