openalgo-charts 2.1.5 → 2.1.6
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 +23 -22
- package/dist/draw/index.d.ts +2 -0
- package/dist/index.d.ts +208 -22
- package/dist/indicators/index.d.ts +7 -1
- package/dist/openalgo-charts.draw.mjs +1 -1
- package/dist/openalgo-charts.draw.mjs.map +1 -1
- package/dist/openalgo-charts.indicators.mjs +1 -1
- package/dist/openalgo-charts.indicators.mjs.map +1 -1
- package/dist/openalgo-charts.mjs +1 -1
- package/dist/openalgo-charts.mjs.map +1 -1
- package/dist/openalgo-charts.standalone.js +1 -1
- package/dist/openalgo-charts.standalone.js.map +1 -1
- package/dist/openalgo-charts.widget.mjs +1 -1
- package/dist/openalgo-charts.widget.mjs.map +1 -1
- package/dist/trade/index.d.ts +8 -0
- package/dist/widget/index.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
**A from-scratch, dependency-free HTML5-canvas charting engine for OpenAlgo.**
|
|
6
6
|
|
|
7
|
-
Professional interactive charts, 102 built-in indicators plus your own custom ones, 51 drawing tools, order flow, market replay, linked chart grids, on-chart trading, vector SVG export and an optional WebGL2 backend. Eight lazy-loaded tiers, zero runtime dependencies,
|
|
7
|
+
Professional interactive charts, 102 built-in indicators plus your own custom ones, 51 drawing tools, order flow, market replay, linked chart grids, on-chart trading, vector SVG export and an optional WebGL2 backend. Eight lazy-loaded tiers, zero runtime dependencies, 71.57 KB Brotli for the base engine, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/openalgo-charts)
|
|
10
10
|
[](./LICENSE)
|
|
11
|
-
[](#size-budget)
|
|
12
|
+
[](#develop)
|
|
13
13
|
[](#principles)
|
|
14
14
|
|
|
15
15
|
[**Documentation**](https://marketcalls.github.io/openalgo-charts/) · [**Live examples**](https://marketcalls.github.io/openalgo-charts/examples) · [**Getting started**](./docs/getting-started.md) · [**Migrating to 2.0**](./docs/migrating-to-2.md) · [**Architecture**](./ARCHITECTURE.md)
|
|
@@ -43,11 +43,12 @@ Every chart in the [live gallery](https://marketcalls.github.io/openalgo-charts/
|
|
|
43
43
|
|
|
44
44
|
## Install
|
|
45
45
|
|
|
46
|
-
Current version: **2.1.
|
|
46
|
+
Current version: **2.1.6**.
|
|
47
47
|
|
|
48
|
-
This
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
This release adds a shared data-loading controller, resilient warm history,
|
|
49
|
+
cancellation, paging and visible retry states for widgets and custom terminals.
|
|
50
|
+
Drawings remain visible beyond the latest candle and are clipped at the price axes.
|
|
51
|
+
See the [2.1.6 changelog](./CHANGELOG.md#216) and
|
|
51
52
|
[OpenAlgo compatibility guide](https://marketcalls.github.io/openalgo-charts/docs/openalgo-compatibility/).
|
|
52
53
|
|
|
53
54
|
```bash
|
|
@@ -69,7 +70,7 @@ in front of npm rather than being places you upload to. A chart is one HTML file
|
|
|
69
70
|
```html
|
|
70
71
|
<div id="chart" style="width:100vw;height:100vh"></div>
|
|
71
72
|
<script type="module">
|
|
72
|
-
import { createChart } from 'https://unpkg.com/openalgo-charts@2.1.
|
|
73
|
+
import { createChart } from 'https://unpkg.com/openalgo-charts@2.1.6/dist/openalgo-charts.mjs';
|
|
73
74
|
const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
|
|
74
75
|
chart.addSeries('candlestick').setData(bars);
|
|
75
76
|
</script>
|
|
@@ -108,16 +109,16 @@ Import only what you use. Each tier is a separate bundle that registers into the
|
|
|
108
109
|
|
|
109
110
|
| Import | Contents | Brotli |
|
|
110
111
|
|---|---|---|
|
|
111
|
-
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds |
|
|
112
|
-
| `openalgo-charts/indicators` | 102 built-in indicators, the `registerIndicator` contract for your own, and the Tier-2 (external-data) contract |
|
|
113
|
-
| `openalgo-charts/draw` | 51 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 25.
|
|
112
|
+
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds | 71.57 KB |
|
|
113
|
+
| `openalgo-charts/indicators` | 102 built-in indicators, the `registerIndicator` contract for your own, and the Tier-2 (external-data) contract | 28.05 KB |
|
|
114
|
+
| `openalgo-charts/draw` | 51 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 25.90 KB |
|
|
114
115
|
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi | 2.66 KB |
|
|
115
116
|
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 KB |
|
|
116
117
|
| `openalgo-charts/trade` | Order / position / bracket tools + DOM ladder | 7.61 KB |
|
|
117
118
|
| `openalgo-charts/webgl` | WebGL2 series backend: batched, analytically anti-aliased GPU rendering of the standard chart types behind `renderer: 'auto'`, with a session-long fallback to the 2D path | 6.38 KB |
|
|
118
|
-
| `openalgo-charts/widget` | The chart with its chrome in one call: `createWidget` adds a top bar, the drawing rail, a status line, the settings and indicator dialogs, drawing properties, a right-click menu, a keymap with a `?` panel and optional layout persistence. The only tier that ships DOM | 36.
|
|
119
|
+
| `openalgo-charts/widget` | The chart with its chrome in one call: `createWidget` adds a top bar, the drawing rail, a status line, the settings and indicator dialogs, drawing properties, a right-click menu, a keymap with a `?` panel and optional layout persistence. The only tier that ships DOM | 36.83 KB |
|
|
119
120
|
|
|
120
|
-
Everything together is **
|
|
121
|
+
Everything together is **193.96 KB Brotli**; a widget terminal (base + draw + indicators + widget, what one `createWidget` call loads) is 162.35 KB. Figures are the measured `size-limit` output. The trade tier is listed as its delta over the base, so loading base + trade costs 79.18 KB.
|
|
121
122
|
|
|
122
123
|
## What's built
|
|
123
124
|
|
|
@@ -409,16 +410,16 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
|
|
|
409
410
|
|
|
410
411
|
| Bundle | Limit | Actual |
|
|
411
412
|
|---|---|---|
|
|
412
|
-
| Base engine |
|
|
413
|
-
| Base + trade |
|
|
414
|
-
| Indicators tier | 30 KB |
|
|
415
|
-
| Draw tier | 26 KB | 25.
|
|
413
|
+
| Base engine | 73 KB | 71.57 KB |
|
|
414
|
+
| Base + trade | 81 KB | 79.18 KB |
|
|
415
|
+
| Indicators tier | 30 KB | 28.05 KB |
|
|
416
|
+
| Draw tier | 26 KB | 25.90 KB |
|
|
416
417
|
| Transform tier | 5 KB | 2.66 KB |
|
|
417
418
|
| Profile tier | 15 KB | 14.96 KB |
|
|
418
419
|
| WebGL2 tier | 7 KB | 6.38 KB |
|
|
419
|
-
| Widget tier | 37 KB | 36.
|
|
420
|
-
| Widget terminal (base + draw + indicators + widget) |
|
|
421
|
-
| **Everything** | **
|
|
420
|
+
| Widget tier | 37 KB | 36.83 KB |
|
|
421
|
+
| Widget terminal (base + draw + indicators + widget) | 165 KB | 162.35 KB |
|
|
422
|
+
| **Everything** | **197 KB** | **193.96 KB** |
|
|
422
423
|
|
|
423
424
|
## Documentation
|
|
424
425
|
|
|
@@ -463,7 +464,7 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
|
|
|
463
464
|
```bash
|
|
464
465
|
npm install # install dev toolchain
|
|
465
466
|
npm run typecheck # strict TypeScript check
|
|
466
|
-
npm test # unit tests (vitest) -
|
|
467
|
+
npm test # unit tests (vitest) - 4303 across 190 files
|
|
467
468
|
npm run build # Rollup -> dist/ (minified ESM per tier + types)
|
|
468
469
|
npm run size # size-limit (Brotli) against the budget
|
|
469
470
|
npm run e2e # Playwright Chromium smoke tests
|
|
@@ -480,7 +481,7 @@ npm run verify # lint + typecheck + test + build + demo tests + dts + size +
|
|
|
480
481
|
|
|
481
482
|
## Status & limitations
|
|
482
483
|
|
|
483
|
-
Version **2.1.
|
|
484
|
+
Version **2.1.6**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
|
|
484
485
|
|
|
485
486
|
Known gaps, stated plainly:
|
|
486
487
|
|
package/dist/draw/index.d.ts
CHANGED
|
@@ -1019,6 +1019,8 @@ declare class DrawingLayer implements IPrimitive {
|
|
|
1019
1019
|
*/
|
|
1020
1020
|
private _hoverHandled;
|
|
1021
1021
|
draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
|
|
1022
|
+
private _drawingContext;
|
|
1023
|
+
private _drawContent;
|
|
1022
1024
|
/**
|
|
1023
1025
|
* Anchor handles. A hover shows them light (thin, translucent) as a hint
|
|
1024
1026
|
* that the shape can be grabbed; a selection shows them at full weight.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Library version string. Matches package.json (including locally prepared releases). */
|
|
2
|
-
declare const VERSION = "2.1.
|
|
2
|
+
declare const VERSION = "2.1.6";
|
|
3
3
|
/** Returns the current library version. */
|
|
4
4
|
declare function version(): string;
|
|
5
5
|
|
|
@@ -736,6 +736,8 @@ type ZOrder = 'bottom' | 'normal' | 'top';
|
|
|
736
736
|
interface PrimitiveRenderContext {
|
|
737
737
|
timeScale: TimeScale;
|
|
738
738
|
priceScale: PriceScale;
|
|
739
|
+
/** The pane's primary visible price series scale, including a moved left axis. */
|
|
740
|
+
readoutPriceScale?: PriceScale;
|
|
739
741
|
dataLayer: DataLayer;
|
|
740
742
|
plotWidth: number;
|
|
741
743
|
plotHeight: number;
|
|
@@ -1906,8 +1908,32 @@ interface IndicatorAlertPayload {
|
|
|
1906
1908
|
time: number;
|
|
1907
1909
|
index: number;
|
|
1908
1910
|
}
|
|
1911
|
+
/** Optional instrument identity supplied by the host. */
|
|
1912
|
+
interface ChartDataContext {
|
|
1913
|
+
symbol?: string;
|
|
1914
|
+
exchange?: string;
|
|
1915
|
+
interval?: string;
|
|
1916
|
+
}
|
|
1917
|
+
/** Source identity changed, or the available source-bar range changed. */
|
|
1918
|
+
type IndicatorDataChange = 'context' | 'range';
|
|
1919
|
+
/** Observable state of an indicator's external data lifecycle. */
|
|
1920
|
+
type IndicatorDataStatus = {
|
|
1921
|
+
state: 'loading' | 'ready' | 'empty' | 'unsupported';
|
|
1922
|
+
} | {
|
|
1923
|
+
state: 'error';
|
|
1924
|
+
error: unknown;
|
|
1925
|
+
};
|
|
1909
1926
|
/** What an indicator's `attach` lifecycle can reach. */
|
|
1910
1927
|
interface IndicatorAttachContext {
|
|
1928
|
+
/** Optional host identity, independent of the indicator's own settings. */
|
|
1929
|
+
dataContext?(): Readonly<ChartDataContext> | undefined;
|
|
1930
|
+
/** Read bars and identity again when the host publishes a change. */
|
|
1931
|
+
subscribeDataChanges?(listener: (change: IndicatorDataChange) => void): () => void;
|
|
1932
|
+
/** Publish status and an explicit retry action for this instance. */
|
|
1933
|
+
setDataStatus?(status: IndicatorDataStatus): void;
|
|
1934
|
+
setDataRetry?(retry: (() => void) | null): void;
|
|
1935
|
+
/** Instance lifetime. Aborted on removal, preserved across style changes. */
|
|
1936
|
+
signal?: AbortSignal;
|
|
1911
1937
|
/** Current settings (live — read at call time, not captured). */
|
|
1912
1938
|
settings(): Readonly<IndicatorSettings>;
|
|
1913
1939
|
/** The chart's current source bars. */
|
|
@@ -1919,11 +1945,9 @@ interface IndicatorAttachContext {
|
|
|
1919
1945
|
/**
|
|
1920
1946
|
* The instrument the chart is showing, when the host knows it.
|
|
1921
1947
|
*
|
|
1922
|
-
*
|
|
1923
|
-
*
|
|
1924
|
-
*
|
|
1925
|
-
* picker) supplies it through its own `IndicatorHost`, which is how a Tier-2
|
|
1926
|
-
* indicator fetches the series matching what is on screen.
|
|
1948
|
+
* Hosts can supply this through `IndicatorHost` or Chart's explicit data
|
|
1949
|
+
* context. Without a configured identity it stays undefined. External
|
|
1950
|
+
* studies read `dataContext` to include the exchange as well.
|
|
1927
1951
|
*/
|
|
1928
1952
|
symbol?(): string | undefined;
|
|
1929
1953
|
/** The chart's timeframe (`'5m'`, `'1d'`), on the same terms as `symbol`. */
|
|
@@ -2471,6 +2495,9 @@ declare class IndicatorFill implements IPrimitive {
|
|
|
2471
2495
|
|
|
2472
2496
|
/** The slice of the chart the runtime needs. Keeps this module testable alone. */
|
|
2473
2497
|
interface IndicatorHost {
|
|
2498
|
+
/** Optional instrument identity and source-range notifications. */
|
|
2499
|
+
dataContext?(): Readonly<ChartDataContext> | undefined;
|
|
2500
|
+
subscribeDataChanges?(listener: (change: IndicatorDataChange) => void): () => void;
|
|
2474
2501
|
/** Add the pane-legend row (name + inline up/down/hide/maximize/close). */
|
|
2475
2502
|
addIndicatorLegend(opts: {
|
|
2476
2503
|
id: string;
|
|
@@ -2544,9 +2571,8 @@ interface IndicatorHost {
|
|
|
2544
2571
|
timezone?(): string;
|
|
2545
2572
|
/**
|
|
2546
2573
|
* The instrument and timeframe on screen, when the host knows them. The
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2549
|
-
* terminal that owns the symbol picker implements them here.
|
|
2574
|
+
* host can supply an explicit `dataContext` instead. Without either hook,
|
|
2575
|
+
* a descriptor sees `undefined` rather than a guessed identity.
|
|
2550
2576
|
*/
|
|
2551
2577
|
symbol?(): string | undefined;
|
|
2552
2578
|
interval?(): string | undefined;
|
|
@@ -2596,6 +2622,12 @@ interface IndicatorHost {
|
|
|
2596
2622
|
}
|
|
2597
2623
|
/** Public handle returned by `chart.addIndicator(...)`. */
|
|
2598
2624
|
interface IndicatorApi {
|
|
2625
|
+
/** External data state, or null for a study without a managed lifecycle. */
|
|
2626
|
+
dataStatus(): Readonly<IndicatorDataStatus> | null;
|
|
2627
|
+
/** Observe changes; immediately receives the current managed status, if any. */
|
|
2628
|
+
subscribeDataStatus(listener: (status: Readonly<IndicatorDataStatus>) => void): () => void;
|
|
2629
|
+
/** Retry external history when the descriptor supplies a retry action. */
|
|
2630
|
+
retryData(): void;
|
|
2599
2631
|
/** Unique instance id (several instances of one indicator can coexist). */
|
|
2600
2632
|
readonly id: string;
|
|
2601
2633
|
/** The descriptor id, e.g. `'macd'`. */
|
|
@@ -3842,6 +3874,7 @@ declare class Chart {
|
|
|
3842
3874
|
/** Handle + record of the primary price series (see `primarySeries`). */
|
|
3843
3875
|
private _primary;
|
|
3844
3876
|
private readonly _indicators;
|
|
3877
|
+
private _dataContext;
|
|
3845
3878
|
/** Guards indicator recompute against re-entry via its own `series.setData`. */
|
|
3846
3879
|
private _recomputing;
|
|
3847
3880
|
private _indicatorsDirty;
|
|
@@ -4050,6 +4083,10 @@ declare class Chart {
|
|
|
4050
4083
|
indicators(): readonly IndicatorApi[];
|
|
4051
4084
|
/** Remove one indicator instance by its handle id. Returns true if it existed. */
|
|
4052
4085
|
removeIndicator(instanceId: string): boolean;
|
|
4086
|
+
/** Optional instrument identity supplied by the host, never inferred from bars. */
|
|
4087
|
+
getDataContext(): Readonly<ChartDataContext> | undefined;
|
|
4088
|
+
/** Clear the previous source bars before changing context, then load the new source. */
|
|
4089
|
+
setDataContext(context: ChartDataContext | undefined): void;
|
|
4053
4090
|
private _indicatorHost;
|
|
4054
4091
|
/**
|
|
4055
4092
|
* Take (or withdraw) the price bars' colour overlay on behalf of one
|
|
@@ -6681,6 +6718,24 @@ interface BarsRequest {
|
|
|
6681
6718
|
to?: UTCSeconds;
|
|
6682
6719
|
/** Fetch authoritative history instead of a cached snapshot, when supported. */
|
|
6683
6720
|
noCache?: boolean;
|
|
6721
|
+
/** Cancel this consumer's request. Existing feeds may ignore cancellation. */
|
|
6722
|
+
signal?: AbortSignal;
|
|
6723
|
+
/** Deadline in milliseconds, including response-body reading. */
|
|
6724
|
+
timeoutMs?: number;
|
|
6725
|
+
/** Preferred number of bars; a date-range feed may return a different count. */
|
|
6726
|
+
countBack?: number;
|
|
6727
|
+
}
|
|
6728
|
+
/** An optional provider page before an exclusive UTC-second anchor. */
|
|
6729
|
+
interface BarsPageRequest extends BarsRequest {
|
|
6730
|
+
before: UTCSeconds;
|
|
6731
|
+
countBack: number;
|
|
6732
|
+
}
|
|
6733
|
+
/** Providers can distinguish an empty date window from exhausted history. */
|
|
6734
|
+
interface BarsPage {
|
|
6735
|
+
bars: Bar[];
|
|
6736
|
+
hasMore?: boolean;
|
|
6737
|
+
/** Exclusive anchor for the next page, including pages without observations. */
|
|
6738
|
+
nextBefore?: UTCSeconds;
|
|
6684
6739
|
}
|
|
6685
6740
|
/** Optional context for continuing history and recovering an interrupted stream. */
|
|
6686
6741
|
interface BarSubscriptionOptions {
|
|
@@ -6702,6 +6757,9 @@ interface BarSubscriptionOptions {
|
|
|
6702
6757
|
*/
|
|
6703
6758
|
interface DataFeed {
|
|
6704
6759
|
getBars(req: BarsRequest): Promise<Bar[]>;
|
|
6760
|
+
getBarsPage?(req: BarsPageRequest): Promise<BarsPage>;
|
|
6761
|
+
/** Read a closed-bar snapshot without initiating a network request. */
|
|
6762
|
+
getCachedBars?(req: BarsRequest): Promise<Bar[] | undefined>;
|
|
6705
6763
|
subscribeBars?(req: BarsRequest, onBar: (bar: Bar) => void, opts?: BarSubscriptionOptions): UnsubscribeFn;
|
|
6706
6764
|
/**
|
|
6707
6765
|
* `opts.depthLevel` requests a book depth (broker-dependent: 5/20/30/50).
|
|
@@ -6719,6 +6777,8 @@ interface DepthLevel {
|
|
|
6719
6777
|
}
|
|
6720
6778
|
/** Variable-depth book; `bids`/`asks` length = whatever the broker streams (5..200). */
|
|
6721
6779
|
interface MarketDepth {
|
|
6780
|
+
/** Exchange event timestamp in UTC seconds, when supplied by the feed. */
|
|
6781
|
+
timeSec?: UTCSeconds;
|
|
6722
6782
|
bids: DepthLevel[];
|
|
6723
6783
|
asks: DepthLevel[];
|
|
6724
6784
|
ltp: number;
|
|
@@ -6754,14 +6814,120 @@ interface TradeFeed {
|
|
|
6754
6814
|
subscribePositions(cb: (positions: unknown[]) => void): UnsubscribeFn;
|
|
6755
6815
|
}
|
|
6756
6816
|
|
|
6817
|
+
/** Limits apply to each pool, whose identity belongs to one data feed. */
|
|
6818
|
+
interface HistoryRequestPoolOptions {
|
|
6819
|
+
maxConcurrent?: number;
|
|
6820
|
+
timeoutMs?: number;
|
|
6821
|
+
}
|
|
6822
|
+
/**
|
|
6823
|
+
* Shares in-flight historical requests while each consumer owns its lifetime.
|
|
6824
|
+
* Higher priorities run first among queued work; active work is not preempted.
|
|
6825
|
+
*/
|
|
6826
|
+
declare class HistoryRequestPool {
|
|
6827
|
+
private readonly _feed;
|
|
6828
|
+
private readonly _max;
|
|
6829
|
+
private readonly _timeout;
|
|
6830
|
+
private readonly _jobs;
|
|
6831
|
+
private _active;
|
|
6832
|
+
private _draining;
|
|
6833
|
+
constructor(feed: DataFeed, options?: HistoryRequestPoolOptions);
|
|
6834
|
+
getBars(req: BarsRequest, priority?: number): Promise<Bar[]>;
|
|
6835
|
+
getBarsPage(req: BarsPageRequest, priority?: number): Promise<BarsPage>;
|
|
6836
|
+
private _request;
|
|
6837
|
+
private _remove;
|
|
6838
|
+
private _finish;
|
|
6839
|
+
private _drain;
|
|
6840
|
+
}
|
|
6841
|
+
/** Reuse one pool only for consumers of this exact feed instance. */
|
|
6842
|
+
declare function sharedHistoryRequests(feed: DataFeed): HistoryRequestPool;
|
|
6843
|
+
|
|
6844
|
+
type DataLoadingStatus = 'idle' | 'loading' | 'ready' | 'empty' | 'refreshing' | 'stale' | 'error';
|
|
6845
|
+
type HistoryLoadingStatus = 'idle' | 'loading' | 'error' | 'exhausted' | 'limited';
|
|
6846
|
+
type DataUpdateReason = 'load' | 'cache' | 'live' | 'refresh' | 'prepend' | 'resume' | 'state';
|
|
6847
|
+
/** Display bars are held still while paused; bars() retains the live store. */
|
|
6848
|
+
interface DataLoadingSnapshot {
|
|
6849
|
+
readonly request: Readonly<BarsRequest> | null;
|
|
6850
|
+
readonly bars: readonly Bar[];
|
|
6851
|
+
readonly status: DataLoadingStatus;
|
|
6852
|
+
readonly historyStatus: HistoryLoadingStatus;
|
|
6853
|
+
readonly hasMore: boolean | null;
|
|
6854
|
+
readonly error?: Error;
|
|
6855
|
+
readonly historyError?: Error;
|
|
6856
|
+
readonly reason: DataUpdateReason;
|
|
6857
|
+
readonly paused: boolean;
|
|
6858
|
+
}
|
|
6859
|
+
interface DataLoadingOptions {
|
|
6860
|
+
requestPool?: HistoryRequestPool;
|
|
6861
|
+
timeoutMs?: number;
|
|
6862
|
+
pageSize?: number;
|
|
6863
|
+
/** Date-window fallback for feeds without getBarsPage. Defaults to the load window. */
|
|
6864
|
+
pageWindowSec?: number;
|
|
6865
|
+
/** Empty windows inspected per gesture, without claiming permanent exhaustion. */
|
|
6866
|
+
maxEmptyPages?: number;
|
|
6867
|
+
maxBars?: number;
|
|
6868
|
+
/** Optional history repair cadence. Zero disables polling. */
|
|
6869
|
+
pollIntervalMs?: number;
|
|
6870
|
+
/** UTC seconds. */
|
|
6871
|
+
now?: () => number;
|
|
6872
|
+
}
|
|
6873
|
+
/**
|
|
6874
|
+
* Owns history, paging and live updates for one current instrument. Consumers
|
|
6875
|
+
* decide how to paint snapshots; no canvas, DOM or broker execution is owned here.
|
|
6876
|
+
*/
|
|
6877
|
+
declare class DataLoadingController {
|
|
6878
|
+
private readonly _feed;
|
|
6879
|
+
private readonly _pool;
|
|
6880
|
+
private readonly _options;
|
|
6881
|
+
private readonly _listeners;
|
|
6882
|
+
private _state;
|
|
6883
|
+
private _bars;
|
|
6884
|
+
private _scope;
|
|
6885
|
+
private _refreshAbort;
|
|
6886
|
+
private _pageAbort;
|
|
6887
|
+
private _loadWork;
|
|
6888
|
+
private _pageWork;
|
|
6889
|
+
private _unsubscribe;
|
|
6890
|
+
private _stream;
|
|
6891
|
+
private _generation;
|
|
6892
|
+
private _refreshId;
|
|
6893
|
+
private _before;
|
|
6894
|
+
private _buffer;
|
|
6895
|
+
private _poll;
|
|
6896
|
+
private _visible;
|
|
6897
|
+
private _destroyed;
|
|
6898
|
+
constructor(feed: DataFeed, options?: DataLoadingOptions);
|
|
6899
|
+
getState(): DataLoadingSnapshot;
|
|
6900
|
+
bars(): readonly Bar[];
|
|
6901
|
+
subscribe(listener: (snapshot: DataLoadingSnapshot) => void): UnsubscribeFn;
|
|
6902
|
+
load(req: BarsRequest): Promise<readonly Bar[]>;
|
|
6903
|
+
private _load;
|
|
6904
|
+
refresh(): Promise<readonly Bar[]>;
|
|
6905
|
+
/** Supply bars from an existing host subscription instead of subscribing twice. */
|
|
6906
|
+
pushBar(value: Bar): void;
|
|
6907
|
+
loadMore(): Promise<readonly Bar[]>;
|
|
6908
|
+
private _loadMore;
|
|
6909
|
+
setPaused(paused: boolean): void;
|
|
6910
|
+
setVisible(visible: boolean): void;
|
|
6911
|
+
destroy(): void;
|
|
6912
|
+
private _current;
|
|
6913
|
+
private _replaceWindow;
|
|
6914
|
+
private _limit;
|
|
6915
|
+
private _publish;
|
|
6916
|
+
private _startStream;
|
|
6917
|
+
private _release;
|
|
6918
|
+
private _clearPoll;
|
|
6919
|
+
private _schedulePoll;
|
|
6920
|
+
private _cancel;
|
|
6921
|
+
}
|
|
6922
|
+
|
|
6757
6923
|
/**
|
|
6758
6924
|
* OpenAlgo REST adapter (ARCHITECTURE.md §10.0). The chart depends only on the
|
|
6759
6925
|
* `DataFeed` interface; this is the only file that knows OpenAlgo's REST shape.
|
|
6760
6926
|
*
|
|
6761
6927
|
* History endpoint: POST `${baseUrl}/api/v1/history`.
|
|
6762
|
-
*
|
|
6763
|
-
*
|
|
6764
|
-
*
|
|
6928
|
+
* The request fields and interval mapping are pinned by offline adapter
|
|
6929
|
+
* fixtures. Response timestamps accept epoch seconds, epoch milliseconds,
|
|
6930
|
+
* offset-qualified timestamps and unqualified IST date/time strings.
|
|
6765
6931
|
*/
|
|
6766
6932
|
|
|
6767
6933
|
interface OpenAlgoConfig {
|
|
@@ -7925,12 +8091,12 @@ declare class TickBarAggregator {
|
|
|
7925
8091
|
* measured without serialising. Byte counting would mean stringifying every
|
|
7926
8092
|
* entry on every write, which costs more than the cache saves.
|
|
7927
8093
|
*
|
|
7928
|
-
* **Storage.**
|
|
7929
|
-
*
|
|
7930
|
-
*
|
|
7931
|
-
*
|
|
7932
|
-
*
|
|
7933
|
-
* through `JSON.stringify` unchanged.
|
|
8094
|
+
* **Storage.** A bounded in-memory copy is always available. A host may inject
|
|
8095
|
+
* `storage` to persist through localStorage, IndexedDB, or another store, but
|
|
8096
|
+
* the engine will not choose one itself. Durable reads, writes, and deletes are
|
|
8097
|
+
* best effort so storage denial or quota exhaustion cannot block market data.
|
|
8098
|
+
* Store methods may return a promise. `CachedBars` is plain JSON so it
|
|
8099
|
+
* round-trips through `JSON.stringify` unchanged.
|
|
7934
8100
|
*
|
|
7935
8101
|
* **Opt-out.** `getBars({ ..., noCache: true })` always hits the network (and
|
|
7936
8102
|
* refreshes the entry); `invalidate()` and `clear()` drop entries by hand.
|
|
@@ -7939,6 +8105,8 @@ declare class TickBarAggregator {
|
|
|
7939
8105
|
type MaybePromise<T> = T | Promise<T>;
|
|
7940
8106
|
/** One cached series. Plain JSON: safe to persist as-is. */
|
|
7941
8107
|
interface CachedBars {
|
|
8108
|
+
/** Persisted schema version. Missing means the compatible legacy schema. */
|
|
8109
|
+
version?: number;
|
|
7942
8110
|
/** Closed bars only, ascending by time. */
|
|
7943
8111
|
bars: Bar[];
|
|
7944
8112
|
/** Coverage start: the `from` of the request that filled this entry. */
|
|
@@ -7955,8 +8123,8 @@ interface CachedBars {
|
|
|
7955
8123
|
nextClose: UTCSeconds;
|
|
7956
8124
|
}
|
|
7957
8125
|
/**
|
|
7958
|
-
* Pluggable
|
|
7959
|
-
*
|
|
8126
|
+
* Pluggable durable store. Sync or async operations are awaited and isolated
|
|
8127
|
+
* from the network result. The cache always keeps its own bounded memory copy.
|
|
7960
8128
|
*/
|
|
7961
8129
|
interface BarCacheStore {
|
|
7962
8130
|
get(key: string): MaybePromise<CachedBars | undefined>;
|
|
@@ -7970,7 +8138,7 @@ interface BarCacheOptions {
|
|
|
7970
8138
|
max?: number;
|
|
7971
8139
|
/** Maximum total cached bars before LRU eviction. Default 250_000. */
|
|
7972
8140
|
maxBars?: number;
|
|
7973
|
-
/**
|
|
8141
|
+
/** Optional durable store. Bounded in-memory retention is always enabled. */
|
|
7974
8142
|
storage?: BarCacheStore;
|
|
7975
8143
|
/** Injectable clock (ms), for tests and for hosts with a server clock. */
|
|
7976
8144
|
now?: () => number;
|
|
@@ -8000,6 +8168,8 @@ interface BarCacheStats {
|
|
|
8000
8168
|
misses: number;
|
|
8001
8169
|
evictions: number;
|
|
8002
8170
|
}
|
|
8171
|
+
/** Current persisted entry schema. Legacy entries without this field remain readable. */
|
|
8172
|
+
declare const BAR_CACHE_VERSION = 1;
|
|
8003
8173
|
/**
|
|
8004
8174
|
* Interval token to seconds. Case matters where it disambiguates: lowercase
|
|
8005
8175
|
* The instant a bar starting at `barStartSec` closes, or null when that cannot
|
|
@@ -8030,6 +8200,10 @@ declare class BarCache implements DataFeed {
|
|
|
8030
8200
|
/** The wrapped feed, for callers that need something this wrapper does not forward. */
|
|
8031
8201
|
readonly source: DataFeed;
|
|
8032
8202
|
private readonly _backing;
|
|
8203
|
+
private readonly _memory;
|
|
8204
|
+
/** Keys whose durable value may still exist after a failed write or delete. */
|
|
8205
|
+
private readonly _tombstones;
|
|
8206
|
+
private readonly _writes;
|
|
8033
8207
|
private readonly _ttlMs;
|
|
8034
8208
|
private readonly _max;
|
|
8035
8209
|
private readonly _maxBars;
|
|
@@ -8043,7 +8217,10 @@ declare class BarCache implements DataFeed {
|
|
|
8043
8217
|
constructor(feed: DataFeed, options?: BarCacheOptions);
|
|
8044
8218
|
subscribeBars?: (req: BarsRequest, onBar: (bar: Bar) => void, ...rest: unknown[]) => UnsubscribeFn;
|
|
8045
8219
|
subscribeDepth?: (req: BarsRequest, onDepth: (depth: MarketDepth) => void, ...rest: unknown[]) => UnsubscribeFn;
|
|
8220
|
+
getBarsPage?: (req: BarsPageRequest) => Promise<BarsPage>;
|
|
8046
8221
|
getBars(req: CachedBarsRequest): Promise<Bar[]>;
|
|
8222
|
+
/** Read any valid, TTL-retained closed overlap without initiating a source request. */
|
|
8223
|
+
getCachedBars(req: BarsRequest): Promise<Bar[] | undefined>;
|
|
8047
8224
|
/**
|
|
8048
8225
|
* Drop one series, or (with no argument) everything this cache knows of.
|
|
8049
8226
|
* "Knows of" is literal with an injected persistent store: recency and size
|
|
@@ -8055,9 +8232,18 @@ declare class BarCache implements DataFeed {
|
|
|
8055
8232
|
clear(): Promise<void>;
|
|
8056
8233
|
stats(): BarCacheStats;
|
|
8057
8234
|
private _lookup;
|
|
8235
|
+
private _slice;
|
|
8058
8236
|
private _put;
|
|
8059
8237
|
private _drop;
|
|
8060
8238
|
private _evict;
|
|
8239
|
+
private _remember;
|
|
8240
|
+
private _readEntry;
|
|
8241
|
+
private _validEntry;
|
|
8242
|
+
private _validBar;
|
|
8243
|
+
private _cloneEntry;
|
|
8244
|
+
private _writeBacking;
|
|
8245
|
+
private _deleteBacking;
|
|
8246
|
+
private _restoreLatestBacking;
|
|
8061
8247
|
}
|
|
8062
8248
|
/**
|
|
8063
8249
|
* Wrap any `DataFeed` in a warm-load bar cache.
|
|
@@ -8263,4 +8449,4 @@ declare function lerp(a: number, b: number, t: number): number;
|
|
|
8263
8449
|
*/
|
|
8264
8450
|
declare function roundToTick(value: number, step: number): number;
|
|
8265
8451
|
|
|
8266
|
-
export { ALT_PRESET, type AddSeriesOptions, type AggTick, type AxisChromeOptions, type AxisStyle, BUILTIN_COMMANDS, type Bar, BarCache, type BarCacheOptions, type BarCacheStats, type BarCacheStore, type BarSubscriptionOptions, type BarUpdate, type BarsRequest, type Bucketing, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, type CachedBars, type CachedBarsRequest, type CalendarBucketing, type CalendarUnit, CandleBuilder, type CandleBuilderOptions, type CandleGeometry, type CandleStyle, type CandleTier, type CandleUpdate, Canvas2dBackend, type CanvasLineStyle, type CanvasOptions, Chart, type ChartClickEvent, type ChartDragEndEvent, type ChartDragEvent, type ChartEvent, type ChartEventOptions, type ChartNavigationOptions, type ChartOptions, type ChartSettingsColorPairInput, type ChartSettingsInput, type ChartSettingsState, type ChartSettingsTab, type ChartSettingsTabId, type ChartSettingsValue, type ChartSettingsValues, type ChartState, ChartTable, type ChartTableOptions, type ChartTheme, type ComparisonAlignment, type ComparisonChartHost, ComparisonController, type ComparisonControllerOptions, type ComparisonHandle, type ComparisonMode, type ComparisonOptions, type ComparisonPane, type ContextMenuEvent, type ContextMenuTarget, type ContextMenuTargetKind, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairStyle, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_CHART_TABLE_OPTIONS, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIMEZONE, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, DEFAULT_ZOOM_GLIDE_OPTIONS, type DataFeed, DataLayer, type DecodedOrder, type DepthLevel, type DoubleClickAction, type DoubleClickEvent, type DrawAnchor, type DrawItem, EventMarkers, type ExportSvgOptions, FakeDataFeed, type FeedScheduler, type FillGradient, type FillPoint, type GridAxisStyle, type GridOptions, type GridStyle, type HistogramStyle, INDICATOR_LINE_STYLES, INDICATOR_PLOT_STYLES, INDICATOR_SOURCES, type IPrimitive, type IRenderBackend, IST_OFFSET_SECONDS, type IndexedBar, type IndicatorAlertContext, type IndicatorAlertPayload, type IndicatorAlertSpec, type IndicatorApi, type IndicatorAttachContext, IndicatorBackground, type IndicatorCalcContext, type IndicatorDescriptor, type IndicatorDrawing, IndicatorDrawings, IndicatorFill, type IndicatorFillOptions, type IndicatorFillSpec, type IndicatorHost, type IndicatorInput, type IndicatorLevel, type IndicatorLevelContext, type IndicatorLineStyle, type IndicatorPlot, type IndicatorSettings, type IndicatorSource, type IndicatorState, type IndicatorStore, type IndicatorValues, type IntervalBucketing, type IntervalDescriptor, type IntervalParts, InvalidationLevel, type IstParts, type KeymapEntry, LINK_CROSSHAIR_ALPHA, type LateTickPolicy, type LegendField, type LegendStatusData, type LegendStatusLineOptions, type LegendStatusSource, type LegendTitleMode, type LegendValue, type LinePoint, type LinkChart, LinkCrosshair, type LinkDataLayer, LinkGroup, type LinkMemberOptions, type LinkMissingPolicy, type LinkOptions, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type MarketPhase, type MarketPhaseFn, type MaybePromise, type ModeCheck, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderBookSnapshot, type OrderDecodeCode, type OrderDecodeIssue, type OrderDecodeResult, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OrderUpdateEvent, type OriginalTime, PRICE_LEVEL_KINDS, PRICE_SCALE_MODES, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PickHost, type PickKind, type PlaceOrder, type PlotMarginOptions, type PointerInfo, type PointerKind, type PointerModifiers, type PointerSample, type PositionSide, type PriceAxisState, type PriceLevelInput, type PriceLevelKind, type PriceLevelQuote, type PriceLevelStyle, type PriceLevelValues, PriceLevels, type PriceLevelsOptions, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveAnchor, type PrimitiveHit, type PrimitiveHost, type PrimitivePlacement, type PrimitiveRenderContext, type QuarantinedRow, type RawOrder, type RenderBackendFactory, type RenderBackendKind, type RenderDevice, type RendererChoice, type RendererEntry, type RendererFallbackEvent, type RendererFallbackReason, type ReplayChartHost, ReplayController, type ReplayOptions, type ReplayScheduler, ReplayShade, type ReplayShadeOptions, type ReplayState, type ReplayViewport, type ResolvedLinkOptions, type RestoreReport, SCALE_FONT_MAX, SCALE_FONT_MIN, type ScaleCanvasOptions, type SeriesApi, type SeriesDataItem, type SeriesId, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesState, type SeriesStyle, type SeriesType, type SessionSpec, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, SvgContext, type SvgContextOptions, SvgLinearGradient, type TableCell, type TablePosition, TextWatermark, type TextWatermarkOptions, type Tick, TickBarAggregator, type TickBarOptions, type TickCountBucketing, type TickMarkType, type TickTimeframe, TimeNavigator, type TimeNavigatorAction, type TimeNavigatorOptions, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, UnknownIntervalError, type UnsubscribeFn, VERSION, type VolumeBucketing, type VolumeMode, type WatermarkPosition, type Whitespace, type WsClientWarning, type WsControlMessage, type WsMode, type WsState, type ZOrder, type ZonedParts, type ZonedPeriod, type ZoomAnchor, ZoomGlide, type ZoomGlideOptions, addComparison, alignToPrimary, applyChartSettings, atr, autoscaleRange, backendDegradation, backoffDelayMs, barCacheKey, barCloseSec, beginPick, bestHit, bitmapSize, bucketStartOf, calendarPeriodFlags, candleGeometry, candleTier, chartSettingsSchema, clamp, classifyAuthAck, compactVolume, comparisonController, computePriceLevels, conflateBars, conflateItems, conflationGroupSize, createChart, createLinkGroup, createRenderBackend, darkTheme, dashPattern, decodeOrder, drawLabel, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, followerIndex, followerRange, formatCombo, formatIstCrosshairLabel, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, formatZonedCrosshairLabel, formatZonedDate, formatZonedTime, formatZonedTimeSeconds, fromGradient, generateBars, getChartType, getIndicator, hasIndicator, inSessionAt, indicatorDefaults, indicatorStyleInputs, intervalParts, intervalToSeconds, isDailyInterval, isIntradayInterval, isKnownInterval, isNewIstDay, isNewZonedDay, isNewZonedMonth, isNewZonedPeriod, isNewZonedQuarter, isNewZonedWeek, isNewZonedYear, isRebasing, isReservedCombo, isSecondsInterval, isTickInterval, isTimeBucketed, isValidCombo, isValidTimezone, isWhitespace, istStringToUtcSeconds, lastPriceLevelFromSeriesStyle, lerp, lightTheme, mapHistoryResponse, mapOrder, mapOrderStatus, mapPosition, markerSizePx, mergeBars, nextBucketStart, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, parseSessionSpec, parseTopic, plotStyleKeys, precisionForStep, readChartSettings, readSequence, registerChartType, registerIndicator, registerInterval, registerRenderBackend, registeredChartTypes, registeredIndicators, registeredIntervals, registeredRenderBackends, resolveCrosshairStyle, resolveGridStyle, resolveInterval, resolvePlotMargins, resolveRenderBackend, resolveScaleStyle, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, seriesStyleForLastPriceLevel, sessionFlags, sessionStartFlags, sessionStartIndices, snapToDevicePixel, sourceValue, sourceValues, startOfZonedDay, startOfZonedMonth, startOfZonedWeek, supertrend, supertrendSeries, tableOrigin, toBar, trueRange, tryResolveInterval, unregisterInterval, unregisterRenderBackend, utcSecondsToIstDateString, utcSecondsToIstParts, utcSecondsToZonedDateString, utcSecondsToZonedParts, version, verticalGradient, watermarkRect, withAlpha, withBarCache, zoneOffsetSeconds, zonedDayIndex, zonedStringToUtcSeconds, zonedWallClockToUtcSeconds, zonedWeekIndex };
|
|
8452
|
+
export { ALT_PRESET, type AddSeriesOptions, type AggTick, type AxisChromeOptions, type AxisStyle, BAR_CACHE_VERSION, BUILTIN_COMMANDS, type Bar, BarCache, type BarCacheOptions, type BarCacheStats, type BarCacheStore, type BarSubscriptionOptions, type BarUpdate, type BarsPage, type BarsPageRequest, type BarsRequest, type Bucketing, BuySellButtons, type BuySellButtonsOptions, CHART_STATE_VERSION, type CachedBars, type CachedBarsRequest, type CalendarBucketing, type CalendarUnit, CandleBuilder, type CandleBuilderOptions, type CandleGeometry, type CandleStyle, type CandleTier, type CandleUpdate, Canvas2dBackend, type CanvasLineStyle, type CanvasOptions, Chart, type ChartClickEvent, type ChartDataContext, type ChartDragEndEvent, type ChartDragEvent, type ChartEvent, type ChartEventOptions, type ChartNavigationOptions, type ChartOptions, type ChartSettingsColorPairInput, type ChartSettingsInput, type ChartSettingsState, type ChartSettingsTab, type ChartSettingsTabId, type ChartSettingsValue, type ChartSettingsValues, type ChartState, ChartTable, type ChartTableOptions, type ChartTheme, type ComparisonAlignment, type ComparisonChartHost, ComparisonController, type ComparisonControllerOptions, type ComparisonHandle, type ComparisonMode, type ComparisonOptions, type ComparisonPane, type ContextMenuEvent, type ContextMenuTarget, type ContextMenuTargetKind, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairStyle, type CustomShortcut, DEFAULT_CANDLE_BUILDER_OPTIONS, DEFAULT_CANDLE_STYLE, DEFAULT_CHART_TABLE_OPTIONS, DEFAULT_HISTOGRAM_STYLE, DEFAULT_KEYMAP, DEFAULT_PRICE_SCALE_OPTIONS, DEFAULT_THEME, DEFAULT_TIMEZONE, DEFAULT_TIME_NAVIGATOR_OPTIONS, DEFAULT_TIME_SCALE_OPTIONS, DEFAULT_TRADING_COLORS, DEFAULT_ZOOM_GLIDE_OPTIONS, type DataFeed, DataLayer, DataLoadingController, type DataLoadingOptions, type DataLoadingSnapshot, type DataLoadingStatus, type DataUpdateReason, type DecodedOrder, type DepthLevel, type DoubleClickAction, type DoubleClickEvent, type DrawAnchor, type DrawItem, EventMarkers, type ExportSvgOptions, FakeDataFeed, type FeedScheduler, type FillGradient, type FillPoint, type GridAxisStyle, type GridOptions, type GridStyle, type HistogramStyle, type HistoryLoadingStatus, HistoryRequestPool, type HistoryRequestPoolOptions, INDICATOR_LINE_STYLES, INDICATOR_PLOT_STYLES, INDICATOR_SOURCES, type IPrimitive, type IRenderBackend, IST_OFFSET_SECONDS, type IndexedBar, type IndicatorAlertContext, type IndicatorAlertPayload, type IndicatorAlertSpec, type IndicatorApi, type IndicatorAttachContext, IndicatorBackground, type IndicatorCalcContext, type IndicatorDataChange, type IndicatorDataStatus, type IndicatorDescriptor, type IndicatorDrawing, IndicatorDrawings, IndicatorFill, type IndicatorFillOptions, type IndicatorFillSpec, type IndicatorHost, type IndicatorInput, type IndicatorLevel, type IndicatorLevelContext, type IndicatorLineStyle, type IndicatorPlot, type IndicatorSettings, type IndicatorSource, type IndicatorState, type IndicatorStore, type IndicatorValues, type IntervalBucketing, type IntervalDescriptor, type IntervalParts, InvalidationLevel, type IstParts, type KeymapEntry, LINK_CROSSHAIR_ALPHA, type LateTickPolicy, type LegendField, type LegendStatusData, type LegendStatusLineOptions, type LegendStatusSource, type LegendTitleMode, type LegendValue, type LinePoint, type LinkChart, LinkCrosshair, type LinkDataLayer, LinkGroup, type LinkMemberOptions, type LinkMissingPolicy, type LinkOptions, type LogicalRange, LogoWatermark, type LogoWatermarkOptions, type LtpEvent, type MarkerPosition, type MarkerShape, type MarkerSize, type MarketDepth, type MarketPhase, type MarketPhaseFn, type MaybePromise, type ModeCheck, type OpenAlgoConfig, OpenAlgoDataFeed, type OpenAlgoLiveConfig, OpenAlgoLiveDataFeed, type OpenAlgoTradeConfig, OpenAlgoTradeFeed, type OpenAlgoWsConfig, OpenAlgoWsFeed, type OrderBookSnapshot, type OrderDecodeCode, type OrderDecodeIssue, type OrderDecodeResult, type OrderSide$1 as OrderSide, type OrderType$1 as OrderType, type OrderUpdateEvent, type OriginalTime, PRICE_LEVEL_KINDS, PRICE_SCALE_MODES, Pane, type PaneInvalidation, PaneLegend, type PaneLegendAction, type PaneLegendOptions, type PaneState, type PickHost, type PickKind, type PlaceOrder, type PlotMarginOptions, type PointerInfo, type PointerKind, type PointerModifiers, type PointerSample, type PositionSide, type PriceAxisState, type PriceLevelInput, type PriceLevelKind, type PriceLevelQuote, type PriceLevelStyle, type PriceLevelValues, PriceLevels, type PriceLevelsOptions, PriceLine, type PriceLineOptions, type PriceRange, PriceScale, type PriceScaleId, type PriceScaleMode, type PriceScaleOptions, type PriceScaleState, type PrimitiveAnchor, type PrimitiveHit, type PrimitiveHost, type PrimitivePlacement, type PrimitiveRenderContext, type QuarantinedRow, type RawOrder, type RenderBackendFactory, type RenderBackendKind, type RenderDevice, type RendererChoice, type RendererEntry, type RendererFallbackEvent, type RendererFallbackReason, type ReplayChartHost, ReplayController, type ReplayOptions, type ReplayScheduler, ReplayShade, type ReplayShadeOptions, type ReplayState, type ReplayViewport, type ResolvedLinkOptions, type RestoreReport, SCALE_FONT_MAX, SCALE_FONT_MIN, type ScaleCanvasOptions, type SeriesApi, type SeriesDataItem, type SeriesId, type SeriesMarker, SeriesMarkers, type SeriesRenderContext, type SeriesState, type SeriesStyle, type SeriesType, type SessionSpec, type ShortcutListItem, ShortcutManager, type ShortcutManagerOptions, type ShortcutPreset, type ShortcutScope, type ShortcutTriggerEvent, type Size, type SocketFactory, type SocketLike, type SupertrendPoint, SvgContext, type SvgContextOptions, SvgLinearGradient, type TableCell, type TablePosition, TextWatermark, type TextWatermarkOptions, type Tick, TickBarAggregator, type TickBarOptions, type TickCountBucketing, type TickMarkType, type TickTimeframe, TimeNavigator, type TimeNavigatorAction, type TimeNavigatorOptions, TimeScale, type TimeScaleOp, type TimeScaleOptions, type TradeFeed, type TradeMarkerVariant, TradeMarkersPrimitive, type TradingColors, TradingController, type TradingHost, type TradingLineStyle, type TradingLineVariant, type TradingOrder, type TradingOrderSide, type TradingOrderType, type TradingPosition, type TradingSettings, type TradingSyncPayload, type TradingTrade, type UTCSeconds, UnknownIntervalError, type UnsubscribeFn, VERSION, type VolumeBucketing, type VolumeMode, type WatermarkPosition, type Whitespace, type WsClientWarning, type WsControlMessage, type WsMode, type WsState, type ZOrder, type ZonedParts, type ZonedPeriod, type ZoomAnchor, ZoomGlide, type ZoomGlideOptions, addComparison, alignToPrimary, applyChartSettings, atr, autoscaleRange, backendDegradation, backoffDelayMs, barCacheKey, barCloseSec, beginPick, bestHit, bitmapSize, bucketStartOf, calendarPeriodFlags, candleGeometry, candleTier, chartSettingsSchema, clamp, classifyAuthAck, compactVolume, comparisonController, computePriceLevels, conflateBars, conflateItems, conflationGroupSize, createChart, createLinkGroup, createRenderBackend, darkTheme, dashPattern, decodeOrder, drawLabel, drawShape, effectiveMarkerPx, ema, emaSeries, epochMsToUtcSeconds, eventToCombo, followerIndex, followerRange, formatCombo, formatIstCrosshairLabel, formatIstDate, formatIstTime, formatIstTimeSeconds, formatSubscribe, formatUnsubscribe, formatZonedCrosshairLabel, formatZonedDate, formatZonedTime, formatZonedTimeSeconds, fromGradient, generateBars, getChartType, getIndicator, hasIndicator, inSessionAt, indicatorDefaults, indicatorStyleInputs, intervalParts, intervalToSeconds, isDailyInterval, isIntradayInterval, isKnownInterval, isNewIstDay, isNewZonedDay, isNewZonedMonth, isNewZonedPeriod, isNewZonedQuarter, isNewZonedWeek, isNewZonedYear, isRebasing, isReservedCombo, isSecondsInterval, isTickInterval, isTimeBucketed, isValidCombo, isValidTimezone, isWhitespace, istStringToUtcSeconds, lastPriceLevelFromSeriesStyle, lerp, lightTheme, mapHistoryResponse, mapOrder, mapOrderStatus, mapPosition, markerSizePx, mergeBars, nextBucketStart, niceTicks, normalizeCombo, optimalBarWidth, parseCombo, parseMessage, parseSessionSpec, parseTopic, plotStyleKeys, precisionForStep, readChartSettings, readSequence, registerChartType, registerIndicator, registerInterval, registerRenderBackend, registeredChartTypes, registeredIndicators, registeredIntervals, registeredRenderBackends, resolveCrosshairStyle, resolveGridStyle, resolveInterval, resolvePlotMargins, resolveRenderBackend, resolveScaleStyle, roundToTick, rowTimeToUtcSeconds, rsi, rsiSeries, seriesStyleForLastPriceLevel, sessionFlags, sessionStartFlags, sessionStartIndices, sharedHistoryRequests, snapToDevicePixel, sourceValue, sourceValues, startOfZonedDay, startOfZonedMonth, startOfZonedWeek, supertrend, supertrendSeries, tableOrigin, toBar, trueRange, tryResolveInterval, unregisterInterval, unregisterRenderBackend, utcSecondsToIstDateString, utcSecondsToIstParts, utcSecondsToZonedDateString, utcSecondsToZonedParts, version, verticalGradient, watermarkRect, withAlpha, withBarCache, zoneOffsetSeconds, zonedDayIndex, zonedStringToUtcSeconds, zonedWallClockToUtcSeconds, zonedWeekIndex };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IndicatorDescriptor, IndicatorSettings, Bar, IndicatorInput, IndicatorPlot, IndicatorLevel } from 'openalgo-charts';
|
|
1
|
+
import { IndicatorDescriptor, ChartDataContext, IndicatorSettings, Bar, IndicatorInput, IndicatorPlot, IndicatorLevel } from 'openalgo-charts';
|
|
2
2
|
|
|
3
3
|
declare const SMA: IndicatorDescriptor;
|
|
4
4
|
declare const WMA: IndicatorDescriptor;
|
|
@@ -1096,6 +1096,10 @@ interface Tier2Point {
|
|
|
1096
1096
|
values: Readonly<Record<string, number | null>>;
|
|
1097
1097
|
}
|
|
1098
1098
|
interface Tier2Context {
|
|
1099
|
+
/** Host identity when supplied. Indicator settings remain independent. */
|
|
1100
|
+
dataContext?: Readonly<ChartDataContext>;
|
|
1101
|
+
/** Cancelled when this request is obsolete or the instance is removed. */
|
|
1102
|
+
signal?: AbortSignal;
|
|
1099
1103
|
settings: Readonly<IndicatorSettings>;
|
|
1100
1104
|
/** The chart's current source bars — use for the requested time window. */
|
|
1101
1105
|
bars: readonly Bar[];
|
|
@@ -1110,6 +1114,8 @@ interface Tier2Descriptor {
|
|
|
1110
1114
|
placement: 'onchart' | 'pane';
|
|
1111
1115
|
inputs: readonly IndicatorInput[];
|
|
1112
1116
|
plots: readonly IndicatorPlot[];
|
|
1117
|
+
/** A host/provider can explicitly decline data it cannot supply. */
|
|
1118
|
+
supports?(ctx: Tier2Context): boolean;
|
|
1113
1119
|
/** Load the series for the current window. */
|
|
1114
1120
|
fetch(ctx: Tier2Context): Promise<readonly Tier2Point[]>;
|
|
1115
1121
|
/**
|