Skip to main content

jgt-pricedb

The persistence layer of the next-generation Price Service: bars live in a database with an incremental, anchor-based refresh — CSV files become an export, not the source of truth.

Lineage: implementation of the PDSP specifications reverse-engineered from the Caishen .NET stack — caishen/rispecs/PDSP/ (specs 70–77) — translated into the jgt ecosystem's shapes.

Structural Tension

  • Current reality: price data as flat CSVs ($JGTPY_DATA/pds/<INSTR>_<TF>.csv); every refresh rewrites whole files and downstream recomputes whole series.
  • Desired state: a database-backed store where refresh finds the anchor (the single forming bar per series) and writes only forward; downstream learns which bar changed and computes incrementally.

Decisions

  • Periods are cut on the broker's trading session, not on UTC midnight (0.1.1). The feed publishes H4, D1, W1 and M1 bars on a 17:00 America/New_York boundary — 21:00Z in summer, 22:00Z in winter — so a UTC grid renamed 100% of them, silently. m1..H1 stay on UTC, where they measurably already were. The session is stated per market, resolved inside bar_key, and recorded on the series; tests/test_session_grid.py is the measurement, run against the real holdings. See rispecs/01-price-store.spec.md, The Session Grid.
  • Portable schema (SQLite for local-first dev, PostgreSQL for deployment); the anchor invariant is enforced by a partial unique index (UNIQUE(series_id) WHERE is_forming), not by application discipline.
  • No standalone importer. Backfill is the refresh engine's bootstrap path (PDSP spec 72, Algorithm C) fed by a source adapter. CsvSource reads the existing full/ CSVs through the exact same upsert path as BrokerSource live updates. The system can always rebuild itself from its own sources.
  • CSV compatibility export (PDSP spec 75 pattern): consumers (jgtpy, jgtml, jgt-data-server) keep reading the same file paths while the database becomes authoritative underneath. Nothing breaks on day one.
  • Redis pub/sub (already in the jgt-data-server stack) carries bar-completed events in Phase 4 — the role Rebus/MSMQ played in Caishen.
  • pyproject.toml with a static version — deliberately avoiding the setup.py circular-import pattern that blocks other jgt packages from installing in containers.

Phases

Phase Creates PDSP spec
1 Schema + store core + bootstrap-backfill through source adapters 70, 71, 72
2 Refresh CLI (jgtpdscli) replacing refresh_data.sh 72, 74
3 CSV export bridge — DB authoritative, downstream untouched 75
4 Redis events → incremental IDS/CDS recompute 73, 77
5 Serving from DB; indicator tables; strategy layer (SpiderDb heir) 76

Layout

  • rispecs/ — jgt-native specifications (the buildable truth; start here)
  • src/jgtpricedb/ — the library
  • docker-compose.yml — optional Postgres for deployment; SQLite needs nothing

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jgtpricedb-0.1.1.tar.gz (95.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jgtpricedb-0.1.1-py3-none-any.whl (41.9 kB view details)

Uploaded Python 3

File details

Details for the file jgtpricedb-0.1.1.tar.gz.

File metadata

  • Download URL: jgtpricedb-0.1.1.tar.gz
  • Upload date:
  • Size: 95.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for jgtpricedb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cb5f990252603ce9bb48f2d3e3c7d906b40e87cc3dafdd95c7b4ee93a6d2c431
MD5 619720abbd8f42292e4655b18868afa3
BLAKE2b-256 b5c78597952f97346e8e1e0e562bce055b1e0ac40e1633f1a4474a96b3201788

See more details on using hashes here.

File details

Details for the file jgtpricedb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: jgtpricedb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for jgtpricedb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b1b7d7788c82ec183138b8c7d26f8850702c9690bc97fcb20bbedc78eb0d20a7
MD5 20daf3fe357ad00126ccdf5644cfd7fb
BLAKE2b-256 20d2a9b6a6eab8d26fa779595f3c5e14ff5056f7befd3c8c8bb69bd6c5bc7cd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page