Spaces:
Running
Running
Update app/index_live_html.py
Browse files- app/index_live_html.py +37 -5
app/index_live_html.py
CHANGED
|
@@ -23,7 +23,7 @@ def build_index_live_html(index_name ="NIFTY 50"):
|
|
| 23 |
return cached_html
|
| 24 |
|
| 25 |
# ================= LIVE FETCH =================
|
| 26 |
-
|
| 27 |
p = ns.nse_index_live(index_name)
|
| 28 |
|
| 29 |
full_df = p.get("data", pd.DataFrame())
|
|
@@ -145,15 +145,47 @@ def build_index_live_html(index_name ="NIFTY 50"):
|
|
| 145 |
<head>
|
| 146 |
<meta charset="UTF-8">
|
| 147 |
<style>
|
| 148 |
-
body {{ font-family: Arial; margin: 12px; background: #f5f5f5; font-size: 14px; }}
|
| 149 |
table {{ border-collapse: collapse; width: 100%; }}
|
| 150 |
th, td {{ border: 1px solid #bbb; padding: 5px 8px; }}
|
| 151 |
.numeric-positive {{ color: green; font-weight: bold; }}
|
| 152 |
.numeric-negative {{ color: red; font-weight: bold; }}
|
| 153 |
.top-up {{ background: #a8f0a5; }}
|
| 154 |
.top-down {{ background: #f0a8a8; }}
|
| 155 |
-
|
| 156 |
-
.mini-card {{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
.grid {{ display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }}
|
| 158 |
.small-table {{ background: white; padding: 8px; border-radius: 6px; }}
|
| 159 |
.st-title {{ background: #222; color: white; text-align: center; padding: 5px; }}
|
|
@@ -180,4 +212,4 @@ th, td {{ border: 1px solid #bbb; padding: 5px 8px; }}
|
|
| 180 |
# ================= SAVE (HTML ONLY) =================
|
| 181 |
save(cache_name, html_out, "html")
|
| 182 |
|
| 183 |
-
return html_out
|
|
|
|
| 23 |
return cached_html
|
| 24 |
|
| 25 |
# ================= LIVE FETCH =================
|
| 26 |
+
|
| 27 |
p = ns.nse_index_live(index_name)
|
| 28 |
|
| 29 |
full_df = p.get("data", pd.DataFrame())
|
|
|
|
| 145 |
<head>
|
| 146 |
<meta charset="UTF-8">
|
| 147 |
<style>
|
| 148 |
+
body {{ font-family: Arial, sans-serif; margin: 12px; background: #f5f5f5; font-size: 14px; }}
|
| 149 |
table {{ border-collapse: collapse; width: 100%; }}
|
| 150 |
th, td {{ border: 1px solid #bbb; padding: 5px 8px; }}
|
| 151 |
.numeric-positive {{ color: green; font-weight: bold; }}
|
| 152 |
.numeric-negative {{ color: red; font-weight: bold; }}
|
| 153 |
.top-up {{ background: #a8f0a5; }}
|
| 154 |
.top-down {{ background: #f0a8a8; }}
|
| 155 |
+
|
| 156 |
+
.mini-card-container {{
|
| 157 |
+
display: flex;
|
| 158 |
+
flex-wrap: wrap;
|
| 159 |
+
gap: 10px;
|
| 160 |
+
margin-bottom: 16px;
|
| 161 |
+
}}
|
| 162 |
+
|
| 163 |
+
.mini-card {{
|
| 164 |
+
background: #fff;
|
| 165 |
+
padding: 12px 16px;
|
| 166 |
+
border-radius: 8px;
|
| 167 |
+
box-shadow: 0 1px 4px rgba(0,0,0,0.12);
|
| 168 |
+
min-width: 130px;
|
| 169 |
+
flex: 1 1 150px;
|
| 170 |
+
}}
|
| 171 |
+
|
| 172 |
+
.mini-card .card-key {{
|
| 173 |
+
font-size: 12px;
|
| 174 |
+
font-weight: bold;
|
| 175 |
+
color: #555;
|
| 176 |
+
text-transform: uppercase;
|
| 177 |
+
margin-bottom: 4px;
|
| 178 |
+
}}
|
| 179 |
+
|
| 180 |
+
.mini-card .card-val {{
|
| 181 |
+
font-size: 16px;
|
| 182 |
+
font-weight: bold;
|
| 183 |
+
color: #222;
|
| 184 |
+
white-space: nowrap;
|
| 185 |
+
overflow: hidden;
|
| 186 |
+
text-overflow: ellipsis;
|
| 187 |
+
}}
|
| 188 |
+
|
| 189 |
.grid {{ display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }}
|
| 190 |
.small-table {{ background: white; padding: 8px; border-radius: 6px; }}
|
| 191 |
.st-title {{ background: #222; color: white; text-align: center; padding: 5px; }}
|
|
|
|
| 212 |
# ================= SAVE (HTML ONLY) =================
|
| 213 |
save(cache_name, html_out, "html")
|
| 214 |
|
| 215 |
+
return html_out
|