Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/pages-dashboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy Quant Dashboard (GitHub Pages)

on:
push:
branches: [main]
paths:
- 'frontend/github-pages/**'
- 'lean-cli/docs/**'
- 'research/data/**'
- 'services/ingestion/sample_*_snapshot.json'
- '.github/workflows/pages-dashboard.yml'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Sync dashboard data
run: bash frontend/github-pages/scripts/sync_data.sh

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: frontend/github-pages

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ infra/.env
# LEAN heavy data/artifacts
lean-cli/data/
lean-cli/backtests/
lean-cli/**/backtests/
lean-cli/.cache/
lean/data/
lean/logs/
Expand Down
75 changes: 39 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
# MultiClaw-Quant-Tools 📈🦞
# MultiClaw Quant Tools

[![Quant Quality Gate](https://github.com/AIML-Solutions/MultiClaw-quant-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/AIML-Solutions/MultiClaw-quant-tools/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-22c55e.svg)](LICENSE)

**MultiClaw-Quant-Tools** is AIML Solutions’ quantitative engineering lane for market data, derivatives analytics, and strategy infrastructure.
Quant engineering stack for paper-trading strategy research, execution-model realism, and Claw-native automation workflows.

## What this repo does
## Current focus (last 3 months)

- Executes LEAN backtests and strategy research workflows
- Ingests structured market/derivatives outputs into PostgreSQL
- Exposes query surfaces through GraphQL and JSON-RPC
- Provides hooks for MCP-enabled agent tooling
- Supports options/greeks analytics and scenario research
- Regime-specialist execution rollouts across strategy sleeves
- Nonlinear market-impact and liquidity-aware sizing controls
- Validation discipline upgrades (walk-forward and stress-first workflow)
- Claw-integrated repo operations and automation cadence

## Current implementation highlights
## What this repository does

- LEAN authenticated with baseline backtest validated
- Postgres + Hasura + Qdrant stack operational
- Backtest summary ingestion to Postgres verified
- GraphQL query path verified
- Market-hours and data-source mapping documented
- Runs LEAN strategy research and backtest workflows
- Maintains options/greeks and statarb strategy implementations
- Provides ingestion + query surfaces (GraphQL/JSON-RPC scaffolds)
- Supports operational docs and runbooks for repeatable quant workflows

## Key documents
## Strategy lanes

- [docs/architecture.md](docs/architecture.md)
- [docs/runbook.md](docs/runbook.md)
- [docs/data-sources-and-market-hours.md](docs/data-sources-and-market-hours.md)
- [docs/DATA_PIPELINE_SPEC.md](docs/DATA_PIPELINE_SPEC.md)
- [docs/OPTIONS_GREEKS_PLAYBOOK.md](docs/OPTIONS_GREEKS_PLAYBOOK.md)
- [docs/graphql-examples.md](docs/graphql-examples.md)
- [docs/ROADMAP.md](docs/ROADMAP.md)
- `lean-cli/baseline-strategy/` — trend sleeve foundation
- `lean-cli/regime-ensemble-alpha/` — allocator with regime controls
- `lean-cli/statarb-spread-engine/` — spread mean-reversion engine
- `lean-cli/options-greeks-vix/` — options/volatility execution lane
- `lean-cli/anchored-vwap-sleeve/` — cross-asset AVWAP sleeve

## Core docs

- `lean-cli/ALGO_SYSTEM_ROADMAP.md`
- `docs/architecture.md`
- `docs/runbook.md`
- `docs/graphql-examples.md`
- `docs/ROADMAP.md`

## Quick start

Expand All @@ -38,31 +42,30 @@
lean login
lean whoami

# bring up infra
# infra bootstrap
cd infra
cp .env.example .env
docker compose up -d

# run baseline local backtest
# run a local smoke backtest
cd ../lean-cli
lean backtest "baseline-strategy" --no-update
```

## Directory map
## Standards

- `lean-cli/` — LEAN projects + generated backtests
- `lean/` — setup + ingestion scripts
- `infra/` — compose + schema bootstrap
- `services/validation/` — Pydantic models
- `services/rpc/` — JSON-RPC scaffold
- `services/mcp/` — MCP integration notes
- `services/options-greeks/` — pricing framework notes
- `services/blockchain/` — cross-lane chain analytics bridge
Every strategy change should pass this gate:
1. design rationale
2. code implementation
3. structural validation
4. stress-aware performance checks

## Contributing
## Security & usage

See [CONTRIBUTING.md](CONTRIBUTING.md).
- Paper-trading/research use only
- Never commit secrets
- Review external integrations before enabling write permissions

## License

MIT — see [LICENSE](LICENSE).
MIT — see `LICENSE`.
53 changes: 53 additions & 0 deletions docs/MULTIAGENT_OPERATING_MODEL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Multi-Agent Operating Model (Quant Platform)

## Objective
Use specialized agents to speed up iteration without losing rigor or auditability.

## Agent Roles

1. **Data Agent**
- Owns ingestion jobs, schema validation, data quality checks.
- Produces freshness/gap reports and replay artifacts.

2. **Strategy Agent**
- Owns sleeve code changes and signal logic.
- Must attach matrix + walk-forward evidence for every strategy PR.

3. **Execution Agent**
- Owns paper-trade connectors, order-state safety, slippage realism.
- Validates fill semantics and risk controls.

4. **Research Agent**
- Owns paper curation and hypothesis queue.
- Delivers token-efficient digest updates and evidence mapping.

5. **Governance Agent**
- Owns repo health, CI policies, branch protection, changelog quality.
- Runs org audit scripts and tracks risk score deltas.

## Hand-off Contract
Every agent hand-off must include:
- objective,
- changed files,
- reproducible command list,
- artifact output paths,
- known caveats.

## Definition of Done (DoD)
A strategy change is only done if all are present:
1. Matrix run artifact
2. Walk-forward artifact
3. Data quality statement
4. Risk/cost caveats
5. PR summary with exact file paths

## Escalation Rules
- If OOS net <= 0 in >= 2 windows: sleeve marked **candidate off**.
- If data requests failure > 2%: no new alpha claims until resolved.
- If CI/governance risk score rises: freeze merges except remediation.

## Cadence
- Daily: data freshness + paper snapshot checks
- 2-3x weekly: strategy matrix reruns for active sleeves
- Weekly: walk-forward and allocator refresh
- Monthly: governance + security hardening review
48 changes: 48 additions & 0 deletions docs/PHASE4_PLATFORM_EXPANSION_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Phase 4 Platform Expansion Plan

## User goals addressed
- Strong quantitative strategy system with valid evaluation
- Execution + data ingest/transform/access tooling
- Secure VPS operations
- Move toward multi-agent operating model
- Interactive GitHub Pages frontend for strategy/portfolio/report visibility
- Token-efficient research loop (ArXiv and beyond)
- On-chain transaction tracing + Solidity analysis lane

## What is implemented now

### Quant strategy/eval lane
- Reproducible matrix, tuning, OOS, walk-forward, allocator, run ledger scripts.
- Methodology validity and data quality reports committed.

### Data tooling
- Ingestion runners + validation layer + new Phase 4 cycle runner.
- Added preflight script with auth-level DB check.

### Research tooling (token-efficient)
- `research/scripts/update_arxiv_digest.py` (no LLM usage; metadata scoring).
- ArXiv topic config and ranked digest outputs.

### Frontend
- New GitHub Pages dashboard scaffold:
- `frontend/github-pages/index.html`
- `frontend/github-pages/app.js`
- `frontend/github-pages/scripts/sync_data.sh`
- GitHub Actions Pages deploy workflow.

### Blockchain lane
- Ethereum tx tracer script (RPC-driven; optional debug trace).
- Bitcoin tx flow tracer script (Blockstream API).
- Solidity static risk scanner.
- Hardhat contract introspection script.

## Immediate blockers
1. Postgres credential mismatch for ingestion user (`quant`) causing write failures.
2. Expanded remote LEAN data download blocked until QC org data terms accepted.

## Next execution order
1. Fix DB auth and re-run full ingestion cycle.
2. Accept QC terms and run expanded data pull.
3. Re-run Phase 3 matrix/walk-forward on expanded data horizon.
4. Add confidence intervals + cost stress framework.
5. Promote only sleeves that pass robustness thresholds.
20 changes: 20 additions & 0 deletions docs/RECENT_CLAW_FOCUS_Q1_2026.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Recent Claw Focus — Q1 2026

## Summary
This document tracks the most recent quarter's Claw-related engineering priorities and execution outcomes for quant systems.

## Priority themes
- Execution realism before alpha expansion
- Regime-specialist policy behavior
- Sequential, gated implementation workflow
- Operational recency and documentation hygiene

## Delivered outcomes
- Strategy sleeves upgraded with improved execution controls
- Validation workflow shifted toward stress-aware methodology
- Repo presentation and structure refreshed for clarity and auditability

## Next quarter focus
- Reality-gap simulator hardening
- Overfit diagnostics and walk-forward rigor
- Portfolio intelligence surface (GraphQL + dashboard)
54 changes: 43 additions & 11 deletions docs/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
# MultiClaw Quant Roadmap

## Phase 1 — Proven baseline (in progress)
## Phase 1 — Proven baseline (complete)
- [x] LEAN setup and authenticated execution
- [x] Baseline backtest run and artifact generation
- [x] Postgres + Hasura + Qdrant stack online
- [x] Backtest summary ingestion + GraphQL query validation

## Phase 2 — Data productization
- [ ] Robust ingestion for bars/options/index options/futures
- [ ] Continuous greeks snapshot pipeline
- [ ] Data quality checks with alerting
- [ ] Idempotent replay/recovery tooling
## Phase 2 — Data productization (in progress)
- [x] Multi-source ingestion skeleton (equities/options/crypto/macro)
- [x] Pydantic validation layer for ingest payloads
- [x] Replayable ingestion shell runners
- [ ] Continuous, monitored quality checks + alerting
- [ ] Idempotent replay/recovery with quarantine reprocess UI

## Phase 3 — Strategy intelligence
- [ ] Regime-aware signal library
- [ ] Scenario engine and stress testing APIs
- [ ] Portfolio/risk dashboards with near real-time updates
- [ ] Research-to-production model lifecycle integration with MLflow
## Phase 3 — Strategy intelligence (in progress)
- [x] Sleeve set: baseline/regime/statarb/options/anchored-vwap
- [x] Reproducible matrix scripts
- [x] Walk-forward stability scripts
- [x] Methodology validity report + caveats
- [ ] Cost-stress confidence intervals and bootstrap significance
- [ ] Expanded data horizon (post-2021, pending QC terms acceptance)

## Phase 4 — Production quant platform hardening (active)
- [x] Org GitHub governance baseline (branch protection + CI hygiene)
- [x] Multi-repo health audit tooling
- [x] Phase 3 infra hardening in OpenClaw fallback model chain
- [ ] VPS hardening scorecard automation (OS patching/firewall/least-privilege)
- [ ] Unified run ledger: backtest + paper-trade + improvement lineage graph
- [ ] Multi-agent orchestration playbook and role contracts

## Phase 5 — Execution & observability product
- [ ] GitHub Pages interactive dashboard for:
- strategy roster + code links
- latest matrix/walk-forward metrics
- paper portfolio snapshots
- run logs and analysis changelog
- [ ] RPC/GraphQL endpoints powering dashboard with signed read-only access
- [ ] Nightly/weekly report generation with provenance hashes

## Phase 6 — On-chain alpha lane (BTC/ETH)
- [ ] Ethereum transaction tracing toolkit (receipt/log/call-trace support)
- [ ] Bitcoin UTXO flow tracing toolkit
- [ ] Solidity static risk scanner + Hardhat introspection workflow
- [ ] Event-driven on-chain feature extraction for quant models

## Phase 7 — Token-efficient research machine
- [ ] ArXiv/SSRN digest updater with topic scoring and dedup
- [ ] Minimal-token abstract triage and backlog ranking
- [ ] Strategy-to-paper mapping and evidence matrix
- [ ] Auto-generated “research changed what in code?” traceability notes
49 changes: 49 additions & 0 deletions docs/VPS_HARDENING_AND_OPERATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# VPS Hardening & Operations Checklist

## Current status (2026-03-28)

### OpenClaw
- Gateway running and reachable locally.
- Phase 3 fallback-chain hardening applied (small-model fallback removed).
- Remaining warning: reverse proxy trusted headers not configured (safe if local-only UI).

### Quant stack
- Strategy matrix / walk-forward / allocator pipelines operational.
- Ingestion lane scripts now use dynamic repo-root resolution (portable across paths).
- Phase 4 cycle runner available: `services/ingestion/run_phase4_cycle.sh`.

### Blocking issue
- Postgres auth mismatch for ingestion user `quant`.
- Symptom from preflight:
- `postgres_tcp_5432`: OK
- `postgres_auth_query`: FAIL (password authentication failed)

## Immediate fix sequence

1. Validate DB credentials in `infra/.env` + `.secrets`.
2. Test manually:
```bash
PGPASSWORD='<password>' psql -h 127.0.0.1 -U quant -d quant -c 'select 1;'
```
3. If invalid, rotate/reset user password in Postgres and update secrets source.
4. Re-run preflight:
```bash
bash services/ingestion/run_phase4_cycle.sh
```

## Security controls to enforce

- OS patching cadence (weekly, unattended upgrades where appropriate)
- UFW/NFT firewall: only required ports open
- SSH hardening: key-only auth, fail2ban, no root login
- Secrets policy: no plaintext secrets in repo; use env/secrets files with strict perms
- Backups: encrypted daily snapshots for DB + strategy artifacts
- Monitoring: basic process and disk alerts

## Operational cadence

- Daily: run Phase 4 cycle + inspect preflight + ingestion results
- 2-3x weekly: backtest matrix refresh
- Weekly: walk-forward + allocator refresh
- Weekly: `openclaw security audit --deep`
- Monthly: vulnerability scan + dependency upgrades
Loading
Loading