openalgo-charts 2.5.3 → 2.5.5

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
@@ -25,7 +25,7 @@ with no runtime dependencies.
25
25
  npm install openalgo-charts
26
26
  ```
27
27
 
28
- Current version: **2.5.3**. Inspect chart data, organize drawings and studies, and find instruments faster.
28
+ Current version: **2.5.5**. Watchlists, news and account panels, a movable price pane, drawings pinned to the screen, price tick bands, and studies that recover after a missing bar.
29
29
  See the [changelog](./CHANGELOG.md) for release notes.
30
30
 
31
31
  ## Quick start
@@ -56,7 +56,7 @@ for live data, or [the widget example](#the-whole-terminal-in-one-call) for char
56
56
 
57
57
  ## Architecture
58
58
 
59
- <a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.5.3 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>
59
+ <a href="docs/architecture-diagram.svg"><img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts 2.5.5 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
60
 
61
61
  How data reaches the chart, what your app owns, and which features you can import.
62
62
  [Open the full-size diagram](docs/architecture-diagram.svg).
@@ -107,7 +107,7 @@ You can also load the library from a CDN in a plain HTML page:
107
107
  ```html
108
108
  <div id="chart" style="width:100vw;height:100vh"></div>
109
109
  <script type="module">
110
- import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.5.3/dist/openalgo-charts.mjs';
110
+ import { createChart, generateBars } from 'https://unpkg.com/openalgo-charts@2.5.5/dist/openalgo-charts.mjs';
111
111
  const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
112
112
  chart.addSeries('candlestick').setData(generateBars(1700000000, 200, 3600));
113
113
  chart.fitContent();
@@ -142,7 +142,12 @@ widget.draw; // the DrawingController the rail drives
142
142
 
143
143
  The optional widget adds symbol search, interval and chart-type controls, a drawing
144
144
  toolbar, settings, indicators, a status line, mobile controls and layout persistence.
145
- Its dialogs use the chart's settings schemas and follow the active theme.
145
+ Its dialogs use the chart's settings schemas and follow the active theme. **Go to**
146
+ jumps to a date or a range, loading older history first (`widget.goTo`), and
147
+ `createChartGrid` lays out one widget per cell, from `1x1` to `2x2`, with splitters,
148
+ linked charts and portable workspace documents. The panel dock also holds named
149
+ **Watchlists** with live quote rows and a **News** reader when the host supplies a
150
+ quote or news feed, and an account summary when its broker declares accounts.
146
151
 
147
152
  The widget uses the same public API as a custom interface. Your app supplies the
148
153
  data feed and handles order requests; the widget does not choose a broker or send
@@ -157,17 +162,17 @@ Unused optional tiers stay out of the base chart download.
157
162
 
158
163
  | Import | Contents | Brotli |
159
164
  |---|---|---|
160
- | `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 | 96.54 kB |
161
- | `openalgo-charts/indicators` | 105 built-in indicators, calculation helpers and helpers for studies that use external data | 29.84 kB |
162
- | `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 41.56 kB |
165
+ | `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 | 119.15 kB |
166
+ | `openalgo-charts/indicators` | 105 built-in indicators, calculation helpers and helpers for studies that use external data | 36.34 kB |
167
+ | `openalgo-charts/draw` | 87 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 44.87 kB |
163
168
  | `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point &amp; Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) | 4.50 kB |
