Skip to content

JoeWat2005/assetframe-scripts

Repository files navigation

AssetFrame — engine (assetframe-script)

The AssetFrame forecast engine: market data → analysis → AI research brief → deterministic compiler → confidence → report → scoring → append‑only ledger → publish. It pairs with assetframe-infra (the Next.js site + Clerk auth, Neon, R2, Lemon Squeezy). This repo writes; the website reads.

Two‑repo architecture

Repo Owns
assetframe-script (this) Python engine + the publish chain — generation, scoring, the ledger, and writing to R2 + Neon.
assetframe-infra The website + infra — auth, billing, the DB schema (migrations), and reading R2/Neon to serve users.

They share R2 (report files) and Neon (tables) — no shared code. The contract:

  • R2 — private bucket, key format <date>/<slug>/<file> (free/pro × html/pdf, plus preview.png).
  • Neon — the engine INSERTs, the web SELECTs: editions, open_calls, open_call_predictions, scored_results (id format AF-YYYYMMDD-<SLUG> / report_ref). Schema migrations live in assetframe-infra; the engine only inserts data.
  • Enumsscripts/taxonomy.py (confidence buckets / asset classes) is mirrored in the infra repo's web/lib/content.ts. Keep the two in sync.

Setup

pip install -r requirements.txt     # fpdf2 (PDF), pymupdf (preview)
pip install boto3                   # only for publish.py (R2 upload)
npm install                         # @neondatabase/serverless, for sync-db.mjs
cp .env.example .env                # fill R2_*, DATABASE_URL[_DEV], EODHD/ANTHROPIC

Daily run (the scheduler decides; Claude only writes/criticises)

python scripts/validate_config.py                # validate config/assets.json
python scripts/run_daily.py --mode dry_run       # resolve today's DUE assets, write nothing
python scripts/run_daily.py --mode score_only    # score closed windows + refresh memory (idempotent)
python scripts/run_daily.py --mode generate_only # generate due assets

Modes: dry_run | score_only | generate_only | production (Phase 2 adds approval). Scope with --asset <id> or --asset-class fx. Run manifests land in runs/<date>/run_manifest.json.

Publish chain (engine → site)

python scripts/export_content.py    # -> content/catalog.json + content/track-record.json
python scripts/publish.py           # -> uploads report files to R2
npm run sync-db                     # -> writes editions + track record into Neon (both branches)

data/, reports/, content/, runs/ are gitignored working artifacts (regenerated each run). The append‑only ledger/outcome_ledger.csv is the tracked source of truth.

Tests

for t in scripts/test_*.py; do python "$t"; done                 # bash / CI
Get-ChildItem scripts\test_*.py | ForEach-Object { python $_.FullName }   # PowerShell

The full report pipeline is documented in .claude/skills/mvp/SKILL.md. Decision‑support only — not regulated financial advice; no auto‑trading; no auto‑publish (a human approval gate gates every report before it goes live on the site).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors