This is watershed, running in your browser: the same Rust engine its tests check, compiled to WebAssembly. Move a slider and watch the change flow up the graph. Where a recalculated value comes out the same as before, the update stops.
A data grid built on the engine: every cell is a node, and its totals are aggregates. Open it on its own page.
Prices stream from Coinbase's public feed. Move the risk limit yourself.
Starting the engine…
The same formulas, compiled to a plan and run for many values of one input. The graph above keeps the values it has.
Nothing run yet.
| Output | At the lowest | At the highest | Least | Most | Mean |
|---|
A browser has no CUDA, so the plan runs here on one thread. Natively the same plan runs on every core or on a GPU: cargo run --release -p watershed-gpu --example loans.
Click any node in the graph to explain it.
The crypto book is a small trading portfolio: eight coins held across three desks. Its prices come from Coinbase as trades happen, many times a second. Each price is an input at the bottom of the graph, and everything above it is calculated from those prices.
btc eth sol avax link ada xrp doge, in US dollars, live from Coinbase. risk_limit is yours to set.ok, too concentrated or over limit.sol input turns green.status is not recalculated at all. The update stops as soon as nothing above it can change. The Updates panel records which coin moved and where each update stopped.Ticks are prices received from Coinbase. Updates are runs of the engine: prices that arrive within the same screen refresh are applied together in one update, so there are fewer updates than ticks. Engine time is how long the engine itself took per update, typically tens of microseconds in a browser.
risk_limit below the book value. within_limit turns false and the status changes to "over limit". Drag it back up.This book has only 18 nodes, so recalculating everything on every tick would be instant too. Real books have thousands of positions and risk measures on top of them, where recalculating everything for every tick is too slow. The rule is the same at any size: recalculate what depends on the change, and stop where nothing changes. The benchmark below builds a graph of up to a million nodes in your browser and compares the two approaches.
Market prices feed trades, and trades add up through a tree of totals to one figure. Build it here, then compare changing a few prices with recalculating every node.
Nothing built yet.
Results appear here: the time for each kind of update, measured in this browser.
Not everything is prices. Wikimedia publishes every edit to every wiki as it is saved, a few dozen a second. Here each edit becomes a row in a watershed collection, which keeps totals over its rows and a total per wiki. The table holds the latest 5,000 edits: each new edit adds a row and pushes out the oldest, and only the totals those two rows belong to are recalculated.
–
Edits stream from stream.wikimedia.org. Nothing is sent back.
Each update's work appears here.
| Wiki | Edits | Share | Bytes |
|---|---|---|---|
| Waiting for edits. | |||
Pick a wiki in the table.
Each edit is a row with three fields: the wiki, the change in size in bytes, and whether a bot made it. Each row also has calculated columns: is_bot, grew (bytes added, or 0) and shrank (bytes removed, or 0). Over the rows sit totals (the count, bot edits, bytes added and removed, the bot share) and, for each wiki, its own count and byte total.
A new edit for English Wikipedia changes the overall totals and English Wikipedia's totals. The edit it pushes out changes the overall totals and its own wiki's. Every other wiki's totals are left alone. Each total updates only its path through a tree of partial sums, so the work stays small however many rows the window holds, and the totals are the same, to the last bit, as adding the rows up from scratch.