164
169
  | `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 kB |
165
- | `openalgo-charts/trade` | Order, position and bracket tools, plus a depth-of-market ladder | 8.01 kB |
170
+ | `openalgo-charts/trade` | Order, position and bracket tools, account state, order preview and position commands, plus a depth-of-market ladder | 16.64 kB |
166
171
  | `openalgo-charts/webgl` | GPU drawing for supported series, with Canvas 2D fallback | 6.39 kB |
167
- | `openalgo-charts/widget` | `createWidget`: toolbar, Data and Objects dock, symbol search, dialogs, mobile controls, shortcuts and optional layout persistence | 59.22 kB |
168
- | `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM | 5.55 kB |
172
+ | `openalgo-charts/widget` | `createWidget`: toolbar, Data, Objects, Watchlist and News dock, account summary, symbol search, dialogs, mobile controls, shortcuts and optional layout persistence | 82.30 kB |
173
+ | `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named watchlists, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM | 9.99 kB |
169
174
 
170
- Everything together is **266.57 kB Brotli**; a widget terminal with built-in indicators (base + draw + indicators + widget) is 227.16 kB. Figures are measured from the 2.5.3 release build. The trade tier is 8.01 kB on its own; base + trade costs 104.55 kB. Sizes use decimal kB.
175
+ Everything together is **335.15 kB Brotli**; a widget terminal with built-in indicators (base + draw + indicators + widget) is 282.67 kB. Figures are measured from the 2.5.5 release build. The trade tier is 16.64 kB on its own; base + trade costs 135.79 kB. Sizes use decimal kB.
171
176
 
172
177
  ## What's built
173
178
 
@@ -225,7 +230,7 @@ draw.setTool('trend-line'); // the next two clicks place it
225
230
 
226
231
  87 tools. Lines, channels and four pitchfork variants. Fibonacci levels, time projections, fans, circles, arcs, wedges and spirals. Gann fans, boxes and squares. Harmonic patterns, Elliott waves and Head and Shoulders. Geometric wavefronts and tessellation. Shapes, paths, forecasts, positions, measurements, text, tables and freehand brushes. Every tool appears in the [editable drawing gallery](https://marketcalls.github.io/openalgo-charts/demos/drawings/index.html), with simulated NIFTY prices near 23800 and desktop or touch controls.
227
232
 
228
- Headless by design: no toolbar, no dialogs. Placement with live preview, selection, whole-shape and per-anchor dragging, magnet snap to O/H/L/C, undo/redo (a drag is one step), and persistence. Anchors are `{ time, price }`, never pixels, so they survive zoom and resolve inside collapsed session gaps and past the last bar.
233
+ Headless by design: no toolbar, no dialogs. Placement with live preview, selection, whole-shape and per-anchor dragging, magnet snap to O/H/L/C, undo/redo (a drag is one step), and persistence. A drawing can be pinned to the screen (`space: 'viewport'`), so pan and zoom leave it where it is. A drawing's `policy` makes it read-only, unselectable, transient or unlisted, for levels the host places and the user should not move. Anchors are `{ time, price }`, never pixels, so they survive zoom and resolve inside collapsed session gaps and past the last bar.
229
234
 
230
235
  `draw.copy()`, `draw.cut()` and `draw.paste()` move drawings through the OS clipboard, including between two charts on the page. The payload is JSON under one namespaced key, so foreign text pastes nothing instead of throwing at your Ctrl+V handler, and every field is validated before it reaches the model. A refused clipboard permission does not lose the copy: every write also lands in a shared in-memory clipboard, and a cut deletes only after the write succeeds. A paste is one undo step of fresh objects, nudged two bars and 16 px so it is visibly a second shape. The key bindings stay yours; the engine installs no listeners.
231
236
 
@@ -252,7 +257,7 @@ A drawing carries a paint order (`zIndex`: below zero paints under the series, a
252
257
  Under the hand: the drawing under the pointer shows its handles faintly before it is grabbed (`hovered()`, `drawing:hover`), at the cost of the overlay tier only; Shift locks a line to 45 degree steps while placing or dragging a handle; the magnet paints a ring on the bar centre where the next click will land, and `'weak'` pulls only when an O/H/L/C is within a few pixels; grab targets grow for a touch pointer; Escape, Enter and Backspace cancel, finish or pop an anchor while placing, through `keyToDrawingAction`, which also maps undo, redo, copy, cut, paste, duplicate, delete and arrow nudge as a pure function you wire yourself. Line tools take a `showStats` readout of change, percent, bars and angle. The brush and highlighter ink every coalesced pointer sample, thin on release and paint as a spline, with pen pressure driving the width when `style.pressure` is on. Every tool icon and a chrome set ship as path data with builders for an inline `<svg>`, a sprite with `<use>` and a CSS cursor (`iconSvg`, `iconSprite`, `iconUse`, `toolCursor`), so a rail, a flyout and the armed cursor derive from one registry.
253
258
 
254
259
  ### Panes, scales &amp; legends
255
- Draggable pane dividers, move / maximize / remove, and pane legends showing one reading per plot in that plot's own colour, with inline show-hide / settings / move / delete controls revealed on hover. The status line is switchable field by field (logo, title, market status, OHLC, bar change, volume, last day change, last value) over a host-supplied data source.
260
+ Draggable pane dividers, move / maximize / collapse to a strip / remove (and, on a chart that opts in with `movablePrimaryPane`, move the price pane below its studies), and pane legends showing one reading per plot in that plot's own colour, with inline show-hide / settings / move / delete controls revealed on hover. The status line is switchable field by field (logo, title, market status, OHLC, bar change, volume, last day change, last value) over a host-supplied data source.
256
261
 
257
262
  Each pane carries a right, a left and a hidden overlay price scale, in four modes: linear, logarithmic, and the two rebasing modes **percentage** (`+3.42%`) and **indexed-to-100** (`103.42`), which quote every price against a baseline taken from the first visible bar, so panning re-bases the axis.
258
263
 
@@ -322,6 +327,8 @@ Hover one chart and the same **instant** is marked on the others; pan or zoom on
322
327
 
323
328
  Nothing crosses a chart boundary as a logical index. The x axis is a gapless index over each chart's own bars, so index 300 is a different instant on every chart: every value is converted index to time on the sender and time back to index on the receiver, against that chart's own data. A daily chart and an hourly chart with different history depth therefore stay on the same instant, which the naive index copy gets right only when both charts hold the same bars. An instant outside a follower's first or last bar is an absence, not a gap, so it draws nothing; inside its range with no bar there it snaps to the nearest bar in time, or draws nothing under `whenMissing: 'hide'`. The linked crosshair is a vertical line only, at reduced opacity: a mirrored horizontal line would assert a price that belongs to another instrument.
324
329
 
330
+ For a ready-made grid of widgets with these links, splitters and saved layouts, use `createChartGrid` from `openalgo-charts/widget`.
331
+
325
332
  Symbol sync remains a host partnership even when using optional instrument metadata: the host emits `'symbol'` on the chart's bus (or calls `group.setSymbol`) and supplies the per-member `onSymbol` that loads the bars. A member with no `onSymbol` broadcasts but never follows, which is how you pin one chart of a grid.
326
333
 
327
334
  ### Settings &amp; context menu
@@ -330,7 +337,7 @@ Symbol sync remains a host partnership even when using optional instrument metad
330
337
  `chart.on('contextmenu', ...)` reports the pane, price, time, logical index and what sits under the pointer: a drawing, an indicator instance, a legend, a primitive, a series, a price scale (with the side and the scale id it names), the time scale, or empty plot. For a menu raised on a price axis, `chart.priceAxisState(pane, scaleId)` reads back every item that menu draws (auto-fit, invert, scale mode, price-per-bar lock, whether the axis is movable) and `setPriceAxisOptions`, `setPriceAxisAutoFit`, `setPriceAxisLockRatio` and `movePriceAxis` act on it, so no row is ticked with nothing behind it.
331
338
 
332
339
  ### Trading
333
- Order, position, and bracket lines with live P&amp;L, one-click and drag-to-modify, OCO, validation, an order state machine, analyzer (sandbox) mode, and a depth-of-market ladder (5 to 200 levels).
340
+ Order, position, and bracket lines with live P&amp;L, one-click and drag-to-modify, OCO, validation, an order state machine, analyzer (sandbox) mode, and a depth-of-market ladder (5 to 200 levels). Instruments can carry a price-dependent tick schedule that validation, dragging and the ladder follow, and brokers that declare them get account state, order preview, durations and native close, reverse and bracket commands.
334
341
 
335
342
  ### Depth of market: simulated live example
336
343
 
@@ -489,17 +496,17 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
489
496
 
490
497
  | Bundle | Limit | Actual |
491
498
  |---|---|---|
492
- | Base engine | 97 kB | 96.54 kB |
493
- | Base + trade | 105.1 kB | 104.55 kB |
494
- | Indicators tier | 30 kB | 29.84 kB |
495
- | Draw tier | 42 kB | 41.56 kB |
499
+ | Base engine | 119.15 kB | 119.15 kB |
500
+ | Base + trade | 135.79 kB | 135.79 kB |
501
+ | Indicators tier | 36.35 kB | 36.34 kB |
502
+ | Draw tier | 44.87 kB | 44.87 kB |
496
503
  | Transform tier | 6 kB | 4.50 kB |
497
504
  | Profile tier | 15 kB | 14.96 kB |
498
505
  | WebGL2 tier | 7 kB | 6.39 kB |
499
- | Widget tier | 60.5 kB | 59.22 kB |
500
- | Widget terminal (base + draw + indicators + widget) | 229 kB | 227.16 kB |
501
- | Workspace tier | 6 kB | 5.55 kB |
502
- | **Everything** | 269 kB | 266.57 kB |
506
+ | Widget tier | 82.31 kB | 82.30 kB |
507
+ | Widget terminal (base + draw + indicators + widget) | 282.67 kB | 282.67 kB |
508
+ | Workspace tier | 9.99 kB | 9.99 kB |
509
+ | **Everything** | 335.15 kB | 335.15 kB |
503
510
 
504
511
  ## Documentation
505
512
 
@@ -544,8 +551,8 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
544
551
  ```bash
545
552
  npm install # install dev toolchain
546
553
  npm run typecheck # strict TypeScript check
547
- npm test # engine unit tests (Vitest): 6095 across 268 files
548
- npm run test:demo # reference-host tests: 424 across 35 files
554
+ npm test # engine unit tests (Vitest): 8660 across 381 files
555
+ npm run test:demo # reference-host tests: 589 across 56 files
549
556
  npm run test:endurance # node endurance-harness tests: 7 cases
550
557
  npm run build # Rollup -> dist/ (minified ESM per tier + types)
551
558
  npm run size # size-limit (Brotli) against the budget
@@ -563,7 +570,7 @@ npm run verify # lint + types + unit + endurance harness + build + demo + dt
563
570
 
564
571
  ## Status &amp; limitations
565
572
 
566
- Version **2.5.3**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
573
+ Version **2.5.5**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
567
574
 
568
575
  Known gaps, stated plainly:
569
576