Repository navigation
Architecture
SergeyGer edited this page Nov 23, 2026
·
3 revisions
TopoMarket is a single Python application with one shared analysis package. The Streamlit UI and the CLI call the same import, update and analysis functions; all data work is performed by the package, never by the UI directly.
app.py Streamlit entry point (delegates to topomarket.ui)
config/ demo and private profile configuration
src/topomarket/
cli.py command-line interface
profiles.py demo/private profile resolution and validation
data/
adapters/ seed-file adapters, raw hash registry, import pipeline
fetch.py fixed-source conditional HTTP fetch (Step 3)
refresh.py staging, validation, merge, atomic snapshots, recovery (Step 3)
normalized.py normalized table construction (sp500_daily, industries_daily, tda_daily)
schemas.py canonical schema contracts (columns, types, units)
manifest.py snapshot/manifest write, read and atomic replacement helpers
demo/ deterministic synthetic demo generator (seed 42)
topology/ topological feature placeholders (Steps 4-5)
evaluation/ label/alert/evaluation placeholders (Step 6)
ui/ dashboard selection/payloads/performance (Step 7); Streamlit shell in app.py
report.py data/import reports and validation helpers
tests/ unit, integration and opt-in private acceptance tests
.github/workflows/ ci, security, codeql, main-guard
| Component | Responsibility | Must not |
|---|---|---|
data/adapters |
Parse supplied source files/archives into canonical intermediate datasets; hash raw bytes; emit parser reports | Read private data from fixed paths; write into the repository |
data/normalized |
Build sp500_daily, industries_daily, tda_daily deterministically; enforce schema/units |
Fetch network data |
data/manifest |
Write/read manifests, hashes, snapshots; atomic replacement | Keep partial snapshots active |
demo |
Generate synthetic data with the same schema as the private pipeline | Download data; include private identifiers |
topology (Steps 4-5) |
Delay embeddings, persistence, scores, Mapper | Use future returns in feature computation |
evaluation (Step 6) |
Labels, episode matching, alert policy, metrics, uncertainty | Change frozen cutoffs after test evaluation |
ui |
Render data/analysis; select dates/members; trigger explicit user actions | Hold authoritative state or fetch providers directly |
cli |
Automation surface over the same package functions | Duplicate analysis logic |
seed files / refresh (Step 3) demo generator (seed 42)
| |
v v
adapters + raw hash registry synthetic tables
| |
+----------> normalized tables <-------+
|
v
snapshot + manifest (hashes, provenance, active pointer)
|
state/refresh_status.json, validators.json, snapshots/
|
v
analysis (topology, features, scores) [Steps 4-6]
|
v
alerts / evaluation / reports [Step 6]
|
v
four-screen Streamlit dashboard [Step 7 shipped]
- Causality: features and scores at close t use only observations known at t; the label horizon (next 20 sessions) is never used inside a feature window.
- Determinism: identical input bytes and configuration produce identical normalized tables and hashes; the demo generator is byte-deterministic for a fixed seed.
- Provenance: every published snapshot references raw input hashes, parser reports, generator version and schema version.
-
Offline demo: the
demoprofile needs no network, credentials or private inputs. - No private data in git: private seeds, snapshots and exports live outside the checkout and are ignored by git; CI scans tracked files.
-
Single source of truth for configuration: source URLs, analysis defaults and profile
metadata live in
config/; thresholds and evidence rules are frozen per evaluation run when Step 6 is implemented.
- Additional data sources implement the same adapter contract and report schema.
- Alternative topological/statistical methods plug into the evaluation interface and are compared on the same eligible dates with the same alert policy.
- The public demo can be hosted from the synthetic profile without credentials.