wickchart 1.5.0 → 1.7.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/types/feeds.d.ts CHANGED
@@ -40,6 +40,131 @@ export declare function genSynthetic(key: string, sec: number, n: number, base?:
40
40
  * @param {number} [startPrice] bridge continuity from the last known price
41
41
  */
42
42
  export declare function makeSynthStream(sec: number, startPrice?: number): () => any;
43
+ /** Default thresholds per kind. They are per-instrument — there is no
44
+ * universal "one bar" size, treat these as starting points to tune. */
45
+ export declare const AGG_DEFAULTS: {
46
+ tick: number;
47
+ volume: number;
48
+ dollar: number;
49
+ };
50
+ /**
51
+ * Parse an `aggregate` spec — `tick`, `volume:50`, `dollar:25000` (case and
52
+ * whitespace tolerant; the value is the bar size in trades / base units /
53
+ * quote units respectively).
54
+ * @param {string} spec attribute value
55
+ * @returns {{kind: 'tick'|'volume'|'dollar', threshold: number}|null} null when invalid
56
+ */
57
+ export declare function parseAggregate(spec: string): {
58
+ kind: 'tick' | 'volume' | 'dollar';
59
+ threshold: number;
60
+ } | null;
61
+ /**
62
+ * Streaming aggregator: feed it trades, get bars back. `add()` returns a
63
+ * bar the moment the threshold is crossed ({@link current} keeps exposing
64
+ * the forming bar meanwhile). The completing trade belongs entirely to the
65
+ * closing bar — a whale print is never split across two bars.
66
+ */
67
+ export declare class TickBarAggregator {
68
+ kind: string;
69
+ threshold: any;
70
+ _bar: {
71
+ time: number;
72
+ open: number;
73
+ high: number;
74
+ low: number;
75
+ close: number;
76
+ volume: number;
77
+ n: number;
78
+ notional: number;
79
+ };
80
+ /**
81
+ * @param {'tick'|'volume'|'dollar'} kind what the threshold counts
82
+ * @param {number} threshold bar size (trades / base units / quote units)
83
+ */
84
+ constructor(kind?: 'tick' | 'volume' | 'dollar', threshold?: number);
85
+ /**
86
+ * Feed one trade `{ time, price, size }` (seconds auto-upgraded to ms,
87
+ * same heuristic as the chart). Returns the completed bar —
88
+ * `{ time, open, high, low, close, volume, closed: true }` — when the
89
+ * threshold is reached, else null.
90
+ * @returns {object|null}
91
+ */
92
+ add(trade: any): object | null;
93
+ /** The forming bar as plain chart-bar fields (no internals), or null. */
94
+ current(): {
95
+ time: number;
96
+ open: number;
97
+ high: number;
98
+ low: number;
99
+ close: number;
100
+ volume: number;
101
+ };
102
+ /** Close the forming bar as-is (end of tape / teardown), or null. */
103
+ flush(): {
104
+ time: number;
105
+ open: number;
106
+ high: number;
107
+ low: number;
108
+ close: number;
109
+ volume: number;
110
+ closed: boolean;
111
+ };
112
+ }
113
+ /**
114
+ * One-pass batch aggregation of a trade history. Returns the closed bars,
115
+ * the still-forming remainder, and the live aggregator positioned at the end
116
+ * of the tape so streaming can continue without a seam.
117
+ * @param {Array<object>} trades `{ time, price, size }` prints
118
+ * @param {'tick'|'volume'|'dollar'} kind
119
+ * @param {number} threshold
120
+ */
121
+ export declare function aggregateTrades(trades: Array<object>, kind: 'tick' | 'volume' | 'dollar', threshold: number): {
122
+ bars: any[];
123
+ pending: {
124
+ time: number;
125
+ open: number;
126
+ high: number;
127
+ low: number;
128
+ close: number;
129
+ volume: number;
130
+ };
131
+ aggregator: TickBarAggregator;
132
+ };
133
+ /**
134
+ * Coerce a generic JSON trades array into plain `{ time, price, size }`
135
+ * (ms, seconds auto-upgraded; `size` also read from `qty`/`amount`).
136
+ * Invalid entries are dropped, never thrown — same contract as the chart's
137
+ * other normalizers. Output is sorted by time.
138
+ */
139
+ export declare function normalizeTrades(list: any): any[];
140
+ /**
141
+ * Deterministic synthetic trade prints (random-walk price with volatility
142
+ * regimes, heavy-tailed sizes). Same key → same tape.
143
+ * @param {string} key seed key
144
+ * @param {number} [n=24000] print count
145
+ * @param {number} [base=100] starting price
146
+ */
147
+ export declare function genSyntheticTrades(key: string, n?: number, base?: number): any[];
148
+ /**
149
+ * Stateful synthetic live tape: one print per call, bridging from
150
+ * `startPrice` (e.g. the last price of a seeded history).
151
+ * @param {number} [startPrice=100]
152
+ */
153
+ export declare function makeSynthTradeStream(startPrice?: number): () => {
154
+ time: number;
155
+ price: number;
156
+ size: number;
157
+ };
158
+ /**
159
+ * Expected synthetic prints per bar — used to size the offline seed so a
160
+ * demo chart starts with roughly the requested bar count.
161
+ * @param {{kind: string, threshold: number}} agg
162
+ * @param {number} [base=100]
163
+ */
164
+ export declare function synthTradesPerBar(agg: {
165
+ kind: string;
166
+ threshold: number;
167
+ }, base?: number): number;
43
168
  /**
44
169
  * Fetch klines from Binance's public REST API.
45
170
  * @param {string} symbol e.g. 'BTCUSDT'
@@ -56,3 +181,43 @@ export declare function fetchBinanceKlines(symbol: string, tfId: string, limit?:
56
181
  export declare function openBinanceSocket(symbol: any, tfId: any, onBar: any, onDown: any, timeoutMs?: number): {
57
182
  close(): void;
58
183
  };
184
+ /**
185
+ * Fetch Binance aggTrades, paging backwards from the newest prints (or from
186
+ * below `beforeId`) until `minTrades` prints / `maxPages` requests / the
187
+ * start of the symbol's history. Returns `{ trades, oldestId }` ascending by
188
+ * time; each print carries its Binance id so live streams can resume without
189
+ * overlaps.
190
+ * @param {string} symbol e.g. 'BTCUSDT'
191
+ * @param {number} [minTrades=1000] stop once at least this many prints are held
192
+ * @param {number} [maxPages=25] hard request cap (1000 prints per page)
193
+ * @param {number} [beforeId] only fetch prints with an id lower than this
194
+ */
195
+ export declare function fetchBinanceAggTrades(symbol: string, minTrades?: number, maxPages?: number, beforeId?: number): Promise<{
196
+ trades: any[];
197
+ oldestId: number;
198
+ }>;
199
+ /**
200
+ * One forward window of aggTrades starting at `fromId` — the catch-up call
201
+ * for REST polling after a trade socket drops. Returns `{ trades, latestId }`.
202
+ * @param {string} symbol
203
+ * @param {number} fromId first print id to fetch (use lastSeenId + 1)
204
+ */
205
+ export declare function fetchBinanceAggTradesSince(symbol: string, fromId: number): Promise<{
206
+ trades: {
207
+ id: any;
208
+ time: any;
209
+ price: number;
210
+ size: number;
211
+ }[];
212
+ latestId: any;
213
+ }>;
214
+ /**
215
+ * Open a Binance aggTrade WebSocket — raw prints for information-based bar
216
+ * aggregation. Same lifecycle contract as openBinanceSocket: `onDown(err)`
217
+ * fires on error/close/timeout, after which the socket is dead and the
218
+ * caller should fall back.
219
+ * @returns {{close(): void}}
220
+ */
221
+ export declare function openBinanceTradeSocket(symbol: any, onTrade: any, onDown: any, timeoutMs?: number): {
222
+ close(): void;
223
+ };
@@ -0,0 +1,114 @@
1
+ /** Decimals worth showing for a price of this magnitude. */
2
+ export declare function decimalsFor(price: any): 2 | 3 | 6;
3
+ /** 1234 → '1.2k', 1234567 → '1.23M', 12 → '12'. */
4
+ export declare function compact(v: any): string;
5
+ export declare function pct(v: any, digits?: number): string;
6
+ /** Greatest index whose time is <= t (binary search; bars are ascending). */
7
+ export declare function indexForTime(bars: any, t: any): number;
8
+ /** Resolve the report colors: theme palettes, overridden by the chart's own
9
+ * --wick-* variables when readable (browser) and theme is 'auto'. */
10
+ export declare function reportColors(chart: any, theme?: string): {
11
+ bg: string;
12
+ panel: string;
13
+ text: string;
14
+ muted: string;
15
+ up: string;
16
+ down: string;
17
+ accent: string;
18
+ } | {
19
+ bg: string;
20
+ panel: string;
21
+ text: string;
22
+ muted: string;
23
+ up: string;
24
+ down: string;
25
+ accent: string;
26
+ };
27
+ /** Relative luminance of a #hex / rgb() string (0..1, best effort). */
28
+ export declare function luminance(color: any): number;
29
+ /**
30
+ * Build the whole report as data: sizes, bands, stat rows, colors, labels.
31
+ * @param {object} chart a <wick-chart> (public API only: data,
32
+ * getVisibleRange, exportPNG, clientWidth/Height, getAttribute)
33
+ * @param {{title?: string, source?: string, brand?: string, theme?: string,
34
+ * scale?: number, precision?: number}} [opts]
35
+ */
36
+ export declare function reportModel(chart: object, opts?: {
37
+ title?: string;
38
+ source?: string;
39
+ brand?: string;
40
+ theme?: string;
41
+ scale?: number;
42
+ precision?: number;
43
+ }): {
44
+ scale: number;
45
+ width: number;
46
+ height: number;
47
+ bands: {
48
+ header: number;
49
+ stats: number;
50
+ footer: number;
51
+ chart: number;
52
+ };
53
+ grid: {
54
+ cols: number;
55
+ };
56
+ title: any;
57
+ brand: string;
58
+ source: string;
59
+ range: {
60
+ from: any;
61
+ to: any;
62
+ };
63
+ last: any;
64
+ precision: number;
65
+ rows: ({
66
+ label: string;
67
+ value: string;
68
+ color: string;
69
+ } | {
70
+ color?: undefined;
71
+ label: string;
72
+ value: string;
73
+ })[];
74
+ generatedAt: number;
75
+ colors: {
76
+ bg: string;
77
+ panel: string;
78
+ text: string;
79
+ muted: string;
80
+ up: string;
81
+ down: string;
82
+ accent: string;
83
+ } | {
84
+ bg: string;
85
+ panel: string;
86
+ text: string;
87
+ muted: string;
88
+ up: string;
89
+ down: string;
90
+ accent: string;
91
+ };
92
+ stats: {
93
+ n: number;
94
+ changePct: number;
95
+ min: number;
96
+ max: number;
97
+ maxDDPct: number;
98
+ annVolPct: number;
99
+ up: number;
100
+ dn: number;
101
+ avgVolume: number;
102
+ };
103
+ };
104
+ /**
105
+ * Compose the branded report and return it as a PNG data URL (default), a
106
+ * Blob, or the canvas itself.
107
+ * @returns {Promise<string|Blob|HTMLCanvasElement>}
108
+ */
109
+ export declare function exportReport(chart: any, opts?: {}): Promise<string | Blob | HTMLCanvasElement>;
110
+ /**
111
+ * Compose and trigger a download (browser only).
112
+ * @returns {Promise<void>}
113
+ */
114
+ export declare function downloadReport(chart: any, filename?: string, opts?: {}): Promise<void>;
@@ -21,7 +21,7 @@ declare class WickChart extends HTMLElementBase {
21
21
  _hover: {
22
22
  index: any;
23
23
  x: number;
24
- y: number;
24
+ y: any;
25
25
  } | {
26
26
  index: number;
27
27
  x: number;
@@ -46,6 +46,10 @@ declare class WickChart extends HTMLElementBase {
46
46
  y1: number;
47
47
  h: number;
48
48
  }[];
49
+ dock: {
50
+ y0: number;
51
+ h: number;
52
+ };
49
53
  };
50
54
  _cache: {
51
55
  v: number;
@@ -160,6 +164,19 @@ declare class WickChart extends HTMLElementBase {
160
164
  panes: any[];
161
165
  volume: boolean;
162
166
  };
167
+ _workerOn: boolean;
168
+ _epoch: number;
169
+ _workerCache: {
170
+ epoch: number;
171
+ map: {};
172
+ pending: {};
173
+ sent: number;
174
+ };
175
+ _sid: number;
176
+ _onlineSeries: {
177
+ epoch: number;
178
+ map: {};
179
+ };
163
180
  _pointers: Map<any, any>;
164
181
  _pan: {
165
182
  x: number;
@@ -172,6 +189,13 @@ declare class WickChart extends HTMLElementBase {
172
189
  idxAtMid: number;
173
190
  midX: number;
174
191
  };
192
+ _scrub: boolean;
193
+ _pressTimer: number;
194
+ _pressOrigin: {
195
+ pointerId: any;
196
+ x: any;
197
+ y: any;
198
+ };
175
199
  _layers: any[];
176
200
  _layerClaim: {
177
201
  layer: any;
@@ -183,6 +207,10 @@ declare class WickChart extends HTMLElementBase {
183
207
  _positions: any[];
184
208
  _alerts: any[];
185
209
  _seq: number;
210
+ _alertEval: string;
211
+ _lastClosedIdx: number;
212
+ _tz: string;
213
+ _vwapAnchor: string;
186
214
  _overlays: any[];
187
215
  _scenario: {
188
216
  path: {
@@ -215,8 +243,11 @@ declare class WickChart extends HTMLElementBase {
215
243
  _onWheel: (e: any) => void;
216
244
  _onDbl: () => void;
217
245
  _onKey: (e: any) => void;
246
+ _onTouchMove: (e: any) => void;
247
+ _onDprChange: () => void;
218
248
  tabIndex: number;
219
249
  _ro: any;
250
+ _dprMq: MediaQueryList;
220
251
  _posVersion: any;
221
252
  _pendingRange: {
222
253
  from: number;
@@ -233,9 +264,18 @@ declare class WickChart extends HTMLElementBase {
233
264
  rawHi: number;
234
265
  };
235
266
  static get observedAttributes(): string[];
267
+ /**
268
+ * Shared ChartWorkerPool for the worker compute path (set by importing
269
+ * 'wickchart/worker'; null — everything sync — until then).
270
+ * @type {object|null}
271
+ */
272
+ static _workerPool: object | null;
236
273
  constructor();
237
274
  connectedCallback(): void;
238
275
  disconnectedCallback(): void;
276
+ /** (Re)arm the devicePixelRatio watcher for the current ratio. */
277
+ _watchDpr(): void;
278
+ _unwatchDpr(): void;
239
279
  attributeChangedCallback(name: any, _old: any, val: any): void;
240
280
  /** Indicator registry (module scope — shared with the legacy alias tag). */
241
281
  static _registry(): Map<string, {
@@ -278,7 +318,7 @@ declare class WickChart extends HTMLElementBase {
278
318
  smooth?: undefined;
279
319
  period?: undefined;
280
320
  };
281
- compute: (bars: any) => number[];
321
+ compute: (bars: any, p: any) => number[];
282
322
  color?: undefined;
283
323
  guides?: undefined;
284
324
  range?: undefined;
@@ -493,7 +533,8 @@ declare class WickChart extends HTMLElementBase {
493
533
  */
494
534
  /** @param {import('./core.js').IndicatorDef} def */
495
535
  static registerIndicator(name: any, def: import('./core.js').IndicatorDef): void;
496
- /** The custom element class (also exported implicitly for users). */
536
+ /** The tag this class registers as. (<hab-chart> is a deprecated alias
537
+ * registered from the HabChart subclass, not this name.) */
497
538
  static get elementName(): string;
498
539
  get data(): any[];
499
540
  /**
@@ -708,6 +749,24 @@ declare class WickChart extends HTMLElementBase {
708
749
  /** Check alerts against an incoming bar (prev close → new close).
709
750
  * Scripted (`when`) alerts evaluate their predicate series, cached per
710
751
  * data version, and fire on the false→true edge. */
752
+ /**
753
+ * Index of the newest bar known to be final: any bar with a newer bar
754
+ * behind it, plus the front bar when the feed flagged it `closed: true`
755
+ * (Binance's `k.x`). -1 when nothing has closed yet.
756
+ */
757
+ _lastClosedIndex(): number;
758
+ /** Re-baseline the closed-bar cursor without firing anything. */
759
+ _syncClosedIdx(): void;
760
+ /**
761
+ * Resolve an alert's evaluation mode: an explicit 'close' / 'live' on the
762
+ * alert wins, otherwise the chart-level `alert-evaluate` default (itself
763
+ * 'live', so 1.x behaviour is unchanged unless asked for).
764
+ * @param {string|undefined} v
765
+ * @returns {'live'|'close'}
766
+ */
767
+ _evalMode(v: string | undefined): 'live' | 'close';
768
+ /** Dispatch one alert, retiring it when it was a `once` alert. */
769
+ _fireAlert(alert: any, detail: any): void;
711
770
  _checkAlerts(prevClose: any, bar: any): void;
712
771
  /** Cached boolean series for a scripted alert's predicate (per data version). */
713
772
  _predicateCache(alert: any): any;
@@ -720,14 +779,18 @@ declare class WickChart extends HTMLElementBase {
720
779
  get indicators(): any;
721
780
  set indicators(v: any);
722
781
  static _MAX_SP: number;
782
+ /** Hold this long on a touchscreen to open the crosshair (ms). */
783
+ static _PRESS_MS: number;
784
+ /** Finger travel that cancels the press and makes it a pan (px). */
785
+ static _PRESS_SLOP: number;
723
786
  /**
724
787
  * Lowest allowed px/bar: either 0.35, or whatever fits the entire
725
788
  * dataset on screen — so any history can be zoomed out fully.
726
789
  */
727
790
  _minSpacing(): number;
728
- static _timeToMs(t: any): any;
791
+ static _timeToMs(t: any): number;
729
792
  static _normBar(b: any): {
730
- time: any;
793
+ time: number;
731
794
  open: any;
732
795
  high: any;
733
796
  low: any;
@@ -755,6 +818,33 @@ declare class WickChart extends HTMLElementBase {
755
818
  _volShadeCache(): any;
756
819
  /** Compute (and cache per data version) an indicator entry's series. */
757
820
  _indicatorSeries(entry: any): any;
821
+ /**
822
+ * After a live stream tick (append or forming-bar replace), patch every
823
+ * online-capable series by recomputing a bounded tail with the same
824
+ * batch definition — O(warm-up) instead of a full-history recompute per
825
+ * indicator per tick. Bases are seeded by the sync or worker path; bulk
826
+ * loads (epoch changes) reseed automatically.
827
+ */
828
+ _onlineTick(): void;
829
+ /** Recompute the last K bars of one series in place (K = max(400,
830
+ * 10×period), clamped to the data). False when the series and data
831
+ * lengths can't line up — the caller drops the base and reseeds. */
832
+ _patchSeriesTail(res: any, entry: any, d: any): boolean;
833
+ /** Remember a fresh series as the base for incremental tick updates
834
+ * (online-capable builtins only). */
835
+ _seedOnline(k: any, entry: any, res: any): void;
836
+ /** Bar count from which the worker path engages (below it, sync wins). */
837
+ _workerCols(): {
838
+ time: Float64Array<ArrayBuffer>;
839
+ open: Float64Array<ArrayBuffer>;
840
+ high: Float64Array<ArrayBuffer>;
841
+ low: Float64Array<ArrayBuffer>;
842
+ close: Float64Array<ArrayBuffer>;
843
+ volume: Float64Array<ArrayBuffer>;
844
+ };
845
+ /** Kick an off-thread compute for one indicator (idempotent per epoch). */
846
+ _workerCompute(pool: any, entry: any, k: any): void;
847
+ _workerArrived(k: any, epoch: any, res: any, entry: any): void;
758
848
  /** Resolve a line color: #hex / rgb() / CSS name / palette key ('rsi', 'up', …) / cycle.
759
849
  * Untrusted values (URL/attribute-sourced) are validated — never interpolated raw. */
760
850
  _lineColor(entry: any, line: any, pal: any, cycleIdx: any): any;
@@ -778,6 +868,8 @@ declare class WickChart extends HTMLElementBase {
778
868
  * the walk to those bars — used at deep zoom where bars are aggregated
779
869
  * into pixel columns (keeps this O(screen) instead of O(visible bars)).
780
870
  */
871
+ /** An instant shifted into the chart's display zone, for the formatters. */
872
+ _zt(t: any): any;
781
873
  _timeTicks(i0: any, i1: any, sampleIdx: any): any[];
782
874
  _render(): void;
783
875
  _pill(x: any, y: any, text: any, bg: any, fg: any, align: string, widthOverride: any): void;
@@ -791,7 +883,13 @@ declare class WickChart extends HTMLElementBase {
791
883
  * layer then receives that pointer's move/up/cancel events (plus a
792
884
  * 'cancel' on Escape) and the chart suppresses its own pan/measure/brush
793
885
  * for the duration.
794
- * @param {{id?: string, draw: Function, onPointer?: Function}} layer
886
+ *
887
+ * A layer may also declare `insetBottom` (px, 0..160): the largest
888
+ * declared inset reserves a docked strip at the very bottom of the
889
+ * canvas — all chart content (panes + time axis) shrinks above it and
890
+ * the strip is handed to layers as `api.layout.dock = { y0, h }`
891
+ * (used by the wickchart-navigator plugin).
892
+ * @param {{id?: string, draw: Function, onPointer?: Function, insetBottom?: number}} layer
795
893
  * @returns {object|null} the normalized layer handle (with `id`), or null
796
894
  * if the layer was rejected (no draw fn, or 16 layers already added)
797
895
  */
@@ -799,6 +897,7 @@ declare class WickChart extends HTMLElementBase {
799
897
  id?: string;
800
898
  draw: Function;
801
899
  onPointer?: Function;
900
+ insetBottom?: number;
802
901
  }): object | null;
803
902
  /**
804
903
  * Remove a layer added via addLayer (pass the returned handle or its id).
@@ -810,6 +909,11 @@ declare class WickChart extends HTMLElementBase {
810
909
  requestDraw(): void;
811
910
  /** Paint every registered layer. Called from _render with live state. */
812
911
  _drawLayers(ctx: any, pal: any, ly: any, d: any): void;
912
+ /**
913
+ * Bottom space reserved by plugin layers: the largest declared
914
+ * `insetBottom` (px, clamped 0..160 at addLayer time), or 0.
915
+ */
916
+ _dockInset(): number;
813
917
  /** Ask layers, in order, whether one claims this pointerdown. */
814
918
  _layerHit(e: any, pt: any): any;
815
919
  /** Deliver a pointer event to a claiming layer; never throws outward. */
@@ -857,6 +961,21 @@ declare class WickChart extends HTMLElementBase {
857
961
  x: number;
858
962
  y: number;
859
963
  };
964
+ /**
965
+ * Put the crosshair on the bar under a point and announce it. Shared by
966
+ * mouse hover, keyboard walking and the touch scrub gesture.
967
+ */
968
+ _hoverAt(pt: any): void;
969
+ /**
970
+ * Start the long-press timer for a touch. A touchscreen has no hover, so
971
+ * without this there is no way to read a bar's values on a phone: a tap
972
+ * selects, a drag pans, and the legend never leaves the last candle.
973
+ * Holding still opens the crosshair; moving first cancels and pans.
974
+ */
975
+ _armPress(pointerId: any, pt: any): void;
976
+ _disarmPress(): void;
977
+ /** Leave scrub mode and put the crosshair away. */
978
+ _endScrub(): void;
860
979
  _pointerDown(e: any): void;
861
980
  _pointerMove(e: any): void;
862
981
  _pointerUp(e: any): void;
@@ -25,7 +25,26 @@ declare class WickFeed extends HTMLElementBase {
25
25
  _binance(gen: any, chart: any, sym: any, tfId: any, limit: any, live: any): Promise<void>;
26
26
  _pollBinance(gen: any, chart: any, sym: any, tfId: any): void;
27
27
  _degrade(gen: any, chart: any, sym: any, tfId: any, limit: any, live: any, err: any): void;
28
+ /**
29
+ * Wrap chart.update for aggregated bars: the chart keys bars by timestamp,
30
+ * and two groups can close inside the same millisecond, so emitted times
31
+ * are nudged +1ms to stay strictly increasing (keeps the one-bar-per-
32
+ * timestamp integrity invariant; display-only, values are untouched).
33
+ */
34
+ _aggEmit(gen: any, chart: any): (bar: any) => void;
35
+ /** Seed + stream one aggregator onto the chart (shared by all sources). */
36
+ _aggAttach(gen: any, chart: any, res: any, bars: any, limit: any, status: any): {
37
+ emit: (bar: any) => void;
38
+ aggregator: any;
39
+ /** Push one print through; emits the closed bar, then the forming one. */
40
+ push(t: any): void;
41
+ };
42
+ _syntheticTrades(gen: any, chart: any, key: any, agg: any, limit: any, live: any, status?: string): void;
43
+ _binanceTrades(gen: any, chart: any, sym: any, agg: any, limit: any, live: any): Promise<void>;
44
+ _pollBinanceTrades(gen: any, chart: any, sym: any, handle: any, fromId: any, agg: any, limit: any, live: any): void;
45
+ _restTrades(gen: any, chart: any, url: any, agg: any, limit: any, live: any): Promise<void>;
28
46
  _rest(gen: any, chart: any, url: any, limit: any, live: any): Promise<void>;
29
47
  }
30
48
  export default WickFeed;
31
49
  export { WickFeed };
50
+ export { parseAggregate, TickBarAggregator, aggregateTrades, normalizeTrades, genSyntheticTrades, makeSynthTradeStream, } from './feeds.js';
@@ -0,0 +1,11 @@
1
+ /** Rebuild the bar-object tape from a columnar snapshot (worker-side only —
2
+ * this cost never touches the main thread). */
3
+ export declare function barsFromCols(cols: any): any[];
4
+ /**
5
+ * Create a worker-core state + dispatcher.
6
+ * @returns {{sessions: Map, handle(message: object): object}} the reply object
7
+ */
8
+ export declare function createWorkerCore(): {
9
+ sessions: Map<any, any>;
10
+ handle(message: object): object;
11
+ };
@@ -0,0 +1,36 @@
1
+ import { WickChart } from './wick-chart.js';
2
+ export { WickChart };
3
+ /**
4
+ * A single-Worker task runner. The factory is injectable so tests can drive
5
+ * the protocol with a fake Worker; the default spawns the module worker
6
+ * sitting next to this file.
7
+ */
8
+ export declare class ChartWorkerPool {
9
+ _factory: () => Worker;
10
+ available: boolean;
11
+ _worker: Worker;
12
+ _seq: number;
13
+ _pending: Map<any, any>;
14
+ /** @param {() => Worker} [factory] */
15
+ constructor(factory?: () => Worker);
16
+ /**
17
+ * Post a task; resolves with the reply's `res`, rejects on failure or
18
+ * worker death (a `stale` rejection means: resend the epoch data first).
19
+ * @param {object} msg task message without the id
20
+ * @returns {Promise<any>}
21
+ */
22
+ run(msg: object): Promise<any>;
23
+ _spawn(): void;
24
+ /** Reject everything in flight and drop the worker; the next run() respawns
25
+ * — a transient worker crash must not permanently kill the mode. */
26
+ _die(): void;
27
+ /** Shut the pool down for good (in-flight tasks reject). */
28
+ terminate(): void;
29
+ }
30
+ /** The page-wide pool (created on first use). */
31
+ export declare function getSharedPool(): any;
32
+ /**
33
+ * Point the chart class at a pool (or null to disable the worker path).
34
+ * @param {ChartWorkerPool|null} pool
35
+ */
36
+ export declare function setChartWorkerPool(pool: ChartWorkerPool | null): ChartWorkerPool;