pond-rs (Rust)
pond-rs is pond written in Rust. It does the same time series work as
the pond-ts core (rolling windows, buckets by calendar day in a time zone,
gaps that stay gaps, per-entity work) and gives the same answers as pond-ts,
to the last bit. It is built mainly for AI agents that write Rust, and for
anyone who wants pond's rules at native speed.
:::note Early versions
pond-rs is on crates.io, with the full API reference on docs.rs. It is at 0.1, so the API can still change between minor versions. These pages describe the latest version, and they grow as more is built.
:::
- Rust
- JavaScript
# Cargo.toml
[dependencies]
pond-rs = "0.1"
npm install @pond-ts/rs
The same Rust code compiled to WebAssembly, for Node and browsers, with pond-ts's method names. It has pond-ts's version number and is released with it. See From JavaScript.
Why a Rust version
- Speed and threads. JavaScript runs one core at a time. pond-rs runs independent pieces of work on several cores, and on one core it was 2.4× to 13× faster than pond-ts in every benchmark so far but one, where the two tied. On the first benchmark (1 million rows), pond-rs on 4 cores took 141–159 ms where polars took 209–231 ms and pond-ts about 3 seconds. Details on Performance.
- The same answers. Every operation pond-ts also has is checked against pond-ts's own output on a shared set of test cases, bit for bit. A result does not change with the number of threads either.
- Time is the point. General table libraries like polars are very good at tables. pond's strengths are time-aware ones: rows keyed by a moment, a span or a labelled bucket; calendar days that know a day can be 23 or 25 hours long; and clear rules for missing values.
- Errors that say what to fix. Column types are checked when the code runs, and each error names the call, the column and what was expected, so an agent can fix its code from the message alone.
What exists today
| Area | In pond-rs now |
|---|---|
| Series and keys | Rows keyed by a time, a time range, or a labelled interval; parse_time reads times written as text |
| Column kinds | Numbers, exact decimals, text, true/false, lists; any may have gaps |
| Windows and buckets | rolling over a time window (trailing, leading or centred) or the last N rows, or on a regular grid; aggregate into fixed buckets ("5m") or calendar buckets in a time zone |
| Reducers | every pond-ts reducer: count, sum, avg, min, max, first, last, median, stdev, percentiles, keep, difference, unique, top, samples |
| Row by row | diff, rate, pct_change, shift, cumulative, fill |
| Along a column | by_column (bins by value: histograms, per-km splits, time in zone), rolling_by_column (a window along distance or another rising column); by_value (a series keyed by distance or another rising number) |
| Smoothing and bands | smooth (EMA, moving average, loess), baseline / outliers, scan (a running total of your own), sample |
| Finding rows | at, bisect, at_or_before / at_or_after, nearest, find, some / every |
| Time spans | within, contained_by, overlapping, trim, before / after; time_range, overlaps, intersection |
| Picking and changing | slice, tail, first / last, filter (a Rust closure per row), reduce (one row for the whole series), with_column, map_numbers and friends, select, rename; as_time, as_time_range, as_interval, offset_time to change the key |
| Regular grids | align (value at each grid point: hold or straight line), materialize (one reading per bucket), dedupe (repeated times) |
| Joining and reshaping | join and join_many (columns side by side, matched by key), concat (rows stacked), collapse (several columns into one), pivot_by_group (long rows into wide) |
| Per entity | partition_by / group_by on one or more columns, partitions run on several cores |
| Arrow and JSON | Read and write Arrow IPC (Feather v2) files and streams, compressed or not; columns can share the file's memory instead of copying it. Read and write pond-ts's JSON format |
Also built: financial studies. Moving averages and rolling statistics, the moving-average family (MACD, …), bands (Bollinger, Keltner, …), momentum (RSI, stochastics, CCI, …), trend (ADX, Ichimoku, …), volatility (ATR, …), statistics (linear regression, beta, …), volume (OBV, money flow index, VWAP, …), price (typical price, balance of power, …), trading calendars and the session studies (session VWAP, pivot points, anchored VWAP) are built, all 109 pond-ts studies; see Finance studies.
Also built: the live layer: series that take events as they arrive, with
live views (filter, map, window, diff, rate, fill, cumulative,
…), aggregate by minute or by calendar day in a time zone, rolling
windows, reduce, and partitions (one series per host, with views and
windows on each); see Live series.
Also built: @pond-ts/rs, pond-rs compiled to WebAssembly for
JavaScript (Node and browsers), with pond-ts's method names and argument
shapes: the batch core, expressions, the 109 studies, trading calendars
and live series; see From JavaScript.
Where to go next
- API reference on docs.rs: every type and function, for the published version.
- Getting started: add the dependency, build a series, bucket it by day.
- Python (pond_rs): the same from Python,
pip install pond-rs, with polars, pandas and pyarrow frames in and out. - Series and columns: keys, column kinds, gaps, and reading values back.
- Operations: rolling windows, buckets, row-by-row changes, filtering and mapping.
- Partitions: the same work per host, per symbol, per anything.
- Finance studies: moving averages, MACD, bands, RSI
and more over price bars, as
@pond-ts/financial. - Live series: events as they arrive, with live filters, per-minute buckets, rolling windows, running totals and per-host partitions.
- Arrow and JSON: reading and writing files, when memory is shared, and pond-ts's JSON format.
- From JavaScript:
@pond-ts/rsin Node and browsers, and how it differs from pond-ts. - Performance: threads, and what the benchmarks measured.
- Coming from pond-ts: what is the same, what is different, and why.
Roadmap
pond-rs follows a written plan in the repository
(docs/rfcs/pond-rs.md
for the reasoning, PLAN.md for the current steps). In order:
- Batch core (done). The first slice, R1a, met every target it set itself; R1b added the rest of pond-ts's batch operations, step by step.
- Financial studies (done), checked against the same pandas / TA-Lib test cases pond-ts uses.
- Live layer (done): series that update as data arrives.
- JavaScript bridge (done):
@pond-ts/rs, the same Rust code as WebAssembly, with pond-ts's method names.
Charts, React and @pond-ts/process stay TypeScript only.