kline-orderbook-chart 0.2.15 → 0.2.17
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 +517 -85
- package/dist/chart_engine.js +1 -1
- package/dist/chart_engine_bg.wasm +0 -0
- package/dist/mrd-chart-engine.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
<
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/PhamNhinh/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%" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Kline Orderbook Chart</h1>
|
|
2
6
|
|
|
3
7
|
<p align="center">
|
|
4
|
-
<strong>
|
|
8
|
+
<strong>The only chart library with built-in orderbook heatmap, footprint chart, and liquidation heatmap<br/>all in one <code><canvas></code>, powered by a native high-performance engine</strong>
|
|
5
9
|
</p>
|
|
6
10
|
|
|
7
11
|
<p align="center">
|
|
8
|
-
<a href="https://app.mrd-indicators.com/trading/chart-terminal">Live Demo</a
|
|
9
|
-
|
|
10
|
-
<a href="
|
|
11
|
-
|
|
12
|
-
<a href="https://
|
|
13
|
-
|
|
14
|
-
<a href="https://discord.gg/buX2h5ZZm">Discord</a>
|
|
12
|
+
<a href="https://app.mrd-indicators.com/trading/chart-terminal">Live Demo</a> •
|
|
13
|
+
<a href="#run-demo-locally">Run Demo Locally</a> •
|
|
14
|
+
<a href="#documentation">Documentation</a> •
|
|
15
|
+
<a href="https://discord.gg/buX2h5ZZm">Discord</a> •
|
|
16
|
+
<a href="https://x.com/mrDocTradingIO">X</a> •
|
|
17
|
+
<a href="mailto:support@mrd-indicators.com">Contact</a>
|
|
15
18
|
</p>
|
|
16
19
|
|
|
17
20
|
<p align="center">
|
|
18
|
-
<img alt="
|
|
21
|
+
<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>
|
|
22
|
+
<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>
|
|
23
|
+
<img alt="bundle size" src="https://img.shields.io/badge/bundle-380KB_gzip-0a7cff" />
|
|
19
24
|
<img alt="zero dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen" />
|
|
20
25
|
<img alt="framework agnostic" src="https://img.shields.io/badge/framework-agnostic-blueviolet" />
|
|
21
26
|
<img alt="license" src="https://img.shields.io/badge/license-commercial-orange" />
|
|
@@ -23,99 +28,455 @@
|
|
|
23
28
|
|
|
24
29
|
---
|
|
25
30
|
|
|
26
|
-
##
|
|
31
|
+
## The problem
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
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.
|
|
34
|
+
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
**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.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## See it in action
|
|
42
|
+
|
|
43
|
+
<p align="center">
|
|
44
|
+
<img src="https://raw.githubusercontent.com/PhamNhinh/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%" />
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<em>BTC/USDT — Candlestick + Orderbook Heatmap + Large Trade Bubbles + Liquidation Heatmap + RSI with signals</em>
|
|
49
|
+
</p>
|
|
50
|
+
|
|
51
|
+
<p align="center">
|
|
52
|
+
<img src="https://raw.githubusercontent.com/PhamNhinh/kline-orderbook-chart/main/assets/media/footprint-chart.png" alt="Footprint chart with bid ask volume, delta, imbalance detection, and VRVP profile" width="100%" />
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<em>BTC/USDT — Footprint chart with bid/ask volume at every price level, POC, delta, VRVP profile panel</em>
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
> **Video demos:** See the full interactive experience in the [`assets/media/`](https://github.com/PhamNhinh/kline-orderbook-chart/tree/main/assets/media) folder — real-time orderbook heatmap streaming, drawing tools, theme switching, and more.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## What makes this different
|
|
64
|
+
|
|
65
|
+
### Orderbook Heatmap + Candlestick — in one chart
|
|
66
|
+
|
|
67
|
+
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.
|
|
68
|
+
|
|
69
|
+
### Footprint Chart — built-in, not a plugin
|
|
70
|
+
|
|
71
|
+
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.
|
|
72
|
+
|
|
73
|
+
### Liquidation Heatmap
|
|
74
|
+
|
|
75
|
+
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.
|
|
76
|
+
|
|
77
|
+
### Native Performance
|
|
78
|
+
|
|
79
|
+
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:
|
|
80
|
+
|
|
81
|
+
- **60 fps** with 100K+ candles and a 500x200 heatmap matrix updating in real-time
|
|
82
|
+
- **~12 MB memory** at 50K candles (vs 50-120 MB for JS-only libraries)
|
|
83
|
+
- **Near-zero GC pressure** — no jank from garbage collection pauses
|
|
84
|
+
- **380 KB gzip** total bundle
|
|
85
|
+
|
|
86
|
+
### Framework Agnostic
|
|
87
|
+
|
|
88
|
+
Give it a `<canvas>` element. It works with React, Vue, Svelte, Angular, or vanilla JavaScript. No framework lock-in, no virtual DOM overhead.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Benchmark
|
|
93
|
+
|
|
94
|
+
<p align="center">
|
|
95
|
+
<img src="https://raw.githubusercontent.com/PhamNhinh/kline-orderbook-chart/main/assets/media/benchmark.png" alt="Kline Orderbook Chart — Native Engine Benchmark Results" width="100%" />
|
|
96
|
+
</p>
|
|
97
|
+
|
|
98
|
+
Real benchmark from the built-in performance suite, measured on a standard desktop (M-series Mac, Chrome):
|
|
99
|
+
|
|
100
|
+
### Engine Init & Rendering
|
|
101
|
+
|
|
102
|
+
| Metric | Result |
|
|
103
|
+
|---|---|
|
|
104
|
+
| **Engine init** | **6 ms** |
|
|
105
|
+
| **Peak FPS** | **29,412 fps** |
|
|
106
|
+
| **Render (all indicators)** | **0.10 ms/frame** |
|
|
107
|
+
| **Benchmark score** | **95 / 100 — Exceptional** |
|
|
108
|
+
|
|
109
|
+
### Candle Scaling (RSI + Volume enabled)
|
|
110
|
+
|
|
111
|
+
| Candle count | FPS |
|
|
112
|
+
|---|---|
|
|
113
|
+
| 100 | 29,412 |
|
|
114
|
+
| 500 | 11,905 |
|
|
115
|
+
| 1K | 11,628 |
|
|
116
|
+
| 5K | 11,905 |
|
|
117
|
+
| 10K | 12,195 |
|
|
118
|
+
| 25K | 11,628 |
|
|
119
|
+
| 50K | 11,905 |
|
|
120
|
+
| 100K | 11,628 |
|
|
121
|
+
|
|
122
|
+
FPS stays above **11,000** even at 100K candles — essentially **zero performance degradation** at scale.
|
|
123
|
+
|
|
124
|
+
### Render Breakdown (10K candles, 100 bars avg)
|
|
125
|
+
|
|
126
|
+
| Component | Time |
|
|
127
|
+
|---|---|
|
|
128
|
+
| Candles | 0.045 ms |
|
|
129
|
+
| RSI | 0.027 ms |
|
|
130
|
+
| Volume | 0.081 ms |
|
|
131
|
+
| Smart Ranges | 0.002 ms |
|
|
132
|
+
| EMA Structure | 0.017 ms |
|
|
133
|
+
| **Total** | **0.10 ms** |
|
|
134
|
+
|
|
135
|
+
### Interaction Latency (10K candles, 200 bars avg)
|
|
136
|
+
|
|
137
|
+
| Action | Latency |
|
|
138
|
+
|---|---|
|
|
139
|
+
| Pan | 0.11 ms |
|
|
140
|
+
| Zoom | 0.11 ms |
|
|
141
|
+
| Crosshair | 0.10 ms |
|
|
142
|
+
|
|
143
|
+
Sub-millisecond response for all user interactions.
|
|
144
|
+
|
|
145
|
+
### First Render Time
|
|
146
|
+
|
|
147
|
+
| Candle count | Time |
|
|
148
|
+
|---|---|
|
|
149
|
+
| 100 | 0.3 ms |
|
|
150
|
+
| 1K | 0.3 ms |
|
|
151
|
+
| 10K | 2.1 ms |
|
|
152
|
+
| 50K | 9.1 ms |
|
|
153
|
+
|
|
154
|
+
50,000 candles render in **under 10 ms** on first load.
|
|
155
|
+
|
|
156
|
+
### Real-Time Streaming Performance (10K candles, RSI + Volume, simulated WebSocket feed)
|
|
157
|
+
|
|
158
|
+
| Operation | FPS | Latency |
|
|
159
|
+
|---|---|---|
|
|
160
|
+
| Kline tick update | 711 fps | 1.41 ms avg |
|
|
161
|
+
| New candle append | 696 fps | 1.44 ms avg |
|
|
162
|
+
| Heatmap update | 5,792 fps | 0.17 ms avg |
|
|
163
|
+
| Combined stress | 653 fps | 1.53 ms avg |
|
|
164
|
+
|
|
165
|
+
All real-time operations maintain **60+ fps** with headroom to spare. Heatmap updates run at nearly **6,000 fps**.
|
|
166
|
+
|
|
167
|
+
### Full Indicator Stress Test (8 indicators: RSI + Volume + Smart Ranges + EMA + VRVP + OI + CVD + Large Trades)
|
|
168
|
+
|
|
169
|
+
| Test | Result |
|
|
170
|
+
|---|---|
|
|
171
|
+
| Cold load + render | 57 fps, 17.98 ms/frame |
|
|
172
|
+
| Sustained render | 6,135 fps, 0.16 ms/frame |
|
|
173
|
+
| Tick + all indicators | 150 fps, 6.68 ms/frame |
|
|
174
|
+
| Pan + all indicators | 4,950 fps, 0.20 ms/frame |
|
|
175
|
+
|
|
176
|
+
Even with **8 indicators active simultaneously** on 10K candles, sustained rendering runs at **6,135 fps**.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Full Feature Set
|
|
181
|
+
|
|
182
|
+
<table>
|
|
183
|
+
<tr>
|
|
184
|
+
<td width="50%">
|
|
185
|
+
|
|
186
|
+
### Order Flow Visualization
|
|
187
|
+
- **Orderbook Heatmap** — real-time depth matrix behind candles
|
|
188
|
+
- **Footprint Chart** — bid/ask volume, delta, imbalance, POC
|
|
189
|
+
- **Liquidation Heatmap** — leveraged position cluster overlay
|
|
190
|
+
- **VRVP** — Visible Range Volume Profile
|
|
191
|
+
- **TPO / Market Profile** — time-at-price distribution
|
|
192
|
+
- **Large Trade Bubbles** — whale order visualization
|
|
193
|
+
|
|
194
|
+
</td>
|
|
195
|
+
<td width="50%">
|
|
196
|
+
|
|
197
|
+
### Technical Indicators
|
|
198
|
+
- **RSI** with divergence detection & pullback signals
|
|
199
|
+
- **Open Interest** with delta tracking
|
|
200
|
+
- **Cumulative Volume Delta (CVD)**
|
|
201
|
+
- **Funding Rate** overlay
|
|
202
|
+
- **EMA Structure** — multi-period trend strength
|
|
203
|
+
- **Custom Indicator Plugin API** — build your own
|
|
204
|
+
|
|
205
|
+
</td>
|
|
206
|
+
</tr>
|
|
207
|
+
<tr>
|
|
208
|
+
<td>
|
|
209
|
+
|
|
210
|
+
### Drawing & Interaction
|
|
211
|
+
- 10+ tools: Trendline, Fibonacci, Channel, Pitchfork, Elliott Wave, Brush, Rectangle, Path, and more
|
|
212
|
+
- Full JSON export/import for persistence
|
|
213
|
+
- Multi-pane crosshair sync
|
|
214
|
+
- Rich tooltip with OHLCV + indicator data
|
|
215
|
+
- Bar replay mode
|
|
216
|
+
|
|
217
|
+
</td>
|
|
218
|
+
<td>
|
|
219
|
+
|
|
220
|
+
### Core Charting
|
|
221
|
+
- Candlestick, Heikin-Ashi, Line, Area chart types
|
|
222
|
+
- Volume histogram with climax detection
|
|
223
|
+
- Responsive time & price axes with auto-scaling
|
|
224
|
+
- Dark, light, and fully custom themes
|
|
225
|
+
- Smooth pan, pinch-zoom, mouse wheel zoom
|
|
226
|
+
- Touch-optimized for mobile & tablet
|
|
227
|
+
|
|
228
|
+
</td>
|
|
229
|
+
</tr>
|
|
230
|
+
</table>
|
|
31
231
|
|
|
32
232
|
---
|
|
33
233
|
|
|
34
234
|
## Quick Start
|
|
35
235
|
|
|
236
|
+
### Install
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
npm install kline-orderbook-chart
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Basic usage
|
|
243
|
+
|
|
36
244
|
```javascript
|
|
37
|
-
import { createChartBridge, prefetchWasm } from '
|
|
245
|
+
import { createChartBridge, prefetchWasm } from 'kline-orderbook-chart'
|
|
38
246
|
|
|
39
|
-
//
|
|
247
|
+
// Pre-load engine for faster first render (optional)
|
|
40
248
|
prefetchWasm()
|
|
41
249
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
intervalSec: 3600,
|
|
250
|
+
// Create chart
|
|
251
|
+
const canvas = document.getElementById('chart')
|
|
252
|
+
const chart = await createChartBridge(canvas, {
|
|
253
|
+
licenseKey: 'YOUR_LICENSE_KEY', // omit for 14-day trial
|
|
47
254
|
})
|
|
48
255
|
|
|
49
|
-
// Load
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
chart.
|
|
256
|
+
// Load data (six separate arrays)
|
|
257
|
+
chart.setKlines(
|
|
258
|
+
[1710000000, 1710003600], // timestamps (seconds)
|
|
259
|
+
[65200, 65600], // opens
|
|
260
|
+
[65800, 66100], // highs
|
|
261
|
+
[65100, 65400], // lows
|
|
262
|
+
[65600, 65900], // closes
|
|
263
|
+
[1234.5, 987.2], // volumes
|
|
264
|
+
)
|
|
265
|
+
chart.setCandleInterval(3600)
|
|
266
|
+
chart.setPrecision(1)
|
|
60
267
|
|
|
61
268
|
// Enable indicators
|
|
62
|
-
chart.enableVolume(
|
|
63
|
-
chart.enableRsi(
|
|
64
|
-
chart.
|
|
269
|
+
chart.enableVolume()
|
|
270
|
+
chart.enableRsi()
|
|
271
|
+
chart.setRsiPeriod(14)
|
|
65
272
|
|
|
66
273
|
// Start rendering
|
|
67
274
|
chart.start()
|
|
68
275
|
|
|
69
|
-
// Real-time update
|
|
276
|
+
// Real-time update
|
|
70
277
|
ws.onmessage = (e) => {
|
|
71
278
|
const { k } = JSON.parse(e.data)
|
|
72
|
-
|
|
73
|
-
else chart.updateLastKline(k.t / 1000, +k.o, +k.h, +k.l, +k.c, +k.v)
|
|
279
|
+
chart.updateLastKline(Math.floor(k.t / 1000), +k.o, +k.h, +k.l, +k.c, +k.v)
|
|
74
280
|
}
|
|
281
|
+
```
|
|
75
282
|
|
|
76
|
-
|
|
77
|
-
new ResizeObserver(() => chart.resize()).observe(canvas.parentElement)
|
|
283
|
+
### Enable orderbook heatmap
|
|
78
284
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
285
|
+
```javascript
|
|
286
|
+
const yStep = (priceMax - priceMin) / rows
|
|
287
|
+
const xStep = (timeEnd - timeStart) / cols
|
|
288
|
+
|
|
289
|
+
chart.setHeatmap(
|
|
290
|
+
depthMatrix, // Float64Array — flattened row-major
|
|
291
|
+
200, // rows (price levels)
|
|
292
|
+
100, // cols (time columns)
|
|
293
|
+
timeStart, // timestamp of first column (seconds)
|
|
294
|
+
xStep, // time interval between columns
|
|
295
|
+
priceMin, // price of first row
|
|
296
|
+
yStep, // price interval between rows
|
|
82
297
|
)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Enable footprint chart
|
|
301
|
+
|
|
302
|
+
```javascript
|
|
303
|
+
chart.setChartType(2)
|
|
304
|
+
chart.setFootprintTickSize(10)
|
|
305
|
+
chart.footprintEnsureLen(timestamps.length)
|
|
83
306
|
|
|
84
|
-
//
|
|
85
|
-
|
|
307
|
+
// Batch-add trades from aggTrade stream
|
|
308
|
+
// flat Float64Array: [barIdx, price, qty, isBuyerMaker, ...]
|
|
309
|
+
chart.footprintAddTradeBatch(flat)
|
|
86
310
|
```
|
|
87
311
|
|
|
88
312
|
---
|
|
89
313
|
|
|
90
|
-
##
|
|
314
|
+
## Run Demo Locally
|
|
91
315
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
chart
|
|
97
|
-
|
|
316
|
+
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:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
git clone https://github.com/PhamNhinh/kline-orderbook-chart.git
|
|
320
|
+
cd kline-orderbook-chart/demo
|
|
321
|
+
npm install
|
|
322
|
+
cd server && npm install && cd ..
|
|
323
|
+
npm start
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Open [http://localhost:5180](http://localhost:5180) — see [demo/README.md](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/demo/README.md) for full documentation.
|
|
98
327
|
|
|
99
|
-
|
|
100
|
-
chart.appendHeatmapColumn(colData, colTimestamp, yStart, yStep)
|
|
328
|
+
For the **full experience** with all features:
|
|
101
329
|
|
|
102
|
-
|
|
103
|
-
|
|
330
|
+
**[app.mrd-indicators.com/trading/chart-terminal](https://app.mrd-indicators.com/trading/chart-terminal)**
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Architecture
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
338
|
+
│ Your Application (React / Vue / Svelte / Vanilla JS) │
|
|
339
|
+
│ │
|
|
340
|
+
│ ┌────────────────────────────────────────────────────────┐ │
|
|
341
|
+
│ │ kline-orderbook-chart │ │
|
|
342
|
+
│ │ │ │
|
|
343
|
+
│ │ ┌──────────────────────────────────────────────────┐ │ │
|
|
344
|
+
│ │ │ Native Engine (compiled) │ │ │
|
|
345
|
+
│ │ │ │ │ │
|
|
346
|
+
│ │ │ Kline ─── Orderbook Heatmap ─── Footprint │ │ │
|
|
347
|
+
│ │ │ Viewport ── Indicators ── Drawings ── Axis │ │ │
|
|
348
|
+
│ │ │ │ │ │
|
|
349
|
+
│ │ │ ▼ Binary Command Buffer (zero-copy) │ │ │
|
|
350
|
+
│ │ └──────────────────────────────────────────────────┘ │ │
|
|
351
|
+
│ │ ▼ │ │
|
|
352
|
+
│ │ ┌──────────────────────────────────────────────────┐ │ │
|
|
353
|
+
│ │ │ Canvas 2D Renderer (JS) │ │ │
|
|
354
|
+
│ │ │ Dispatches binary opcodes → fillRect/stroke/text│ │ │
|
|
355
|
+
│ │ └──────────────────────────────────────────────────┘ │ │
|
|
356
|
+
│ └────────────────────────────────────────────────────────┘ │
|
|
357
|
+
│ │
|
|
358
|
+
│ <canvas> ← one element, everything renders here │
|
|
359
|
+
└──────────────────────────────────────────────────────────────┘
|
|
104
360
|
```
|
|
105
361
|
|
|
106
362
|
---
|
|
107
363
|
|
|
108
|
-
##
|
|
364
|
+
## Framework Examples
|
|
109
365
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
chart.setFootprintTickSize(10)
|
|
113
|
-
chart.footprintEnsureLen(timestamps.length)
|
|
366
|
+
<details>
|
|
367
|
+
<summary><strong>React</strong></summary>
|
|
114
368
|
|
|
115
|
-
|
|
116
|
-
|
|
369
|
+
```jsx
|
|
370
|
+
import { useEffect, useRef } from 'react'
|
|
371
|
+
import { createChartBridge, prefetchWasm } from 'kline-orderbook-chart'
|
|
372
|
+
|
|
373
|
+
prefetchWasm()
|
|
374
|
+
|
|
375
|
+
function Chart({ licenseKey }) {
|
|
376
|
+
const canvasRef = useRef(null)
|
|
377
|
+
const chartRef = useRef(null)
|
|
378
|
+
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
let destroyed = false
|
|
381
|
+
|
|
382
|
+
createChartBridge(canvasRef.current, { licenseKey }).then(chart => {
|
|
383
|
+
if (destroyed) { chart.destroy(); return }
|
|
384
|
+
chartRef.current = chart
|
|
385
|
+
|
|
386
|
+
fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
|
|
387
|
+
.then(r => r.json())
|
|
388
|
+
.then(raw => {
|
|
389
|
+
chart.setKlines(
|
|
390
|
+
raw.map(k => Math.floor(k[0] / 1000)),
|
|
391
|
+
raw.map(k => +k[1]), raw.map(k => +k[2]),
|
|
392
|
+
raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
|
|
393
|
+
)
|
|
394
|
+
chart.setCandleInterval(300)
|
|
395
|
+
chart.setPrecision(1)
|
|
396
|
+
chart.enableVolume()
|
|
397
|
+
chart.start()
|
|
398
|
+
})
|
|
399
|
+
})
|
|
400
|
+
|
|
401
|
+
return () => { destroyed = true; chartRef.current?.destroy() }
|
|
402
|
+
}, [licenseKey])
|
|
403
|
+
|
|
404
|
+
return <canvas ref={canvasRef} style={{ width: '100%', height: '100%' }} />
|
|
405
|
+
}
|
|
117
406
|
```
|
|
118
407
|
|
|
408
|
+
See [full React guide](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/examples/react.md) for hooks, resize handling, and WebSocket integration.
|
|
409
|
+
</details>
|
|
410
|
+
|
|
411
|
+
<details>
|
|
412
|
+
<summary><strong>Vue 3</strong></summary>
|
|
413
|
+
|
|
414
|
+
```vue
|
|
415
|
+
<template>
|
|
416
|
+
<canvas ref="el" style="width:100%;height:100%" />
|
|
417
|
+
</template>
|
|
418
|
+
|
|
419
|
+
<script setup>
|
|
420
|
+
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
|
421
|
+
import { createChartBridge, prefetchWasm } from 'kline-orderbook-chart'
|
|
422
|
+
|
|
423
|
+
prefetchWasm()
|
|
424
|
+
|
|
425
|
+
const el = ref(null)
|
|
426
|
+
let chart = null
|
|
427
|
+
|
|
428
|
+
onMounted(async () => {
|
|
429
|
+
chart = await createChartBridge(el.value, {
|
|
430
|
+
licenseKey: import.meta.env.VITE_MRD_KEY,
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
const res = await fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
|
|
434
|
+
const raw = await res.json()
|
|
435
|
+
chart.setKlines(
|
|
436
|
+
raw.map(k => Math.floor(k[0] / 1000)),
|
|
437
|
+
raw.map(k => +k[1]), raw.map(k => +k[2]),
|
|
438
|
+
raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
|
|
439
|
+
)
|
|
440
|
+
chart.setCandleInterval(300)
|
|
441
|
+
chart.setPrecision(1)
|
|
442
|
+
chart.enableVolume()
|
|
443
|
+
chart.start()
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
onBeforeUnmount(() => chart?.destroy())
|
|
447
|
+
</script>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
See [full Vue guide](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/examples/vue.md) for composables, theme switching, and drawing tools.
|
|
451
|
+
</details>
|
|
452
|
+
|
|
453
|
+
<details>
|
|
454
|
+
<summary><strong>Vanilla JS</strong></summary>
|
|
455
|
+
|
|
456
|
+
```html
|
|
457
|
+
<canvas id="chart" style="width:100%;height:600px"></canvas>
|
|
458
|
+
<script type="module">
|
|
459
|
+
import { createChartBridge, prefetchWasm } from 'kline-orderbook-chart'
|
|
460
|
+
|
|
461
|
+
prefetchWasm()
|
|
462
|
+
|
|
463
|
+
const chart = await createChartBridge(document.getElementById('chart'))
|
|
464
|
+
|
|
465
|
+
const res = await fetch('https://api.binance.com/api/v3/klines?symbol=BTCUSDT&interval=5m&limit=1000')
|
|
466
|
+
const raw = await res.json()
|
|
467
|
+
chart.setKlines(
|
|
468
|
+
raw.map(k => Math.floor(k[0] / 1000)),
|
|
469
|
+
raw.map(k => +k[1]), raw.map(k => +k[2]),
|
|
470
|
+
raw.map(k => +k[3]), raw.map(k => +k[4]), raw.map(k => +k[5]),
|
|
471
|
+
)
|
|
472
|
+
chart.setCandleInterval(300)
|
|
473
|
+
chart.setPrecision(1)
|
|
474
|
+
chart.enableVolume()
|
|
475
|
+
chart.start()
|
|
476
|
+
</script>
|
|
477
|
+
```
|
|
478
|
+
</details>
|
|
479
|
+
|
|
119
480
|
---
|
|
120
481
|
|
|
121
482
|
## Drawing Tools
|
|
@@ -132,50 +493,121 @@ chart.onDrawingComplete = (id, type, points) => { /* persist to backend */ }
|
|
|
132
493
|
|
|
133
494
|
---
|
|
134
495
|
|
|
135
|
-
##
|
|
496
|
+
## Pricing
|
|
136
497
|
|
|
137
498
|
| | Standard | Professional | Enterprise |
|
|
138
499
|
|---|:---:|:---:|:---:|
|
|
139
|
-
| Candlestick + Volume |
|
|
140
|
-
| RSI + EMA |
|
|
141
|
-
| 5 drawing tools |
|
|
142
|
-
| All 10+ drawing tools | — |
|
|
143
|
-
| Orderbook Heatmap | — |
|
|
144
|
-
| Footprint Chart | — |
|
|
145
|
-
| Liquidation Heatmap | — |
|
|
146
|
-
| OI / CVD / Funding Rate | — |
|
|
147
|
-
| Large Trade Bubbles | — |
|
|
148
|
-
| VRVP / TPO | — | — |
|
|
149
|
-
| Smart Money Concepts | — | — |
|
|
150
|
-
| VPIN / Stops & Icebergs | — | — |
|
|
151
|
-
| Custom Indicator Plugin | — | — |
|
|
152
|
-
| White-label | — | — |
|
|
500
|
+
| Candlestick + Volume | ✓ | ✓ | ✓ |
|
|
501
|
+
| RSI + EMA | ✓ | ✓ | ✓ |
|
|
502
|
+
| 5 drawing tools | ✓ | ✓ | ✓ |
|
|
503
|
+
| All 10+ drawing tools | — | ✓ | ✓ |
|
|
504
|
+
| Orderbook Heatmap | — | ✓ | ✓ |
|
|
505
|
+
| Footprint Chart | — | ✓ | ✓ |
|
|
506
|
+
| Liquidation Heatmap | — | ✓ | ✓ |
|
|
507
|
+
| OI / CVD / Funding Rate | — | ✓ | ✓ |
|
|
508
|
+
| Large Trade Bubbles | — | ✓ | ✓ |
|
|
509
|
+
| VRVP / TPO | — | — | ✓ |
|
|
510
|
+
| Smart Money Concepts | — | — | ✓ |
|
|
511
|
+
| VPIN / Stops & Icebergs | — | — | ✓ |
|
|
512
|
+
| Custom Indicator Plugin | — | — | ✓ |
|
|
513
|
+
| White-label | — | — | ✓ |
|
|
514
|
+
|
|
515
|
+
**14-day free trial included** — no credit card required.
|
|
153
516
|
|
|
154
|
-
|
|
517
|
+
<p align="center">
|
|
518
|
+
<a href="https://app.mrd-indicators.com/charting-library/pricing"><strong>View pricing & get a trial key →</strong></a>
|
|
519
|
+
</p>
|
|
155
520
|
|
|
156
521
|
---
|
|
157
522
|
|
|
158
523
|
## Browser Support
|
|
159
524
|
|
|
160
|
-
Chrome 80+
|
|
525
|
+
Chrome 80+ • Firefox 79+ • Safari 15.2+ • Edge 80+ • Mobile Chrome • Mobile Safari
|
|
161
526
|
|
|
162
|
-
Requires
|
|
527
|
+
Requires ES2020.
|
|
163
528
|
|
|
164
529
|
---
|
|
165
530
|
|
|
166
531
|
## Documentation
|
|
167
532
|
|
|
168
|
-
|
|
533
|
+
> **[→ Full Documentation Table of Contents](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/README.md)**
|
|
534
|
+
|
|
535
|
+
### Tutorials
|
|
536
|
+
|
|
537
|
+
| Guide | Description |
|
|
538
|
+
|---|---|
|
|
539
|
+
| [Getting Started](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/getting-started.md) | Installation, creating your first chart, loading data, starting the render loop |
|
|
540
|
+
| [Core Concepts & Architecture](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/architecture.md) | Architecture overview, native engine, command buffer pipeline, responsibility model |
|
|
541
|
+
| [Framework Integration](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/examples/framework-integration.md) | Complete examples for React, Vue 3, Svelte, Vanilla JS with SSR handling |
|
|
542
|
+
|
|
543
|
+
### Data & Chart Types
|
|
544
|
+
|
|
545
|
+
| Guide | Description |
|
|
546
|
+
|---|---|
|
|
547
|
+
| [Candlestick Data](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/data.md) | OHLCV data format, real-time updates, append/prepend, chart types |
|
|
548
|
+
| [Orderbook Heatmap](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/orderbook-heatmap.md) | Depth matrix setup, real-time streaming, range configuration, prefetch |
|
|
549
|
+
| [Footprint Chart](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/footprint-chart.md) | Trade stream ingestion, display modes, delta histogram, signals |
|
|
550
|
+
| [Chart Aggregation](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/chart-aggregation.md) | Renko, Range, and Tick chart construction from OHLCV data |
|
|
551
|
+
|
|
552
|
+
### Indicators & Analysis
|
|
553
|
+
|
|
554
|
+
| Guide | Description |
|
|
555
|
+
|---|---|
|
|
556
|
+
| [Built-in Indicators](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/indicators.md) | All 14+ indicators — RSI, CVD, OI, Funding Rate, VRVP, TPO, VPIN, Smart Ranges, EMA Structure |
|
|
557
|
+
| [Custom Indicators](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/custom-indicators.md) | Plugin API with `compute` + `render`, engine-backed drawing primitives |
|
|
558
|
+
|
|
559
|
+
### Drawing & Interaction
|
|
560
|
+
|
|
561
|
+
| Guide | Description |
|
|
562
|
+
|---|---|
|
|
563
|
+
| [Drawing Tools](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/drawings.md) | All 10+ tools, programmatic creation, styling, JSON serialization |
|
|
564
|
+
| [Events & Tooltips](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/tooltip.md) | Tooltip callback, drawing events, hover hit tests, crosshair data |
|
|
565
|
+
| [Viewport & Interaction](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/viewport-interaction.md) | Pan, zoom, pinch gestures, bar replay, crosshair sync, Y-axis scaling |
|
|
566
|
+
|
|
567
|
+
### Configuration
|
|
568
|
+
|
|
569
|
+
| Guide | Description |
|
|
570
|
+
|---|---|
|
|
571
|
+
| [Theming](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/themes.md) | Dark/light mode, framework theme synchronization |
|
|
572
|
+
| [Advanced Topics](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/guides/advanced.md) | Iceberg detection, licensing, performance optimization, memory management |
|
|
573
|
+
|
|
574
|
+
### Reference
|
|
575
|
+
|
|
576
|
+
| Guide | Description |
|
|
577
|
+
|---|---|
|
|
578
|
+
| [API Reference](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/api/README.md) | Complete method & event documentation |
|
|
579
|
+
| [React Integration](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/examples/react.md) | Hooks, resize, WebSocket |
|
|
580
|
+
| [Vue 3 Integration](https://github.com/PhamNhinh/kline-orderbook-chart/blob/main/docs/examples/vue.md) | Composables, theme switching |
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## Licensing
|
|
585
|
+
|
|
586
|
+
Free 14-day trial included. Contact us for pricing and license options:
|
|
587
|
+
|
|
588
|
+
<p align="center">
|
|
589
|
+
<a href="https://app.mrd-indicators.com/trading/chart-terminal">Try live demo</a> •
|
|
590
|
+
<a href="mailto:support@mrd-indicators.com"><strong>Contact for pricing →</strong></a>
|
|
591
|
+
</p>
|
|
592
|
+
|
|
593
|
+
---
|
|
594
|
+
|
|
595
|
+
## Keywords
|
|
596
|
+
|
|
597
|
+
`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`
|
|
169
598
|
|
|
170
599
|
---
|
|
171
600
|
|
|
172
601
|
## License
|
|
173
602
|
|
|
174
|
-
|
|
175
|
-
|
|
603
|
+
This is proprietary commercial software. A valid license key is required for production use.
|
|
604
|
+
Free 14-day trial is available with watermark.
|
|
605
|
+
|
|
606
|
+
See [LICENSE](./LICENSE) for full terms.
|
|
176
607
|
|
|
177
608
|
---
|
|
178
609
|
|
|
179
610
|
<p align="center">
|
|
180
|
-
<sub
|
|
611
|
+
<sub>Native high-performance engine. Designed for traders who need to see the full order book.</sub><br/>
|
|
612
|
+
<sub>© 2026 MRD Technologies. All rights reserved.</sub>
|
|
181
613
|
</p>
|