openalgo-charts 2.5.7 → 2.5.9
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 +43 -28
- package/dist/draw/index.d.ts +552 -164
- package/dist/index.d.ts +235 -29
- 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.transform.mjs +1 -1
- package/dist/openalgo-charts.transform.mjs.map +1 -1
- package/dist/openalgo-charts.webgl.mjs +1 -1
- package/dist/openalgo-charts.webgl.mjs.map +1 -1
- package/dist/openalgo-charts.widget.mjs +1 -1
- package/dist/openalgo-charts.widget.mjs.map +1 -1
- package/dist/openalgo-charts.workspace.mjs +1 -1
- package/dist/openalgo-charts.workspace.mjs.map +1 -1
- package/dist/webgl/index.d.ts +37 -13
- package/dist/widget/index.d.ts +288 -153
- package/dist/workspace/index.d.ts +116 -1
- package/package.json +5 -2
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.5.
|
|
28
|
+
Current version: **2.5.9**, drawing interaction and replay: drawings belong to the instrument they were drawn on, the magnet works on every pane and in every drag, box select, drag to copy, an eraser, a temporary measure and visibility per interval join the drawing controller, the widget adds a floating drawing toolbar, style templates and a coordinates tab, replay's forming bar stays inside the bar it closes on (and can form over simulated steps where no finer data exists), and lines reach the edges of the view. 2.5.8 was the rendering performance release.
|
|
29
29
|
See the [changelog](./CHANGELOG.md) for release notes.
|
|
30
30
|
|
|
31
31
|
## Quick start
|
|
@@ -54,9 +54,16 @@ Bar timestamps use UTC seconds. See [getting started](./docs/getting-started.md)
|
|
|
54
54
|
for setup, [data feeds](https://marketcalls.github.io/openalgo-charts/docs/data-feeds/)
|
|
55
55
|
for live data, or [the widget example](#the-whole-terminal-in-one-call) for chart controls.
|
|
56
56
|
|
|
57
|
+
In a framework, create the chart when the component mounts and call `chart.destroy()`
|
|
58
|
+
when it unmounts. [Framework integration](https://marketcalls.github.io/openalgo-charts/docs/frameworks/)
|
|
59
|
+
covers React, Next.js, Angular and Svelte. The [Vue 3 guide](https://marketcalls.github.io/openalgo-charts/docs/vue/)
|
|
60
|
+
has a composable and a component tested in Chromium, Firefox and WebKit, with a
|
|
61
|
+
no-build example in [`examples/vue`](./examples/vue). In Vue, hold the chart in a
|
|
62
|
+
`shallowRef`, never in `ref()` or `reactive()`.
|
|
63
|
+
|
|
57
64
|
## Architecture
|
|
58
65
|
|
|
59
|
-
<a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.5.
|
|
66
|
+
<a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.5.9 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>
|
|
60
67
|
|
|
61
68
|
How data reaches the chart, what your app owns, and which features you can import.
|
|
62
69
|
[Open the full-size diagram](docs/architecture-diagram.svg).
|
|
@@ -107,7 +114,7 @@ You can also load the library from a CDN in a plain HTML page:
|
|
|
107
114
|
```html
|
|
108
115
|
<div id="chart" style="width:100vw;height:100vh"></div>
|
|
109
116
|
<script type="module">
|
|
110
|
-
import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.5.
|
|
117
|
+
import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.5.9/dist/openalgo-charts.mjs';
|
|
111
118
|
const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
|
|
112
119
|
chart.addSeries('candlestick').setData(generateBars(1700000000, 200, 3600));
|
|
113
120
|
chart.fitContent();
|
|
@@ -165,17 +172,17 @@ Unused optional tiers stay out of the base chart download.
|
|
|
165
172
|
|
|
166
173
|
| Import | Contents | Brotli |
|
|
167
174
|
|---|---|---|
|
|
168
|
-
| `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 |
|
|
169
|
-
| `openalgo-charts/indicators` | 105 built-in indicators, calculation helpers and helpers for studies that use external data |
|
|
170
|
-
| `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons |
|
|
171
|
-
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) | 4.
|
|
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 | 131.68 kB |
|
|
176
|
+
| `openalgo-charts/indicators` | 105 built-in indicators, calculation helpers and helpers for studies that use external data | 40.38 kB |
|
|
177
|
+
| `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 55.61 kB |
|
|
178
|
+
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) | 4.56 kB |
|
|
172
179
|
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 kB |
|
|
173
180
|
| `openalgo-charts/trade` | Order, position and bracket tools, account state, order preview and position commands, plus a depth-of-market ladder | 16.69 kB |
|
|
174
|
-
| `openalgo-charts/webgl` | GPU drawing for supported series, with Canvas 2D fallback | 6.
|
|
175
|
-
| `openalgo-charts/widget` | `createWidget`: toolbar, Data, Objects, Watchlist and News dock, account summary, symbol search, dialogs, mobile controls, shortcuts and optional layout persistence |
|
|
176
|
-
| `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named watchlists, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM |
|
|
181
|
+
| `openalgo-charts/webgl` | GPU drawing for supported series, with Canvas 2D fallback | 6.93 kB |
|
|
182
|
+
| `openalgo-charts/widget` | `createWidget`: toolbar, Data, Objects, Watchlist and News dock, account summary, symbol search, dialogs, mobile controls, shortcuts and optional layout persistence | 99.64 kB |
|
|
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.33 kB |
|
|
177
184
|
|
|
178
|
-
Everything together is **
|
|
185
|
+
Everything together is **381.78 kB Brotli**; a widget terminal with built-in indicators (base + draw + indicators + widget) is 327.32 kB. Figures are measured from the 2.5.9 release build. The trade tier is 16.69 kB on its own; base + trade costs 148.36 kB. Sizes use decimal kB.
|
|
179
186
|
|
|
180
187
|
## What's built
|
|
181
188
|
|
|
@@ -501,17 +508,17 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
|
|
|
501
508
|
|
|
502
509
|
| Bundle | Limit | Actual |
|
|
503
510
|
|---|---|---|
|
|
504
|
-
| Base engine |
|
|
505
|
-
| Base + trade |
|
|
506
|
-
| Indicators tier |
|
|
507
|
-
| Draw tier |
|
|
508
|
-
| Transform tier | 6 kB | 4.
|
|
511
|
+
| Base engine | 131.68 kB | 131.68 kB |
|
|
512
|
+
| Base + trade | 148.37 kB | 148.36 kB |
|
|
513
|
+
| Indicators tier | 40.39 kB | 40.38 kB |
|
|
514
|
+
| Draw tier | 55.62 kB | 55.61 kB |
|
|
515
|
+
| Transform tier | 6 kB | 4.56 kB |
|
|
509
516
|
| Profile tier | 15 kB | 14.96 kB |
|
|
510
|
-
| WebGL2 tier | 7 kB | 6.
|
|
511
|
-
| Widget tier |
|
|
512
|
-
| Widget terminal (base + draw + indicators + widget) |
|
|
513
|
-
| Workspace tier |
|
|
514
|
-
| **Everything** |
|
|
517
|
+
| WebGL2 tier | 7 kB | 6.93 kB |
|
|
518
|
+
| Widget tier | 99.65 kB | 99.64 kB |
|
|
519
|
+
| Widget terminal (base + draw + indicators + widget) | 327.32 kB | 327.32 kB |
|
|
520
|
+
| Workspace tier | 11.34 kB | 11.33 kB |
|
|
521
|
+
| **Everything** | 381.79 kB | 381.78 kB |
|
|
515
522
|
|
|
516
523
|
## Documentation
|
|
517
524
|
|
|
@@ -536,7 +543,7 @@ Teach your AI coding assistant this library:
|
|
|
536
543
|
npx skills add https://github.com/marketcalls/openalgo-charts
|
|
537
544
|
```
|
|
538
545
|
|
|
539
|
-
Installs six skills from [`.github/skills/`](./.github/skills) - a reference hub with
|
|
546
|
+
Installs six skills from [`.github/skills/`](./.github/skills) - a reference hub with 26 deep-dive files covering the whole API surface and its foot-guns, plus task skills for scaffolding a chart, adding indicators, building a terminal, writing a plugin, and debugging. Works with Claude Code, Cursor, Codex, Copilot, Gemini CLI and the rest of the `skills` CLI's supported agents.
|
|
540
547
|
|
|
541
548
|
## Examples
|
|
542
549
|
|
|
@@ -549,6 +556,12 @@ cd examples/yfinance && pip install -r requirements.txt && python server.py
|
|
|
549
556
|
python server.py --fixture # no yfinance, no network: deterministic synthetic bars
|
|
550
557
|
```
|
|
551
558
|
|
|
559
|
+
A **Vue 3 example** ([`examples/vue`](./examples/vue)) runs with no build step from Vue's
|
|
560
|
+
browser build: a composable, a component with symbol, interval and theme props, a bare
|
|
561
|
+
chart and the widget under one `KeepAlive`, and a switch that unmounts both. Serve the
|
|
562
|
+
repository root after `npm run build` (for example `node tests/e2e/serve.cjs`) and open
|
|
563
|
+
`/examples/vue/index.html`.
|
|
564
|
+
|
|
552
565
|
## Develop
|
|
553
566
|
|
|
554
567
|
See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation updates and the release workflow.
|
|
@@ -556,18 +569,20 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
|
|
|
556
569
|
```bash
|
|
557
570
|
npm install # install dev toolchain
|
|
558
571
|
npm run typecheck # strict TypeScript check
|
|
559
|
-
npm test # engine unit tests (Vitest):
|
|
560
|
-
npm run test:demo # reference-host tests:
|
|
572
|
+
npm test # engine unit tests (Vitest): 9803 across 442 files
|
|
573
|
+
npm run test:demo # reference-host tests: 668 across 63 files
|
|
561
574
|
npm run test:endurance # node endurance-harness tests: 7 cases
|
|
562
575
|
npm run build # Rollup -> dist/ (minified ESM per tier + types)
|
|
563
576
|
npm run size # size-limit (Brotli) against the budget
|
|
564
577
|
npm run e2e # Playwright Chromium smoke tests
|
|
578
|
+
npm run bench:render # render bench: pan, zoom-out and tick frame budgets per bar count
|
|
565
579
|
npm run verify # lint + types + unit + endurance harness + build + demo + dts + size + shake
|
|
566
580
|
```
|
|
567
581
|
|
|
568
582
|
## Principles
|
|
569
583
|
|
|
570
|
-
- **Canvas rendering, two canvases per pane**: a base canvas for the chart, its axes and the price lines (order and position lines included), and an overlay canvas for the crosshair, the drawings and the other top-layer primitives, so a crosshair move repaints only the overlay. No SVG and no DOM element per bar; SVG appears only in `exportSVG` output and in the icon markup of the draw and widget tiers. The optional WebGL tier draws on a shared offscreen surface and copies into the base canvas. Frame times are recorded
|
|
584
|
+
- **Canvas rendering, two canvases per pane**: a base canvas for the chart, its axes and the price lines (order and position lines included), and an overlay canvas for the crosshair, the drawings and the other top-layer primitives, so a crosshair move repaints only the overlay. No SVG and no DOM element per bar; SVG appears only in `exportSVG` output and in the icon markup of the draw and widget tiers. The optional WebGL tier draws on a shared offscreen surface and copies into the base canvas. Frame times are budgeted per bar count by the render bench ([performance notes](./docs/performance-notes.md)) and recorded over long sessions by [browser endurance](./docs/browser-endurance.md).
|
|
585
|
+
- **Repaint what changed, on one loop**: a live tick repaints the price pane and the panes of the studies computed from it, and a study recompute repaints only the panes its output lands on; a write that moves the shared time scale, such as an appended bar, repaints every pane. The bottom pane repaints with them while the corner clock is on, and every pane with a price series while the bar countdown is on, since both read the time as their pane paints. Kinetic scroll and the eased wheel zoom are stepped inside the chart's own animation frame, so each frame paints the step it made.
|
|
571
586
|
- **Gapless time axis by default**: weekends, holidays, and session breaks collapse.
|
|
572
587
|
- **Registries, not switches**: chart types, indicators, and drawing tools are all descriptors. Adding one is a registration, never a core change.
|
|
573
588
|
- **Zero runtime dependencies**: nothing is excluded from the size budget.
|
|
@@ -575,14 +590,14 @@ npm run verify # lint + types + unit + endurance harness + build + demo + dt
|
|
|
575
590
|
|
|
576
591
|
## Status & limitations
|
|
577
592
|
|
|
578
|
-
Version **2.5.
|
|
593
|
+
Version **2.5.9**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
|
|
579
594
|
|
|
580
595
|
Known gaps, stated plainly:
|
|
581
596
|
|
|
582
597
|
- **Footprint and order flow need trade-by-trade data classified bid/ask.** OpenAlgo does not store this by default, so it is live-session-only unless you add a tick recorder: `FootprintAggregator` is the live path. See [`ARCHITECTURE.md`](./ARCHITECTURE.md) §6A.
|
|
583
598
|
- **Only `Footprint` is theme-aware among the profile primitives.** `VolumeProfile`, `MarketProfile` and `HorizontalProfile` never read `rc.theme`; their defaults are dark-tuned, so a light theme needs explicit colours. `HorizontalProfile` also hardcodes its POC / value-area line colours and has no `setOptions`.
|
|
584
599
|
- The OpenAlgo **WS/trade adapter wire schemas** ship with injectable transports and offline tests, but the exact field names should be verified against your running OpenAlgo build.
|
|
585
|
-
- **Large histories slow the live path.** With 150 bars in view, two charts and five studies each, the
|
|
600
|
+
- **Large histories slow the live path.** With 150 bars in view, two charts and five studies each, the frame-interval p95 recorded on 2.5.5 was 17 ms at 2,000 bars per chart and 717 ms at 50,000. The view is the same in both, so the extra time is work over the whole history, such as recomputing every study on each tick. The workload, machine and commands are in [browser endurance](./docs/browser-endurance.md); that workload has not been rerun since. 2.5.8 cut the tick: a study writes only the plot points that moved and sixteen common built-ins step from the last bar, and on the render bench a ten-study tick at 50,000 bars fell from a p95 of 1166.3 ms to 49.2 ms on `canvas2d` ([performance notes](./docs/performance-notes.md)). It still grows with the loaded history rather than the view, so bound retained history for sustained sessions.
|
|
586
601
|
- **The WebGL2 backend draws the standard chart types.** Kagi, point-and-figure and custom chart types, drawings, text and every primitive stay on the 2D context; `renderer: 'auto'` moves the series pass of the standard types to the GPU and is not a second renderer for everything. Its frame time against Canvas2D has not been measured.
|
|
587
602
|
|
|
588
603
|
See [`ARCHITECTURE.md`](./ARCHITECTURE.md) §13a for the full deferred list.
|