@pond-ts/charts 0.57.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +576 -0
- package/CHANGELOG.md +1213 -1
- package/dist/AreaChart.d.ts +12 -1
- package/dist/AreaChart.js +131 -13
- package/dist/BarChart.d.ts +56 -7
- package/dist/BarChart.js +263 -39
- package/dist/BarList.d.ts +85 -5
- package/dist/BarList.js +25 -4
- package/dist/BoxList.d.ts +70 -3
- package/dist/BoxList.js +21 -7
- package/dist/BoxPlot.d.ts +2 -1
- package/dist/BoxPlot.js +101 -9
- package/dist/Candlestick.d.ts +13 -1
- package/dist/Candlestick.js +89 -3
- package/dist/ChartContainer.d.ts +36 -48
- package/dist/ChartContainer.js +465 -59
- package/dist/ChartRow.d.ts +9 -2
- package/dist/ChartRow.js +176 -14
- package/dist/HeatMap.d.ts +176 -0
- package/dist/HeatMap.js +344 -0
- package/dist/Layers.d.ts +5 -1
- package/dist/Layers.js +1014 -253
- package/dist/Legend.js +8 -4
- package/dist/LineChart.d.ts +18 -1
- package/dist/LineChart.js +165 -4
- package/dist/ListTable.d.ts +30 -3
- package/dist/ListTable.js +381 -23
- package/dist/ScatterChart.d.ts +3 -2
- package/dist/ScatterChart.js +68 -4
- package/dist/XAxis.js +40 -22
- package/dist/YAxis.d.ts +58 -2
- package/dist/YAxis.js +3 -1
- package/dist/area.d.ts +34 -1
- package/dist/area.js +88 -1
- package/dist/bars.d.ts +67 -6
- package/dist/bars.js +250 -35
- package/dist/box.d.ts +2 -2
- package/dist/box.js +158 -40
- package/dist/brush.d.ts +142 -0
- package/dist/brush.js +179 -0
- package/dist/child-index.d.ts +27 -0
- package/dist/child-index.js +57 -0
- package/dist/context.d.ts +870 -39
- package/dist/cursors.d.ts +161 -0
- package/dist/cursors.js +503 -0
- package/dist/data.d.ts +38 -0
- package/dist/data.js +43 -0
- package/dist/decimate.d.ts +78 -1
- package/dist/decimate.js +157 -0
- package/dist/format.d.ts +15 -0
- package/dist/format.js +16 -1
- package/dist/heat.d.ts +163 -0
- package/dist/heat.js +659 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.js +27 -0
- package/dist/line.d.ts +137 -0
- package/dist/line.js +328 -0
- package/dist/ohlc.d.ts +16 -1
- package/dist/ohlc.js +93 -4
- package/dist/range.d.ts +14 -1
- package/dist/range.js +24 -3
- package/dist/scatter.d.ts +17 -9
- package/dist/scatter.js +221 -33
- package/dist/select.d.ts +13 -5
- package/dist/select.js +14 -6
- package/dist/selection-fixtures.d.ts +174 -0
- package/dist/selection-fixtures.js +569 -0
- package/dist/selection-stories.d.ts +73 -0
- package/dist/selection-stories.js +301 -0
- package/dist/selectors.d.ts +316 -0
- package/dist/selectors.js +391 -0
- package/dist/span.d.ts +122 -0
- package/dist/span.js +203 -0
- package/dist/sweep.d.ts +154 -0
- package/dist/sweep.js +282 -0
- package/dist/theme.d.ts +510 -5
- package/dist/theme.js +217 -41
- package/dist/tracker.d.ts +6 -0
- package/dist/tracker.js +6 -0
- package/dist/tradingAxis.fixture.d.ts +78 -0
- package/dist/tradingAxis.fixture.js +215 -0
- package/dist/useChartLegend.js +18 -3
- package/dist/yticks.d.ts +3 -0
- package/dist/yticks.js +104 -0
- package/package.json +6 -5
package/API.md
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
# API.md — public API map for agents
|
|
2
|
+
|
|
3
|
+
A fast-navigation map of every public export across pond's six packages,
|
|
4
|
+
written **for coding agents**. Use it to find the right primitive and the file
|
|
5
|
+
it lives in without crawling `src/`. It is a map, not a reference: one line per
|
|
6
|
+
export, grouped by purpose, with the source path. Verify exact signatures in
|
|
7
|
+
the listed source file (or the generated typedoc) before writing code against
|
|
8
|
+
them.
|
|
9
|
+
|
|
10
|
+
**This file ships inside every `pond-ts` / `@pond-ts/*` npm package**, so an
|
|
11
|
+
agent working in a consuming repo has the whole export surface locally — no
|
|
12
|
+
network, no crawling `node_modules/*/dist/*.d.ts`. Every package carries the
|
|
13
|
+
same monorepo-wide copy on purpose: the packages compose, so knowing what is
|
|
14
|
+
next door is the point.
|
|
15
|
+
|
|
16
|
+
- **Authority**: each package's `src/index.ts` is the export surface. If this
|
|
17
|
+
file and `index.ts` disagree, `index.ts` wins.
|
|
18
|
+
- **Source paths** (`packages/core/src/…`) are repo-relative. From a consuming
|
|
19
|
+
repo, read them on GitHub:
|
|
20
|
+
<https://github.com/pond-ts/pond/blob/main/>`<path>`.
|
|
21
|
+
- **Human-facing docs**: <https://pond-ts.org> — narrative guides, per-feature
|
|
22
|
+
reference, and generated typedoc per package. This file is the agent-facing
|
|
23
|
+
complement, not a replacement.
|
|
24
|
+
- **Contributing to pond itself**: when a PR adds, removes, or renames a public
|
|
25
|
+
export, update the matching row here in that PR — CI enforces it (the
|
|
26
|
+
`API map` workflow).
|
|
27
|
+
|
|
28
|
+
| Package | npm name | Entry points | Docs hub |
|
|
29
|
+
| -------------------- | -------------------- | ------------------------------------------------------ | ------------------------- |
|
|
30
|
+
| `packages/core` | `pond-ts` | `.` and `./types` (zero-runtime schema contract) | `website/docs/pond-ts/` |
|
|
31
|
+
| `packages/react` | `@pond-ts/react` | `.` | `website/docs/react/` |
|
|
32
|
+
| `packages/charts` | `@pond-ts/charts` | `.` | `website/docs/charts/` |
|
|
33
|
+
| `packages/financial` | `@pond-ts/financial` | `.` and `./fluent` (prototype augmentation) | `website/docs/financial/` |
|
|
34
|
+
| `packages/fit` | `@pond-ts/fit` | `.` | `website/docs/fit/` |
|
|
35
|
+
| `packages/process` | `@pond-ts/process` | `.` and `./pool` (Node worker pool) — **experimental** | `website/docs/process/` |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## pond-ts (core) — batch
|
|
40
|
+
|
|
41
|
+
### Series classes & construction
|
|
42
|
+
|
|
43
|
+
| Export | Purpose | Source |
|
|
44
|
+
| ----------------------- | ------------------------------------------------------ | ---------------------------------------------------- |
|
|
45
|
+
| `TimeSeries` | Immutable time-indexed collection, columnar storage | `packages/core/src/batch/time-series.ts` |
|
|
46
|
+
| `ValueSeries` | Series keyed by a monotonic non-time value axis | `packages/core/src/batch/value-series.ts` |
|
|
47
|
+
| `PartitionedTimeSeries` | Scoped view for per-partition stateful transforms | `packages/core/src/batch/partitioned-time-series.ts` |
|
|
48
|
+
| `Sequence` | Infinite grid of time buckets (daily, hourly, every N) | `packages/core/src/sequence/sequence.ts` |
|
|
49
|
+
| `BoundedSequence` | Finite ordered list of explicit interval buckets | `packages/core/src/sequence/bounded-sequence.ts` |
|
|
50
|
+
|
|
51
|
+
Static constructors on `TimeSeries`: `fromJSON()` (row tuples/objects),
|
|
52
|
+
`fromColumns()` (struct-of-arrays; `number` + `string` value columns),
|
|
53
|
+
`fromArrow()` (bring-your-own Apache Arrow `Table`; zero-copy Float64 adopt +
|
|
54
|
+
BigInt-free int64 time. Readable Arrow types are an **allowlist checked
|
|
55
|
+
against each field's declared type** — `Int`, `Float32`/`Float64`, `Date`,
|
|
56
|
+
`Time`, `Timestamp`, `Utf8`/`Utf8View`, `Null`, and a `Dictionary` of any of
|
|
57
|
+
those — and anything else, notably `Decimal` and `Float16`, is refused by name
|
|
58
|
+
rather than misread; see
|
|
59
|
+
`packages/core/src/batch/operators/arrow-types.ts`), `fromEvents()`,
|
|
60
|
+
`fromPoints()` (wide rows with `ts`), `concat()`, `joinMany()`. On
|
|
61
|
+
`ValueSeries`, the same three shapes keyed on the axis instead of time:
|
|
62
|
+
`fromJSON()`, `fromColumns()`, `fromArrow()` (`{ axis }` is required — no
|
|
63
|
+
`'time'` field convention to fall back on, and no unit scaling). Arrow-ingest
|
|
64
|
+
types (`ArrowTableLike`, `ArrowVectorLike`, `ArrowDataLike`, `ArrowFieldLike`,
|
|
65
|
+
`ArrowSchemaLike`, `ArrowTimeUnit`, `FromArrowOptions`,
|
|
66
|
+
`FromArrowValueOptions`) live in
|
|
67
|
+
`packages/core/src/batch/operators/from-arrow.ts`.
|
|
68
|
+
|
|
69
|
+
Both classes also export **columnar JSON** — `toColumns()`, one plain array
|
|
70
|
+
per column with gaps as `null`, the exact `{ name, schema, columns }` envelope
|
|
71
|
+
`fromColumns()` takes back (`packages/core/src/batch/operators/to-columns.ts`).
|
|
72
|
+
A **two-edged key** (`timeRange` / `interval`) flattens into extra columns
|
|
73
|
+
named off it — `timeRange` + `timeRangeEnd`, `interval` + `intervalEnd` +
|
|
74
|
+
`intervalLabel` — the convention `toArrow` already emitted, now read by
|
|
75
|
+
`fromColumns` and by `fromArrow({ keyKind })` as well
|
|
76
|
+
(`packages/core/src/batch/operators/flat-keys.ts` owns the naming + collision
|
|
77
|
+
rules). Columnar wire types live beside their row siblings:
|
|
78
|
+
`TimeSeriesJsonColumns` / `FlatKeyColumns` / `TimeSeriesColumnarInput` /
|
|
79
|
+
`TimeSeriesColumnarOutput` in `packages/core/src/schema/json.ts`.
|
|
80
|
+
|
|
81
|
+
Going the other way, `TimeSeries.toArrow()` / `ValueSeries.toArrow()` export
|
|
82
|
+
the columns **in Arrow's memory layout with no copy** — pond's validity bitmap
|
|
83
|
+
is already LSB-first one-bit-per-value, numerics are a contiguous
|
|
84
|
+
`Float64Array`, booleans a packed bitmap, dict-encoded strings `Int32Array`
|
|
85
|
+
indices plus a dictionary. It returns `{ length, fields }` rather than an Arrow
|
|
86
|
+
`Table` (pond doesn't depend on `apache-arrow`; the caller assembles with
|
|
87
|
+
`makeData`/`makeVector`), so another columnar engine is a buffer handoff
|
|
88
|
+
instead of a re-ingest. Arrow-export types (`ArrowExport`, `ArrowExportField`,
|
|
89
|
+
`ArrowExportType`, `ToArrowOptions`) live in
|
|
90
|
+
`packages/core/src/batch/operators/to-arrow.ts`.
|
|
91
|
+
|
|
92
|
+
`ValueSeries` also exports rows (`toRows()`, `toObjects()`, `toJSON()`).
|
|
93
|
+
Value-axis wire types
|
|
94
|
+
(`ValueSeriesJsonInput`, `ValueSeriesJsonRow`, `ValueSeriesJsonObjectRow`,
|
|
95
|
+
`ValueSeriesJsonOutputArray`, `ValueSeriesJsonOutputObject`,
|
|
96
|
+
`ValueSeriesJsonCell`, `ValueSeriesRow`, `ValueSeriesObjectRow`,
|
|
97
|
+
`ValueSeriesJsonColumns`, `ValueSeriesColumnarInput`,
|
|
98
|
+
`ValueSeriesColumnarOutput`) live in `packages/core/src/schema/value-io.ts`.
|
|
99
|
+
|
|
100
|
+
### Temporal keys & events
|
|
101
|
+
|
|
102
|
+
| Export | Purpose | Source |
|
|
103
|
+
| ------------- | --------------------------------------------- | -------------------------------------- |
|
|
104
|
+
| `Time` | Point-in-time event key | `packages/core/src/core/time.ts` |
|
|
105
|
+
| `TimeRange` | Interval event key (start/end) | `packages/core/src/core/time-range.ts` |
|
|
106
|
+
| `Interval` | Labeled time-interval event key | `packages/core/src/core/interval.ts` |
|
|
107
|
+
| `Event` | Immutable event: temporal key + typed payload | `packages/core/src/core/event.ts` |
|
|
108
|
+
| `toTimeRange` | Coerce temporal values to `TimeRange` | `packages/core/src/core/time-range.ts` |
|
|
109
|
+
|
|
110
|
+
### TimeSeries methods (all in `packages/core/src/batch/time-series.ts`)
|
|
111
|
+
|
|
112
|
+
- **Query**: `at()`, `first()`, `last()`, `bisect(key)`, `includesKey(key)`,
|
|
113
|
+
`atOrBefore(key)`, `atOrAfter(key)`, `nearest(key)`, `find()`, `some()`,
|
|
114
|
+
`every()`
|
|
115
|
+
- **Export/access**: `column(name)`, `keyColumn()`, `toRows()`, `toObjects()`,
|
|
116
|
+
`toArray()`, `toJSON()`, `toColumns()`, `toArrow()`, `toPoints()`
|
|
117
|
+
- **Temporal range**: `timeRange()`, `overlaps()`, `contains()`,
|
|
118
|
+
`intersection()`, `overlapping(range)`, `containedBy(range)`, `trim(range)`,
|
|
119
|
+
`after()`, `before()`, `within()`, `tail(duration)`
|
|
120
|
+
- **Key-type conversion**: `asTime({ at })`, `asTimeRange()`, `asInterval()`
|
|
121
|
+
- **Filter/slice**: `filter()`, `sample(strategy)`, `slice(begin, end)`
|
|
122
|
+
- **Column reshape**: `select()`, `rename()`, `map()`, `mapColumns()`,
|
|
123
|
+
`withColumn()`, `collapse()`
|
|
124
|
+
- **Array columns**: `arrayContains()`, `arrayContainsAll()`,
|
|
125
|
+
`arrayContainsAny()`, `arrayAggregate()`, `arrayExplode()`
|
|
126
|
+
- **Gap fill / dedupe**: `fill()`, `materialize()`, `dedupe()`
|
|
127
|
+
- **Aggregate/group**: `aggregate(sequence, spec)`, `reduce()`, `groupBy()`,
|
|
128
|
+
`partitionBy()`, `byColumn()` (order-free, by column value),
|
|
129
|
+
`rollingByColumn()`, `byValue(axis)` (project onto a `ValueSeries`)
|
|
130
|
+
- **Windowing/smoothing**: `rolling(window, spec, opts)`, `smooth(column,
|
|
131
|
+
method)` (EMA / Butterworth / Savitzky-Golay), `align(method, opts)`
|
|
132
|
+
- **Differential/statistical**: `diff()`, `rate()`, `pctChange()`,
|
|
133
|
+
`cumulative()`, `scan()` (custom stateful reducer), `shift()`, `baseline()`
|
|
134
|
+
(rolling avg/sd/bands), `outliers()` (deviation from baseline)
|
|
135
|
+
- **Join/pivot**: `join(other, opts)`, `pivotByGroup(group, opts)`
|
|
136
|
+
|
|
137
|
+
### ValueSeries methods (all in `packages/core/src/batch/value-series.ts`)
|
|
138
|
+
|
|
139
|
+
Deliberately small — the ordering-based slice of the algebra, no calendar ops
|
|
140
|
+
(see `docs/rfcs/value-axis.md`) — except for ingest/export, which is at full
|
|
141
|
+
`TimeSeries` parity.
|
|
142
|
+
|
|
143
|
+
- **Query/read**: `length`, `axisName`, `axisValues()`, `axisAt(i)`,
|
|
144
|
+
`column(name)`, `nearestIndex(value)`, `sliceByValue(lo, hi)`
|
|
145
|
+
- **Export**: `toRows()`, `toObjects()`, `toJSON({ rowFormat })`,
|
|
146
|
+
`toColumns()`, `toArrow(opts)`
|
|
147
|
+
|
|
148
|
+
### Columnar layer & support
|
|
149
|
+
|
|
150
|
+
| Export | Purpose | Source |
|
|
151
|
+
| ---------------------------------------------------------------------------------------------- | ------------------------------------------ | ---------------------------------------------- |
|
|
152
|
+
| `Float64Column` / `StringColumn` / `BooleanColumn` / `ArrayColumn` | Packed value-column storage per kind | `packages/core/src/columnar/` |
|
|
153
|
+
| `ChunkedFloat64Column` / `ChunkedStringColumn` / `ChunkedBooleanColumn` / `ChunkedArrayColumn` | Chunked variants (variable-length buffers) | `packages/core/src/columnar/chunked-column.ts` |
|
|
154
|
+
| `TimeKeyColumn` / `TimeRangeKeyColumn` / `IntervalKeyColumn` / `ValueKeyColumn` | Key-column storage per key kind | `packages/core/src/columnar/key-column.ts` |
|
|
155
|
+
| `top` | Reducer factory: top-N values | `packages/core/src/reducers/top.ts` |
|
|
156
|
+
| `ValidationError` | Error class thrown on invalid input | `packages/core/src/core/errors.ts` |
|
|
157
|
+
|
|
158
|
+
### Key exported types (batch)
|
|
159
|
+
|
|
160
|
+
| Type group | Names | Source |
|
|
161
|
+
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
162
|
+
| Schema contract | `SeriesSchema`, `RowForSchema`, `EventForSchema`, `EventDataForSchema`, `EventKeyForSchema`, `TimeSeriesInput`, `TimeSeriesJsonInput` | `packages/core/src/schema/index.ts` |
|
|
163
|
+
| Aggregation specs | `AggregateReducer`, `AggregateMap`, `AggregateOutputMap`, `AggregateSchema`, `BinReducerName`, `BinOutput` | `packages/core/src/schema/index.ts`, `packages/core/src/column.ts` |
|
|
164
|
+
| Operation schemas | `RollingSchema`, `RollingAlignment`, `AlignSchema`, `DiffSchema`, `SmoothSchema`, `SmoothMethod`, `FillStrategy`, `FillMapping` | `packages/core/src/schema/index.ts` |
|
|
165
|
+
| Column/data kinds | `Column`, `KeyColumn`, `ColumnKind`, `ScalarKind`, `ScalarValue`, `ColumnValue`, `ArrayValue`, `ValidityBitmap` | `packages/core/src/columnar/` |
|
|
166
|
+
| JSON wire format | `JsonRowFormat`, `JsonRowForSchema`, `JsonObjectRowForSchema`, `JsonValueForKind`, `JsonTimestampInput`, `JsonTimeRangeInput`, `JsonIntervalInput` | `packages/core/src/schema/index.ts` |
|
|
167
|
+
| Temporal utility | `TemporalLike`, `DurationInput`, `CalendarUnit`, `TimeZoneOptions`, `KeyLike`, `BatchSampleStrategy` | `packages/core/src/core/`, `packages/core/src/sequence/` |
|
|
168
|
+
|
|
169
|
+
The `pond-ts/types` subpath re-exports the schema-as-contract types with zero
|
|
170
|
+
runtime (`packages/core/src/schema/public.ts`).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## pond-ts (core) — live / streaming
|
|
175
|
+
|
|
176
|
+
### Classes
|
|
177
|
+
|
|
178
|
+
| Export | Purpose | Source |
|
|
179
|
+
| ----------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------- |
|
|
180
|
+
| `LiveSeries` | Bounded in-memory buffer of time-keyed events with retention | `packages/core/src/live/live-series.ts` |
|
|
181
|
+
| `LiveView` | Stateful transformation view over a live source | `packages/core/src/live/live-view.ts` |
|
|
182
|
+
| `LivePartitionedSeries` | Routes events into per-partition sub-buffers by column value | `packages/core/src/live/live-partitioned-series.ts` |
|
|
183
|
+
| `LivePartitionedView` | Derived per-partition view over a partitioned series | `packages/core/src/live/live-partitioned-series.ts` |
|
|
184
|
+
| `LiveAggregation` | Emits aggregated buckets when `Sequence` boundaries cross | `packages/core/src/live/live-aggregation.ts` |
|
|
185
|
+
| `LiveRollingAggregation` | Single-window rolling aggregation, configurable trigger | `packages/core/src/live/live-rolling-aggregation.ts` |
|
|
186
|
+
| `LiveFusedRolling` | Multi-window rolling, shared deque, single ingest pass | `packages/core/src/live/live-fused-rolling.ts` |
|
|
187
|
+
| `LivePartitionedFusedRolling` | Fused rolling per partition, synchronized emission | `packages/core/src/live/live-partitioned-fused-rolling.ts` |
|
|
188
|
+
| `LiveReduce` | Reduce over current buffer; emits per trigger | `packages/core/src/live/live-reduce.ts` |
|
|
189
|
+
| `LiveColumnGroup` | Zero-copy column gather over a view slice | `packages/core/src/live/live-view.ts` |
|
|
190
|
+
|
|
191
|
+
### Triggers
|
|
192
|
+
|
|
193
|
+
`Trigger` factory (`packages/core/src/live/triggers.ts`): `Trigger.event()`
|
|
194
|
+
(per-event, default), `Trigger.clock(sequence)` (boundary crossing),
|
|
195
|
+
`Trigger.every(duration)` (fixed cadence sugar), `Trigger.count(n)`. Types:
|
|
196
|
+
`EventTrigger`, `ClockTrigger`, `CountTrigger`.
|
|
197
|
+
|
|
198
|
+
### Methods
|
|
199
|
+
|
|
200
|
+
- **`LiveSeries`** — static: `LiveSeries.fromJSON()`; ingest: `push()`,
|
|
201
|
+
`pushMany()`, `pushJson()`; query: same
|
|
202
|
+
key-query set as `TimeSeries` (`at`/`first`/`last`/`find`/`bisect`/
|
|
203
|
+
`atOrBefore`/`atOrAfter`/…); operators: `window()`, `aggregate()`,
|
|
204
|
+
`rolling()`, `reduce()`, `diff()`, `rate()`, `pctChange()`, `fill()`,
|
|
205
|
+
`cumulative()`, `partitionBy()`; snapshots: `toTimeSeries()`, `toRows()`;
|
|
206
|
+
subscription: `on()` (event/batch/evict) → unsubscribe fn; utilities:
|
|
207
|
+
`stats()`, `clear()`, `timeRange()`, `eventRate()`, `length`.
|
|
208
|
+
- **`LiveView`** — transform: `filter()`, `map()`, `select()`, `sample()`;
|
|
209
|
+
plus the same operator/query/snapshot/subscription surface as `LiveSeries`
|
|
210
|
+
(minus ingest).
|
|
211
|
+
- **`LivePartitionedSeries`** — `toMap()` (spawn all partitions), `apply()`
|
|
212
|
+
(per-partition factory), `collect()` (fan-in unified series), `sample()`,
|
|
213
|
+
`stats()`, `on()` (spawn callback).
|
|
214
|
+
|
|
215
|
+
### Key exported types (live)
|
|
216
|
+
|
|
217
|
+
`LiveSeriesOptions` (`name`, `schema`, `ordering: 'strict' | 'drop' |
|
|
218
|
+
'reorder'`, `graceWindow`, `retention: { maxEvents?, maxAge? }`),
|
|
219
|
+
`LivePartitionedOptions`, `LiveAggregationOptions`, `LiveRollingOptions`,
|
|
220
|
+
`RollingWindow`, `LiveFillStrategy`, `LiveFillMapping` — all under
|
|
221
|
+
`packages/core/src/live/`.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## @pond-ts/react
|
|
226
|
+
|
|
227
|
+
All hooks in `packages/react/src/<hookName>.ts`.
|
|
228
|
+
|
|
229
|
+
| Export | Signature gist | Purpose |
|
|
230
|
+
| ---------------- | --------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
231
|
+
| `useLiveSeries` | `useLiveSeries(opts, hookOpts?)` | Create + own a `LiveSeries` for the component lifetime; returns it with a snapshot |
|
|
232
|
+
| `useTimeSeries` | `useTimeSeries(input, key?)` | Memoized `TimeSeries.fromJSON` for static/fetched data |
|
|
233
|
+
| `useSnapshot` | `useSnapshot(source, opts?)` | Subscribe to a live source, return a throttled `TimeSeries` snapshot |
|
|
234
|
+
| `useWindow` | `useWindow(source, size, opts?)` | Windowed view of a live source + throttled snapshot |
|
|
235
|
+
| `useDerived` | `useDerived(series, transform)` | Batch transform of a snapshot, recomputed on change |
|
|
236
|
+
| `useLiveQuery` | `useLiveQuery(build, deps, opts?)` | Build a derived live view, subscribe, return view + snapshot |
|
|
237
|
+
| `useLatest` | `useLatest(source, opts?)` | Only the latest event |
|
|
238
|
+
| `useCurrent` | `useCurrent(source, mapping, opts?)` | Current value of a reducer over the source |
|
|
239
|
+
| `useEventRate` | `useEventRate(source, duration, opts?)` | Events-per-second over a trailing window |
|
|
240
|
+
| `useLiveVersion` | `useLiveVersion(source, opts?)` | Change signal for reading columns without a snapshot |
|
|
241
|
+
| `takeSnapshot` | `takeSnapshot(source)` | Non-hook: snapshot any live source to a `TimeSeries` |
|
|
242
|
+
|
|
243
|
+
Types: `UseSnapshotOptions`, `SnapshotSource` (structural — covers
|
|
244
|
+
`LiveSeries`, `LiveView`, …), `UseCurrentOptions`, `UseLiveVersionOptions`.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## @pond-ts/charts
|
|
249
|
+
|
|
250
|
+
### Components — layout & axes
|
|
251
|
+
|
|
252
|
+
| Component | Key props | Purpose | Source |
|
|
253
|
+
| --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
254
|
+
| `ChartContainer` | `width`, `range?`, `theme?`, `cursor?`, `panZoom?`, `bounds?`, `showAxis?`, `calendar?`, `origin?`, `maxBandWidth?`/`bandAlign?`, `onTrackerChanged?`, `onDrawStats?` | Root: shared x-scale, interactions, annotations | `packages/charts/src/ChartContainer.tsx` |
|
|
255
|
+
| `ChartRow` | `height`, `cursor?` (deprecated — mount a cursor in the row) | One stacked plot band; owns its y-axes | `packages/charts/src/ChartRow.tsx` |
|
|
256
|
+
| `Layers` | children | Mandatory z-stack inside a row (back-to-front) | `packages/charts/src/Layers.tsx` |
|
|
257
|
+
| `YAxis` | `id` (req), `side?`, `scale?` (`'linear'` \| `'log'` \| `'symlog'`), `linearWindow?`, `min?`/`max?`, `format?`, `width?`, `hide?` | Y-axis gutter; layers bind via their `axis` prop | `packages/charts/src/YAxis.tsx` |
|
|
258
|
+
| `XAxis` | `side?`, `label?`, `format?`, `ticks?`, `transform?`, `dateStyle?` | Placeable x-axis strip; kind inferred from data | `packages/charts/src/XAxis.tsx` |
|
|
259
|
+
| `TimeAxis` / `CategoryAxis` | (XAxis props) | Thin `XAxis` presets | `packages/charts/src/TimeAxis.tsx`, `CategoryAxis.tsx` |
|
|
260
|
+
| `Canvas` | `width`, `height`, `draw` | Low-level DPR-aware canvas primitive | `packages/charts/src/Canvas.tsx` |
|
|
261
|
+
| `Selector` | `enabled?` (default `true`), `selected?` (mark \| set), `hovered?`, `onSelect?`, `onHover?`, `children?` | Wraps its scope; mounting enables click-select and owns the state it drives (RFC A10) | `packages/charts/src/selectors.tsx` |
|
|
262
|
+
| `MultiSelector` | `enabled?`, `selected?`, `hovered?`, `sequence?`, `onSelect?`, `onHover?`, `children?` | Sweep-select superset of `Selector`: drag sweeps marks, release reports `(hits, modifiers, spans)` — plural, one per swept layer (RFC A5.2) | `packages/charts/src/selectors.tsx` |
|
|
263
|
+
|
|
264
|
+
### Components — draw layers
|
|
265
|
+
|
|
266
|
+
All take `series` plus an `as?` style identifier (theme lookup) and `axis?`
|
|
267
|
+
scale id — style and scale are separate channels; there are no per-component
|
|
268
|
+
color props (see Theming).
|
|
269
|
+
|
|
270
|
+
**Column props are schema-derived** ([PND-CHARTAPI]): a name that isn't a
|
|
271
|
+
numeric column of the series fails to compile, and `<BarChart>`'s props are a
|
|
272
|
+
union of its legal source modes, so mixing `series`/`bins`/`categories` or
|
|
273
|
+
`column`/`columns` is a compile error too. Two carve-outs:
|
|
274
|
+
a **loosely-typed** series (`TimeSeries<SeriesSchema>`) still accepts any name
|
|
275
|
+
(`packages/charts/src/column-names.ts` explains the `never` fallback that makes
|
|
276
|
+
this work), and `bins` names stay `string` (they name aggregate fields, not
|
|
277
|
+
schema columns). Because the union splits per series _kind_, a value typed as
|
|
278
|
+
**either** kind must be narrowed or cast at the call site.
|
|
279
|
+
|
|
280
|
+
| Component | Data props | Purpose | Source |
|
|
281
|
+
| -------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | -------------------------------------- |
|
|
282
|
+
| `LineChart` | `column`, `gaps?`, `sessionBreaks?` | Gap-aware line | `packages/charts/src/LineChart.tsx` |
|
|
283
|
+
| `AreaChart` | `column`, `baseline?`, `gaps?` | Filled area | `packages/charts/src/AreaChart.tsx` |
|
|
284
|
+
| `BandChart` | `lower`, `upper` | Variance-band envelope | `packages/charts/src/BandChart.tsx` |
|
|
285
|
+
| `ScatterChart` | `column`, `id?` (selection), radius/color encodings | Points; data-driven size/colour | `packages/charts/src/ScatterChart.tsx` |
|
|
286
|
+
| `BarChart` | `column` \| `columns` \| `bins` \| `categories`, `orientation?`, `thresholds?`/`bandColors?` | Bars, stacked bars, histograms, categorical | `packages/charts/src/BarChart.tsx` |
|
|
287
|
+
| `HeatMap` | `series`, `columns` (rows), `colors`, `domain?`, `scale?`, `noData?`, `gap?`, `decimate?`, `orientation?` | Grid of colour-coded cells; bins on x, columns on y | `packages/charts/src/HeatMap.tsx` |
|
|
288
|
+
| `BoxPlot` | `lower`/`q1?`/`median?`/`q3?`/`upper`, `shape?` | Box-and-whisker from quantile columns | `packages/charts/src/BoxPlot.tsx` |
|
|
289
|
+
| `Candlestick` | OHLC columns, `variant?`, `colorBy?`, `showOHLC?` | First-class OHLC candles (TimeSeries only) | `packages/charts/src/Candlestick.tsx` |
|
|
290
|
+
| `Legend` | `placement?`, `items?`, `onRowClick?`, `onRowHover?` | Series key from registered layers' resolved styles | `packages/charts/src/Legend.tsx` |
|
|
291
|
+
|
|
292
|
+
### Components — annotations & indicators
|
|
293
|
+
|
|
294
|
+
| Component | Key props | Purpose | Source |
|
|
295
|
+
| ---------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
|
|
296
|
+
| `Region` | `from`, `to`, `label?`, `id?`, `onChange?` | Shaded x-span; draggable when `onChange` given | `packages/charts/src/annotations.tsx` |
|
|
297
|
+
| `Baseline` | `value`, `axis?`, `label?`, `indicator?`, `onChange?` | Horizontal value line | `packages/charts/src/annotations.tsx` |
|
|
298
|
+
| `Marker` | `at`, `label?`, `indicator?`, `onChange?` | Vertical x line | `packages/charts/src/annotations.tsx` |
|
|
299
|
+
| `Zone` | `from`, `to`, `axis?`, `role?`, `label?`, `edges?` | Shaded y-span — a value-axis scale (AQI categories, HR zones); inert + edge-less by default, `±Infinity` for open ends | `packages/charts/src/annotations.tsx` |
|
|
300
|
+
| `YAxisIndicator` | `value?` \| `source?`, `axis?`, `format?` | Live value pill pinned to a y-axis edge | `packages/charts/src/indicators.tsx` |
|
|
301
|
+
|
|
302
|
+
### Components — cursors (mounted presets)
|
|
303
|
+
|
|
304
|
+
The `cursor` string modes as components (interaction RFC §4/A4.1) — mount one
|
|
305
|
+
as a child of `<ChartContainer>` (the default for every row) or inside a
|
|
306
|
+
`<ChartRow>` (the per-row override). Render-only presets stack; one
|
|
307
|
+
gesture-owning cursor (`Crosshair`/`Range`) per scope. The `cursor` /
|
|
308
|
+
`cursorTime` / `crosshairSnap` / `cursorFormat` / `cursorSequence` /
|
|
309
|
+
`onRegionSelect` / `regionSelectModifier` props (and `<ChartRow cursor>`) are
|
|
310
|
+
**deprecated** — they keep working for one minor via an internal shim. The
|
|
311
|
+
underlying `CursorSpec` contract stays unpublished (Q3); every drag claim on
|
|
312
|
+
the plot (annotation-create, the range drag, pan) is arbitrated by one brush
|
|
313
|
+
recognizer with a documented precedence (`src/brush.tsx`, RFC A1.5/A2.7).
|
|
314
|
+
|
|
315
|
+
| Component | Key props | Purpose | Source |
|
|
316
|
+
| ----------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
|
|
317
|
+
| `LineCursor` | `showTime?` | The synced vertical line (`cursor="line"`, the legacy default) | `packages/charts/src/cursors.tsx` |
|
|
318
|
+
| `PointCursor` | `showTime?` | A dot on each series at the cursor (`"point"`) | `packages/charts/src/cursors.tsx` |
|
|
319
|
+
| `InlineCursor` | `showTime?` | Dots + a value chip beside each (`"inline"`) | `packages/charts/src/cursors.tsx` |
|
|
320
|
+
| `FlagCursor` | `showTime?` | Dots + staffed value flags stacked at the top (`"flag"`) | `packages/charts/src/cursors.tsx` |
|
|
321
|
+
| `CrosshairCursor` | `snap?`, `showTime?`, `format?` | The inspection reticle: dashed cross, y value pill, x time pill (`"crosshair"`) | `packages/charts/src/cursors.tsx` |
|
|
322
|
+
| `RangeCursor` | `sequence?`, `onDragRelease?`, `enableDrag?`, `dragModifier?` | The hover-time band + the drag: release fires once with a `RangeSpan`, then reverts (`"region"` + `onRegionSelect` successor) | `packages/charts/src/cursors.tsx` |
|
|
323
|
+
|
|
324
|
+
### Components — standalone row lists (DOM tables, no `<ChartContainer>`)
|
|
325
|
+
|
|
326
|
+
One row per _entity_ (interface, split, symbol) on one shared value scale;
|
|
327
|
+
label + data cells, `sortBy`/`sort`, optional per-row expander. The in-plot
|
|
328
|
+
histogram stays `<BarChart orientation="horizontal">` — these are the table
|
|
329
|
+
shape (react-timeseries-charts' `HorizontalBarChart`).
|
|
330
|
+
|
|
331
|
+
| Component | Data props | Purpose | Source |
|
|
332
|
+
| --------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------- | --------------------------------- |
|
|
333
|
+
| `BarList` | `rows`, `columns` (`values` names), `sortBy?`, `before?`/`after?`, `renderExpanded?` | Ranked bar list — one proportional bar line per column per row | `packages/charts/src/BarList.tsx` |
|
|
334
|
+
| `BoxList` | `rows`, `columns` (five-number names + `value?` tick), same table props | Distribution list — range band / q1→q3 body / median / current tick | `packages/charts/src/BoxList.tsx` |
|
|
335
|
+
|
|
336
|
+
Row/option types + readers (`packages/charts/src/list.ts`): `ListRow`,
|
|
337
|
+
`ListValue`, `ListCellSpec`, `ListMarker` (reference rule through every row,
|
|
338
|
+
label above; joins the auto domain fit), `ListSortDirection`, `BarListColumn`,
|
|
339
|
+
`BoxListColumn`, `ListRowsOptions`; `listRowsFromTimeSeries` /
|
|
340
|
+
`listRowsFromValueSeries` build one `ListRow` per event / axis key (numeric +
|
|
341
|
+
string columns land in `values`).
|
|
342
|
+
|
|
343
|
+
### View builders (all in `packages/charts/src/data.ts`)
|
|
344
|
+
|
|
345
|
+
With a pond series, the components are the whole data contract (pass the
|
|
346
|
+
series directly) — these exports expose the chart-ready view shapes for
|
|
347
|
+
consumers writing custom draw code; no shipped layer needs their output.
|
|
348
|
+
The ValueSeries siblings (`fromValueSeries` etc.) are deliberately
|
|
349
|
+
**unexported** (adapters are internal; see [PND-VSADAPT]).
|
|
350
|
+
|
|
351
|
+
| Export | Signature gist | Feeds |
|
|
352
|
+
| -------------------- | ------------------------------------------------------ | --------------------------------------------------------- |
|
|
353
|
+
| `fromTimeSeries` | `(series, column) → ChartSeries` | Line/Area/Scatter |
|
|
354
|
+
| `bandFromTimeSeries` | `(series, lower, upper) → BandSeries` | BandChart |
|
|
355
|
+
| `boxFromTimeSeries` | `(series, BoxColumns) → BoxSeries` | BoxPlot |
|
|
356
|
+
| `barsFromTimeSeries` | `(series, column) → BarSeries` | BarChart |
|
|
357
|
+
| `ohlcFromTimeSeries` | `(series, OhlcColumns) → OhlcSeries` | Candlestick |
|
|
358
|
+
| `stacksFromGroups` | `(Map<string, TimeSeries>, column) → StackedBarSeries` | Stacked bars from grouped series |
|
|
359
|
+
| `stacksFromColumns` | `(series, columns[]) → StackedBarSeries` | Stacked bars from wide columns |
|
|
360
|
+
| `barsFromBins` | `(bins, column, opts?) → BarSeries` | One-column histogram (single-series path, [PND-BARSEM]) |
|
|
361
|
+
| `stacksFromBins` | `(bins, columns[], opts?) → StackedBarSeries` | Multi-column histograms from `byColumn` output |
|
|
362
|
+
| `categoryStack` | `(CategoryDatum[]) → StackedBarSeries` | Categorical bars |
|
|
363
|
+
| `categoryStacks` | `(CategoryStackDatum[], columns) → StackedBarSeries` | Stacked categorical bars ([PND-CATSTACK]) |
|
|
364
|
+
| `bandedColor` | `(value, colors[], lo, hi) → string \| undefined` | The heat map's own banding — for a matching legend |
|
|
365
|
+
| `heatValueExtent` | `(StackedBarSeries) → [lo, hi] \| null` | Finite extent across a grid; `<HeatMap>`'s domain default |
|
|
366
|
+
| `transposeRow` | `(series, opts?) → CategoryDatum[]` | One row read across as categories |
|
|
367
|
+
|
|
368
|
+
Series shapes (same file): `ChartSeries`, `BandSeries`, `BoxSeries`,
|
|
369
|
+
`BarSeries`, `OhlcSeries`, `StackedBarSeries`; option types `BoxColumns`,
|
|
370
|
+
`OhlcColumns`, `BinRecord`, `StacksFromBinsOptions`, `CategoryDatum`,
|
|
371
|
+
`CategoryStackDatum`, `RowAt`,
|
|
372
|
+
`TransposeRowOptions`.
|
|
373
|
+
|
|
374
|
+
### Theming
|
|
375
|
+
|
|
376
|
+
| Export | Purpose | Source |
|
|
377
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
|
|
378
|
+
| `ChartTheme` | The one styling channel: role-keyed slots per draw layer + fixed chrome slots | `packages/charts/src/theme.ts` |
|
|
379
|
+
| `defaultTheme` / `estelaTheme` | Built-in themes (neutral light / dark estela palette) | `packages/charts/src/theme.ts` |
|
|
380
|
+
| `cssVarTheme` | `(base, resolve, opts?) → ChartTheme` — static CSS-custom-property overlay | `packages/charts/src/css-theme.ts` |
|
|
381
|
+
| `useChartTheme` | Hook: re-resolves on `data-theme`/`class` flips (MutationObserver) | `packages/charts/src/useChartTheme.ts` |
|
|
382
|
+
| Style types | `LineStyle`, `AreaStyle`, `BandStyle`, `ScatterStyle`, `BarStyle`, `BoxStyle`, `CandleStyle` | `packages/charts/src/theme.ts` |
|
|
383
|
+
| State types | `ScatterStates`, `BoxStates`, `BoxLadder`, `HeatStates` — the per-state sub-objects | `packages/charts/src/theme.ts` |
|
|
384
|
+
| Helper types | `ChartThemeOverrides`, `VarReader`, `UseChartThemeOptions` | `packages/charts/src/css-theme.ts`, `useChartTheme.ts` |
|
|
385
|
+
|
|
386
|
+
### Live values, scales & key types
|
|
387
|
+
|
|
388
|
+
| Export | Purpose | Source |
|
|
389
|
+
| ------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ----------------------------------------- |
|
|
390
|
+
| `createLiveValue` / `LiveValue` | Imperative push channel for high-frequency indicator updates (isolated repaint) | `packages/charts/src/indicators.tsx` |
|
|
391
|
+
| `scaleTradingTime` / `TradingTimeScale` | Discontinuous time scale collapsing closed-market gaps | `packages/charts/src/tradingTimeScale.ts` |
|
|
392
|
+
| `DiscontinuityProvider` | Gap topology consumed by the trading-time scale | `packages/charts/src/tradingTimeScale.ts` |
|
|
393
|
+
| `scaleBand` / `ScaleBand` | Ordinal slot scale for the category axis | `packages/charts/src/bandScale.ts` |
|
|
394
|
+
| `GapMode` | `'none' \| 'empty' \| 'dashed' \| 'step' \| 'fade'` (Line/Area `gaps` prop) | `packages/charts/src/gaps.ts` |
|
|
395
|
+
| `DecimateOption` | `<LineChart decimate>` — M4 viewport decimation (`bool \| { threshold }`) | `packages/charts/src/decimate.ts` |
|
|
396
|
+
| `CursorMode` | `'none' \| 'line' \| 'point' \| 'inline' \| 'flag' \| 'crosshair' \| 'region'` | `packages/charts/src/context.ts` |
|
|
397
|
+
| `TrackerInfo` / `TrackerSample` | Hover readout payload (`onTrackerChanged`) | `packages/charts/src/context.ts` |
|
|
398
|
+
| `AnnotationKind` / `CreateSpec` | Annotation identity + draw-gesture payload (`onCreate`) | `packages/charts/src/context.ts` |
|
|
399
|
+
| `SelectInfo` | Selection/hover payload (`Selector`/`MultiSelector` `onSelect`/`onHover`) | `packages/charts/src/context.ts` |
|
|
400
|
+
| `SelectModifiers` | Keyboard modifiers on a click, 2nd arg to `onSelect` | `packages/charts/src/context.ts` |
|
|
401
|
+
| `SelectorProps` | `<Selector>`'s props — `enabled?` / `selected?` / `hovered?` / `onSelect?` / `onHover?` / `children?` | `packages/charts/src/selectors.tsx` |
|
|
402
|
+
| `MultiSelectorProps` | `<MultiSelector>`'s props — the above plus `sequence?`, with plural callbacks | `packages/charts/src/selectors.tsx` |
|
|
403
|
+
| `RangeSpan` | `<RangeCursor onDragRelease>` payload — `{ x: [lo, hi], y? }` in axis units | `packages/charts/src/context.ts` |
|
|
404
|
+
| `SpanSelection` | Range entry for `selected` — one layer's marks over `x`/`y`/`rows` (RFC A5.2) | `packages/charts/src/context.ts` |
|
|
405
|
+
| `SelectionEntry` | One `selected` array entry: `SelectInfo \| SpanSelection` | `packages/charts/src/context.ts` |
|
|
406
|
+
| `selectionContains` | Is a hit in a mixed selection? The same membership predicate the layers run | `packages/charts/src/span.ts` |
|
|
407
|
+
| `sameMark` | Are two hits the same mark? Full identity (`id`, `mark`-or-`key`, `label`) | `packages/charts/src/span.ts` |
|
|
408
|
+
| `isSpanSelection` | Entry discriminant — narrows a `SelectionEntry` to `SpanSelection` | `packages/charts/src/span.ts` |
|
|
409
|
+
| `DrawStatsFrame` / `LayerDrawInfo` | Per-repaint draw-cost + decimation stats (`ChartContainer` `onDrawStats`) | `packages/charts/src/context.ts` |
|
|
410
|
+
| `TimeGrain` | Coarse time unit for grain-aware formatting | `packages/charts/src/tickLadder.ts` |
|
|
411
|
+
| `SwatchSpec` / `LegendItemInput` | Legend swatch vocabulary + explicit-rows input (`<Legend items>`) | `packages/charts/src/swatch.ts` |
|
|
412
|
+
| `useChartLegend` | Headless legend hook: rows (items grouped by chart row) + `hover`/`select` verbs | `packages/charts/src/useChartLegend.ts` |
|
|
413
|
+
| `ChartLegend` / `LegendRow` / `LegendItem` | The hook's return shape (`rows` group `items`; items carry `selected`/`hovered`) | `packages/charts/src/useChartLegend.ts` |
|
|
414
|
+
| `LegendPlacement` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `packages/charts/src/Legend.tsx` |
|
|
415
|
+
| `Curve` | Path interpolation: `'linear' \| 'monotone' \| 'natural' \| 'basis' \| 'step'` | `packages/charts/src/curve.ts` |
|
|
416
|
+
| `RadiusEncoding` / `ColorEncoding` | Data-driven scatter size/colour | `packages/charts/src/encoding.ts` |
|
|
417
|
+
| `CandleVariant` / `ColorBy` | OHLC mark shape / colouring strategy | `packages/charts/src/ohlc.ts` |
|
|
418
|
+
| `AxisFormat` / `CursorFormat` | Tick and cursor-readout formatting (d3 specifier or fn) | `packages/charts/src/format.ts` |
|
|
419
|
+
| `AxisTransform` | Monotonic `to`/`from` pair for derived-unit x-axis relabeling | `packages/charts/src/derivedTicks.ts` |
|
|
420
|
+
| `Orientation` | Bar growth direction | `packages/charts/src/bars.ts` |
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
## @pond-ts/financial
|
|
425
|
+
|
|
426
|
+
### Studies (each also a fluent method after `import '@pond-ts/financial/fluent'`)
|
|
427
|
+
|
|
428
|
+
All are pure `(series, options) → TimeSeries` appending output columns;
|
|
429
|
+
`column` defaults to `'close'`; periods are bar counts; warm-up is
|
|
430
|
+
length-preserving (`undefined` head rows).
|
|
431
|
+
|
|
432
|
+
| Study | Output column(s) | Options gist | Source |
|
|
433
|
+
| --------------------------- | ----------------------------------- | --------------------------------------------------- | -------------------------------------------------- |
|
|
434
|
+
| `sma` | `sma` | `{ period, column?, output? }` | `packages/financial/src/studies/moving-average.ts` |
|
|
435
|
+
| `ema` | `ema` | `{ period, column?, output? }` (α = 2/(period+1)) | `packages/financial/src/studies/moving-average.ts` |
|
|
436
|
+
| `bollinger` | `bbMiddle`, `bbUpper`, `bbLower` | `{ period, stdDev?, column?, prefix? }` | `packages/financial/src/studies/bollinger.ts` |
|
|
437
|
+
| `envelope` | `envMiddle`, `envUpper`, `envLower` | `{ period, percent?, maType?, column?, prefix? }` | `packages/financial/src/studies/envelope.ts` |
|
|
438
|
+
| `rollingStdev` | `stdev` | `{ period, column?, output? }` (population, ddof=0) | `packages/financial/src/studies/rolling-stat.ts` |
|
|
439
|
+
| `rollingMin` / `rollingMax` | `min` / `max` | `{ period, column?, output? }` (Donchian edges) | `packages/financial/src/studies/rolling-stat.ts` |
|
|
440
|
+
| `rollingPercentile` | `p{q}` (e.g. `p90`) | `{ period, q, column?, output? }` | `packages/financial/src/studies/rolling-stat.ts` |
|
|
441
|
+
| `zScore` | `zscore` | `{ period, column?, output? }` | `packages/financial/src/studies/z-score.ts` |
|
|
442
|
+
| `percentChange` | `pctChange` | `{ periods?, column?, output? }` | `packages/financial/src/studies/percent-change.ts` |
|
|
443
|
+
|
|
444
|
+
Adding a study? Follow `packages/financial/src/studies/README.md` (uniform
|
|
445
|
+
shape + pandas oracle case + fluent method are all REQUIRED).
|
|
446
|
+
|
|
447
|
+
### Trading calendars & sessions
|
|
448
|
+
|
|
449
|
+
| Export | Purpose | Source |
|
|
450
|
+
| ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------- |
|
|
451
|
+
| `TradingCalendar` | Query API: `.sessions()`, `.sessionOn()`, `.isTradingDay()`, `.isOpen()`, `.sessionsInRange()`, `.sessionSequence()`, `.barSequence(period)`, `.tagSessions()`, `.discontinuities()` | `packages/financial/src/calendar/` |
|
|
452
|
+
| `generateSessions` | `Session[]` from `SessionRules` over a date range (DST-correct) | `packages/financial/src/calendar/` |
|
|
453
|
+
| `normalizeSessions` | Validate + sort an explicit session list | `packages/financial/src/calendar/` |
|
|
454
|
+
| `identityDiscontinuity` / `segmentDiscontinuity` / `weekendSkip` | `DiscontinuityProvider`s for the trading-time axis | `packages/financial/src/calendar/` |
|
|
455
|
+
| Types | `Session`, `SessionBreak`, `SessionRules`, `DateRange`, `InstantRange`, `TaggedSchema`, `LiveSegment`, `DiscontinuityProvider` | `packages/financial/src/calendar/` |
|
|
456
|
+
|
|
457
|
+
### Contract & constants
|
|
458
|
+
|
|
459
|
+
`OhlcvColumns` (column-name contract), `DEFAULT_OHLCV`
|
|
460
|
+
(`{ open, high, low, close, volume }`), `DEFAULT_SOURCE` (`'close'`) —
|
|
461
|
+
`packages/financial/src/contract/`. `RollingReducer` (reducer-name union used
|
|
462
|
+
by studies) — `packages/financial/src/kernels/rolling.ts`.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## @pond-ts/fit
|
|
467
|
+
|
|
468
|
+
| Group | Exports | Source |
|
|
469
|
+
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
|
|
470
|
+
| Activity model types | `ImportedActivity`, `ActivityMeta`, `ActivityStreams`, `Lap`, `GeoPoint`, `ActivitySource` | `packages/fit/src/types.ts` |
|
|
471
|
+
| Activity façade | `Activity` (`Activity.fromStreams(imported)`), `Section`, `ProfiledActivity`, `ProfiledSection`, `Sample`, `SectionMetrics` | `packages/fit/src/activity/` |
|
|
472
|
+
| Summary pipeline | `computeActivitySummary`, `prepareActivity` → `summaryFromPrepared` (reuse decode), `windowChannels` (zoom re-bucketing), `buildTrackFromStreams` (pond series from streams); types `ActivitySummary`, `PreparedActivity`, `ChannelProfile`, `ChannelSample`, `ChannelKey` | `packages/fit/src/summary/` |
|
|
473
|
+
| Track & geo | `Track` (`Track.of(points)`), `polylineCumulative`, `interpolateAtDistance`, `polylineSlice`, `boundsOf`, `bestEffortsByDistance`, `segmentsInRange` | `packages/fit/src/track/`, `packages/fit/src/geo/` |
|
|
474
|
+
| Power analytics | `computePower` (NP/IF/TSS/zones; `{ binWatts }` sets the histogram bucket width), `powerBestEfforts`; types `PowerSummary`, `PowerZone`, `PowerBin`, `PowerCurvePoint`, `PowerEffort`, `ComputePowerOptions`. `PowerBin`/`PowerZone` carry pond's canonical `start`/`end` bin edges, so they feed `@pond-ts/charts` unmapped | `packages/fit/src/power/` |
|
|
475
|
+
| Profile & zones | `Profile`, `hydrateProfile`, `profileAsOf`, `hrZonesFrom`, `paceZonesFrom`, `powerZonesFrom` (Coggan from FTP) | `packages/fit/src/profile/` |
|
|
476
|
+
| Zone distribution | `zoneDistributionByValue`, `hrZoneDistribution`, `paceZoneDistribution`, `ZoneTime` (canonical `start`/`end` edges + `openEnded`; chart-ready) | `packages/fit/src/zones/` |
|
|
477
|
+
| Quantities | Value objects with canonical units: `Distance`, `Elevation`, `Duration`, `Speed`, `Pace`, `Power`, `HeartRate`, `Cadence` | `packages/fit/src/quantities.ts` |
|
|
478
|
+
| Units | `convertDistance` / `convertElevation` / `convertTemperature` / `convertSpeed`, `metersToMiles`, `metersToFeet`, `formatDuration`, `formatPace`, `*UnitLabel` helpers, `DEFAULT_UNITS` | `packages/fit/src/units.ts` |
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
### `@pond-ts/financial/parallel` (Node-only, opt-in)
|
|
483
|
+
|
|
484
|
+
`withWorkers(series, { workers })` — opts a series into partitioned rolling
|
|
485
|
+
studies and returns it unchanged; `shutdownWorkers()`; `parallelDispatches()`;
|
|
486
|
+
`MIN_ROWS`; type `WithWorkersOptions`. Chosen **once at ingest**: the studies keep their
|
|
487
|
+
signatures and stay synchronous, and derived series inherit it (registration is
|
|
488
|
+
keyed on the key-column buffer). **Single-threaded remains the default** — the
|
|
489
|
+
main package never imports this. Node-only by construction: `Atomics.wait` on
|
|
490
|
+
the main thread is what keeps the studies synchronous, and browsers forbid it.
|
|
491
|
+
|
|
492
|
+
Accelerates any rolling study asking for `avg`/`stdev` off one column — `sma`,
|
|
493
|
+
`envelope`, `bollinger` — at 1.85×/1.35×/1.92×. **Partitioning does not change
|
|
494
|
+
the answer**: since [PND-PROCKERN] the kernel's accumulator rebuilds are pinned
|
|
495
|
+
to absolute row index, so a chunk reconstructs exactly the state a whole-column
|
|
496
|
+
pass held and the partitioned result is bit-identical. **`zScore` is not
|
|
497
|
+
accelerated**: [PND-SHIFTFRAME] moved it onto a shifted-frame kernel this pool
|
|
498
|
+
does not hook, so opting in neither speeds it up nor changes its answer. It used
|
|
499
|
+
to be the fastest entry here at 2.44×, and the only one whose error had no bound.
|
|
500
|
+
Below `MIN_ROWS` a registered series still runs sequentially and is
|
|
501
|
+
bit-identical. `parallelDispatches()` returns how many passes have actually run
|
|
502
|
+
on workers — acceleration is otherwise invisible, since a declined pass returns
|
|
503
|
+
the same answer, only slower than you expected. Source:
|
|
504
|
+
`packages/financial/src/parallel/`.
|
|
505
|
+
|
|
506
|
+
## @pond-ts/process
|
|
507
|
+
|
|
508
|
+
**Experimental — published pre-1.0, API expected to move with friction
|
|
509
|
+
reports; pin an exact version.** The declarative plan layer is the consumer
|
|
510
|
+
surface (RFC [process.md](docs/rfcs/process.md)); the engine ships exported
|
|
511
|
+
beneath it — the [PND-PROCSUB] packaging decision, resolved at first publish.
|
|
512
|
+
Docs: [website/docs/process/](website/docs/process/). Tickets:
|
|
513
|
+
[PND_PROCESS_PLAN.md](docs/plans/PND_PROCESS_PLAN.md).
|
|
514
|
+
|
|
515
|
+
Typed dataflow graphs for pipelines whose **shape is data** (runtime-assembled,
|
|
516
|
+
user-edited, one computation fanned out to several consumers). Chaining stays
|
|
517
|
+
the default for pipelines known at authoring time — see the package README.
|
|
518
|
+
|
|
519
|
+
| Group | Exports | Source |
|
|
520
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- |
|
|
521
|
+
| Worker pool (Node) | `HostPool` (`start`, `run`, `close`, `size`, `inFlight`); types `HostPoolOptions`, `PoolSetup`, `PoolSetupConfig`; `toWire` / `fromWire`, types `WireResult`, `WireColumn` — subpath `@pond-ts/process/pool` | `packages/process/src/pool/index.ts` |
|
|
522
|
+
| Ports | `Inlet`, `Outlet` (typed fields on `node.in` / `node.out`; `get()`, `peek()`, `version`, `connect`, `disconnect`) | `packages/process/src/port.ts` |
|
|
523
|
+
| Nodes | `Node` (`in`, `out`, `dirty`, `error`, `invalidate()`), `defineNode` (reusable multi-output node type), `derive` (single-output, wired inline) | `packages/process/src/node.ts` |
|
|
524
|
+
| Port declaration | `port<T>({ equals, defaultValue })`; types `PortSpec`, `PortSpecMap`, `PortValue`, `PortValues` | `packages/process/src/types.ts` |
|
|
525
|
+
| Sources | `source<T>()` → `SourceNode` (`set()`), `fromLive(liveSource)` → `LiveSourceNode` (`dispose()`); `GraphSource` (bind contract — looser than core's `LiveSource`, accepts `LiveAggregation`), `SnapshotSource`, `NoInputs` | `packages/process/src/source.ts` |
|
|
526
|
+
| Graph view | `Graph` (`Graph.from(...roots)`, `nodes`, `order()`, `edges()`, `toJSON()`); types `GraphEdge`, `GraphJson`, `GraphNodeJson`, `GraphEdgeJson` | `packages/process/src/graph.ts` |
|
|
527
|
+
| Range output buffers | `prepareRange(length, keep, prior)` → `RangeOutput` (`values`, `bits`, `set`, `clear`) carrying `[0, keep)` forward as blocks — values **and** validity; `sealRange(out, length)` → `Float64Column`; `validityByteCount`. Reached from an op as `ctx.out[n]` | `packages/process/src/column.ts` |
|
|
528
|
+
| Ranged recompute | `graph.setSourceFrom(series, changedFrom)` — declares which row first changed; `graph.recomputes` → `{ ranged, full }`. An op opts in with `OpDef.runRange(ctx)`, receiving `{ from, to, previous, previousView, out }` (type `RangeContext`) — write into `out` and return nothing for the block path alongside the usual context. Requires `lookback`. Falls back to a full `run` whenever anything is missing | `packages/process/src/plan/graph.ts` |
|
|
529
|
+
| Node budget | `bind(series, { registry, budgetBytes })` — engine-wide cap on retained node values, LRU, enforced after each `run`; `graph.retainedBytes` / `graph.evictions` / `graph.enforceBudget()`. Unbounded when omitted. Skips a node whose consumer still holds its outlet | `packages/process/src/plan/graph.ts` |
|
|
530
|
+
| Plan history | `requiredHistory(registry, plan)` → `{ known, rows?, undeclared, byOp }` — the minimum safe tail in rows, folded from per-op `OpDef.lookback`. Sums along nesting, maxes across siblings. `known: false` names ops with no declared lookback rather than defaulting to zero (type `HistoryResult`) | `packages/process/src/plan/history.ts` |
|
|
531
|
+
| Column values | `packColumn` (values → packed `Float64Column`, NaN = missing), `columnBytes` (retained size, for a byte budget), `appendColumn` (column → series; boxing-free when gapless), `columnBuffers` / `columnFromBuffers` (the buffer pair a column is, for an isolate boundary; type `ColumnBuffers`), `columnView` (zero-copy borrowed read view for in-process folds; type `ColumnView`) | `packages/process/src/column.ts` |
|
|
532
|
+
| Plan — registry | `createRegistry({ folds })` / `Registry` (`define`, `get`, `foldFor`, `outputsOf`, `resolveParams`, `byFamily`, `describe`, `toJsonSchema`), param builders `int` / `num` / `choice` / `flag`, `UnknownOpError`, `ParamError` | `packages/process/src/plan/registry.ts`, `params.ts` |
|
|
533
|
+
| Plan — identity | `specId` (content-addressed, param-order invariant, defaults materialized), `refToId`, `explain`, `unitOf`, `columnsOf`, `dependsOn`, `outputKey` | `packages/process/src/plan/identity.ts` |
|
|
534
|
+
| Plan — types | `Spec`, `Plan`, `Input` (column name \| `Spec` \| `PickedOutput`), `SpecRef`, `Def` (`OpDef` \| `FoldDef`), `OpContext`, `OpResult`, `FoldContext`, `FactBody`, `isFold`, `ParamDef`, `Params`, `Units`, `InputDef`, `OutputDef` | `packages/process/src/plan/types.ts` |
|
|
535
|
+
| Plan — bind / run | `bind(series, { registry, units })` → `BoundGraph` (`compile`, `setSource`, `ids`, `series`, `columnOf`), `run(graph, { plan, select, onError })` → `RunResult`, `UnitError` | `packages/process/src/plan/graph.ts`, `run.ts` |
|
|
536
|
+
| Plan — request/response | `RunRequest` (`PlanRequest` \| `SlotRequest`), `RunOptions`, `RunResult`, `Select` (`{ on, output?, name? }` — points at a node; what comes back is what that node produces), `ErrorPolicy`, `Fact` (carries `op`), `OutputInfo`, `Skipped`, `NodeTiming` (`slot`, `pulled`, `cached`, `ms`, `inputs`) | `packages/process/src/plan/run.ts` |
|
|
537
|
+
| Plan — host | `createHost({ registry, units, sources })` → `Host` (`add`, `has`, `datasets`, `graphFor`, `run`, `runAsync`), `toWire`, `UnknownDatasetError`; local-string `Envelope` (`PlanEnvelope` \| `SlotEnvelope`), remote-capable `AsyncEnvelope` (`AsyncPlanEnvelope` \| `AsyncSlotEnvelope` \| `Envelope`), `DatasetInfo`, `WireResult` | `packages/process/src/plan/host.ts` |
|
|
538
|
+
| Plan — slots | `expandSlots(slots, columns)` → `Map<slot, Spec>` (expands to the nested form, so ids match by construction; `slot#Output` picks one output), `SlotError`; types `SlotDef` (`{ op, params, in }`), `Slots` | `packages/process/src/plan/slots.ts` |
|
|
539
|
+
| Plan — builder | `plan(from)` → low-level `PlanBuilder`; `process(registry, from)` → typed fluent `ProcessBuilder` (`column`, op methods, `outputs`), `BuilderError`; types `NodeHandle`, `OutputHandle`, `FluentColumnRef`, `SingleColumnNode`, `MultiColumnNode`, `ColumnSelection`, `FactRef`, `BuiltRequest` | `packages/process/src/plan/builder.ts`, `fluent.ts` |
|
|
540
|
+
| Plan — async sources | `defineSource({ name, load })`, `createSourceRegistry()` / `SourceRegistry`, `sourceId`, `UnknownSourceError`; types `SourceRef`, `SourceParams`, `LoadedSource` (value + revision), `SourceLoadContext`, `SourceDef` | `packages/process/src/plan/source.ts` |
|
|
541
|
+
| Plan — folds | `STANDARD_FOLDS` and the four it holds — `last`, `extremes`, `percentileRank`, `shape` — pre-registered by `createRegistry()`; each a plain `FoldDef`, so a consumer can `define` over one | `packages/process/src/plan/folds.ts` |
|
|
542
|
+
| Errors | `ProcessError` (base), `CycleError`, `UnconnectedInputError`, `MissingOutputError`, `UnsetSourceError` | `packages/process/src/errors.ts` |
|
|
543
|
+
| Node type helpers | `NodeSpec`, `NodeFactory`, `InletsFor`, `OutletsFor`, `OutletValue`, `SpecsForOutlets`, `DerivedOutput` | `packages/process/src/node.ts` |
|
|
544
|
+
|
|
545
|
+
Note: this package's `npm test` includes a `test:dts` step that typechecks the
|
|
546
|
+
**emitted** `dist/*.d.ts` from a consumer's perspective (`test-dts/`,
|
|
547
|
+
`skipLibCheck: false`). The package's own build sets `skipLibCheck: true` and
|
|
548
|
+
never checks its own output, so a declaration referencing a type `stripInternal`
|
|
549
|
+
deleted builds green and breaks only downstream. If you mark something
|
|
550
|
+
`@internal`, confirm no public signature names it.
|
|
551
|
+
|
|
552
|
+
---
|
|
553
|
+
|
|
554
|
+
## Cross-package seams (where agents most often need the joint)
|
|
555
|
+
|
|
556
|
+
- **Batch → charts**: a draw layer takes a pond `series` + `column` directly;
|
|
557
|
+
the `data.ts` adapters are the explicit versions of what layers do
|
|
558
|
+
internally. Histogram path: `series.byColumn(...)` → `stacksFromBins(...)` →
|
|
559
|
+
`<BarChart bins>`.
|
|
560
|
+
- **Live → react → charts**: `LiveSeries` → `useSnapshot`/`useWindow` →
|
|
561
|
+
the same layer props a batch chart uses (no separate live-mode API).
|
|
562
|
+
- **Financial → charts**: `TradingCalendar.discontinuities()` →
|
|
563
|
+
`ChartContainer calendar` (trading-time axis); studies append columns that
|
|
564
|
+
`LineChart`/`BandChart` draw (`bbUpper`/`bbLower` → `BandChart`).
|
|
565
|
+
- **Core → financial**: studies compose on core kernels; fluent methods mutate
|
|
566
|
+
`TimeSeries.prototype` (runtime import of `@pond-ts/financial/fluent`
|
|
567
|
+
required).
|
|
568
|
+
- **Live → process**: `fromLive(liveSeries)` binds a live source as a graph
|
|
569
|
+
input. Events only mark the node dirty; the snapshot runs once at the next
|
|
570
|
+
pull, so per-event incremental work stays in the live layer and the graph
|
|
571
|
+
composes batch transforms over snapshots. The graph has **no partial
|
|
572
|
+
invalidation** — a dirty node recomputes from a whole snapshot — so for
|
|
573
|
+
windowed work bind the _aggregation_ (`fromLive(live.aggregate(...))`),
|
|
574
|
+
which materializes bucket count rather than event count (235x per pull on
|
|
575
|
+
a 50k buffer). Tradeoff: a live aggregation exposes closed buckets only,
|
|
576
|
+
so the in-progress bucket is invisible until it closes.
|