Upload folder using huggingface_hub
Browse files- __pycache__/app.cpython-312.pyc +0 -0
- app.py +22 -0
__pycache__/app.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-312.pyc and b/__pycache__/app.cpython-312.pyc differ
|
|
|
app.py
CHANGED
|
@@ -146,6 +146,24 @@ def refresh():
|
|
| 146 |
return (summary, df, gr.update(value=curve, visible=True), note_upd, stamp)
|
| 147 |
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
def load_rebalance():
|
| 150 |
tok = os.environ.get("HF_TOKEN")
|
| 151 |
if not tok:
|
|
@@ -222,6 +240,7 @@ with gr.Blocks(title="DeepQuant β live paper monitor", theme=gr.themes.Soft())
|
|
| 222 |
with gr.Tabs():
|
| 223 |
with gr.Tab("π Live account"):
|
| 224 |
stats = gr.Markdown()
|
|
|
|
| 225 |
rebal = gr.Markdown()
|
| 226 |
gr.Markdown("### Holdings")
|
| 227 |
tbl = gr.Dataframe(wrap=True, interactive=False)
|
|
@@ -253,6 +272,9 @@ with gr.Blocks(title="DeepQuant β live paper monitor", theme=gr.themes.Soft())
|
|
| 253 |
demo.load(load_rebalance, None, rebal)
|
| 254 |
btn.click(load_rebalance, None, rebal)
|
| 255 |
timer.tick(load_rebalance, None, rebal)
|
|
|
|
|
|
|
|
|
|
| 256 |
|
| 257 |
pv_outs = [pv_banner, tgt_tbl, ord_tbl]
|
| 258 |
demo.load(rebalance_preview, None, pv_outs)
|
|
|
|
| 146 |
return (summary, df, gr.update(value=curve, visible=True), note_upd, stamp)
|
| 147 |
|
| 148 |
|
| 149 |
+
def load_health():
|
| 150 |
+
tok = os.environ.get("HF_TOKEN")
|
| 151 |
+
if not tok:
|
| 152 |
+
return ""
|
| 153 |
+
try:
|
| 154 |
+
r = json.load(open(hf_hub_download("s-ttp/marketfm-panel", "deepquant_health.json", repo_type="dataset",
|
| 155 |
+
token=tok, force_download=True)))
|
| 156 |
+
icon = {"OK": "π’", "WATCH": "π‘", "ALERT": "π΄"}
|
| 157 |
+
lines = [f"### π©Ί Agent health β {icon.get(r.get('overall'), 'βͺ')} {r.get('overall')} <sub>(checked {r.get('date')})</sub>"]
|
| 158 |
+
for c in r.get("checks", []):
|
| 159 |
+
lines.append(f"- {icon.get(c['status'], 'βͺ')} **{c['name']}** β {c['detail']}")
|
| 160 |
+
lines.append("<sub>Deterministic daily checks: live tracking gap located in the 20-year backtest distribution, "
|
| 161 |
+
"risk guardrails, and pipeline freshness. Flags only β the supervisor never trades.</sub>")
|
| 162 |
+
return "\n".join(lines)
|
| 163 |
+
except Exception:
|
| 164 |
+
return ""
|
| 165 |
+
|
| 166 |
+
|
| 167 |
def load_rebalance():
|
| 168 |
tok = os.environ.get("HF_TOKEN")
|
| 169 |
if not tok:
|
|
|
|
| 240 |
with gr.Tabs():
|
| 241 |
with gr.Tab("π Live account"):
|
| 242 |
stats = gr.Markdown()
|
| 243 |
+
health = gr.Markdown()
|
| 244 |
rebal = gr.Markdown()
|
| 245 |
gr.Markdown("### Holdings")
|
| 246 |
tbl = gr.Dataframe(wrap=True, interactive=False)
|
|
|
|
| 272 |
demo.load(load_rebalance, None, rebal)
|
| 273 |
btn.click(load_rebalance, None, rebal)
|
| 274 |
timer.tick(load_rebalance, None, rebal)
|
| 275 |
+
demo.load(load_health, None, health)
|
| 276 |
+
btn.click(load_health, None, health)
|
| 277 |
+
timer.tick(load_health, None, health)
|
| 278 |
|
| 279 |
pv_outs = [pv_banner, tgt_tbl, ord_tbl]
|
| 280 |
demo.load(rebalance_preview, None, pv_outs)
|