kline-orderbook-chart 2.0.0 → 2.2.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/README.md CHANGED
@@ -1,686 +1,202 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/tapedelta/kline-orderbook-chart/main/assets/media/kline-orderbook-chart.png" alt="Kline Orderbook Chart — Candlestick with real-time orderbook heatmap, footprint chart, liquidation heatmap, and indicators" width="100%" />
2
+ <img src="https://raw.githubusercontent.com/tapedelta/kline-orderbook-chart/main/assets/media/kline-orderbook-chart.png" alt="Candlestick chart with orderbook depth heatmap, footprint and indicators rendered by kline-orderbook-chart" width="100%" />
3
3
  </p>
4
4
 
5
- <h1 align="center">Kline Orderbook Chart</h1>
5
+ <h1 align="center">kline-orderbook-chart</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>The only chart library with built-in orderbook heatmap, footprint chart, and liquidation heatmap<br/>all in one <code>&lt;canvas&gt;</code>, powered by a native high-performance engine</strong>
8
+ Candlestick chart library for trading products, with an orderbook depth heatmap, footprint chart, volume profiles and order-flow indicators on one canvas.
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://tapedelta.com/examples"><strong>▶ Live Demos</strong></a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
13
- <a href="https://tapedelta.com/docs/charting-library/getting-started"><strong>📖 Docs</strong></a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
14
- <a href="https://app.tapedelta.com/trading/chart-terminal">Full App</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
15
- <a href="#run-demo-locally">Run Demo Locally</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
16
- <a href="https://discord.gg/cJn5P6Mn3c">Discord</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
17
- <a href="https://x.com/mrDocTradingIO">X</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
18
- <a href="mailto:support@tapedelta.com">Contact</a>
12
+ <a href="https://tapedelta.com/docs/charting-library/getting-started"><strong>Documentation</strong></a> ·
13
+ <a href="https://tapedelta.com/docs/charting-library/api-reference">API reference</a> ·
14
+ <a href="https://tapedelta.com/examples">Live demos</a> ·
15
+ <a href="https://tapedelta.com/chart-library/pricing">Pricing</a> ·
16
+ <a href="./CHANGELOG.md">Changelog</a>
19
17
  </p>
20
18
 
21
19
  <p align="center">
22
20
  <a href="https://www.npmjs.com/package/kline-orderbook-chart"><img alt="npm version" src="https://img.shields.io/npm/v/kline-orderbook-chart?color=0a7cff&label=npm" /></a>
23
- <a href="https://www.npmjs.com/package/kline-orderbook-chart"><img alt="npm downloads" src="https://img.shields.io/npm/dm/kline-orderbook-chart?color=0a7cff" /></a>
24
- <img alt="bundle size" src="https://img.shields.io/badge/bundle-380KB_gzip-0a7cff" />
25
- <img alt="zero dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen" />
26
- <img alt="framework agnostic" src="https://img.shields.io/badge/framework-agnostic-blueviolet" />
21
+ <img alt="dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen" />
27
22
  <img alt="license" src="https://img.shields.io/badge/license-commercial-orange" />
28
23
  </p>
29
24
 
30
- <p align="center">
31
- <a href="https://tapedelta.com/examples"><img alt="Live Demos — run in your browser" src="https://img.shields.io/badge/LIVE_DEMOS-run_in_your_browser-0a7cff?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1Mi41OSA0OS42MSI%2BPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTQwLjQ1LDE1LjljMi4xOSwwLDQuMTcuODgsNS42LDIuMzEsMS40MywxLjQzLDIuMzIsMy40LDIuMzIsNS41OCwwLDQuMzYtMy41NSw3Ljg5LTcuOTIsNy44OWgtNS4wNHYtMTUuNzhoNS4wNFoiLz48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMjkuNTIsNDcuMzJsLTEuNi0yOS4wOWMwLTIuNDUtLjk4LTQuOC0yLjcyLTYuNTNMMTUuNzUsMi4yOXYyNS4zM2MwLDMuOTUsMS40Niw3Ljc1LDQuMSwxMC42OWw5LjY2LDkuMDFaIi8%2BPHBhdGggZmlsbD0iI2ZmZiIgZD0iTTI5LjUyLDQ3LjMyYy0uOTgtLjkzLTYuNTUtNi4wOS03LjY5LTcuMTctMS44Mi0xLjczLTMuMTUtMi44Mi00LjY1LTUuOTktMS40LTIuOTUtMS4zMy01LjE3LTEuNC03Ljkxdi0xMC4zNGMyLjU1LDIuNTIsNi4yMiw0LjkxLDYuMzMsOS4xbC4xMSwzLjkzcy4wMi42Ni4wNC45NmMuMTQsMi4xNywzLjY3LDEwLjAzLDcuMjYsMTcuNDRaIi8%2BPC9zdmc%2B" /></a>
32
- </p>
33
-
34
- <p align="center">
35
- <strong><a href="https://tapedelta.com/examples">Try 20+ interactive demos live in your browser →</a></strong><br/>
36
- Kline · Orderbook Heatmap · Footprint · DOM Ladder · Volume Profile · CVD · RSI · Bar Replay · Mobile — real Binance data, no clone, no build step.
37
- </p>
38
-
39
- <p align="center">
40
- 📖 <strong>Full documentation:</strong> <a href="https://tapedelta.com/docs/charting-library/getting-started"><code>tapedelta.com/docs/charting-library/getting-started</code></a>
41
- </p>
42
-
43
- ---
44
-
45
- > **Upgrading from `0.x`?** `1.0.0` replaces the license layer with Ed25519
46
- > for security reasons — old keys do not validate. See [CHANGELOG.md](./CHANGELOG.md)
47
- > for the migration steps. If you are on a paid plan, email
48
- > <support@tapedelta.com> with your previous key for a free replacement
49
- > token (same plan, same expiry).
50
-
51
25
  ---
52
26
 
53
- ## The problem
54
-
55
- You need a candlestick chart that also renders **real-time orderbook depth as a heatmap** behind the candles. You search for "orderbook heatmap chart library" or "kline heatmap javascript" — and find nothing. Every existing charting library gives you candles OR a heatmap, never both rendered together in a single performant canvas.
56
-
57
- Building it yourself means months of work: Canvas rendering, depth matrix management, color mapping, scroll sync, zoom, crosshair, touch events, and performance optimization for hundreds of thousands of data points updating in real-time.
58
-
59
- **Kline Orderbook Chart solves this.** One npm install. One `<canvas>`. Candlesticks with orderbook heatmap, footprint chart, liquidation heatmap, and 12+ indicators — all rendered at 60 fps by a native high-performance engine.
60
-
61
- ---
62
-
63
- ## See it in action
64
-
65
- <p align="center">
66
- <img src="https://raw.githubusercontent.com/tapedelta/kline-orderbook-chart/main/assets/media/heatmap-large-trades.png" alt="Candlestick chart with orderbook heatmap, large trade bubbles, and liquidation heatmap overlay" width="100%" />
67
- </p>
68
-
69
- <p align="center">
70
- <em>BTC/USDT — Candlestick + Orderbook Heatmap + Large Trade Bubbles + Liquidation Heatmap + RSI with signals</em>
71
- </p>
72
-
73
- <p align="center">
74
- <img src="https://raw.githubusercontent.com/tapedelta/kline-orderbook-chart/main/assets/media/footprint-chart.png" alt="Footprint chart with bid ask volume, delta, imbalance detection, and VRVP profile" width="100%" />
75
- </p>
76
-
77
- <p align="center">
78
- <em>BTC/USDT — Footprint chart with bid/ask volume at every price level, POC, delta, VRVP profile panel</em>
79
- </p>
80
-
81
- > **Video demos:** See the full interactive experience in the [`assets/media/`](https://github.com/tapedelta/kline-orderbook-chart/tree/main/assets/media) folder — real-time orderbook heatmap streaming, drawing tools, theme switching, and more.
82
-
83
- ---
84
-
85
- ## What makes this different
86
-
87
- ### Orderbook Heatmap + Candlestick — in one chart
88
-
89
- No other charting library renders orderbook depth data as a heatmap layer behind candlesticks. This library takes a real-time depth matrix (price levels x time columns) and renders it as a color-mapped heatmap with adaptive intensity — while simultaneously drawing candles, volume, and all your indicators on top. One canvas, one render loop, zero lag.
90
-
91
- ### Footprint Chart — built-in, not a plugin
92
-
93
- Bid/ask volume at every price level, rendered inline on each candle. Delta coloring, imbalance dot detection, POC (Point of Control) highlighting, and a full volume profile panel on the right side. This is the same visualization prop trading firms pay thousands for — now embeddable in any web app.
94
-
95
- ### Liquidation Heatmap
96
-
97
- Estimated liquidation level clusters rendered as a heat overlay. See where leveraged positions are concentrated and where cascading liquidations may trigger — directly on the price chart.
98
-
99
- ### Native Performance
100
-
101
- The entire computation pipeline — indicator math, heatmap color mapping, viewport transforms, hit testing — runs in a native-compiled engine. JavaScript only handles Canvas 2D draw calls via a zero-copy binary command protocol. The result:
102
-
103
- - **60 fps** with 100K+ candles and a 500x200 heatmap matrix updating in real-time
104
- - **~12 MB memory** at 50K candles (vs 50-120 MB for JS-only libraries)
105
- - **Near-zero GC pressure** — no jank from garbage collection pauses
106
- - **380 KB gzip** total bundle
107
-
108
- ### Framework Agnostic
109
-
110
- Give it a `<canvas>` element. It works with React, Vue, Svelte, Angular, or vanilla JavaScript. No framework lock-in, no virtual DOM overhead.
111
-
112
- ---
27
+ ## Install
113
28
 
114
- ## Benchmark
29
+ ```bash
30
+ npm install kline-orderbook-chart
31
+ ```
115
32
 
116
- <p align="center">
117
- <img src="https://raw.githubusercontent.com/tapedelta/kline-orderbook-chart/main/assets/media/benchmark.png" alt="Kline Orderbook Chart — Native Engine Benchmark Results" width="100%" />
118
- </p>
33
+ With **Vite**, exclude the package from dependency pre-bundling so the dev server serves its engine file:
119
34
 
120
- Real benchmark from the built-in performance suite, measured on a standard desktop (M-series Mac, Chrome):
35
+ ```javascript
36
+ // vite.config.js
37
+ export default { optimizeDeps: { exclude: ['kline-orderbook-chart'] } }
38
+ ```
121
39
 
122
- ### Engine Init & Rendering
40
+ Other bundlers and SSR frameworks: see [Getting Started → Bundlers](https://tapedelta.com/docs/charting-library/getting-started#bundlers).
123
41
 
124
- | Metric | Result |
125
- |---|---|
126
- | **Engine init** | **6 ms** |
127
- | **Peak FPS** | **29,412 fps** |
128
- | **Render (all indicators)** | **0.10 ms/frame** |
129
- | **Benchmark score** | **95 / 100 — Exceptional** |
42
+ ## Quick start
130
43
 
131
- ### Candle Scaling (RSI + Volume enabled)
44
+ ```html
45
+ <div style="width: 100%; height: 600px">
46
+ <canvas id="chart" style="width: 100%; height: 100%; display: block"></canvas>
47
+ </div>
48
+ ```
132
49
 
133
- | Candle count | FPS |
134
- |---|---|
135
- | 100 | 29,412 |
136
- | 500 | 11,905 |
137
- | 1K | 11,628 |
138
- | 5K | 11,905 |
139
- | 10K | 12,195 |
140
- | 25K | 11,628 |
141
- | 50K | 11,905 |
142
- | 100K | 11,628 |
50
+ ```javascript
51
+ import { createChartBridge } from 'kline-orderbook-chart'
143
52
 
144
- FPS stays above **11,000** even at 100K candles — essentially **zero performance degradation** at scale.
53
+ async function main() {
54
+ const canvas = document.getElementById('chart')
55
+ const chart = await createChartBridge(canvas, { licenseKey: 'YOUR_LICENSE_KEY' })
145
56
 
146
- ### Render Breakdown (10K candles, 100 bars avg)
57
+ const res = await fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
58
+ const rows = await res.json()
147
59
 
148
- | Component | Time |
149
- |---|---|
150
- | Candles | 0.045 ms |
151
- | RSI | 0.027 ms |
152
- | Volume | 0.081 ms |
153
- | Smart Ranges | 0.002 ms |
154
- | EMA Structure | 0.017 ms |
155
- | **Total** | **0.10 ms** |
60
+ chart.setCandleInterval(300) // seconds per candle
61
+ chart.setPrecision(1)
62
+ chart.setKlines(
63
+ rows.map(r => r[0] / 1000), // Unix seconds
64
+ rows.map(r => +r[1]), rows.map(r => +r[2]),
65
+ rows.map(r => +r[3]), rows.map(r => +r[4]),
66
+ rows.map(r => +r[5]),
67
+ )
68
+ chart.enableVolume()
69
+ chart.start()
156
70
 
157
- ### Interaction Latency (10K candles, 200 bars avg)
71
+ new ResizeObserver(() => chart.resize()).observe(canvas.parentElement)
72
+ }
158
73
 
159
- | Action | Latency |
160
- |---|---|
161
- | Pan | 0.11 ms |
162
- | Zoom | 0.11 ms |
163
- | Crosshair | 0.10 ms |
74
+ main()
75
+ ```
164
76
 
165
- Sub-millisecond response for all user interactions.
77
+ Live updates use `chart.updateLastKline(t, o, h, l, c, v)` for the forming bar and `chart.appendKline(...)` for a new bar. Call `chart.destroy()` when the component unmounts.
166
78
 
167
- ### First Render Time
79
+ ## License keys
168
80
 
169
- | Candle count | Time |
81
+ | Key | Result |
170
82
  |---|---|
171
- | 100 | 0.3 ms |
172
- | 1K | 0.3 ms |
173
- | 10K | 2.1 ms |
174
- | 50K | 9.1 ms |
175
-
176
- 50,000 candles render in **under 10 ms** on first load.
177
-
178
- ### Real-Time Streaming Performance (10K candles, RSI + Volume, simulated WebSocket feed)
83
+ | None | Free tier: candles, volume and basic drawing tools, with a small brand mark. No expiry. |
84
+ | Trial key | Every feature for 30 days, with a "Trial" badge. Get one at [tapedelta.com/chart-library/checkout?plan=trial](https://tapedelta.com/chart-library/checkout?plan=trial). |
85
+ | Paid key | Your plan's features, no watermark, on the domains (web) or app platform (desktop, mobile) in the key. |
179
86
 
180
- | Operation | FPS | Latency |
181
- |---|---|---|
182
- | Kline tick update | 711 fps | 1.41 ms avg |
183
- | New candle append | 696 fps | 1.44 ms avg |
184
- | Heatmap update | 5,792 fps | 0.17 ms avg |
185
- | Combined stress | 653 fps | 1.53 ms avg |
87
+ Keys are verified on the device; no network request is made. `createChartBridge` never rejects because of a license problem: an invalid key shows a notice on the canvas, an expired paid key keeps working for 7 days and then runs the free tier, and a string that is not a key (such as `'trial'`) runs the free tier. Details: [Licensing](https://tapedelta.com/docs/charting-library/licensing).
186
88
 
187
- All real-time operations maintain **60+ fps** with headroom to spare. Heatmap updates run at nearly **6,000 fps**.
89
+ ## Features
188
90
 
189
- ### Full Indicator Stress Test (8 indicators: RSI + Volume + Smart Ranges + EMA + VRVP + OI + CVD + Large Trades)
190
-
191
- | Test | Result |
91
+ | Area | Included |
192
92
  |---|---|
193
- | Cold load + render | 57 fps, 17.98 ms/frame |
194
- | Sustained render | 6,135 fps, 0.16 ms/frame |
195
- | Tick + all indicators | 150 fps, 6.68 ms/frame |
196
- | Pan + all indicators | 4,950 fps, 0.20 ms/frame |
197
-
198
- Even with **8 indicators active simultaneously** on 10K candles, sustained rendering runs at **6,135 fps**.
199
-
200
- ---
201
-
202
- ## Full Feature Set
203
-
204
- <table>
205
- <tr>
206
- <td width="50%">
207
-
208
- ### Order Flow Visualization
209
- - **Orderbook Heatmap** — real-time depth matrix behind candles
210
- - **Footprint Chart** — bid/ask volume, delta, imbalance, POC
211
- - **Liquidation Heatmap** — leveraged position cluster overlay
212
- - **VRVP** — Visible Range Volume Profile
213
- - **TPO / Market Profile** — time-at-price distribution
214
- - **Large Trade Bubbles** — whale order visualization
215
-
216
- </td>
217
- <td width="50%">
218
-
219
- ### Technical Indicators
220
- - **RSI** with divergence detection & pullback signals — *renders a state you supply via `setRsiStateJson()`; see CHANGELOG 2.0.0*
221
- - **Open Interest** with delta tracking
222
- - **Cumulative Volume Delta (CVD)**
223
- - **Funding Rate** overlay
224
- - **EMA Structure** — multi-period trend strength
225
- - **Custom Indicator Plugin API** — build your own
226
-
227
- </td>
228
- </tr>
229
- <tr>
230
- <td>
231
-
232
- ### Drawing & Interaction
233
- - 10+ tools: Trendline, Fibonacci, Channel, Pitchfork, Elliott Wave, Brush, Rectangle, Path, and more
234
- - Full JSON export/import for persistence
235
- - Multi-pane crosshair sync
236
- - Rich tooltip with OHLCV + indicator data
237
- - Bar replay mode
238
-
239
- </td>
240
- <td>
241
-
242
- ### Core Charting
243
- - Candlestick, Heikin-Ashi, Line, Area chart types
244
- - Volume histogram with climax detection
245
- - Responsive time & price axes with auto-scaling
246
- - Dark, light, and fully custom themes
247
- - Smooth pan, pinch-zoom, mouse wheel zoom
248
- - Touch-optimized for mobile & tablet
249
-
250
- </td>
251
- </tr>
252
- </table>
253
-
254
- ---
255
-
256
- ## Quick Start
93
+ | Chart types | Candles, hollow candles, bars, footprint, Renko, TPO profile chart |
94
+ | Order flow | Orderbook depth heatmap, footprint with stacked imbalances, liquidation heatmap, large trades, aggregated liquidations |
95
+ | Oscillators | RSI |
96
+ | Volume and profile | Volume, VRVP, TPO / Market Profile, CVD, VPIN |
97
+ | Structure | EMA Structure, Gaussian VWAP Cloud, Smart Ranges |
98
+ | Derivatives | Open Interest, Funding Rate |
99
+ | Drawing | Basic tools on every plan; Fibonacci, positions, anchored VWAP, fixed-range profile, auto Elliott and chart patterns on Professional and above |
100
+ | Custom indicators | JavaScript plugin API (Professional, Enterprise) |
101
+ | Side panels | Orderbook · Depth Profile, DOM Ladder, Tick Stream, Time & Sales tape (Enterprise) |
257
102
 
258
- ### Install
103
+ The library renders data you supply; it does not include market data, application UI (toolbars, settings dialogs, symbol search) or alert delivery. MACD, Stochastic and Bollinger Bands are not built in; they can be written with the custom indicator API.
259
104
 
260
- ```bash
261
- npm install kline-orderbook-chart
262
- ```
105
+ ## Orderbook heatmap
263
106
 
264
- ### Basic usage
107
+ The depth matrix is row-major `[rows × cols]`: price rows from `yStart` upward, time columns from `xStart`.
265
108
 
266
109
  ```javascript
267
- import { createChartBridge, prefetchEngine } from 'kline-orderbook-chart'
268
-
269
- // Pre-load engine for faster first render (optional)
270
- prefetchEngine()
271
-
272
- // Create chart
273
- const canvas = document.getElementById('chart')
274
- const chart = await createChartBridge(canvas, {
275
- // Ed25519-signed license token (JWS-compact: header.payload.signature).
276
- // Omit, or pass 'trial', to run a 14-day watermarked trial.
277
- licenseKey: 'YOUR_LICENSE_TOKEN',
278
- })
279
-
280
- // Load data (six separate arrays)
281
- chart.setKlines(
282
- [1710000000, 1710003600], // timestamps (seconds)
283
- [65200, 65600], // opens
284
- [65800, 66100], // highs
285
- [65100, 65400], // lows
286
- [65600, 65900], // closes
287
- [1234.5, 987.2], // volumes
288
- )
289
- chart.setCandleInterval(3600)
290
- chart.setPrecision(1)
291
-
292
- // Enable indicators
293
- chart.enableVolume()
294
- chart.enableRsi()
295
- chart.setRsiPeriod(14)
296
-
297
- // Start rendering
298
- chart.start()
299
-
300
- // Real-time update
301
- ws.onmessage = (e) => {
302
- const { k } = JSON.parse(e.data)
303
- chart.updateLastKline(Math.floor(k.t / 1000), +k.o, +k.h, +k.l, +k.c, +k.v)
304
- }
305
- ```
306
-
307
- ### Enable orderbook heatmap
110
+ const matrix = new Float32Array(rows * cols)
111
+ // matrix[r * cols + c] = resting size at price yStart + r * yStep, time xStart + c * xStep
112
+ chart.setHeatmap(matrix, rows, cols, xStart, xStep, yStart, yStep)
308
113
 
309
- ```javascript
310
- const yStep = (priceMax - priceMin) / rows
311
- const xStep = (timeEnd - timeStart) / cols
312
-
313
- chart.setHeatmap(
314
- depthMatrix, // Float64Array — flattened row-major
315
- 200, // rows (price levels)
316
- 100, // cols (time columns)
317
- timeStart, // timestamp of first column (seconds)
318
- xStep, // time interval between columns
319
- priceMin, // price of first row
320
- yStep, // price interval between rows
321
- )
114
+ // each new snapshot: one value per price row
115
+ chart.appendHeatmapColumn(column, snapshotTs, yStart, yStep)
322
116
  ```
323
117
 
324
- ### Enable footprint chart
118
+ ## Footprint
325
119
 
326
120
  ```javascript
327
- chart.setChartType(2)
328
121
  chart.setFootprintTickSize(10)
329
- chart.footprintEnsureLen(timestamps.length)
330
-
331
- // Batch-add trades from aggTrade stream
332
- // flat Float64Array: [barIdx, price, qty, isBuyerMaker, ...]
333
- chart.footprintAddTradeBatch(flat)
334
- ```
335
-
336
- ---
337
-
338
- ## Run Demo Locally
339
-
340
- Full-featured real-time demo with live market data from **Binance Futures** and **Bybit Linear** — orderbook heatmap, footprint chart, RSI, OI, drawing tools, and more:
341
-
342
- ```bash
343
- git clone https://github.com/tapedelta/kline-orderbook-chart.git
344
- cd kline-orderbook-chart/demo
345
- npm install
346
- cd server && npm install && cd ..
347
- npm start
122
+ chart.footprintEnsureLen(candleCount)
123
+ // 5 numbers per trade: [barIndex, price, qty, isBuyerMaker (0|1), tsSec]
124
+ chart.footprintAddTradeBatch(new Float64Array(flatTrades))
125
+ chart.setChartType(1) // 0 candles, 1 footprint, 2 Renko, 3 TPO
348
126
  ```
349
127
 
350
- Open [http://localhost:5180](http://localhost:5180) — see [demo/README.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/demo/README.md) for full documentation.
128
+ ## Drawings
351
129
 
352
- For the **full experience** with all features:
353
-
354
- **[app.tapedelta.com/trading/chart-terminal](https://app.tapedelta.com/trading/chart-terminal)**
355
-
356
- ---
357
-
358
- ## Architecture
359
-
360
- ```
361
- ┌──────────────────────────────────────────────────────────────┐
362
- │ Your Application (React / Vue / Svelte / Vanilla JS) │
363
- │ │
364
- │ ┌────────────────────────────────────────────────────────┐ │
365
- │ │ kline-orderbook-chart │ │
366
- │ │ │ │
367
- │ │ ┌──────────────────────────────────────────────────┐ │ │
368
- │ │ │ Native Engine (compiled) │ │ │
369
- │ │ │ │ │ │
370
- │ │ │ Kline ─── Orderbook Heatmap ─── Footprint │ │ │
371
- │ │ │ Viewport ── Indicators ── Drawings ── Axis │ │ │
372
- │ │ │ │ │ │
373
- │ │ │ ▼ Binary Command Buffer (zero-copy) │ │ │
374
- │ │ └──────────────────────────────────────────────────┘ │ │
375
- │ │ ▼ │ │
376
- │ │ ┌──────────────────────────────────────────────────┐ │ │
377
- │ │ │ Canvas 2D Renderer (JS) │ │ │
378
- │ │ │ Dispatches binary opcodes → fillRect/stroke/text│ │ │
379
- │ │ └──────────────────────────────────────────────────┘ │ │
380
- │ └────────────────────────────────────────────────────────┘ │
381
- │ │
382
- │ <canvas> ← one element, everything renders here │
383
- └──────────────────────────────────────────────────────────────┘
384
- ```
385
-
386
- ---
387
-
388
- ## Native & Desktop (GPUI / Rust)
389
-
390
- The same engine core that powers the web package also builds as a **native
391
- Rust crate** — no browser, no canvas, no JavaScript runtime. Every frame the
392
- engine emits a renderer-agnostic **command buffer** (`FillRect`, `Line`,
393
- `Text`, `HeatmapWorld`, …); on the web a thin layer dispatches it to Canvas
394
- 2D, and natively you dispatch the *same* buffer to your painter — **[GPUI](https://github.com/zed-industries/zed)**
395
- (the Rust UI framework behind the Zed editor), wgpu, or skia.
396
-
397
- ```rust
398
- use chart_engine::{ChartEngine, render::Paint};
399
-
400
- let mut engine = ChartEngine::new(960.0, 600.0);
401
- engine.set_license(include_str!("../license.mrd").trim()); // native token: pl="any"
402
- engine.set_klines(&ts, &open, &high, &low, &close, &volume);
403
-
404
- for cmd in engine.commands() { // walk the last frame
405
- match cmd {
406
- Paint::FillRect { x, y, w, h, color } => painter.fill_rect(x, y, w, h, color),
407
- Paint::Line { x1, y1, x2, y2, color, line_width } => painter.line(x1, y1, x2, y2, color, line_width),
408
- Paint::HeatmapWorld { .. } => painter.heatmap(cmd), // depth / GEX raster
409
- _ => {}
410
- }
411
- }
130
+ ```javascript
131
+ chart.startDrawing('fib') // user places it
132
+ const json = chart.exportDrawingsJson() // save
133
+ chart.importDrawingsJson(json) // restore
134
+ chart.onDrawingComplete(() => save(chart.exportDrawingsJson()))
412
135
  ```
413
136
 
414
- - **One engine, two targets** — same candles, orderbook heatmap, footprint,
415
- liquidation heatmap, GEX gamma heatmap, and 18+ indicators render
416
- identically on the web and in a native window. You maintain one engine and
417
- two thin dispatchers, not two charts.
418
- - **GPUI reference adapter** — a buildable `Paint` → GPUI mapping ships in the
419
- repo, so you start from a working element instead of an empty `match`.
420
- - **Native licensing** — native builds use an Ed25519 token minted with
421
- `pl:"any"`, which skips the web domain check.
422
- - **Licensed SDK, not source** — the native SDK is a precompiled engine binary
423
- plus an open decoder/adapter, sold under the **same commercial licence as the
424
- web build**. You licence the binary; the engine source is not sold. Delivered
425
- through your licence, not crates.io.
426
-
427
- **Read more:** [Native & Desktop (GPUI / Rust) docs](https://tapedelta.com/docs/charting-library/native-gpui)
428
- &bull; [Building a Native GPUI Chart in Rust — GEX Gamma Heatmap](https://tapedelta.com/blog/gpui-rust-charting-library-gex-heatmap)
429
-
430
- ---
431
-
432
- ## Framework Examples
433
-
434
- <details>
435
- <summary><strong>React</strong></summary>
137
+ ## React
436
138
 
437
139
  ```jsx
438
140
  import { useEffect, useRef } from 'react'
439
- import { createChartBridge, prefetchEngine } from 'kline-orderbook-chart'
440
-
441
- prefetchEngine()
141
+ import { createChartBridge } from 'kline-orderbook-chart'
442
142
 
443
- function Chart({ licenseKey }) {
143
+ export function Chart({ licenseKey, candles }) {
444
144
  const canvasRef = useRef(null)
445
145
  const chartRef = useRef(null)
446
146
 
447
147
  useEffect(() => {
448
- let destroyed = false
449
-
450
- createChartBridge(canvasRef.current, { licenseKey }).then(chart => {
451
- if (destroyed) { chart.destroy(); return }
148
+ let cancelled = false
149
+ createChartBridge(canvasRef.current, { licenseKey }).then((chart) => {
150
+ if (cancelled) { chart.destroy(); return }
452
151
  chartRef.current = chart
453
-
454
- fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
455
- .then(r => r.json())
456
- .then(raw => {
457
- chart.setKlines(
458
- raw.map(k => Math.floor(k[0] / 1000)),
459
- raw.map(k => +k[1]), raw.map(k => +k[2]),
460
- raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
461
- )
462
- chart.setCandleInterval(300)
463
- chart.setPrecision(1)
464
- chart.enableVolume()
465
- chart.start()
466
- })
152
+ chart.start()
467
153
  })
468
-
469
- return () => { destroyed = true; chartRef.current?.destroy() }
154
+ return () => { cancelled = true; chartRef.current?.destroy(); chartRef.current = null }
470
155
  }, [licenseKey])
471
156
 
472
- return <canvas ref={canvasRef} style={{ width: '100%', height: '100%' }} />
473
- }
474
- ```
475
-
476
- See [full React guide](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/examples/react.md) for hooks, resize handling, and WebSocket integration.
477
- </details>
478
-
479
- <details>
480
- <summary><strong>Vue 3</strong></summary>
481
-
482
- ```vue
483
- <template>
484
- <canvas ref="el" style="width:100%;height:100%" />
485
- </template>
486
-
487
- <script setup>
488
- import { ref, onMounted, onBeforeUnmount } from 'vue'
489
- import { createChartBridge, prefetchEngine } from 'kline-orderbook-chart'
490
-
491
- prefetchEngine()
492
-
493
- const el = ref(null)
494
- let chart = null
495
-
496
- onMounted(async () => {
497
- chart = await createChartBridge(el.value, {
498
- licenseKey: import.meta.env.VITE_TAPEDELTA_KEY,
499
- })
500
-
501
- const res = await fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
502
- const raw = await res.json()
503
- chart.setKlines(
504
- raw.map(k => Math.floor(k[0] / 1000)),
505
- raw.map(k => +k[1]), raw.map(k => +k[2]),
506
- raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
507
- )
508
- chart.setCandleInterval(300)
509
- chart.setPrecision(1)
510
- chart.enableVolume()
511
- chart.start()
512
- })
513
-
514
- onBeforeUnmount(() => chart?.destroy())
515
- </script>
516
- ```
517
-
518
- See [full Vue guide](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/examples/vue.md) for composables, theme switching, and drawing tools.
519
- </details>
520
-
521
- <details>
522
- <summary><strong>Vanilla JS</strong></summary>
523
-
524
- ```html
525
- <canvas id="chart" style="width:100%;height:600px"></canvas>
526
- <script type="module">
527
- import { createChartBridge, prefetchEngine } from 'kline-orderbook-chart'
528
-
529
- prefetchEngine()
530
-
531
- const chart = await createChartBridge(document.getElementById('chart'))
532
-
533
- const res = await fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
534
- const raw = await res.json()
535
- chart.setKlines(
536
- raw.map(k => Math.floor(k[0] / 1000)),
537
- raw.map(k => +k[1]), raw.map(k => +k[2]),
538
- raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
539
- )
540
- chart.setCandleInterval(300)
541
- chart.setPrecision(1)
542
- chart.enableVolume()
543
- chart.start()
544
- </script>
545
- ```
546
- </details>
547
-
548
- ---
549
-
550
- ## Drawing Tools
551
-
552
- ```javascript
553
- chart.setDrawingTool('fibonacci') // trendline | horizontal | arrow | fibonacci |
554
- // extension | long | short | vwap | elliott | label
555
-
556
- chart.getDrawingsJson() // export → JSON string
557
- chart.setDrawingsJson(json) // restore saved drawings
157
+ useEffect(() => {
158
+ const chart = chartRef.current
159
+ if (chart && candles) chart.setKlines(candles.t, candles.o, candles.h, candles.l, candles.c, candles.v)
160
+ }, [candles])
558
161
 
559
- chart.onDrawingComplete = (id, type, points) => { /* persist to backend */ }
162
+ return <canvas ref={canvasRef} style={{ width: '100%', height: '100%', display: 'block' }} />
163
+ }
560
164
  ```
561
165
 
562
- ---
563
-
564
- ## Pricing
565
-
566
- | | Standard | Professional | Enterprise |
567
- |---|:---:|:---:|:---:|
568
- | Candlestick + Volume | &#10003; | &#10003; | &#10003; |
569
- | RSI + EMA | &#10003; | &#10003; | &#10003; |
570
- | 5 drawing tools | &#10003; | &#10003; | &#10003; |
571
- | All 10+ drawing tools | — | &#10003; | &#10003; |
572
- | Orderbook Heatmap | — | &#10003; | &#10003; |
573
- | Footprint Chart | — | &#10003; | &#10003; |
574
- | Liquidation Heatmap | — | &#10003; | &#10003; |
575
- | OI / CVD / Funding Rate | — | &#10003; | &#10003; |
576
- | Large Trade Bubbles | — | &#10003; | &#10003; |
577
- | VRVP / TPO | — | — | &#10003; |
578
- | Smart Money Concepts | — | — | &#10003; |
579
- | VPIN / Stops & Icebergs | — | — | &#10003; |
580
- | Custom Indicator Plugin | — | — | &#10003; |
581
- | White-label | — | — | &#10003; |
582
-
583
- **14-day free trial included** — no credit card required.
584
-
585
- > **Native / Desktop (GPUI / Rust)** is available as a licensed SDK under the
586
- > same commercial model — a precompiled engine binary, not source. See
587
- > [Native & Desktop docs](https://tapedelta.com/docs/charting-library/native-gpui)
588
- > or email <support@tapedelta.com> for a native key.
589
-
590
- <p align="center">
591
- <a href="https://app.tapedelta.com/charting-library/pricing"><strong>View pricing & get a trial key &rarr;</strong></a>
592
- </p>
593
-
594
- ---
595
-
596
- ## Browser Support
166
+ Vue, Svelte and resize handling: [framework integration](https://tapedelta.com/docs/charting-library/react-integration).
597
167
 
598
- Chrome 80+ &bull; Firefox 79+ &bull; Safari 15.2+ &bull; Edge 80+ &bull; Mobile Chrome &bull; Mobile Safari
599
-
600
- Requires ES2020.
601
-
602
- ---
168
+ ## TypeScript
603
169
 
604
- ## Documentation
170
+ The package ships `index.d.ts`. The methods declared there are the supported API, and the [API reference](https://tapedelta.com/docs/charting-library/api-reference) is generated from it. Other members visible on the runtime objects are internal.
605
171
 
606
- > **[📖 Read the full docs at tapedelta.com/docs/charting-library/getting-started](https://tapedelta.com/docs/charting-library/getting-started)** — runnable code, framework integrations, and the complete API reference. The Markdown mirrors on GitHub link the same content for offline / IDE browsing.
172
+ ## Performance
607
173
 
608
- ### Tutorials
174
+ Measured with the built-in benchmark suite on an Apple M-series Mac in Chrome, 10,000 candles:
609
175
 
610
- | Guide | Web docs | GitHub mirror |
611
- |---|---|---|
612
- | Getting Started | [tapedelta.com/docs/charting-library/getting-started](https://tapedelta.com/docs/charting-library/getting-started) | [docs/guides/getting-started.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/getting-started.md) |
613
- | Core Concepts & Architecture | — | [docs/guides/architecture.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/architecture.md) |
614
- | Framework Integration | [tapedelta.com/docs/charting-library/react-integration](https://tapedelta.com/docs/charting-library/react-integration) | [docs/examples/framework-integration.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/examples/framework-integration.md) |
615
-
616
- ### Data & Chart Types
617
-
618
- | Guide | Web docs | GitHub mirror |
619
- |---|---|---|
620
- | Candlestick Data | [tapedelta.com/docs/charting-library/data-loading](https://tapedelta.com/docs/charting-library/data-loading) | [docs/guides/data.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/data.md) |
621
- | Orderbook Heatmap | [tapedelta.com/docs/charting-library/orderbook-heatmap](https://tapedelta.com/docs/charting-library/orderbook-heatmap) | [docs/guides/orderbook-heatmap.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/orderbook-heatmap.md) |
622
- | Footprint Chart | [tapedelta.com/docs/charting-library/footprint-chart](https://tapedelta.com/docs/charting-library/footprint-chart) | [docs/guides/footprint-chart.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/footprint-chart.md) |
623
- | Chart Aggregation | — | [docs/guides/chart-aggregation.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/chart-aggregation.md) |
624
-
625
- ### Indicators & Analysis
626
-
627
- | Guide | Web docs | GitHub mirror |
628
- |---|---|---|
629
- | Built-in Indicators | [tapedelta.com/docs/charting-library/indicators](https://tapedelta.com/docs/charting-library/indicators) | [docs/guides/indicators.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/indicators.md) |
630
- | Custom Indicators | — | [docs/guides/custom-indicators.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/custom-indicators.md) |
631
-
632
- ### Drawing & Interaction
633
-
634
- | Guide | Web docs | GitHub mirror |
635
- |---|---|---|
636
- | Drawing Tools | [tapedelta.com/docs/charting-library/drawing](https://tapedelta.com/docs/charting-library/drawing) | [docs/guides/drawings.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/drawings.md) |
637
- | Events & Tooltips | — | [docs/guides/tooltip.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/tooltip.md) |
638
- | Viewport & Interaction | — | [docs/guides/viewport-interaction.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/viewport-interaction.md) |
639
-
640
- ### Configuration
641
-
642
- | Guide | Web docs | GitHub mirror |
643
- |---|---|---|
644
- | Theming | [tapedelta.com/docs/charting-library/chart-instance](https://tapedelta.com/docs/charting-library/chart-instance) | [docs/guides/themes.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/themes.md) |
645
- | Advanced Topics | — | [docs/guides/advanced.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/guides/advanced.md) |
646
-
647
- ### Reference
648
-
649
- | Guide | Web docs | GitHub mirror |
650
- |---|---|---|
651
- | API Reference | [tapedelta.com/docs/charting-library/introduction](https://tapedelta.com/docs/charting-library/introduction) | [docs/api/README.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/api/README.md) |
652
- | React Integration | [tapedelta.com/docs/charting-library/react-integration](https://tapedelta.com/docs/charting-library/react-integration) | [docs/examples/react.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/examples/react.md) |
653
- | Vue 3 Integration | [tapedelta.com/docs/charting-library/react-integration](https://tapedelta.com/docs/charting-library/react-integration) | [docs/examples/vue.md](https://github.com/tapedelta/kline-orderbook-chart/blob/main/docs/examples/vue.md) |
654
-
655
- ---
656
-
657
- ## Licensing
176
+ | Measurement | Result |
177
+ |---|---|
178
+ | Engine start | 6 ms |
179
+ | First render, 50,000 candles | 9.1 ms |
180
+ | Render frame with volume and two indicators | 0.10 ms |
181
+ | Pan / zoom / crosshair frame | 0.11 ms |
182
+ | Live candle update | 1.4 ms |
183
+ | Heatmap column update | 0.17 ms |
658
184
 
659
- Free 14-day trial included. Contact us for pricing and license options:
185
+ ## Browser support
660
186
 
661
- <p align="center">
662
- <a href="https://app.tapedelta.com/trading/chart-terminal">Try live demo</a>&nbsp;&nbsp;&bull;&nbsp;&nbsp;
663
- <a href="mailto:support@tapedelta.com"><strong>Contact for pricing &rarr;</strong></a>
664
- </p>
187
+ Chrome and Edge 90+, Firefox 90+, Safari 15.4+, iOS Safari 15+, Android Chrome 90+.
665
188
 
666
- ---
189
+ ## Native desktop
667
190
 
668
- ## Keywords
191
+ The same engine is available as a precompiled Rust library for native desktop apps (GPUI, wgpu, skia), under the same commercial license. See [Native & Desktop](https://tapedelta.com/docs/charting-library/native-gpui).
669
192
 
670
- `orderbook heatmap chart` · `kline heatmap` · `candlestick orderbook depth` · `footprint chart library` · `crypto chart heatmap` · `trading chart library` · `orderbook depth visualization` · `liquidation heatmap` · `volume profile chart` · `market depth chart javascript` · `real-time orderbook heatmap` · `kline orderbook chart` · `rust charting library` · `gpui chart` · `native rust chart` · `zed gpui chart` · `desktop trading chart`
193
+ ## Versioning and support
671
194
 
672
- ---
195
+ - The package follows [Semantic Versioning](https://semver.org/). Breaking changes to the declared API happen only in major versions and are listed in the [changelog](./CHANGELOG.md).
196
+ - Support: <support@tapedelta.com>.
673
197
 
674
198
  ## License
675
199
 
676
- This is proprietary commercial software. A valid license key is required for production use.
677
- Free 14-day trial is available with watermark.
200
+ Commercial software. Use requires a license from Tape Delta, except for the free tier described above. See [LICENSE](./LICENSE).
678
201
 
679
- See [LICENSE](./LICENSE) for full terms.
680
-
681
- ---
682
-
683
- <p align="center">
684
- <sub>Native high-performance engine. Designed for traders who need to see the full order book.</sub><br/>
685
- <sub>&copy; 2026 Tape Delta. All rights reserved.</sub>
686
- </p>
202
+ © 2025–2026 Tape Delta. All rights reserved.