Example data
The Deephaven TradingView Lightweight package includes several built-in, deterministically generated tables for testing and example code. Each function returns a fresh deephaven.table.Table whose values are produced by closed-form expressions (no random data), so snapshot tests stay stable across runs.
Import the module under the tvl alias and call any of the functions below. Every chart-type page in this documentation builds its examples on these fixtures.
ohlc
A 90-row daily OHLCV table with a precomputed Ema column. Each row is one trading day starting 2024-01-01; Open / High / Low / Close follow a smoothed random walk around 100, Volume is correlated with the per-bar move, and Ema is a 20-tick EMA of Close for overlay examples. Designed for the candlestick and bar chart examples.
Each row represents one trading day starting 2024-01-01. The price path is a smoothed random walk (windowed cumulative sum of Gaussian log-returns plus an EMA), giving visible trends and reversals instead of a pure sine. High/Low straddle Open/Close by an absolute-Gaussian intra-bar range, and volume swells with absolute return so big moves print big bars.
Returns: A deephaven.table.Table with columns Timestamp (Instant): daily timestamps from 2024-01-01.
Open (double): opening price.
High (double): high price, ≥ max(Open, Close).
Low (double): low price, ≤ min(Open, Close).
Close (double): closing price.
Volume (long): bar volume; correlates with return.
Ema (double): 20-tick EMA of Close, for overlay examples.
Index (long): incrementing row counter, for row-position formulas.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), the seed block is followed by one new candle per second. If false, only the static seed is returned. |
stocks
A 120-row multi-symbol trade-style table. Three symbols (AAA, BBB, CCC) are interleaved round-robin via ii % 3, each with its own sine-wave price curve so by-grouped examples produce visually distinct series. Designed for the line / area / baseline “by group” examples.
Three symbols (AAA, BBB, CCC) tick in round-robin. Each symbol has an independent random walk anchored at a distinct base price (90, 140, 60) with its own volatility, so by-grouped chart examples (line/area/baseline) show three visually distinct series.
Returns: A deephaven.table.Table with columns Timestamp (Instant): daily timestamps from 2024-01-01.
Sym (string): one of "AAA", "BBB", "CCC".
Price (double): symbol-dependent price walk.
Size (long): trade size; lognormal-ish, ~100 +/- 50.
Index (long): incrementing row counter, for row-position formulas.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), trades tick in once per second after an initial 120-row seed. If false, only the static seed is returned. |
volume
A 60-row single-column volume series. One row per day from 2024-01-01, with Volume around 1000 ± 300 via overlapping sines. Designed for the histogram chart examples where a single value column is plotted against time.
Designed for the histogram example. The volume curve is a lognormal base scaled by a weekday-of-week factor (Mondays/Fridays heavier), so the histogram has visible structure beyond pure noise.
Returns: A deephaven.table.Table with columns Timestamp (Instant): daily timestamps from 2024-01-01.
Volume (long): daily volume, lognormal w/ weekly seasonality.
Index (long): incrementing row counter, for row-position formulas.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), one new bar ticks in per second after the 60-row seed. If false, only the static seed is returned. |
yields
An 11-point yield-curve snapshot. Tenors follow the canonical Treasury set (3M, 6M, 1Y, 2Y, 3Y, 5Y, 7Y, 10Y, 20Y, 30Y, 40Y) and are emitted in months (3, 6, 12, 24, 36, 60, 84, 120, 240, 360, 480). The unit LWC’s yield-curve axis expects. The Yield column follows a smooth concave curve that rises quickly at the short end, peaks in the belly, and tapers off. Designed for the yield_curve chart examples.
In ticking mode a single replacement curve emits each second with the factors perturbed by small Gaussians, so the chart redraws a slowly drifting curve over time. last_by("Tenor") keeps the row count flat.
Returns: A deephaven.table.Table with columns Tenor (double): months to maturity.
Yield (double): yield in percent.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), the curve updates once per second. If false, a single static snapshot is returned. |
options_chain
A 21-row symmetric options-chain snapshot. Strikes step by 5 from 50 to 150 (at-the-money = 100). Call and put prices follow a simplified intrinsic-plus-time-value shape so the typical “X” pattern of the options chart is visible. Designed for the options_chart examples.
In ticking mode the chain refreshes every second with the spot drifting via a smoothed random walk, so the smile and intrinsic legs slide together.
Returns: A deephaven.table.Table with columns Strike (double): strike price, 50..150 by 5.
CallBid (double): call bid price.
CallAsk (double): call ask price.
PutBid (double): put bid price.
PutAsk (double): put ask price.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), the chain refreshes once per second. If false, a single static snapshot at spot=100 is returned. |
values
A 90-row single-value time series. One row per day from 2024-01-01, with Value oscillating around 100 via two superimposed sines. Designed for the simplest line / area / baseline / histogram example pages where you want a single column over time.
Designed for the simplest line/area/baseline/histogram example pages. The series is a smoothed random walk (Gaussian steps + EMA), so it has runs, reversals, and consolidations — readable shape but not pure noise.
Returns: A deephaven.table.Table with columns Timestamp (Instant): daily timestamps from 2024-01-01.
Value (double): smoothed walk centered at ~100.
Index (long): incrementing row counter, for row-position formulas.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), one new sample ticks in per second after the 90-row seed. If false, only the static seed is returned. |
large_prices
A 1,000,000-row intraday price series spanning ~10 years. Timestamps step uniformly (~315 seconds per row) starting 2020-01-01; the price curve is a low-frequency sine plus a higher-frequency wiggle, giving the downsampler something visually meaningful to thin out. Designed for the downsampling and large-data examples.
Timestamps step uniformly so 1M rows cover ~10 years (~315 seconds per row). The price curve combines a low-frequency drift (cumulative sum of small Gaussians) with a higher-frequency wiggle, giving the downsampler structure to thin without making the chart look noisy.
Returns: A deephaven.table.Table with columns Timestamp (Instant): ~315-second spaced timestamps from 2020-01-01.
Price (double): smoothed walk centered at ~100.
Index (long): incrementing row counter, for row-position formulas.
| Parameters | Type | Default | Description |
|---|---|---|---|
| ticking | bool | True | If true (default), additional rows tick in once per second after the 1M-row seed. If false, only the static seed is returned. Note that 1M static + ticking is a large table — prefer ticking=False for the downsample comparison demo. |