Upload folder using huggingface_hub
Browse files- README.md +14 -8
- __pycache__/app.cpython-312.pyc +0 -0
- app.py +50 -15
README.md
CHANGED
|
@@ -7,17 +7,23 @@ sdk: gradio
|
|
| 7 |
sdk_version: 5.50.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
short_description:
|
| 11 |
---
|
| 12 |
|
| 13 |
# DeepQuant
|
| 14 |
|
| 15 |
-
A
|
| 16 |
-
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
|
|
|
| 7 |
sdk_version: 5.50.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
+
short_description: Hybrid autonomous fund β deterministic engine + agentic AI
|
| 11 |
---
|
| 12 |
|
| 13 |
# DeepQuant
|
| 14 |
|
| 15 |
+
A **hybrid autonomous fund** running end-to-end on an Alpaca **paper** account: a deterministic quant engine
|
| 16 |
+
executes a 20-year-validated, regime-aware multi-asset strategy, while an **agentic AI layer** supervises it,
|
| 17 |
+
narrates it, and β within strict evidence gates β recalibrates it. No human in the loop.
|
| 18 |
|
| 19 |
+
**Division of labour, by design:**
|
| 20 |
+
- **Deterministic:** stock ranking (MarketFM, ~11,800-name survivorship-free universe), order execution over the
|
| 21 |
+
Alpaca API, risk rails (long-only, 10% cap, no leverage), daily statistical health checks vs the strategy's own
|
| 22 |
+
backtest distribution.
|
| 23 |
+
- **Agentic (Claude Opus 5):** a weekly role-separated crew β Analyst β adversarial Critic β PM β that assesses
|
| 24 |
+
the evidence and decides to hold, adopt a better-validated strategy variant, or pause trading; every action is
|
| 25 |
+
re-checked by a code validator (full walk-forward acceptance criteria, 90-day rate limit, hard rails).
|
| 26 |
+
- **MarketGuruLLM** (fine-tuned Qwen2.5-14B) narrates every rebalance and decision in plain English.
|
| 27 |
|
| 28 |
+
The page is **read-only**: live positions, equity vs S&P 500 since inception, agent health, the latest decision
|
| 29 |
+
with its reasoning, and a dry-run rebalance preview. Backtested results, paper trading β not investment advice.
|
__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
|
@@ -245,19 +245,53 @@ def rebalance_preview():
|
|
| 245 |
with gr.Blocks(title="DeepQuant β live paper monitor", theme=gr.themes.Soft()) as demo:
|
| 246 |
gr.Markdown(
|
| 247 |
"# π€ DeepQuant\n"
|
| 248 |
-
"###
|
| 249 |
-
"DeepQuant runs a regime-aware
|
| 250 |
-
"
|
| 251 |
-
"
|
| 252 |
-
"
|
| 253 |
-
"
|
| 254 |
-
"-
|
| 255 |
-
"
|
| 256 |
-
"
|
| 257 |
-
"
|
| 258 |
-
"
|
| 259 |
-
"
|
| 260 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
with gr.Tabs():
|
| 262 |
with gr.Tab("π Live account"):
|
| 263 |
stats = gr.Markdown()
|
|
@@ -273,8 +307,9 @@ with gr.Blocks(title="DeepQuant β live paper monitor", theme=gr.themes.Soft())
|
|
| 273 |
updated = gr.Markdown("_loadingβ¦_")
|
| 274 |
btn = gr.Button("β» Refresh now", scale=0)
|
| 275 |
with gr.Tab("π Rebalance preview"):
|
| 276 |
-
gr.Markdown("What the
|
| 277 |
-
"
|
|
|
|
| 278 |
pv_banner = gr.Markdown()
|
| 279 |
pbtn = gr.Button("β³ Recompute preview", scale=0)
|
| 280 |
with gr.Row():
|
|
|
|
| 245 |
with gr.Blocks(title="DeepQuant β live paper monitor", theme=gr.themes.Soft()) as demo:
|
| 246 |
gr.Markdown(
|
| 247 |
"# π€ DeepQuant\n"
|
| 248 |
+
"### A hybrid autonomous fund β deterministic quant engine, agentic AI judgment\n"
|
| 249 |
+
"DeepQuant runs a 20-year-validated, regime-aware multi-asset strategy **end-to-end on a live paper account** β "
|
| 250 |
+
"it selects, executes, monitors, explains, recalibrates and even pauses itself, with no human in the loop. "
|
| 251 |
+
"Every responsibility is assigned by one principle: **deterministic code wherever correctness must be provable, "
|
| 252 |
+
"agentic AI wherever judgment adds value** β never the other way around.\n\n"
|
| 253 |
+
"**The stack:**\n"
|
| 254 |
+
"- π§ **[MarketFM](https://huggingface.co/spaces/s-ttp/marketfm-ranker)** β a survivorship-free quant model "
|
| 255 |
+
"(~11,800 US stocks, 21 point-in-time factors) ranks the cross-section and sets the target portfolio\n"
|
| 256 |
+
"- βοΈ **Deterministic execution engine** β turns targets into orders over the **Alpaca API**: weekly rebalances, "
|
| 257 |
+
"market-open checks, notional market orders, idempotent reconciliation β inside uncrossable rails "
|
| 258 |
+
"(long-only, 10% position cap, no leverage, cash buffer)\n"
|
| 259 |
+
"- π©Ί **Deterministic supervision** β daily health checks locate live performance *inside the strategy's own "
|
| 260 |
+
"20-year backtest distribution* and watch guardrails, drift and pipeline freshness\n"
|
| 261 |
+
"- π€ **Agentic decision crew** (Claude Opus 5) β every week an **Analyst** assesses the evidence, an adversarial "
|
| 262 |
+
"**Critic** stress-tests it, and a **PM** decides: hold, adopt a better-validated strategy variant, or pause "
|
| 263 |
+
"trading β each action gated by a **code validator** (walk-forward acceptance criteria, 90-day rate limit, hard rails)\n"
|
| 264 |
+
"- π¬ **[MarketGuruLLM](https://huggingface.co/s-ttp/qwen25-14b-fin-lora)** β a fine-tuned analyst model narrates "
|
| 265 |
+
"every rebalance and every decision in plain English\n\n"
|
| 266 |
+
"**The strategy:** large-cap **momentum + quality** while the market trend is up; when it turns down, de-risk into "
|
| 267 |
+
"a blend of **stocks + bonds + gold** (60 / 20 / 20). Backtested 2002β2026, net of costs: **~14% / yr vs the "
|
| 268 |
+
"S&P 500's ~11%**, higher Sharpe, β35% max drawdown vs the index's β49%.\n"
|
| 269 |
+
"<sub>Fully autonomous, paper trading, this page is read-only. Backtested results β past performance β future. "
|
| 270 |
+
"Not investment advice.</sub>")
|
| 271 |
+
with gr.Accordion("𧬠Why hybrid? Who decides what β and why", open=False):
|
| 272 |
+
gr.Markdown(
|
| 273 |
+
"The lesson from building this system: **neither pure determinism nor pure agency is enough.** Rules can't "
|
| 274 |
+
"weigh ambiguous evidence; models can't be allowed to improvise with money. So each job goes to the framework "
|
| 275 |
+
"that has *earned* it:\n\n"
|
| 276 |
+
"| Responsibility | Framework | Why |\n|---|---|---|\n"
|
| 277 |
+
"| Stock ranking & target weights | **Deterministic** (MarketFM factors + fixed rules) | Validated on a 20-year "
|
| 278 |
+
"walk-forward, survivorship-free, net of costs β and reproducible to the penny |\n"
|
| 279 |
+
"| Order execution & risk rails | **Deterministic** | Execution is arithmetic β the last place you want a model "
|
| 280 |
+
"hallucinating. The rails (long-only, caps, no leverage) are code no one can override |\n"
|
| 281 |
+
"| Daily monitoring | **Deterministic** | Statistical checks against the strategy's own history β e.g. \"is this "
|
| 282 |
+
"drawdown inside the envelope of 280 historical 8-week windows?\" |\n"
|
| 283 |
+
"| Weekly assessment & judgment | **Agentic** β a role-separated crew (Analyst β adversarial Critic β PM) on "
|
| 284 |
+
"Claude Opus 5 | Weighing noisy, conflicting evidence is judgment; separating the roles makes each argument "
|
| 285 |
+
"survive an adversarial challenge before any decision |\n"
|
| 286 |
+
"| Strategy changes | **Hybrid** | The crew may adopt *only* variants that beat the incumbent across a bounded "
|
| 287 |
+
"menu (selection signal Γ regime rule Γ defense sleeve Γ cadence) on the full 20-year walk-forward, net of cost β "
|
| 288 |
+
"re-checked by a code validator; max one change per 90 days. Trigger on recent data, validate on all data |\n"
|
| 289 |
+
"| Emergency brake | **Hybrid** | The crew can pause execution up to 2 weeks on operational anomalies; holding "
|
| 290 |
+
"the validated book is always the safe default β and any AI failure automatically resolves to HOLD |\n"
|
| 291 |
+
"| Explanations | **Agentic** (MarketGuruLLM) | Language is what language models are for |\n\n"
|
| 292 |
+
"Every weekly decision is logged in full β the Analyst's assessment, the Critic's objections, the PM's ruling "
|
| 293 |
+
"and the evidence they cite β and the current strategy configuration is versioned, so the fund's entire "
|
| 294 |
+
"decision history is auditable. **AI proposes and judges; validated evidence admits; code enforces.**")
|
| 295 |
with gr.Tabs():
|
| 296 |
with gr.Tab("π Live account"):
|
| 297 |
stats = gr.Markdown()
|
|
|
|
| 307 |
updated = gr.Markdown("_loadingβ¦_")
|
| 308 |
btn = gr.Button("β» Refresh now", scale=0)
|
| 309 |
with gr.Tab("π Rebalance preview"):
|
| 310 |
+
gr.Markdown("What the deterministic engine **would** trade right now β the live target portfolio from the "
|
| 311 |
+
"current (versioned) strategy config, diffed against the account. Display only: orders are placed "
|
| 312 |
+
"solely by the scheduled Monday agent, inside its guardrails.")
|
| 313 |
pv_banner = gr.Markdown()
|
| 314 |
pbtn = gr.Button("β³ Recompute preview", scale=0)
|
| 315 |
with gr.Row():
|