kline-orderbook-chart 2.1.0 → 2.2.1
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/CHANGELOG.md +88 -2
- package/LICENSE +126 -90
- package/README.md +128 -599
- package/dist/chart-engine.mjs +469 -44
- package/dist/chart_engine.js +1 -1
- package/dist/chart_engine_bg.wasm +0 -0
- package/dist/index.d.ts +585 -149
- package/dist/ingestWorker.js +1 -1
- package/dist/mboWorker.js +14 -0
- package/dist/panelWorker.js +363 -5
- package/dist/tapeScriptWorker.js +19 -0
- package/dist/tickWorker.js +453 -34
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,155 +1,520 @@
|
|
|
1
|
+
// Type definitions for kline-orderbook-chart.
|
|
2
|
+
// Everything declared here is the supported public API. Members that exist on
|
|
3
|
+
// the runtime objects but are not declared here are internal and may change
|
|
4
|
+
// in any release.
|
|
5
|
+
|
|
6
|
+
/** Numeric array input. Typed arrays are read without a copy. */
|
|
7
|
+
export type NumArray = ArrayLike<number>;
|
|
8
|
+
|
|
9
|
+
// ── Module functions ────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
/** Create a chart on a canvas. Never rejects for license reasons; see {@link LicenseInfo}. */
|
|
1
12
|
export declare function createChartBridge(
|
|
2
13
|
canvas: HTMLCanvasElement,
|
|
3
14
|
options?: ChartBridgeOptions,
|
|
4
15
|
): Promise<ChartEngine>;
|
|
5
16
|
|
|
6
|
-
/**
|
|
7
|
-
* Eagerly fetch and compile the native engine module in the background.
|
|
8
|
-
* Fire-and-forget — call as early as you can in your app's lifecycle.
|
|
9
|
-
* When createChartBridge() runs later, it reuses the already-loaded
|
|
10
|
-
* module instead of waiting on the network.
|
|
11
|
-
*/
|
|
17
|
+
/** Start downloading and compiling the engine in the background. */
|
|
12
18
|
export declare function prefetchEngine(): void;
|
|
13
19
|
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated since v1.2 — use {@link prefetchEngine} instead. Kept as a
|
|
16
|
-
* back-compat alias so existing integrations keep working without code
|
|
17
|
-
* changes. Will not be removed in 1.x.
|
|
18
|
-
*/
|
|
20
|
+
/** @deprecated Use {@link prefetchEngine}. */
|
|
19
21
|
export declare function prefetchWasm(): void;
|
|
20
22
|
|
|
23
|
+
/** Cap the render rate of every chart on the page. `0` = display refresh rate. */
|
|
24
|
+
export declare function setMaxFps(fps: number): void;
|
|
25
|
+
|
|
21
26
|
export interface ChartBridgeOptions {
|
|
22
|
-
/**
|
|
27
|
+
/** Signed license key. Omit for the free tier. */
|
|
23
28
|
licenseKey?: string | null;
|
|
29
|
+
/** Alias of `licenseKey`. */
|
|
24
30
|
key?: string | null;
|
|
25
|
-
/**
|
|
31
|
+
/** Bundle id for a mobile license (React Native / Capacitor / Cordova web view). */
|
|
26
32
|
appId?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Customise the trial-expired watermark CTA. The watermark only renders
|
|
29
|
-
* once the 30-day trial elapses (or a paid license expires) — at that
|
|
30
|
-
* point the badge in the top-right corner of the canvas (and the centred
|
|
31
|
-
* "License expired" overlay, when the chart is fully blocked) become
|
|
32
|
-
* clickable affordances that open the pricing page in a new tab.
|
|
33
|
-
*
|
|
34
|
-
* Default: opens https://app.tapedelta.com/charting-library/pricing.
|
|
35
|
-
*
|
|
36
|
-
* Customers embedding the engine in their own trading product can
|
|
37
|
-
* point trial-expired users at THEIR upgrade page instead.
|
|
38
|
-
*/
|
|
39
|
-
brand?: {
|
|
40
|
-
/** Destination opened in a new tab when the user clicks the badge. */
|
|
41
|
-
url?: string;
|
|
42
|
-
/** Sub-text on the badge (default: "Open the full app"). */
|
|
43
|
-
text?: string;
|
|
44
|
-
/** Bold title on the badge (default: "Tape Delta"). */
|
|
45
|
-
title?: string;
|
|
46
|
-
};
|
|
47
33
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
export
|
|
34
|
+
|
|
35
|
+
/** License state as resolved on this device. */
|
|
36
|
+
export interface LicenseInfo {
|
|
37
|
+
/** `'free'`, `'trial'`, `'standard'`, `'professional'` or `'enterprise'`. */
|
|
38
|
+
plan: string;
|
|
39
|
+
/** `false` when the signature, domain, platform or app id does not match. */
|
|
40
|
+
valid: boolean;
|
|
41
|
+
/** `true` when the key is past its expiry and the grace period; the chart runs the free tier. */
|
|
42
|
+
expired?: boolean;
|
|
43
|
+
/** `true` during the 7 days after a paid key's expiry; every plan feature still works. */
|
|
44
|
+
grace?: boolean;
|
|
45
|
+
/** End of the grace period, epoch seconds. */
|
|
46
|
+
graceEndsAt?: number;
|
|
47
|
+
/** `'web'`, `'desktop'`, `'mobile'` or `'any'`. */
|
|
48
|
+
platform?: string;
|
|
49
|
+
/** Why the key was refused or has expired. */
|
|
50
|
+
error?: string;
|
|
51
|
+
/** Renewal reminder during the grace period. */
|
|
52
|
+
warning?: string;
|
|
53
|
+
/** Set when the value passed is not a license key. */
|
|
54
|
+
notice?: string;
|
|
55
|
+
/** `true` when the chart shows the brand mark or the license badge. */
|
|
56
|
+
watermark: boolean;
|
|
57
|
+
/** Days until expiry; `Infinity` for the free tier and perpetual keys. */
|
|
58
|
+
daysLeft?: number;
|
|
59
|
+
/** Feature key → enabled for this plan. */
|
|
60
|
+
features: Record<string, boolean>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ── Chart ───────────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
/** 0 = Candles, 1 = Footprint, 2 = Renko, 3 = TPO profile chart. */
|
|
66
|
+
export type ChartType = 0 | 1 | 2 | 3;
|
|
67
|
+
|
|
68
|
+
export interface CandleStyle {
|
|
69
|
+
kind?: 'candles' | 'hollow' | 'bars';
|
|
70
|
+
body?: boolean;
|
|
71
|
+
border?: boolean;
|
|
72
|
+
wick?: boolean;
|
|
73
|
+
/** Color each bar by its close against the previous close. */
|
|
74
|
+
prevClose?: boolean;
|
|
75
|
+
/** Bars kind: draw high-low-close without the open tick. */
|
|
76
|
+
barsHlc?: boolean;
|
|
77
|
+
/** Bars kind: 1 px bars. Default `true`. */
|
|
78
|
+
barsThin?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface LastPriceLineConfig {
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
width?: number;
|
|
84
|
+
dashLen?: number;
|
|
85
|
+
gapLen?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface HeatmapProfileStyle {
|
|
89
|
+
/** Bar length cap as a fraction of the chart width (0.02–0.6). */
|
|
90
|
+
width?: number;
|
|
91
|
+
rowMode?: 'global' | 'custom';
|
|
92
|
+
/** Rows per bar in `custom` mode. */
|
|
93
|
+
ticks?: number;
|
|
94
|
+
dataSource?: 'heatmap' | 'live' | 'both';
|
|
95
|
+
gradeColors?: boolean;
|
|
96
|
+
showValues?: boolean;
|
|
97
|
+
/** `#RRGGBB` or `#RRGGBBAA`. */
|
|
98
|
+
bidColor?: string;
|
|
99
|
+
askColor?: string;
|
|
100
|
+
textColor?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A price-alert line drawn and dragged on the chart. */
|
|
104
|
+
export interface PriceAlertLevel {
|
|
105
|
+
/** Positive integer you map back to your own alert id. */
|
|
106
|
+
handle: number;
|
|
107
|
+
price: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type DrawingTool =
|
|
111
|
+
| 'trendline' | 'arrow' | 'arrowmarker' | 'hline' | 'verticalline' | 'channel'
|
|
112
|
+
| 'measure' | 'pricerange' | 'dayrange' | 'circle' | 'pricelabel' | 'textnote'
|
|
113
|
+
| 'arrowup' | 'arrowdown' | 'brush' | 'path' | 'elliott'
|
|
114
|
+
// Professional and Enterprise:
|
|
115
|
+
| 'fib' | 'fibext' | 'long' | 'short' | 'vwap' | 'frvp'
|
|
116
|
+
| 'elliottauto' | 'elliottautorange' | 'elliottzigzag' | 'elliottzigzagrange'
|
|
117
|
+
| 'xabcd' | 'cypher' | 'headshoulders' | 'abcd' | 'trianglepattern' | 'threedrives';
|
|
118
|
+
|
|
119
|
+
export interface DrawingStyle {
|
|
120
|
+
/** Stroke color, CSS hex. */
|
|
121
|
+
hex?: string;
|
|
122
|
+
r?: number;
|
|
123
|
+
g?: number;
|
|
124
|
+
b?: number;
|
|
125
|
+
lineWidth?: number;
|
|
126
|
+
dashed?: boolean;
|
|
127
|
+
fontSize?: number;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** OHLCV arrays handed to a custom indicator's `compute`. */
|
|
131
|
+
export interface CustomIndicatorOhlcv {
|
|
132
|
+
length: number;
|
|
133
|
+
/** Unix seconds. */
|
|
134
|
+
timestamps: Float64Array;
|
|
135
|
+
open: Float64Array;
|
|
136
|
+
high: Float64Array;
|
|
137
|
+
low: Float64Array;
|
|
138
|
+
close: Float64Array;
|
|
139
|
+
volume: Float64Array;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface CustomIndicatorContext {
|
|
143
|
+
/** Reusable Float64Array of length `n` keyed by `key`. Contents survive between runs. */
|
|
144
|
+
f64(key: string, n: number): Float64Array;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/** Draw calls available inside a custom indicator's `render`. Index arguments are bar indices. */
|
|
148
|
+
export interface CustomIndicatorDraw {
|
|
149
|
+
seriesLine(series: NumArray, color?: string, lineWidth?: number): void;
|
|
150
|
+
band(upper: NumArray, lower: NumArray, fillColor?: string): void;
|
|
151
|
+
hline(price: number, color?: string, lineWidth?: number): void;
|
|
152
|
+
marker(index: number, price: number, color?: string, radius?: number): void;
|
|
153
|
+
text(index: number, price: number, text: string, color?: string, fontSize?: number, align?: 'left' | 'center' | 'right'): void;
|
|
154
|
+
/** Time-anchored segment; times in Unix seconds. */
|
|
155
|
+
line(t1: number, p1: number, t2: number, p2: number, color?: string, lineWidth?: number, dash?: number, gap?: number, extend?: number): void;
|
|
156
|
+
vline(t: number, color?: string, lineWidth?: number, dash?: number, gap?: number): void;
|
|
157
|
+
box(t1: number, p1: number, t2: number, p2: number, opts?: Record<string, unknown>): void;
|
|
158
|
+
label(t: number, p: number, text: string, opts?: Record<string, unknown>): void;
|
|
159
|
+
arrow(t1: number, p1: number, t2: number, p2: number, color?: string, lineWidth?: number, headSize?: number): void;
|
|
160
|
+
bgColor(startIndex: number, endIndex: number, color?: string): void;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface CustomIndicatorConfig<P extends Record<string, unknown> = Record<string, unknown>, C = Record<string, NumArray>> {
|
|
164
|
+
name: string;
|
|
165
|
+
params?: P;
|
|
166
|
+
/** `'overlay'` (default) draws on the price pane; any other string opens its own pane. */
|
|
167
|
+
pane?: string;
|
|
168
|
+
compute?(ohlcv: CustomIndicatorOhlcv, params: P, ctx: CustomIndicatorContext): C;
|
|
169
|
+
render(this: { params: P }, draw: CustomIndicatorDraw, computed: C): void;
|
|
170
|
+
/** Called when the indicator is removed. */
|
|
171
|
+
dispose?(): void;
|
|
172
|
+
}
|
|
51
173
|
|
|
52
174
|
export interface ChartEngine {
|
|
53
|
-
|
|
175
|
+
// Lifecycle
|
|
176
|
+
/** Start the render loop. The chart redraws only when something changes. */
|
|
54
177
|
start(): void;
|
|
178
|
+
/** Stop the render loop; the last frame stays on the canvas. */
|
|
55
179
|
stop(): void;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Re-render the current chart frame to a fresh offscreen canvas at
|
|
59
|
-
* `cssSize × scale` device px (true supersampling), for crisp
|
|
60
|
-
* snapshots/exports independent of the screen's devicePixelRatio.
|
|
61
|
-
* Returns null when the candle engine isn't the active painter
|
|
62
|
-
* (e.g. tick mode) — blit the live canvas in that case.
|
|
63
|
-
*/
|
|
64
|
-
captureFrame(scale?: number): HTMLCanvasElement | null;
|
|
65
|
-
destroy(): void;
|
|
180
|
+
/** Stop painting while data keeps loading, e.g. while the page is hidden. */
|
|
66
181
|
pause(): void;
|
|
182
|
+
/** Continue painting after pause(). */
|
|
67
183
|
resume(): void;
|
|
68
184
|
readonly isPaused: boolean;
|
|
69
|
-
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
185
|
+
/** Re-read the canvas size. Call it from a ResizeObserver on the parent. */
|
|
186
|
+
resize(retries?: number): void;
|
|
187
|
+
/** Release the engine, listeners and canvases. Call on unmount. */
|
|
188
|
+
destroy(): void;
|
|
189
|
+
/** Draw one frame now instead of on the next animation frame. */
|
|
190
|
+
renderFrameNow(): void;
|
|
191
|
+
/** Render the current frame offscreen at `scale` × CSS size; `null` if unavailable. */
|
|
192
|
+
captureFrame(scale?: number): HTMLCanvasElement | null;
|
|
193
|
+
/** Show or hide the built-in loading indicator. */
|
|
74
194
|
setLoading(on: boolean): void;
|
|
75
195
|
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
196
|
+
// License
|
|
197
|
+
/** Current license state. */
|
|
198
|
+
readonly license: LicenseInfo;
|
|
199
|
+
/** Swap the key without recreating the chart. Resolves `true` when the key is valid. */
|
|
200
|
+
setLicenseKey(key: string | null): Promise<boolean>;
|
|
201
|
+
|
|
202
|
+
// Candles
|
|
203
|
+
/** Replace all candles. Timestamps are Unix seconds, ascending. */
|
|
204
|
+
setKlines(timestamps: NumArray, open: NumArray, high: NumArray, low: NumArray, close: NumArray, volume: NumArray): void;
|
|
205
|
+
/** Same as setKlines but keeps the current pan and zoom. */
|
|
206
|
+
setKlinesPreserveViewport(timestamps: NumArray, open: NumArray, high: NumArray, low: NumArray, close: NumArray, volume: NumArray): void;
|
|
207
|
+
/** Add older candles in front of the loaded ones without moving the view. */
|
|
208
|
+
prependKlines(timestamps: NumArray, open: NumArray, high: NumArray, low: NumArray, close: NumArray, volume: NumArray): void;
|
|
79
209
|
appendKline(t: number, o: number, h: number, l: number, c: number, v: number): void;
|
|
80
|
-
|
|
210
|
+
updateLastKline(t: number, o: number, h: number, l: number, c: number, v: number): void;
|
|
211
|
+
/** Remove the last candle. Returns `false` when there was none. */
|
|
212
|
+
popLastKline(): boolean;
|
|
213
|
+
getKlineCount(): number;
|
|
214
|
+
/** Close of the last candle; `0` when no data is loaded. */
|
|
215
|
+
getLastClose(): number;
|
|
216
|
+
/** Bar length in seconds. Inferred from the data when never set. */
|
|
217
|
+
setCandleInterval(seconds: number): void;
|
|
218
|
+
getCandleInterval(): number;
|
|
219
|
+
/** Decimal places on the price axis, crosshair and tooltip. */
|
|
220
|
+
setPrecision(decimals: number): void;
|
|
221
|
+
/** Time-axis offset from UTC in seconds (e.g. 7 * 3600). */
|
|
222
|
+
setTzOffsetSeconds(seconds: number): void;
|
|
223
|
+
setKlineVisible(visible: boolean): void;
|
|
224
|
+
getKlineVisible(): boolean;
|
|
225
|
+
|
|
226
|
+
// Chart type and style
|
|
227
|
+
setChartType(type: ChartType): void;
|
|
228
|
+
getChartType(): ChartType;
|
|
229
|
+
setCandleStyle(style: CandleStyle): void;
|
|
230
|
+
|
|
231
|
+
// Orderbook heatmap (Professional)
|
|
81
232
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* once a long live session grows past max. Default is unlimited — set a
|
|
85
|
-
* value to bound memory, or keep 0 for deep-history / 1M-column views.
|
|
233
|
+
* Load a depth matrix, row-major `[rows × cols]`: `matrix[row * cols + col]`.
|
|
234
|
+
* Row 0 is the lowest price (`yStart`); values are resting size (≥ 0).
|
|
86
235
|
*/
|
|
236
|
+
setHeatmap(matrix: NumArray, rows: number, cols: number, xStart: number, xStep: number, yStart: number, yStep: number): void;
|
|
237
|
+
/** Append one snapshot column (`rows` values) at `timestamp`. */
|
|
238
|
+
appendHeatmapColumn(values: NumArray, timestamp: number, yStart: number, yStep: number): void;
|
|
239
|
+
/** Add older columns to the left; `matrix` is row-major `[rows × cols]`, oldest column first. */
|
|
240
|
+
prependHeatmapColumns(matrix: NumArray, rows: number, cols: number, yStart: number, yStep: number): void;
|
|
241
|
+
/** Keep at most `max` live columns (oldest dropped). `0` = unlimited, the default. */
|
|
87
242
|
setHeatmapMaxCols(max: number): void;
|
|
243
|
+
/** Fixed intensity range; `(0, 0)` restores the adaptive range. */
|
|
244
|
+
setHeatmapRange(min: number, max: number): void;
|
|
245
|
+
clearHeatmapRange(): void;
|
|
246
|
+
/** 0 Viridis, 1 Thermal, 2 Ocean, 3 Plasma, 4 Inferno, 5 Cyan Fire, 6 Green Glow, 7 Magma. */
|
|
247
|
+
setHeatmapColorScheme(scheme: number): void;
|
|
248
|
+
setHeatmapShowProfile(show: boolean): void;
|
|
249
|
+
/** Side-profile bar length cap as a fraction of the chart width (0.02–0.6, default 0.15). */
|
|
250
|
+
setHeatmapProfileWidth(fraction: number): void;
|
|
251
|
+
/** Side-profile color intensity multiplier (about 0.5–2). */
|
|
252
|
+
setHeatmapProfileBrightness(mul: number): void;
|
|
253
|
+
setHeatmapProfileStyle(style: HeatmapProfileStyle): void;
|
|
254
|
+
/** Current book for the side profile: flat `[price, size, isAsk(0|1)]` triplets. */
|
|
255
|
+
setHeatmapProfileLiveDepth(flat: NumArray): void;
|
|
256
|
+
clearHeatmapProfileLiveDepth(): void;
|
|
257
|
+
|
|
258
|
+
// Footprint (Professional) — switch with setChartType(1)
|
|
259
|
+
/** Price width of one footprint row. */
|
|
260
|
+
setFootprintTickSize(tick: number): void;
|
|
261
|
+
/** Make room for `n` bars (call with the candle count after setKlines). */
|
|
262
|
+
footprintEnsureLen(n: number): void;
|
|
263
|
+
/** Add one trade to bar `barIndex`. `isBuyerMaker = true` means the aggressor sold. */
|
|
264
|
+
footprintAddTrade(barIndex: number, price: number, qty: number, isBuyerMaker: boolean, tsSec?: number): void;
|
|
265
|
+
/** Flat trades, 5 numbers each: `[barIndex, price, qty, isBuyerMaker(0|1), tsSec]`. */
|
|
266
|
+
footprintAddTradeBatch(flat: NumArray): void;
|
|
267
|
+
/** Replace one bar with pre-aggregated rows (bid and ask volume per price). */
|
|
268
|
+
footprintSetBar(barIndex: number, tickSize: number, prices: NumArray, bidVols: NumArray, askVols: NumArray): void;
|
|
269
|
+
footprintClear(): void;
|
|
88
270
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* first, contiguous at the current x_step immediately before the current
|
|
92
|
-
* start; re-quantized to the live y grid. No-op until setHeatmap was called.
|
|
271
|
+
* Cell content: 0 Bid×Ask, 1 Delta, 2 Volume, 3 Volume + Delta, 4 Centered Delta,
|
|
272
|
+
* 5 Centered Bid×Ask, 6 Bid/Ask, 7 None, 8 Trades, 9 Volume + Trades, 10 Time.
|
|
93
273
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
274
|
+
footprintSetDisplayMode(mode: number): void;
|
|
275
|
+
footprintSetShowProfile(show: boolean): void;
|
|
276
|
+
footprintSetShowSignals(show: boolean): void;
|
|
277
|
+
/** Text size multiplier, 0.5–2. */
|
|
278
|
+
footprintSetFontScale(scale: number): void;
|
|
279
|
+
footprintSetStackedImbalanceEnabled(on: boolean): void;
|
|
280
|
+
/** Imbalance ratio, 1.01–100 (2.3 = 230 %). */
|
|
281
|
+
footprintSetStackedImbalanceRatio(ratio: number): void;
|
|
282
|
+
/** Consecutive imbalanced rows that make a stack, ≥ 2. */
|
|
283
|
+
footprintSetStackedImbalanceMinStack(rows: number): void;
|
|
284
|
+
/** 0 = diagonal (bid vs the ask one row up), 1 = horizontal (same row). */
|
|
285
|
+
footprintSetStackedImbalanceMode(mode: 0 | 1): void;
|
|
286
|
+
/** Stop drawing stacks older than `bars`; 0 = all. */
|
|
287
|
+
footprintSetStackedImbalanceMaxAge(bars: number): void;
|
|
288
|
+
|
|
289
|
+
// View and coordinates
|
|
290
|
+
/** Show the latest bars and re-enable price auto-scale on every pane. */
|
|
291
|
+
resetView(): void;
|
|
292
|
+
resetPriceScale(): void;
|
|
293
|
+
setYAutoScale(on: boolean): void;
|
|
294
|
+
getYAutoScale(): boolean;
|
|
295
|
+
/** Canvas CSS px → chart coordinates: `x` = time (Unix seconds), `y` = price. */
|
|
296
|
+
screenToWorld(sx: number, sy: number): { x: number; y: number };
|
|
297
|
+
/** Chart coordinates → canvas CSS px; `null` when the chart is not ready. */
|
|
298
|
+
worldToScreen(x: number, y: number): { x: number; y: number } | null;
|
|
299
|
+
|
|
300
|
+
// Theme and colors
|
|
110
301
|
setTheme(name: 'dark' | 'light'): void;
|
|
111
302
|
getTheme(): 'dark' | 'light';
|
|
303
|
+
setBackgroundColor(hex: string): void;
|
|
304
|
+
/** Vertical gradient from the background color to `endHex`. */
|
|
305
|
+
setBgGradient(enabled: boolean, endHex: string): void;
|
|
306
|
+
setCandleBullColor(hex: string): void;
|
|
307
|
+
setCandleBearColor(hex: string): void;
|
|
308
|
+
setCandleBullBorderColor(hex: string): void;
|
|
309
|
+
setCandleBearBorderColor(hex: string): void;
|
|
310
|
+
setCandleBullWickColor(hex: string): void;
|
|
311
|
+
setCandleBearWickColor(hex: string): void;
|
|
312
|
+
setGridColor(hex: string, alpha?: number): void;
|
|
313
|
+
setGridHVisible(visible: boolean): void;
|
|
314
|
+
setGridVVisible(visible: boolean): void;
|
|
315
|
+
setCrosshairColor(hex: string, alpha?: number): void;
|
|
316
|
+
/** `'dashed'` (0), `'solid'` (1) or `'dotted'` (2). */
|
|
317
|
+
setCrosshairStyle(style: 'dashed' | 'solid' | 'dotted' | 0 | 1 | 2): void;
|
|
318
|
+
/** Line width in px, 0.5–4. */
|
|
319
|
+
setCrosshairWidth(width: number): void;
|
|
320
|
+
/** Snap the crosshair to OHLC: `'off'`, `'weak'` or `'strong'`. */
|
|
321
|
+
setCrosshairMagnet(mode: 'off' | 'weak' | 'strong' | 0 | 1 | 2): void;
|
|
322
|
+
setLastPriceLine(config: LastPriceLineConfig): void;
|
|
323
|
+
/** Base font size in px for axis and label text. */
|
|
324
|
+
setFontSize(size: number): void;
|
|
325
|
+
setIndicatorsVisible(visible: boolean): void;
|
|
326
|
+
setDrawingsVisible(visible: boolean): void;
|
|
112
327
|
|
|
113
328
|
// Events
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
329
|
+
/** Hover payload as a JSON string (`null` when the pointer leaves), plus the pointer position. */
|
|
330
|
+
onTooltip(cb: ((json: string | null, sx: number, sy: number) => void) | null): void;
|
|
331
|
+
/** Called after every painted frame. Keep it cheap. */
|
|
332
|
+
onPostRender(cb: (() => void) | null): void;
|
|
333
|
+
/** `true` while the user pans or zooms. Returns an unsubscribe function. */
|
|
118
334
|
onGestureChange(cb: (busy: boolean) => void): () => void;
|
|
119
335
|
readonly isChartBusy: boolean;
|
|
120
|
-
/** World-x (chart time, seconds) at a screen CSS-px x; pass 0 for the left plot edge. */
|
|
121
|
-
screenToWorldX(sx: number): number;
|
|
122
336
|
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
337
|
+
// Drawings
|
|
338
|
+
/** Arm a drawing tool; the user places it with the pointer. */
|
|
339
|
+
startDrawing(tool: DrawingTool, style?: DrawingStyle): void;
|
|
340
|
+
cancelDrawing(): void;
|
|
341
|
+
/** All drawings as a JSON string. */
|
|
342
|
+
exportDrawingsJson(): string;
|
|
343
|
+
/** Replace all drawings with a JSON string from exportDrawingsJson. */
|
|
344
|
+
importDrawingsJson(json: string): void;
|
|
345
|
+
clearDrawings(): void;
|
|
346
|
+
removeDrawing(id: number): void;
|
|
347
|
+
onDrawingComplete(cb: (() => void) | null): void;
|
|
348
|
+
onDrawingCancel(cb: (() => void) | null): void;
|
|
349
|
+
onDrawingEdited(cb: (() => void) | null): void;
|
|
350
|
+
/** `id` is 0 when the selection is cleared. */
|
|
351
|
+
onDrawingSelected(cb: ((id: number) => void) | null): void;
|
|
352
|
+
/** Double-click on a drawing: canvas offset and page client coordinates. */
|
|
353
|
+
onDrawingDblClick(cb: ((id: number, offsetX: number, offsetY: number, clientX: number, clientY: number) => void) | null): void;
|
|
354
|
+
/** Add a trend line in chart coordinates. Color channels 0–255. Returns the drawing id. */
|
|
355
|
+
addTrendline(t1: number, p1: number, t2: number, p2: number, r: number, g: number, b: number, lineWidth: number, dashed: boolean, pane?: number): number;
|
|
356
|
+
addHorizontalLine(t: number, price: number, r: number, g: number, b: number, lineWidth: number, dashed: boolean, pane?: number): number;
|
|
357
|
+
addVerticalLine(t: number, r: number, g: number, b: number, lineWidth: number, dashed: boolean, pane?: number): number;
|
|
358
|
+
|
|
359
|
+
// Markers
|
|
360
|
+
/** Triangle marker at `(timestamp, price)`. Returns the marker id. */
|
|
361
|
+
addMarker(timestamp: number, price: number, isBid: boolean): number;
|
|
362
|
+
removeMarker(id: number): void;
|
|
363
|
+
clearMarkers(): void;
|
|
364
|
+
selectMarker(id: number): void;
|
|
365
|
+
deselectMarker(): void;
|
|
366
|
+
/** Selected marker id; 0 when none. */
|
|
367
|
+
getSelectedMarker(): number;
|
|
368
|
+
onMarkerSelected(cb: ((id: number) => void) | null): void;
|
|
369
|
+
|
|
370
|
+
// Price alert lines
|
|
371
|
+
/** Replace every alert line. Re-sending an identical list does nothing. */
|
|
372
|
+
setPriceAlerts(levels: PriceAlertLevel[]): void;
|
|
373
|
+
clearPriceAlerts(): void;
|
|
374
|
+
/** The user dragged a line to a new price. */
|
|
375
|
+
onPriceAlertMoved(cb: ((handle: number, price: number) => void) | null): void;
|
|
376
|
+
/** The user clicked a line's remove button. */
|
|
377
|
+
onPriceAlertRemove(cb: ((handle: number) => void) | null): void;
|
|
378
|
+
|
|
379
|
+
// Built-in indicators — data you supply is aligned to the candles by index
|
|
380
|
+
// unless the method takes timestamps.
|
|
381
|
+
|
|
382
|
+
enableVolume(): void;
|
|
383
|
+
disableVolume(): void;
|
|
384
|
+
isVolumeEnabled(): boolean;
|
|
385
|
+
|
|
386
|
+
/** Open Interest (Professional). */
|
|
387
|
+
enableOi(): void;
|
|
388
|
+
disableOi(): void;
|
|
389
|
+
isOiEnabled(): boolean;
|
|
390
|
+
/** OI points at their own timestamps (Unix seconds). */
|
|
391
|
+
setOiDataTs(timestamps: NumArray, values: NumArray): void;
|
|
392
|
+
|
|
393
|
+
/** Funding Rate (Professional). */
|
|
394
|
+
enableFundingRate(): void;
|
|
395
|
+
disableFundingRate(): void;
|
|
396
|
+
isFundingRateEnabled(): boolean;
|
|
397
|
+
/** Primary funding series at its own timestamps (Unix seconds). */
|
|
398
|
+
setFrBinanceData(timestamps: NumArray, rates: NumArray): void;
|
|
399
|
+
/** Optional cross-venue average series. */
|
|
400
|
+
setFrAggData(timestamps: NumArray, rates: NumArray): void;
|
|
401
|
+
setFrShowAgg(show: boolean): void;
|
|
402
|
+
|
|
403
|
+
/** Cumulative Volume Delta (Professional). */
|
|
404
|
+
enableCvd(): void;
|
|
405
|
+
disableCvd(): void;
|
|
406
|
+
isCvdEnabled(): boolean;
|
|
407
|
+
/** Taker-buy volume and total volume per candle. */
|
|
408
|
+
setCvdData(takerBuyVolume: NumArray, totalVolume: NumArray): void;
|
|
409
|
+
|
|
410
|
+
/** Visible Range Volume Profile (Professional). Without setVrvpData the split falls back to candle direction. */
|
|
411
|
+
enableVrvp(): void;
|
|
412
|
+
disableVrvp(): void;
|
|
413
|
+
isVrvpEnabled(): boolean;
|
|
414
|
+
setVrvpData(takerBuyVolume: NumArray, totalVolume: NumArray): void;
|
|
415
|
+
/** Profile width as a percent of the chart width (4–45). */
|
|
416
|
+
setVrvpWidthPct(pct: number): void;
|
|
417
|
+
|
|
418
|
+
/** TPO / Market Profile overlay (Professional). */
|
|
419
|
+
enableTpo(): void;
|
|
420
|
+
disableTpo(): void;
|
|
421
|
+
isTpoEnabled(): boolean;
|
|
422
|
+
setTpoData(takerBuyVolume: NumArray, totalVolume: NumArray): void;
|
|
423
|
+
/** Session length in minutes (1440 = daily). */
|
|
424
|
+
setTpoPeriod(minutes: number): void;
|
|
425
|
+
/** 0 TPO letters, 1 Volume profile, 2 both. */
|
|
426
|
+
setTpoMode(mode: 0 | 1 | 2): void;
|
|
427
|
+
|
|
428
|
+
/** Large trade bubbles (Professional). */
|
|
429
|
+
enableLargeTrades(): void;
|
|
430
|
+
disableLargeTrades(): void;
|
|
431
|
+
isLargeTradesEnabled(): boolean;
|
|
432
|
+
/** Flat trades, 4 numbers each: `[tsSec, price, notionalUsd, isBuy(0|1)]`. */
|
|
433
|
+
setLargeTradesData(flat: NumArray): void;
|
|
434
|
+
pushLargeTrade(tsSec: number, price: number, notionalUsd: number, isBuy: 0 | 1): void;
|
|
435
|
+
clearLargeTrades(): void;
|
|
436
|
+
|
|
437
|
+
/** Aggregated liquidations histogram (Professional). */
|
|
438
|
+
enableAggLiq(): void;
|
|
439
|
+
disableAggLiq(): void;
|
|
440
|
+
isAggLiqEnabled(): boolean;
|
|
441
|
+
setAggLiqData(bars: Array<{ time: number; longUsd: number; shortUsd: number; longQty?: number; shortQty?: number; count?: number }>): void;
|
|
442
|
+
pushAggLiqBar(tsSec: number, longUsd: number, shortUsd: number, longQty: number, shortQty: number, count: number): void;
|
|
443
|
+
clearAggLiq(): void;
|
|
444
|
+
|
|
445
|
+
/** VPIN (Professional). */
|
|
446
|
+
enableVpin(): void;
|
|
447
|
+
disableVpin(): void;
|
|
448
|
+
isVpinEnabled(): boolean;
|
|
449
|
+
setVpinData(takerBuyVolume: NumArray, totalVolume: NumArray): void;
|
|
450
|
+
/** 5–500. */
|
|
451
|
+
setVpinBucketSize(size: number): void;
|
|
452
|
+
/** 5–200. */
|
|
453
|
+
setVpinNumBuckets(n: number): void;
|
|
454
|
+
/** 0.1–0.99. */
|
|
455
|
+
setVpinThreshold(value: number): void;
|
|
456
|
+
|
|
457
|
+
/** Smart Ranges, computed from the candles (Professional). */
|
|
458
|
+
enableSmartRanges(): void;
|
|
459
|
+
disableSmartRanges(): void;
|
|
460
|
+
isSmartRangesEnabled(): boolean;
|
|
461
|
+
|
|
462
|
+
/** EMA Structure, computed from the candles (Standard). */
|
|
463
|
+
enableEmaStructure(): void;
|
|
464
|
+
disableEmaStructure(): void;
|
|
465
|
+
isEmaStructureEnabled(): boolean;
|
|
466
|
+
|
|
467
|
+
/** Gaussian VWAP Cloud, computed from the candles (Standard). */
|
|
468
|
+
enableGaussianVwapCloud(): void;
|
|
469
|
+
disableGaussianVwapCloud(): void;
|
|
470
|
+
isGaussianVwapCloudEnabled(): boolean;
|
|
471
|
+
|
|
472
|
+
/** RSI (Standard): Wilder's RSI of the closes; overbought / oversold zones at 80–90 and 10–20. */
|
|
473
|
+
enableRsi(): void;
|
|
474
|
+
disableRsi(): void;
|
|
475
|
+
isRsiEnabled(): boolean;
|
|
476
|
+
/** Lookback in bars. Default 14. */
|
|
477
|
+
setRsiPeriod(period: number): void;
|
|
478
|
+
/** EMA 9 of the RSI. */
|
|
479
|
+
setRsiShowEma(show: boolean): void;
|
|
480
|
+
/** WMA 45 of the RSI, with the fill between it and the RSI. Default on. */
|
|
481
|
+
setRsiShowWma(show: boolean): void;
|
|
482
|
+
setRsiLineColor(hex: string): void;
|
|
483
|
+
setRsiLineWidth(width: number): void;
|
|
484
|
+
|
|
485
|
+
// Custom indicators (Professional, Enterprise)
|
|
486
|
+
/** Register a JavaScript indicator. Returns its id, or `null` when the plan does not include it. */
|
|
487
|
+
addIndicator<P extends Record<string, unknown>, C>(config: CustomIndicatorConfig<P, C>): number | null;
|
|
488
|
+
removeIndicator(id: number): void;
|
|
489
|
+
/** Merge params and recompute. */
|
|
490
|
+
updateIndicatorParams(id: number, params: Record<string, unknown>): void;
|
|
491
|
+
setIndicatorEnabled(id: number, enabled: boolean): void;
|
|
492
|
+
listIndicators(): Array<{ id: number; name: string; params: Record<string, unknown>; enabled: boolean }>;
|
|
137
493
|
}
|
|
138
494
|
|
|
139
|
-
/** @deprecated
|
|
495
|
+
/** @deprecated Use {@link ChartEngine}. */
|
|
140
496
|
export type MrdChart = ChartEngine;
|
|
141
497
|
|
|
142
|
-
// ── Orderbook
|
|
498
|
+
// ── Orderbook · Depth Profile (Enterprise) ─────────────────────────────────
|
|
143
499
|
|
|
500
|
+
/** Create an Orderbook · Depth Profile panel (Enterprise). */
|
|
144
501
|
export declare function createOrderbookBridge(
|
|
145
502
|
canvas: HTMLCanvasElement,
|
|
146
503
|
options?: OrderbookBridgeOptions,
|
|
147
504
|
): Promise<OrderbookEngine>;
|
|
148
505
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
506
|
+
/** Options shared by the panel engines. */
|
|
507
|
+
export interface PanelRenderOptions {
|
|
508
|
+
/** URL of the shipped worker file. Default: next to `chart-engine.mjs`. */
|
|
509
|
+
workerUrl?: string;
|
|
510
|
+
/**
|
|
511
|
+
* Orderbook and DOM Ladder paint in a worker by default (`'canvas2d'` opts out);
|
|
512
|
+
* Tick Stream paints on the main thread unless `'worker'`.
|
|
513
|
+
*/
|
|
514
|
+
renderer?: 'canvas2d' | 'worker';
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface OrderbookBridgeOptions extends PanelRenderOptions {
|
|
153
518
|
licenseKey?: string | null;
|
|
154
519
|
key?: string | null;
|
|
155
520
|
symbol?: string;
|
|
@@ -164,41 +529,134 @@ export interface OrderbookBridgeOptions {
|
|
|
164
529
|
}
|
|
165
530
|
|
|
166
531
|
export interface OrderbookEngine {
|
|
167
|
-
engine: any;
|
|
168
532
|
start(): void;
|
|
169
533
|
stop(): void;
|
|
170
534
|
resize(): void;
|
|
171
535
|
destroy(): void;
|
|
172
536
|
clear(): void;
|
|
173
|
-
|
|
174
|
-
pushSnapshot(bids: [number, number]
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
537
|
+
/** Book as `[price, qty]` pairs, best price first. */
|
|
538
|
+
pushSnapshot(bids: Array<[number, number]>, asks: Array<[number, number]>, midPrice: number): void;
|
|
539
|
+
/** Book as flat `[price, qty, …]` arrays. */
|
|
540
|
+
pushSnapshotFlat(bidFlat: NumArray, askFlat: NumArray, midPrice: number): void;
|
|
541
|
+
/** Multi-venue depth profile input. */
|
|
542
|
+
setDepthBook(bids: Array<[number, number]>, asks: Array<[number, number]>, midPrice: number): void;
|
|
543
|
+
setDepthBookFlat(bidFlat: NumArray, askFlat: NumArray, midPrice: number): void;
|
|
544
|
+
pushHeatmapCol(bids: Array<[number, number]>, asks: Array<[number, number]>, midPrice: number): void;
|
|
545
|
+
pushHeatmapColFlat(bidFlat: NumArray, askFlat: NumArray, midPrice: number): void;
|
|
546
|
+
resetRing(): void;
|
|
547
|
+
setSymbol(symbol: string): void;
|
|
548
|
+
setTickSize(tick: number): void;
|
|
179
549
|
setVisibleTicks(n: number): void;
|
|
180
550
|
setHeatmapCols(n: number): void;
|
|
551
|
+
setHeatmapAlphaMul(mul: number): void;
|
|
181
552
|
setExchangeCount(n: number): void;
|
|
182
|
-
|
|
183
|
-
|
|
553
|
+
setExchangeLabels(labels: string[]): void;
|
|
554
|
+
setPrecision(decimals: number): void;
|
|
555
|
+
setAutoCenter(on: boolean): void;
|
|
184
556
|
centerOnMid(): void;
|
|
557
|
+
setShowCumulative(on: boolean): void;
|
|
558
|
+
setShowSignalOverlays(on: boolean): void;
|
|
559
|
+
/** Signal overlays you compute: imbalance (−1..1) with the best bid/ask it used. */
|
|
560
|
+
setSignalObi(obi: number, bidPrice: number, askPrice: number): void;
|
|
561
|
+
setSignalSpoof(score: number): void;
|
|
562
|
+
setSignalAbsorption(bidAbsorption: number, askAbsorption: number): void;
|
|
563
|
+
setSignalFlow(netFlow: number, cumDelta: number): void;
|
|
564
|
+
setSignalWalls(bidWalls: Array<[number, number]>, askWalls: Array<[number, number]>): void;
|
|
565
|
+
setSignalGaps(bidGaps: Array<[number, number]>, askGaps: Array<[number, number]>): void;
|
|
185
566
|
setTheme(name: 'dark' | 'light'): void;
|
|
186
|
-
|
|
187
567
|
getHoverPrice(): number;
|
|
188
568
|
getHoverQty(): number;
|
|
569
|
+
/** 0 none, 1 bid, 2 ask. */
|
|
189
570
|
getHoverSide(): number;
|
|
190
571
|
}
|
|
191
572
|
|
|
192
|
-
/** @deprecated
|
|
573
|
+
/** @deprecated Use {@link OrderbookEngine}. */
|
|
193
574
|
export type MrdOrderbook = OrderbookEngine;
|
|
194
575
|
|
|
195
|
-
// ──
|
|
576
|
+
// ── DOM Ladder (Enterprise) ─────────────────────────────────────────────────
|
|
577
|
+
|
|
578
|
+
/** Create a DOM Ladder panel (Enterprise). */
|
|
579
|
+
export declare function createDomLadderBridge(
|
|
580
|
+
canvas: HTMLCanvasElement,
|
|
581
|
+
options?: PanelRenderOptions & {
|
|
582
|
+
licenseKey?: string | null; key?: string | null; theme?: 'dark' | 'light';
|
|
583
|
+
tickSize?: number; pricePrecision?: number; visibleRows?: number;
|
|
584
|
+
textScale?: number; fillIntensity?: number; qtyDisplayUsd?: boolean;
|
|
585
|
+
},
|
|
586
|
+
): Promise<DomLadderEngine>;
|
|
587
|
+
|
|
588
|
+
export interface DomLadderEngine {
|
|
589
|
+
start(): void;
|
|
590
|
+
stop(): void;
|
|
591
|
+
resize(): void;
|
|
592
|
+
destroy(): void;
|
|
593
|
+
/** Full book snapshot: flat `[price, qty, …]` or `[price, qty]` pairs. */
|
|
594
|
+
pushBook(bids: NumArray | Array<[number, number]>, asks: NumArray | Array<[number, number]>, midPrice: number): void;
|
|
595
|
+
/** One aggressive trade; `tsMs` defaults to now. */
|
|
596
|
+
appendTrade(price: number, qty: number, isBuy: boolean, tsMs?: number): void;
|
|
597
|
+
/** Per-price buy/sell volume: `{ p, b, s }` (or `{ price, buy, sell }`). */
|
|
598
|
+
pushDomVol(buckets: Array<{ p?: number; b?: number; s?: number; price?: number; buy?: number; sell?: number }>): void;
|
|
599
|
+
clearDomVol(): void;
|
|
600
|
+
setWalls(bidWallPrices: number[], askWallPrices: number[]): void;
|
|
601
|
+
/** Clear the book, trades and volume before loading another symbol. */
|
|
602
|
+
resetSymbol(): void;
|
|
603
|
+
setTickSize(tick: number): void;
|
|
604
|
+
setVisibleRows(n: number): void;
|
|
605
|
+
setPricePrecision(decimals: number): void;
|
|
606
|
+
setQtyDisplayUsd(on: boolean): void;
|
|
607
|
+
setFillIntensity(value: number): void;
|
|
608
|
+
setTextScale(scale: number): void;
|
|
609
|
+
centerOnMid(): void;
|
|
610
|
+
setTheme(name: 'dark' | 'light'): void;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
// ── Tick Stream (Enterprise) ────────────────────────────────────────────────
|
|
614
|
+
|
|
615
|
+
/** Create a Tick Stream panel (Enterprise). */
|
|
616
|
+
export declare function createTickBridge(
|
|
617
|
+
canvas: HTMLCanvasElement,
|
|
618
|
+
options?: PanelRenderOptions & {
|
|
619
|
+
licenseKey?: string | null; key?: string | null; theme?: 'dark' | 'light';
|
|
620
|
+
tickSize?: number; pricePrecision?: number; lookbackMs?: number; cellMs?: number;
|
|
621
|
+
},
|
|
622
|
+
): Promise<TickEngine>;
|
|
623
|
+
|
|
624
|
+
export interface TickEngine {
|
|
625
|
+
start(): void;
|
|
626
|
+
stop(): void;
|
|
627
|
+
resize(): void;
|
|
628
|
+
destroy(): void;
|
|
629
|
+
clearData(): void;
|
|
630
|
+
/** One aggressive trade. `side`: 1 = buy, -1 = sell. */
|
|
631
|
+
pushTrade(tsMs: number, price: number, qty: number, side: 1 | -1): void;
|
|
632
|
+
/** Flat trades: `[tsMs, price, qty, side, …]`. */
|
|
633
|
+
pushTradesFlat(flat: NumArray): void;
|
|
634
|
+
/** Book snapshot; bids and asks as flat `[price, qty, …]`. */
|
|
635
|
+
pushBook(tsMs: number, bidsFlat: NumArray, asksFlat: NumArray, midPrice: number): void;
|
|
636
|
+
getLastMid(): number;
|
|
637
|
+
setLookback(lookbackMs: number, cellMs: number): void;
|
|
638
|
+
setTickSize(tick: number): void;
|
|
639
|
+
setPricePrecision(decimals: number): void;
|
|
640
|
+
setTzOffsetSeconds(seconds: number): void;
|
|
641
|
+
setFollowLive(on: boolean): void;
|
|
642
|
+
setAutoScaleY(on: boolean): void;
|
|
643
|
+
setShowBookHeatmap(on: boolean): void;
|
|
644
|
+
setHeatmapIntensity(lo: number, hi: number): void;
|
|
645
|
+
setHeatmapPalette(id: number): void;
|
|
646
|
+
setShowTradeTape(on: boolean): void;
|
|
647
|
+
setShowVolume(on: boolean): void;
|
|
648
|
+
setShowVwap(on: boolean): void;
|
|
649
|
+
setShowGrid(on: boolean): void;
|
|
650
|
+
setShowPriceLine(on: boolean): void;
|
|
651
|
+
setShowLatestProfile(on: boolean): void;
|
|
652
|
+
setLargeTradeScale(scale: number): void;
|
|
653
|
+
setLargeTrade3d(on: boolean): void;
|
|
654
|
+
setTheme(name: 'dark' | 'light'): void;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// ── Time & Sales tape (Enterprise) ──────────────────────────────────────────
|
|
196
658
|
|
|
197
|
-
/**
|
|
198
|
-
* Schema-driven print grid painted from native render commands. The engine
|
|
199
|
-
* owns the print ring, so the host pushes one flat batch per frame and holds
|
|
200
|
-
* no trade objects — a fast multi-venue tape costs no DOM layout.
|
|
201
|
-
*/
|
|
659
|
+
/** Create a Time & Sales tape (Enterprise). */
|
|
202
660
|
export declare function createTapeBridge(
|
|
203
661
|
canvas: HTMLCanvasElement,
|
|
204
662
|
options?: TapeBridgeOptions,
|
|
@@ -208,9 +666,6 @@ export declare function createTapeBridge(
|
|
|
208
666
|
export declare const TAPE_APPEND_STRIDE: 13;
|
|
209
667
|
|
|
210
668
|
export interface TapeBridgeOptions {
|
|
211
|
-
/** Ed25519-signed license token. Requires the Enterprise tier; without a
|
|
212
|
-
* covering license the tape renders an "Enterprise license required"
|
|
213
|
-
* notice and never paints prints. */
|
|
214
669
|
licenseKey?: string | null;
|
|
215
670
|
key?: string | null;
|
|
216
671
|
theme?: 'dark' | 'light';
|
|
@@ -222,7 +677,7 @@ export interface TapeBridgeOptions {
|
|
|
222
677
|
highlightBig?: boolean;
|
|
223
678
|
/** Placeholder shown while the tape is empty. */
|
|
224
679
|
emptyText?: string;
|
|
225
|
-
/** Badge shown while
|
|
680
|
+
/** Badge shown while scrolled away from the live print. */
|
|
226
681
|
pausedText?: string;
|
|
227
682
|
}
|
|
228
683
|
|
|
@@ -236,14 +691,12 @@ export type TapeCellKind =
|
|
|
236
691
|
export interface TapeColumn {
|
|
237
692
|
field: TapeField;
|
|
238
693
|
kind?: TapeCellKind;
|
|
239
|
-
/** Minimum
|
|
694
|
+
/** Minimum width in CSS px. */
|
|
240
695
|
minWidth?: number;
|
|
241
|
-
/** Share of the leftover width this column
|
|
696
|
+
/** Share of the leftover width this column takes. 0 = fixed. */
|
|
242
697
|
grow?: number;
|
|
243
698
|
align?: 'left' | 'center' | 'right';
|
|
244
|
-
/** Fixed decimal places, or a rule: compact (K/M/B), auto price, auto size. */
|
|
245
699
|
decimals?: number | 'compact' | 'autoPrice' | 'autoSize';
|
|
246
|
-
/** Header caption when no labels array is passed to setColumns. */
|
|
247
700
|
label?: string;
|
|
248
701
|
}
|
|
249
702
|
|
|
@@ -252,7 +705,6 @@ export interface TapePrint {
|
|
|
252
705
|
price: number;
|
|
253
706
|
size: number;
|
|
254
707
|
value: number;
|
|
255
|
-
/** Venue slot registered with setVenue. */
|
|
256
708
|
venue?: number;
|
|
257
709
|
/** Taker side — true = buy. */
|
|
258
710
|
buy?: boolean;
|
|
@@ -263,7 +715,6 @@ export interface TapePrint {
|
|
|
263
715
|
ask?: number;
|
|
264
716
|
bidSize?: number;
|
|
265
717
|
askSize?: number;
|
|
266
|
-
/** Prints aggregated into this row. Default 1. */
|
|
267
718
|
count?: number;
|
|
268
719
|
}
|
|
269
720
|
|
|
@@ -273,29 +724,20 @@ export interface TapePalette {
|
|
|
273
724
|
}
|
|
274
725
|
|
|
275
726
|
export interface TapeEngine {
|
|
276
|
-
engine
|
|
277
|
-
/** true when the license doesn't cover this engine. */
|
|
727
|
+
/** true when the license does not cover this engine. */
|
|
278
728
|
readonly blocked: boolean;
|
|
279
729
|
start(): void;
|
|
280
730
|
stop(): void;
|
|
281
731
|
resize(): void;
|
|
282
732
|
destroy(): void;
|
|
283
|
-
|
|
284
|
-
// Schema — declared by the host, so a new venue or column needs no engine change.
|
|
285
733
|
setColumns(cols: TapeColumn[], labels?: string[]): void;
|
|
286
734
|
setVenue(slot: number, label: string, logo?: CanvasImageSource | null): void;
|
|
287
|
-
|
|
288
|
-
// Data
|
|
289
735
|
/** Flat batch, oldest first, TAPE_APPEND_STRIDE floats per print. Returns the first sequence number. */
|
|
290
736
|
append(rows: Float64Array): number;
|
|
291
|
-
/** Object convenience over append. Copies into a reused scratch buffer. */
|
|
292
737
|
appendTrades(trades: TapePrint[]): number;
|
|
293
|
-
/** Tag a print once a detector resolves a verdict for it. */
|
|
294
738
|
setSignal(seq: number, sig: 'absorption' | 'exhaustion' | 'sweep' | 'none'): void;
|
|
295
739
|
reset(): void;
|
|
296
740
|
setCapacity(cap: number): void;
|
|
297
|
-
|
|
298
|
-
// View
|
|
299
741
|
setFilter(f: { minValue?: number; side?: 'buy' | 'sell' | null; venues?: number[] | null }): void;
|
|
300
742
|
scrollBy(dx: number, dy: number): void;
|
|
301
743
|
scrollToLive(): void;
|
|
@@ -303,12 +745,8 @@ export interface TapeEngine {
|
|
|
303
745
|
rowCount(): number;
|
|
304
746
|
contentWidth(): number;
|
|
305
747
|
rowHeight(): number;
|
|
306
|
-
|
|
307
|
-
// Stats over the rate window, so the host keeps no ring of its own.
|
|
308
748
|
setRateWindowMs(ms: number): void;
|
|
309
749
|
getRates(nowMs?: number): { tps: number; vps: number; dps: number };
|
|
310
|
-
|
|
311
|
-
// Appearance
|
|
312
750
|
setTheme(name: 'dark' | 'light'): void;
|
|
313
751
|
setPalette(p: TapePalette): void;
|
|
314
752
|
setTextScale(s: number): void;
|
|
@@ -318,8 +756,6 @@ export interface TapeEngine {
|
|
|
318
756
|
setBigTiers(tiers: ArrayLike<number>): void;
|
|
319
757
|
setLabels(l: { empty?: string; paused?: string }): void;
|
|
320
758
|
setTzOffsetMin(m: number): void;
|
|
321
|
-
|
|
322
|
-
// Events — seq is 0 when no row is under the cursor.
|
|
323
759
|
onHover(cb: (seq: number, event?: PointerEvent) => void): void;
|
|
324
760
|
onClick(cb: (seq: number, event?: PointerEvent) => void): void;
|
|
325
761
|
onLiveChange(cb: (isLive: boolean) => void): void;
|