Skip to content

The series domain: published readings that are not prices, built from TradingView raw files (0.3.0) - #31

Merged
mspinola merged 1 commit into
mainfrom
claude/series-domain-tradingview
Sep 17, 2026
Merged

mspinola merged 1 commit into
mainfrom
claude/series-domain-tradingview

Conversation

@mspinola

Copy link
Copy Markdown
Owner

Summary

Step 4 of the order of work in cot-analyzer's docs/design/tradingview-breadth-scoping.md: the series domain and the TradingView build step. Closes Part B of docs/design/breadth-domain-scoping.md with a different vendor than it planned.

  • A third domain. series holds daily vendor readings with no price behind them (FOMO share, new-highs/lows counts, put/call ratios). One tier, raw, stored flat like equities and served as-is; Close is the reading. get_bars refuses price tiers and asof= with messages naming why. available, coverage_gaps, provenance work unchanged.
  • Registry. PRICE_SOURCES gains tradingview (never defaulted, like cboe); Symbol gains tradingview, kind (percent | count | ratio) and anchors. Series symbols default no Yahoo or Norgate ticker, so no other producer can claim them (checked: the Yahoo producer filters on s.yahoo). Eleven entries; NASDAQ_ is the Composite, the FOMO script's universe. NASDAQ_FOMO_5D carries anchors 48.05 (2026-07-29, the EDGE report) and 32.23 (2026-09-16, box and Mac identical).
  • Producer, stage 2 only. providers/tradingview.py builds from raw JSON a Claude Code Desktop local routine on the Windows box writes verbatim under _raw/tradingview/ (outside both syncs already). Guards, each refusing by file and bar and writing nothing: JSON shape and symbol; overlap agreement with the store and between files (the store is never rewritten); range by kind; strictly increasing stamps; registry anchors; a session gate (latest weekday past 16:30 ET) so a stale pull exits non-zero and the routine's second run retries.
  • CLI. --build-tradingview, --expect-session YYYY-MM-DD|none; --bars --domain series is refused rather than silently doing nothing.
  • Version 0.2.0 → 0.3.0. README gains the domain row and a paragraph.

Test plan

  • tests/test_series_domain.py (8) and tests/test_tradingview_build.py (34): the fixture is the box's ten-bar INDEX:NCFD file; every guard has a case that also checks nothing was written; expected-session pinned across the week and the close; CLI exit codes.
  • Full suite offline: 299 passed, 14 skipped (network). One pre-existing invariant (every tier stored or derived) caught the first cut and shaped the tier tables.
  • ruff check src tests clean at 0.15.22.
  • Next on the box: run-series.cmd, the routine instructions and allow rules, the backfill, and the verifier's freshness row (step 5 of the scoping doc).

🤖 Generated with Claude Code

… TradingView raw files (0.3.0)

A third domain beside equities and futures, for daily vendor readings with no
price behind them: the share of Nasdaq stocks above their 5-day average (the
AGI "FOMO" read), counts of new 52-week highs and lows, the Cboe put/call
ratios. Nothing adjusts them, so the domain has one tier, `raw`, which is the
stored frame; `Close` is the reading. Scoping: docs/design/
breadth-domain-scoping.md (Part B, now landed with a different vendor) and
cot-analyzer's docs/design/tradingview-breadth-scoping.md.

Registry: DOMAINS gains "series", PRICE_SOURCES gains "tradingview" (never
defaulted, like cboe), Symbol gains `tradingview`, `kind` (percent | count |
ratio, which fixes the validated range) and `anchors` (published readings the
build re-verifies). Series symbols default no Yahoo or Norgate ticker, so no
other producer can claim them. Eleven entries under Market Breadth and Options
Sentiment; NASDAQ_ means the Composite, the FOMO script's universe, not the
100. NASDAQ_FOMO_5D carries two anchors: 48.05 on 2026-07-29 (the EDGE report's
printed reading) and 32.23 on 2026-09-16 (pulled after the close on the
producer box and on a Mac, identical).

Tiers: DOMAIN_TIERS["series"] = ("raw",), stored flat like equities, derived
as the identity so the stored-or-derived partition stays total. Reader:
get_bars serves the frame as-is, refuses price tiers with a message naming
the domain, and refuses asof= (a published reading does not restate; end=
says what a vintage would say). available(), coverage_gaps and provenance
work unchanged.

Producer: providers/tradingview.py, stage 2 only. TradingView has no data
API; the feed reaches this stack through a claude.ai connector, so stage 1
is a Claude Code Desktop local routine on the Windows box writing the
connector's results verbatim under _raw/tradingview/<symbol>/<date>.json
(producer-internal, outside both syncs, which already exclude _raw). The
build reads only those files and refuses, naming the file and the bar:

- a file that is not the connector's JSON, or names another symbol or
  interval;
- any bar that overlaps the store and differs in Close (the store is never
  rewritten; a vendor restatement or a transcription slip is a human's to
  resolve), and any bar two raw files disagree on;
- values outside the kind's range, non-integer counts, non-positive ratios,
  non-increasing stamps, two bars on one session;
- an anchor that does not match;
- a newest bar older than the expected session (the latest weekday whose
  16:30 ET close has passed), with nothing written: the routine's second
  run is the retry. Exchange holidays are not modelled and are documented.

CLI: --build-tradingview and --expect-session (a date, or "none" for old
files); --bars --domain series is refused rather than silently doing nothing.
Session dates are the Eastern date of the vendor's open stamp.

Tests: the fixture is the ten-bar INDEX:NCFD file the routine wrote on the
box on 2026-09-16; every guard has a case that also checks nothing was
written; the expected-session rule is pinned across the week and the close;
the CLI exit codes follow the result.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mspinola
mspinola merged commit 5194553 into main Sep 17, 2026
5 checks passed
@mspinola
mspinola deleted the claude/series-domain-tradingview branch September 17, 2026 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant