Update preopen_html.py
Browse files- preopen_html.py +5 -3
preopen_html.py
CHANGED
|
@@ -73,8 +73,10 @@ def build_preopen_html(key="NIFTY"):
|
|
| 73 |
# ================= Constituents table =================
|
| 74 |
cons_html = df_to_html_color(const_df) if not const_df.empty else "<i>No pre-open constituents</i>"
|
| 75 |
|
| 76 |
-
# ================= Metric tables =================
|
| 77 |
-
|
|
|
|
|
|
|
| 78 |
metric_tables = ""
|
| 79 |
for col in metric_cols:
|
| 80 |
df_const = const_df.copy()
|
|
@@ -128,7 +130,7 @@ th {{ background: #333; color: white; font-weight: 600; }}
|
|
| 128 |
{cons_html}
|
| 129 |
</div>
|
| 130 |
|
| 131 |
-
<h3>Metric Tables (
|
| 132 |
<div class="grid">
|
| 133 |
{metric_tables}
|
| 134 |
</div>
|
|
|
|
| 73 |
# ================= Constituents table =================
|
| 74 |
cons_html = df_to_html_color(const_df) if not const_df.empty else "<i>No pre-open constituents</i>"
|
| 75 |
|
| 76 |
+
# ================= Metric tables (restricted to selected columns) =================
|
| 77 |
+
metric_cols_allowed = ["pChange", "totalTurnover", "marketCap", "IEP", "totalTradedVolume", "perChange"]
|
| 78 |
+
metric_cols = [c for c in metric_cols_allowed if c in const_df.columns and pd.api.types.is_numeric_dtype(const_df[c])] if not const_df.empty else []
|
| 79 |
+
|
| 80 |
metric_tables = ""
|
| 81 |
for col in metric_cols:
|
| 82 |
df_const = const_df.copy()
|
|
|
|
| 130 |
{cons_html}
|
| 131 |
</div>
|
| 132 |
|
| 133 |
+
<h3>Metric Tables (selected numeric)</h3>
|
| 134 |
<div class="grid">
|
| 135 |
{metric_tables}
|
| 136 |
</div>
|