openalgo-charts 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -210,11 +210,11 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
|
|
|
210
210
|
|---|---|---|
|
|
211
211
|
| Base engine | 60 KB | 59.06 KB |
|
|
212
212
|
| Base + trade | 68 KB | 66.67 KB |
|
|
213
|
-
| Indicators tier | 30 KB | 27.
|
|
213
|
+
| Indicators tier | 30 KB | 27.27 KB |
|
|
214
214
|
| Draw tier | 14 KB | 13.13 KB |
|
|
215
215
|
| Transform tier | 5 KB | 2.66 KB |
|
|
216
216
|
| Profile tier | 11 KB | 10.66 KB |
|
|
217
|
-
| **Everything** | **124 KB** | **120.
|
|
217
|
+
| **Everything** | **124 KB** | **120.38 KB** |
|
|
218
218
|
|
|
219
219
|
## Documentation
|
|
220
220
|
|
|
@@ -271,7 +271,7 @@ npm run verify # typecheck + test + build + size
|
|
|
271
271
|
|
|
272
272
|
## Status & limitations
|
|
273
273
|
|
|
274
|
-
Version **1.8.
|
|
274
|
+
Version **1.8.4**. All engine build phases are implemented with 2411 unit tests across 130 files.
|
|
275
275
|
|
|
276
276
|
Known gaps, stated plainly:
|
|
277
277
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Library version string. Matches package.json (published npm release). */
|
|
2
|
-
declare const VERSION = "1.8.
|
|
2
|
+
declare const VERSION = "1.8.4";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -2296,6 +2296,13 @@ interface IndicatorHost {
|
|
|
2296
2296
|
*/
|
|
2297
2297
|
addIndicatorPrimitive?(primitive: IPrimitive, paneIndex: number): void;
|
|
2298
2298
|
removeIndicatorPrimitive?(primitive: IPrimitive): void;
|
|
2299
|
+
/**
|
|
2300
|
+
* Recompute whatever the host has marked stale, before a caller reads a value.
|
|
2301
|
+
*
|
|
2302
|
+
* Optional, like `timezone`, so a host predating it still satisfies this
|
|
2303
|
+
* interface: one that recomputes eagerly has nothing to flush.
|
|
2304
|
+
*/
|
|
2305
|
+
flushIndicators?(): void;
|
|
2299
2306
|
/** Bars of the primary price series — the calculation input. */
|
|
2300
2307
|
sourceBars(): readonly Bar[];
|
|
2301
2308
|
/** Index of a fresh pane for an indicator that wants its own. */
|
|
@@ -3349,6 +3356,7 @@ declare class Chart {
|
|
|
3349
3356
|
private readonly _indicators;
|
|
3350
3357
|
/** Guards indicator recompute against re-entry via its own `series.setData`. */
|
|
3351
3358
|
private _recomputing;
|
|
3359
|
+
private _indicatorsDirty;
|
|
3352
3360
|
/** Instance id of the indicator whose colours are on the price bars, if any. */
|
|
3353
3361
|
private _barColorOwner;
|
|
3354
3362
|
private _barColors;
|
|
@@ -3524,7 +3532,13 @@ declare class Chart {
|
|
|
3524
3532
|
* descriptor chose.
|
|
3525
3533
|
*/
|
|
3526
3534
|
private _distinctColors;
|
|
3527
|
-
/**
|
|
3535
|
+
/**
|
|
3536
|
+
* Every live indicator instance, in the order they were added.
|
|
3537
|
+
*
|
|
3538
|
+
* Flushes any pending recompute first. Indicator maths is deferred to the
|
|
3539
|
+
* frame, so a caller that updates a bar and reads a value back in the same
|
|
3540
|
+
* turn would otherwise see the previous tick's numbers.
|
|
3541
|
+
*/
|
|
3528
3542
|
indicators(): readonly IndicatorApi[];
|
|
3529
3543
|
/** Remove one indicator instance by its handle id. Returns true if it existed. */
|
|
3530
3544
|
removeIndicator(instanceId: string): boolean;
|
|
@@ -3535,7 +3549,7 @@ declare class Chart {
|
|
|
3535
3549
|
*
|
|
3536
3550
|
* Only one overlay can be on the candles, so this is last writer wins. That is
|
|
3537
3551
|
* deterministic rather than arbitrary: publishers run inside
|
|
3538
|
-
* `
|
|
3552
|
+
* `_flushIndicators`, in `addIndicator` order, so the same instance wins
|
|
3539
3553
|
* every frame. Withdrawal is gated on ownership, or the first publisher's
|
|
3540
3554
|
* teardown would wipe the second one's colours. If the *winner* is removed
|
|
3541
3555
|
* while another publisher is still live, the bars go back to their own colours
|
|
@@ -3554,11 +3568,27 @@ declare class Chart {
|
|
|
3554
3568
|
*/
|
|
3555
3569
|
private _applyBarColors;
|
|
3556
3570
|
/**
|
|
3557
|
-
*
|
|
3558
|
-
*
|
|
3559
|
-
*
|
|
3571
|
+
* Mark every indicator stale after a source-data change, to be recomputed
|
|
3572
|
+
* once before the next paint.
|
|
3573
|
+
*
|
|
3574
|
+
* Recomputing straight from the data update instead costs a full pass over
|
|
3575
|
+
* every bar, for every indicator, for every tick. A busy symbol delivers ticks
|
|
3576
|
+
* in bursts far faster than the display refreshes, so most of those passes are
|
|
3577
|
+
* thrown away unseen: 50 ticks between two frames cost 50 recomputes per
|
|
3578
|
+
* indicator and blocked the main thread for over half a second on a ten
|
|
3579
|
+
* indicator chart. Deferring to the frame makes that one recompute, because
|
|
3580
|
+
* only the last one could ever have been shown.
|
|
3581
|
+
*
|
|
3582
|
+
* `flushIndicators` therefore has to run before anything that can observe a
|
|
3583
|
+
* value, which is the frame and the public `indicators()` accessor.
|
|
3584
|
+
*/
|
|
3585
|
+
private _invalidateIndicators;
|
|
3586
|
+
/**
|
|
3587
|
+
* Recompute every stale indicator. Reentrant-guarded: an indicator writes its
|
|
3588
|
+
* plots with `series.setData`, which re-enters the same data-mutation path
|
|
3589
|
+
* that marked us dirty.
|
|
3560
3590
|
*/
|
|
3561
|
-
private
|
|
3591
|
+
private _flushIndicators;
|
|
3562
3592
|
/** Subscribe to clicks on hit-testable primitives (markers, events, lines). */
|
|
3563
3593
|
subscribeClick(cb: (externalId: string) => void): void;
|
|
3564
3594
|
/**
|