Skip to content

Feature request: TV-parity continuous-contract data source for futures #60

@Zombajo

Description

@Zombajo

Summary

For futures strategies, PyneCore users currently have to choose between:

  1. Raw per-contract Databento data, which jumps at roll boundaries and is not what TV charts show.
  2. Databento's pre-stitched .c.0 continuous feed, which uses a documented ratio/difference adjustment that does not match TradingView's proprietary continuous-contract algorithm (offset ~700 points on NQ vs CME_MINI:NQ1!).

Either choice produces a price level mismatch vs TV. For ratio-based indicators that combine close with a moving average of close — BBW = 2*stdev(close,9)/sma(close,9), PMAR = close/vwma(close,20) — the ~700pt offset between TV's continuous and Databento's specific contract cascades into ~3pct BBW divergence and 7-10 absolute points of BBWP / PMARP percentile drift. That in turn produces ~19-24pct trade-level filter disagreement when running the same Pine source on TV vs PyneCore.

We solved this on our side with the reconstruction algorithm below (Apache-2.0, ~300 lines of Python over raw Databento stype_in: parent data). It would be natural for PyneCore to offer this as a first-class data source so users don't have to maintain a parallel reconstruction pipeline.

The reconstruction algorithm (Apache-2.0, freely usable)

Repo path: research/data/reconstruction/generate_tradingview_parity_contract.py in https://github.com/Zombajo/sanesignals-algotrading.
Doc path: METHODOLOGY/15_CONTINUOUS_CONTRACT_RECONSTRUCTION.md in the same repo.

Three steps:

  1. Volume-dominance rollover detection. For each consecutive contract pair (current, next): on each trading day where both have volume, if daily_volume(next) > daily_volume(current), ROLL on that day. TV's exact trigger appears to be volume dominance — confirmed empirically by matching roll dates to TV's continuous front-month over a 16-year sample.

  2. Chicago Central Time session boundaries for the daily-volume aggregation. Globex trading day starts 17:00 CT (previous calendar day). session_date = (timestamp_CT - 17 hours).normalize(). UTC aggregation produces 1-2 day roll-date offsets that compound at high-volume rollovers.

  3. Additive backward adjustment. At each roll, gap = close(new_contract, roll_day) - close(old_contract, roll_day); all bars before the roll get +gap added to OHLC; gaps compound backward in time.

Validation results (NQ, 16 years)

Metric Value
Open price offset vs TV ~2 points (constant)
Close price offset vs TV Variable, sub-bar
BBWP impact of residual < 0.01 percentile points
PMARP impact of residual < 0.001 percentile points
Verdict PARITY_APPROXIMATE — close enough for indicator reconciliation

After applying this reconstruction:

  • NQ Edge+ Phase 2 (BBWP filter alone): TV PF and PyneCore PF reconcile to $0.00 median delta on matched trade samples.
  • NQ Edge+ Phase 3 (PMARP filter alone): same outcome.

Why a built-in would help

Right now, every futures-strategy user who wants TV parity has to maintain their own reconstruction pipeline. That includes acquiring raw per-contract Databento data, running the volume-dominance roll detector, and applying additive backward-adjustment. It's a one-time problem to solve, and the result is reusable — having it as a native PyneCore data source would let strategy authors just declare the symbol with PyneCore handling the reconstruction transparently, the way TV does.

Suggested implementation surface

  • New provider option, e.g. databento.continuous(symbol="NQ", method="volume_dominance_backadjusted"), that takes raw per-contract data and returns a reconstructed series.
  • Or: integrate as a post-processing step in the existing pyne data convert-from CLI when an explicit --continuous-method tv_parity flag is set.

We are happy to:

  • Open a draft PR porting the script into PyneCore's providers/ layout.
  • Share the 16-year NQ validation dataset for the maintainers' own roll-date diff sanity-check.
  • Document the algorithm in the PyneCore docs site.

Environment

  • PyneCore version: 6.4.8
  • Instrument tested: NQ (CME_MINI:NQ1! on TV)
  • Other instruments at parity-pending status: ES, CL, GC, SI, HG, ZB, YM, RTY

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions