Skip to content

Adds live two-line UI, PoolTick telemetry, and vault stream adapter#1

Merged
monthviewsales merged 8 commits into
mainfrom
develop
Jan 22, 2026
Merged

Adds live two-line UI, PoolTick telemetry, and vault stream adapter#1
monthviewsales merged 8 commits into
mainfrom
develop

Conversation

@monthviewsales
Copy link
Copy Markdown
Collaborator

Summary

  • Adds a live two-line UI for real-time price display and a compact PoolTick summary line.
  • Introduces PoolTick telemetry: normalized per-tick JSON lines with reserves, rolling-window flow metrics, depth score, and a state label written to a log file.
  • Implements a pool state machine (with configurable MIN_QUOTE_SOL gating) to label pool activity (IDLE, IMPULSE, CONFIRMING, TRENDING, FAILED, THIN_OR_STALE).
  • Adds a vault stream adapter that supports both raw (base64) and parsed (jsonParsed) account encodings and resolves mint decimals when needed.
  • Provides rolling-window metrics (10s/60s/300s) for net quote flow and flow volume used by the state machine and telemetry.
  • Adds helper modules for mint-decimal caching, tick construction, tick logging, SPL layout decoding, and adapters used by live and snapshot flows.
  • Updates CLI flows to emit PoolTicks and to render the new live summary; documents new env vars and output in the README and bumps package version.

Why

  • Enables lightweight on-process analytics and state labeling for pools to detect impulses, trends, and failures.
  • Makes vault balance decoding robust to RPC encoding modes and missing decimals by resolving mints or using fallbacks.
  • Emits structured tick telemetry for downstream processing, easier debugging, and historical analysis.

Tests & docs

  • Adds unit tests covering mint decimals resolution, SPL layout decoding, rolling metrics, pool state machine behavior, tick construction, tick logging, and vault adapter streaming/snapshot behavior.
  • Updates README and sample env with new settings and documents the two-line live UI and PoolTick schema.

Notes

  • Introduces two new environment variables: VAULT_ENCODING (raw | parsed) and MIN_QUOTE_SOL (minimum quote reserve for state gating).
  • PoolTick lines are appended to a log file (configurable path) for offline consumption.
  • Version bumped to 1.1.0.

Checklist

  • Adds features for live analytics and telemetry
  • Adds unit tests for new modules
  • Updates documentation and sample env

Introduce a single abstraction boundary for vault balance streaming that normalizes updates and hides RPC encoding details.

Add a vault stream adapter plus local SPL decoding and an in-memory mint-decimals cache so the app can subscribe with base64 (raw) or jsonParsed (parsed) without pulling in new deps. Wire a VAULT_ENCODING env switch (defaults to raw and logs the default) into the live price path and tooling, seeding state from snapshots and then consuming normalized live updates.

Refactor streaming logic to use the adapter, preserve slot-sync and debounce behavior, and keep parsed-mode behavior unchanged. Update docs and add design notes about the approach.
Adds a normalized PoolTick event and a small analytics pipeline to produce per-pool telemetry.

Adds a PoolTick model and generator, a rolling-window metrics engine (10s/60s/300s) that computes net quote flow, flow volume and a deterministic depth score (log1p), and a logger that writes one JSON line per emitted tick to logs/poolTicks.log (handles bigint safely).

Wires tick creation into existing snapshot and live streaming paths for both AMM and pump sources, maps pump proxies for real reserves, computes staleness per pool, and attaches rolling metrics before logging. Preserves human-readable console output and existing decoding/streaming behavior and stays CommonJS.

Includes unit tests for the new telemetry pieces and vault adapters to validate decoding, caching and streaming behaviors.
Documents that the app emits a normalized PoolTick JSON object (one line per tick) to logs/poolTicks.log whenever a price line is printed (snapshot or live).
Specifies included fields: spot price, reserves, staleness, and rolling metrics (quote flow + depth score).
Clarifies logging format to enable consistent downstream analytics and ingestion.
Adds an optional filename option to the pool tick logger factory so callers can specify the log file location while keeping the original default.

Creates the parent directory for a provided log path at instantiation instead of eagerly creating a default logs directory at module load, avoiding side effects and enabling tests to use temporary files.

Updates tests to write to a temp log file rather than the repository logs directory.
Adds a deterministic per-pool state labeler that annotates PoolTick records with a state name, direction and concise reasons to make trading signals explainable and machine-consumable. Introduces a MIN_QUOTE_SOL environment variable (default 35) with parsing and startup validation, and logs the configured value.

Wires the state evaluator into tick handling so emitted PoolTicks include state metadata. Implements cooldown, warmup, thin/stale gates, impulse/confirm/trend logic with depth-scaled thresholds and concise reason strings. Adds unit tests covering min-quote gate, impulse->confirming, cooldown behavior, warmup, and missing-timestamp handling.

Also hardens rolling-window metrics: window sampling and readiness checks improved so metrics are null until sufficient history exists. Updates docs and .env.sample to document the new env var and PoolTick state output.

Improves observability and stability by preventing noisy labels on low-liquidity or stale pools and providing clear, reproducible state decisions for downstream analytics.
* analytics:
  Adds pool state machine with MIN_QUOTE_SOL gating
  Allows custom pool tick log path
  Adds pool tick logging note to README
  Adds PoolTick telemetry and rolling-window metrics
  Add vault stream adapter with raw/jsonParsed decoding
Adds a TTY live-renderer that prints a two-line in-place display: the existing price line plus a PoolTick summary showing state (with direction arrow), liquidity depth, 10s/60s flows, and staleness. Provides safe non-TTY fallback to plain logging.

Introduces small formatting helpers and a summary renderer that consumes the evaluated tick/state output. Wires the summary into the streaming code paths so the latest state line is kept in sync with price updates.

Updates documentation to describe the live UI and removes an obsolete planning doc.
@monthviewsales monthviewsales self-assigned this Jan 22, 2026
@monthviewsales monthviewsales added the enhancement New feature or request label Jan 22, 2026
@monthviewsales monthviewsales merged commit bfda290 into main Jan 22, 2026
@monthviewsales monthviewsales deleted the develop branch January 22, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant