openalgo-charts 2.5.9 → 2.6.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/README.md +54 -45
- package/dist/draw/index.d.ts +440 -404
- package/dist/index.d.ts +4041 -3019
- package/dist/indicators/index.d.ts +230 -61
- package/dist/openalgo-charts.draw.mjs +1 -1
- package/dist/openalgo-charts.draw.mjs.map +1 -1
- package/dist/openalgo-charts.draw.standalone.js +1 -0
- package/dist/openalgo-charts.indicators.mjs +1 -1
- package/dist/openalgo-charts.indicators.mjs.map +1 -1
- package/dist/openalgo-charts.indicators.standalone.js +1 -0
- package/dist/openalgo-charts.mjs +1 -1
- package/dist/openalgo-charts.mjs.map +1 -1
- package/dist/openalgo-charts.profile.mjs +1 -1
- package/dist/openalgo-charts.profile.mjs.map +1 -1
- package/dist/openalgo-charts.profile.standalone.js +1 -0
- package/dist/openalgo-charts.standalone.js +1 -1
- package/dist/openalgo-charts.standalone.js.map +1 -1
- package/dist/openalgo-charts.trade.mjs +1 -1
- package/dist/openalgo-charts.trade.mjs.map +1 -1
- package/dist/openalgo-charts.trade.standalone.js +1 -0
- package/dist/openalgo-charts.transform.mjs +1 -1
- package/dist/openalgo-charts.transform.mjs.map +1 -1
- package/dist/openalgo-charts.transform.standalone.js +1 -0
- package/dist/openalgo-charts.webgl.mjs +1 -1
- package/dist/openalgo-charts.webgl.mjs.map +1 -1
- package/dist/openalgo-charts.webgl.standalone.js +1 -0
- package/dist/openalgo-charts.widget.chart-data-export-dialog-CX6h5-cp.mjs +2 -0
- package/dist/openalgo-charts.widget.chart-data-export-dialog-CX6h5-cp.mjs.map +1 -0
- package/dist/openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs +2 -0
- package/dist/openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs.map +1 -0
- package/dist/openalgo-charts.widget.grid-menus-CPZWEiD3.mjs +2 -0
- package/dist/openalgo-charts.widget.grid-menus-CPZWEiD3.mjs.map +1 -0
- package/dist/openalgo-charts.widget.keymap-editor-Uozy6qFE.mjs +2 -0
- package/dist/openalgo-charts.widget.keymap-editor-Uozy6qFE.mjs.map +1 -0
- package/dist/openalgo-charts.widget.layouts-menu-B7XYKPAW.mjs +2 -0
- package/dist/openalgo-charts.widget.layouts-menu-B7XYKPAW.mjs.map +1 -0
- package/dist/openalgo-charts.widget.layouts-templates-menu-DmYVzrWk.mjs +2 -0
- package/dist/openalgo-charts.widget.layouts-templates-menu-DmYVzrWk.mjs.map +1 -0
- package/dist/openalgo-charts.widget.mjs +1 -1
- package/dist/openalgo-charts.widget.mjs.map +1 -1
- package/dist/openalgo-charts.widget.standalone.js +1 -0
- package/dist/openalgo-charts.widget.storage-idb-WH_o01Wj.mjs +2 -0
- package/dist/openalgo-charts.widget.storage-idb-WH_o01Wj.mjs.map +1 -0
- package/dist/openalgo-charts.workspace.mjs +1 -1
- package/dist/openalgo-charts.workspace.mjs.map +1 -1
- package/dist/openalgo-charts.workspace.standalone.js +1 -0
- package/dist/profile/index.d.ts +84 -31
- package/dist/trade/index.d.ts +202 -175
- package/dist/transform/index.d.ts +44 -21
- package/dist/webgl/index.d.ts +56 -47
- package/dist/widget/index.d.ts +1647 -512
- package/dist/workspace/index.d.ts +183 -92
- package/package.json +26 -13
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ with no runtime dependencies.
|
|
|
12
12
|
[](https://www.npmjs.com/package/openalgo-charts)
|
|
13
13
|
[](./LICENSE)
|
|
14
14
|
[](https://www.npmjs.com/package/openalgo-charts)
|
|
15
|
-
[](#develop)
|
|
16
16
|
[](#principles)
|
|
17
17
|
|
|
18
18
|
[**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)
|
|
@@ -25,7 +25,7 @@ with no runtime dependencies.
|
|
|
25
25
|
npm install openalgo-charts
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
-
Current version: **2.
|
|
28
|
+
Current version: **2.6.0**, analysis depth and a stricter API: the chart applies Heikin Ashi, Renko, range bars, line break, point and figure and Kagi to the bars you feed, live, with each study on the elements or the underlying bars; seven new built-ins and a timeframe input on 29 of them; symbol search through the OpenAlgo feed; rich event details with host actions; a typed event map for `chart.on`; a classic-script build of every tier and `require()` of the ESM files; and declarations that hold for a host compiling with both strict flags. 2.5.10 was the persistence, saved layouts and chart grid release.
|
|
29
29
|
See the [changelog](./CHANGELOG.md) for release notes.
|
|
30
30
|
|
|
31
31
|
## Quick start
|
|
@@ -56,14 +56,17 @@ for live data, or [the widget example](#the-whole-terminal-in-one-call) for char
|
|
|
56
56
|
|
|
57
57
|
In a framework, create the chart when the component mounts and call `chart.destroy()`
|
|
58
58
|
when it unmounts. [Framework integration](https://marketcalls.github.io/openalgo-charts/docs/frameworks/)
|
|
59
|
-
covers React, Next.js, Angular and Svelte
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
covers plain JavaScript and the CDN build, React, Next.js, Vue 3, Angular and Svelte
|
|
60
|
+
with the same parts for each: lifecycle, reactivity, resize and theme, live data, the
|
|
61
|
+
widget, cached views and server rendering. Its
|
|
62
|
+
[Vue 3 section](https://marketcalls.github.io/openalgo-charts/docs/frameworks/#vue-3)
|
|
63
|
+
is backed by a no-build example in [`examples/vue`](./examples/vue) tested in Chromium,
|
|
64
|
+
Firefox and WebKit. In Vue, hold the chart in a `shallowRef`, never in `ref()` or
|
|
65
|
+
`reactive()`.
|
|
63
66
|
|
|
64
67
|
## Architecture
|
|
65
68
|
|
|
66
|
-
<a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.
|
|
69
|
+
<a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.6.0 architecture: host responsibilities, the base data-to-rendering pipeline with alerts and shared replay, and eight optional tiers including workspace storage, trading tools and the widget" width="920" /></a>
|
|
67
70
|
|
|
68
71
|
How data reaches the chart, what your app owns, and which features you can import.
|
|
69
72
|
[Open the full-size diagram](docs/architecture-diagram.svg).
|
|
@@ -114,7 +117,7 @@ You can also load the library from a CDN in a plain HTML page:
|
|
|
114
117
|
```html
|
|
115
118
|
<div id="chart" style="width:100vw;height:100vh"></div>
|
|
116
119
|
<script type="module">
|
|
117
|
-
import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.
|
|
120
|
+
import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.6.0/dist/openalgo-charts.mjs';
|
|
118
121
|
const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
|
|
119
122
|
chart.addSeries('candlestick').setData(generateBars(1700000000, 200, 3600));
|
|
120
123
|
chart.fitContent();
|
|
@@ -122,7 +125,7 @@ You can also load the library from a CDN in a plain HTML page:
|
|
|
122
125
|
```
|
|
123
126
|
|
|
124
127
|
Each optional tier has its own file. For example,
|
|
125
|
-
`openalgo-charts.indicators.mjs` registers all
|
|
128
|
+
`openalgo-charts.indicators.mjs` registers all 112 built-in indicators. Pin the
|
|
126
129
|
version in production. The base chart needs no stylesheet; the widget adds its
|
|
127
130
|
own styles. See
|
|
128
131
|
[Use from a CDN](https://marketcalls.github.io/openalgo-charts/docs/cdn).
|
|
@@ -138,7 +141,7 @@ const widget = createWidget('#terminal', {
|
|
|
138
141
|
feed: new OpenAlgoDataFeed({ baseUrl: 'http://127.0.0.1:5000', apiKey: 'YOUR_KEY' }),
|
|
139
142
|
symbol: 'RELIANCE', exchange: 'NSE', interval: '5m',
|
|
140
143
|
theme: 'dark',
|
|
141
|
-
mobile: 'auto', // compact controls
|
|
144
|
+
mobile: 'auto', // compact controls up to 640 CSS px wide, or a phone on its side (coarse pointer, up to 960 px wide and under 600 px tall)
|
|
142
145
|
persist: true,
|
|
143
146
|
onOrder: (order) => broker.place(order), // the right-click menu offers order entry only when this is set
|
|
144
147
|
});
|
|
@@ -149,12 +152,16 @@ widget.draw; // the DrawingController the rail drives
|
|
|
149
152
|
|
|
150
153
|
The optional widget adds symbol search, interval and chart-type controls, a drawing
|
|
151
154
|
toolbar, settings, indicators, a status line, mobile controls and layout persistence.
|
|
152
|
-
Its dialogs use the chart's settings schemas and follow the active theme.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
Its dialogs use the chart's settings schemas and follow the active theme. A bottom bar
|
|
156
|
+
under the chart carries preset ranges, the market status, a clock and the scale toggles,
|
|
157
|
+
and its **Go to** (in the top bar with `bottombar: false`) jumps to a date or a range,
|
|
158
|
+
loading older history first (`widget.goTo`), and `createChartGrid` lays out one widget
|
|
159
|
+
per cell, from one chart to sixteen in uniform and uneven layouts, with splitters, a
|
|
160
|
+
grid bar, maximize and swap, named link groups, one bottom bar for the active chart,
|
|
161
|
+
saved desks, one picture of every chart and portable workspace documents. The panel
|
|
162
|
+
dock also holds named **Watchlists** with live quote rows and a **News** reader when the
|
|
163
|
+
host supplies a quote or news feed, and an account summary when its broker declares
|
|
164
|
+
accounts.
|
|
158
165
|
Undo and Redo walk one timeline for the whole chart (`widget.history`): studies
|
|
159
166
|
added, removed or edited, scale and pane changes, chart settings and drawings, in
|
|
160
167
|
the order they were made.
|
|
@@ -172,17 +179,17 @@ Unused optional tiers stay out of the base chart download.
|
|
|
172
179
|
|
|
173
180
|
| Import | Contents | Brotli |
|
|
174
181
|
|---|---|---|
|
|
175
|
-
| `openalgo-charts` | Engine, 13 chart types, panes and scales, custom indicator registry, primitives, alerts, replay, comparisons, chart linking, state, feeds, bar cache, trading overlays, CSV and SVG export |
|
|
176
|
-
| `openalgo-charts/indicators` |
|
|
177
|
-
| `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons |
|
|
178
|
-
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) |
|
|
179
|
-
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.
|
|
180
|
-
| `openalgo-charts/trade` | Order, position and bracket tools, account state, order preview and position commands, plus a depth-of-market ladder | 16.
|
|
181
|
-
| `openalgo-charts/webgl` | GPU drawing for supported series, with Canvas 2D fallback | 6.
|
|
182
|
-
| `openalgo-charts/widget` | `createWidget`: toolbar, Data, Objects, Watchlist and News dock, account summary, symbol search, dialogs, mobile controls, shortcuts and optional
|
|
183
|
-
| `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named watchlists, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM | 11.
|
|
184
|
-
|
|
185
|
-
Everything together is **
|
|
182
|
+
| `openalgo-charts` | Engine, 13 chart types, panes and scales, custom indicator registry, primitives, alerts, replay, comparisons, chart linking, state, feeds, bar cache, trading overlays, CSV and SVG export | 137.53 kB |
|
|
183
|
+
| `openalgo-charts/indicators` | 112 built-in indicators, calculation helpers and helpers for studies that use external data | 43.02 kB |
|
|
184
|
+
| `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 58.36 kB |
|
|
185
|
+
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) | 6.07 kB |
|
|
186
|
+
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.94 kB |
|
|
187
|
+
| `openalgo-charts/trade` | Order, position and bracket tools, account state, order preview and position commands, plus a depth-of-market ladder | 16.88 kB |
|
|
188
|
+
| `openalgo-charts/webgl` | GPU drawing for supported series, with Canvas 2D fallback | 6.97 kB |
|
|
189
|
+
| `openalgo-charts/widget` | `createWidget`: toolbar, bottom bar, Data, Objects, Watchlist and News dock, account summary, symbol search, dialogs, mobile controls, a shortcuts editor, saved layouts, the chart grid (`createChartGrid`) and optional persistence in IndexedDB | 123.57 kB |
|
|
190
|
+
| `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named watchlists, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM | 11.73 kB |
|
|
191
|
+
|
|
192
|
+
Everything together is **419.05 kB Brotli**; a widget terminal with built-in indicators (base + draw + indicators + widget) is 362.48 kB. The widget's seven first-use parts (the shortcuts editor, the Layouts menu, the templates list, the chart data dialog, the grid bar and its menus, and the IndexedDB store) add 18.24 kB in files of their own, fetched only when a widget first uses one. The nine classic-script files together are 430.90 kB. Figures are measured from the 2.6.0 release build. The trade tier is 16.88 kB on its own; base + trade costs 154.41 kB. Sizes use decimal kB.
|
|
186
193
|
|
|
187
194
|
## What's built
|
|
188
195
|
|
|
@@ -199,7 +206,7 @@ const macd = chart.addIndicator('macd', { fastPeriod: 8 }); // gets its own pa
|
|
|
199
206
|
macd.setSettings({ 'macd:width': 2, 'macd:lineStyle': 'dashed' });
|
|
200
207
|
```
|
|
201
208
|
|
|
202
|
-
|
|
209
|
+
112 built-ins across Trend, Momentum, Volatility and Volume, from the everyday (SMA, EMA, WMA, VWAP, Bollinger Bands, RSI, MACD, Stochastic, ADX/DMI, ATR) through Supertrend, HalfTrend, Ichimoku, Keltner, Donchian, Chandelier Exit and CPR with floor pivots to Connors RSI, Fisher Transform, Woodies CCI, Klinger, Vortex, WaveTrend Pro, Chop Zone and Williams Fractals, with a least-squares family (Least Squares Moving Average, Linear Regression Slope, Standard Error, Standard Error Bands) and a Smoothed Moving Average alongside them, joined in 1.8.3 by the T3 average, the Hull Suite (Hma / Ehma / Thma with a displaced band) and Consolidation and Breakout, which tracks inside-bar ranges and marks the bar that leaves one. Version 2.6.0 adds ZigZag, 52 Week High/Low, Zero Lag EMA, Variable Index Dynamic Average, Elder-Ray Index, Schaff Trend Cycle and Volatility Squeeze. Twenty-eight of them draw shaded bands, six emit named buy/sell markers, three recolour the price candles, and Seasonality draws a monthly return heatmap as a table over the chart. The full catalogue with ids and defaults is in the docs.
|
|
203
210
|
|
|
204
211
|
Since 2.4.0 a study can fold the chart's own bars up to a higher timeframe with `securitySeries` (as the bucket stood at each bar, or the last completed one, or with lookahead when reproducing a source that repaints), paint a plot displaced by a number of bars, colour a candle's wick and border apart from its body, pin a marker to the pane edge, put a tooltip on a drawn zone, compute an alert message from the bar that fired, and ask the host for another instrument's bars through `chart.setBarsProvider`. A calculation that throws once it is on the chart is reported on that study's data status rather than thrown into the render loop.
|
|
205
212
|
|
|
@@ -500,7 +507,7 @@ chart.on('renderer:fallback', ({ from, to, reason }) => log(reason));
|
|
|
500
507
|
The series pass on each pane goes through a render backend port. The shipped Canvas2D backend was pixel-identical to 1.9.2 when the port landed in 2.0.0, and the render-parity spec holds later changes to zero differing pixels against a baseline build from `npm run baseline` (it skips when no baseline is present). The `openalgo-charts/webgl` tier registers a WebGL2 backend that batches every standard chart type into one shared offscreen surface per page with analytic anti-aliasing and composites it into the pane's own canvas, so screenshots, the SVG export and the DOM are unchanged and a dashboard of panes never opens more than one GL context. `'webgl2'` throws until the tier is imported and falls back to the 2D path with one warning on a device without WebGL2; `'auto'` is the silent form. A lost context moves the chart to `canvas2d` for the session and emits `renderer:fallback`. Text, dashed lines, gradients, drawings and custom types stay on the 2D context, which already does them well.
|
|
501
508
|
|
|
502
509
|
### Data
|
|
503
|
-
OpenAlgo REST history + WebSocket ticks with auto-reconnect and resubscribe, live candle aggregation, tick/volume bars, a unified `chart.on(...)` event bus, markers and signals, earnings/dividend/expiry event markers, an IANA chart timezone, and custom price/time formatters. Regular and extended hours, adjusted and raw prices, and a quote currency or unit are each their own provider series (`BarsRequest.variant`, `DataFeed.dataVariants`): nothing is converted locally, and a variant the feed does not declare is reported rather than made up. A session calendar (`chart.setSessionCalendar`, `Instrument.applyTo`) lays the space past the last bar out in the venue's hours, so a drawing placed there lands on a real session time.
|
|
510
|
+
OpenAlgo REST history + WebSocket ticks with auto-reconnect and resubscribe, live candle aggregation, tick/volume bars, a unified `chart.on(...)` event bus, markers and signals, earnings/dividend/expiry event markers, an IANA chart timezone, and custom price/time formatters. Regular and extended hours, adjusted and raw prices, and a quote currency or unit are each their own provider series (`BarsRequest.variant`, `DataFeed.dataVariants`): nothing is converted locally, and a variant the feed does not declare is reported rather than made up. A session calendar (`chart.setSessionCalendar`, `Instrument.applyTo`) lays the space past the last bar out in the venue's hours, so a drawing placed there lands on a real session time. The same calendar answers which part of the trading day an instant falls in (pre-open, regular, post-close, extended, closed or holiday) and a market status for now (`marketStatusAt`), and `attachSessionShading` washes the pre-open, post-close and extended-hours bars when a host asks for it.
|
|
504
511
|
|
|
505
512
|
## Size budget
|
|
506
513
|
|
|
@@ -508,17 +515,19 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
|
|
|
508
515
|
|
|
509
516
|
| Bundle | Limit | Actual |
|
|
510
517
|
|---|---|---|
|
|
511
|
-
| Base engine |
|
|
512
|
-
| Base + trade |
|
|
513
|
-
| Indicators tier |
|
|
514
|
-
| Draw tier |
|
|
515
|
-
| Transform tier | 6 kB |
|
|
516
|
-
| Profile tier |
|
|
517
|
-
| WebGL2 tier |
|
|
518
|
-
| Widget tier |
|
|
519
|
-
| Widget
|
|
520
|
-
|
|
|
521
|
-
|
|
|
518
|
+
| Base engine | 137.54 kB | 137.53 kB |
|
|
519
|
+
| Base + trade | 154.42 kB | 154.41 kB |
|
|
520
|
+
| Indicators tier | 43.02 kB | 43.02 kB |
|
|
521
|
+
| Draw tier | 58.36 kB | 58.36 kB |
|
|
522
|
+
| Transform tier | 6.07 kB | 6.07 kB |
|
|
523
|
+
| Profile tier | 14.94 kB | 14.94 kB |
|
|
524
|
+
| WebGL2 tier | 6.97 kB | 6.97 kB |
|
|
525
|
+
| Widget tier | 123.57 kB | 123.57 kB |
|
|
526
|
+
| Widget first-use parts (seven files beside the widget tier) | 18.24 kB | 18.24 kB |
|
|
527
|
+
| Widget terminal (base + draw + indicators + widget) | 362.48 kB | 362.48 kB |
|
|
528
|
+
| Workspace tier | 11.73 kB | 11.73 kB |
|
|
529
|
+
| Script tags (the nine classic-script files) | 430.91 kB | 430.90 kB |
|
|
530
|
+
| **Everything** | 419.06 kB | 419.05 kB |
|
|
522
531
|
|
|
523
532
|
## Documentation
|
|
524
533
|
|
|
@@ -568,15 +577,15 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
|
|
|
568
577
|
|
|
569
578
|
```bash
|
|
570
579
|
npm install # install dev toolchain
|
|
571
|
-
npm run typecheck #
|
|
572
|
-
npm test # engine unit tests (Vitest):
|
|
573
|
-
npm run test:demo # reference-host tests:
|
|
580
|
+
npm run typecheck # TypeScript: src with the stricter flags, then the tests
|
|
581
|
+
npm test # engine unit tests (Vitest): 11591 across 512 files
|
|
582
|
+
npm run test:demo # reference-host tests: 689 across 67 files
|
|
574
583
|
npm run test:endurance # node endurance-harness tests: 7 cases
|
|
575
584
|
npm run build # Rollup -> dist/ (minified ESM per tier + types)
|
|
576
585
|
npm run size # size-limit (Brotli) against the budget
|
|
577
586
|
npm run e2e # Playwright Chromium smoke tests
|
|
578
587
|
npm run bench:render # render bench: pan, zoom-out and tick frame budgets per bar count
|
|
579
|
-
npm run verify # lint + types + unit + endurance harness + build + demo + dts + size + shake
|
|
588
|
+
npm run verify # lint + types + cycles + unused exports + unit + endurance harness + build + demo + dts + exports + compat + size + shake
|
|
580
589
|
```
|
|
581
590
|
|
|
582
591
|
## Principles
|
|
@@ -590,7 +599,7 @@ npm run verify # lint + types + unit + endurance harness + build + demo + dt
|
|
|
590
599
|
|
|
591
600
|
## Status & limitations
|
|
592
601
|
|
|
593
|
-
Version **2.
|
|
602
|
+
Version **2.6.0**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
|
|
594
603
|
|
|
595
604
|
Known gaps, stated plainly:
|
|
596
605
|
|