@tony01/astroneum 0.4.1-beta.2
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/CHANGELOG.md +237 -0
- package/LICENSE +21 -0
- package/README.md +198 -0
- package/dist/Indicator-BBI3L_lx.d.ts +1181 -0
- package/dist/ar-SA-AEPUSRMF.js +2 -0
- package/dist/astroneum.css +1 -0
- package/dist/chunk-2SN3RH42.js +2 -0
- package/dist/chunk-2YYGUSVX.js +3 -0
- package/dist/chunk-3GJSZFLM.js +2 -0
- package/dist/chunk-4YOLQ5DC.js +2 -0
- package/dist/chunk-I4YQBP2M.js +3 -0
- package/dist/chunk-OOMZRONH.js +35 -0
- package/dist/chunk-PV2GAINM.js +2 -0
- package/dist/chunk-SDXH2WAI.js +3 -0
- package/dist/chunk-YFPXTHZX.js +2 -0
- package/dist/chunk-YW3STIPY.js +653 -0
- package/dist/de-DE-4PR3NRQ7.js +2 -0
- package/dist/entries/alerts.d.ts +93 -0
- package/dist/entries/alerts.js +2 -0
- package/dist/entries/datafeeds/crypto.d.ts +65 -0
- package/dist/entries/datafeeds/crypto.js +2 -0
- package/dist/entries/datafeeds/polygon.d.ts +113 -0
- package/dist/entries/datafeeds/polygon.js +2 -0
- package/dist/entries/multichart.d.ts +96 -0
- package/dist/entries/multichart.js +2 -0
- package/dist/entries/portfolio.d.ts +55 -0
- package/dist/entries/portfolio.js +2 -0
- package/dist/entries/replay.d.ts +141 -0
- package/dist/entries/replay.js +2 -0
- package/dist/entries/script.d.ts +68 -0
- package/dist/entries/script.js +2 -0
- package/dist/entries/watchlist.d.ts +43 -0
- package/dist/entries/watchlist.js +2 -0
- package/dist/es-ES-HNDVPSLW.js +2 -0
- package/dist/fr-FR-Y7XWRGF2.js +2 -0
- package/dist/hi-IN-KEGIKIMV.js +2 -0
- package/dist/id-ID-QXDIUQUZ.js +2 -0
- package/dist/index.d.ts +1434 -0
- package/dist/index.js +2 -0
- package/dist/it-IT-UDTDFSRB.js +2 -0
- package/dist/ja-JP-NIODTBW3.js +2 -0
- package/dist/ko-KR-DQHPXKBA.js +2 -0
- package/dist/nl-NL-BB3ZHCXS.js +2 -0
- package/dist/pl-PL-I5MZDLFD.js +2 -0
- package/dist/pt-BR-MAMRTOYR.js +2 -0
- package/dist/ru-RU-F43D6B7G.js +2 -0
- package/dist/th-TH-KTFIUAD6.js +2 -0
- package/dist/tr-TR-WFTKJ22Y.js +2 -0
- package/dist/vi-VN-CD3WI2FQ.js +2 -0
- package/dist/zh-CN-Y2C6RSOI.js +3 -0
- package/docs/STRUCTURE.md +231 -0
- package/docs/TODO-DESIGN.md +261 -0
- package/docs/TODO.md +222 -0
- package/docs/api.md +528 -0
- package/docs/datafeed-guide.md +311 -0
- package/docs/design-astroneum.md +479 -0
- package/docs/plugin-development.md +565 -0
- package/docs/tv-functions-skill.md +706 -0
- package/package.json +147 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to **astroneum** are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
7
|
+
once it reaches v1.0. Until then, minor releases may include breaking changes
|
|
8
|
+
— always check this file before upgrading.
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Added — Full Indicator Parity (50 total, +23 new)
|
|
13
|
+
|
|
14
|
+
Astroneum now ships **50 technical indicators** — up from 27 — achieving full
|
|
15
|
+
parity with the comparison table against TradingView Pro. Every indicator in the
|
|
16
|
+
original roadmap (Phases 1–4) is implemented.
|
|
17
|
+
|
|
18
|
+
**Phase 1 — Critical (MVP)**
|
|
19
|
+
- **ATR** (Average True Range) — `averageTrueRange.ts` — market volatility
|
|
20
|
+
measure used for position sizing and stop-loss placement.
|
|
21
|
+
- **ADX** (Average Directional Index) — `averageDirectionalIndex.ts` —
|
|
22
|
+
standalone trend-strength indicator (0–25 weak, 25–50 strong, 50+ very
|
|
23
|
+
strong).
|
|
24
|
+
- **A/D** (Accumulation/Distribution) — `accumulationDistribution.ts` —
|
|
25
|
+
cumulative volume + CLV money flow, divergence signals for reversals.
|
|
26
|
+
|
|
27
|
+
**Phase 2 — Important (Competitive Feature)**
|
|
28
|
+
- **CMF** (Chaikin Money Flow) — `chaikinMoneyFlow.ts` — money flow over N
|
|
29
|
+
periods using close-location-within-range (default 20).
|
|
30
|
+
- **MFI** (Money Flow Index) — `moneyFlowIndex.ts` — volume-weighted RSI
|
|
31
|
+
using typical price, overbought >80 / oversold <20.
|
|
32
|
+
- **VWAP** (Volume Weighted Average Price) — `volumeWeightedAveragePrice.ts`
|
|
33
|
+
— cumulative volume-weighted typical price overlay.
|
|
34
|
+
- **Ichimoku Cloud** — `ichimokuCloud.ts` — 5-line comprehensive trend
|
|
35
|
+
system (Tenkan/Kijun/Senkou A/B/Chikou), default periods 9/26/52.
|
|
36
|
+
|
|
37
|
+
**Phase 3 — Polish (Market Completeness)**
|
|
38
|
+
- **DEMA / TEMA / WMA / VWMA** — double/triple/weighted/volume-weighted
|
|
39
|
+
moving averages (`doubleExponentialMovingAverage.ts`,
|
|
40
|
+
`tripleExponentialMovingAverage.ts`, `weightedMovingAverage.ts`,
|
|
41
|
+
`volumeWeightedMovingAverage.ts`).
|
|
42
|
+
- **HV** (Historical Volatility) — `historicalVolatility.ts` — annualized
|
|
43
|
+
volatility from log returns × √252.
|
|
44
|
+
- **DC** (Donchian Channels) — `donchianChannels.ts` — highest-high /
|
|
45
|
+
lowest-low channels with midline.
|
|
46
|
+
- **KC** (Keltner Channels) — `keltnerChannels.ts` — EMA middle line with
|
|
47
|
+
ATR-based upper/lower bands.
|
|
48
|
+
- **SuperTrend** — `superTrend.ts` — trend-following volatility stop with
|
|
49
|
+
direction tracking.
|
|
50
|
+
|
|
51
|
+
**Phase 4 — Advanced (Niche Features)**
|
|
52
|
+
- **STDDEV** (Standard Deviation) — `standardDeviation.ts` — population
|
|
53
|
+
standard deviation of close over N periods.
|
|
54
|
+
- **VROC** (Volume Rate of Change) — `volumeRateOfChange.ts` — percentage
|
|
55
|
+
change in volume over N periods.
|
|
56
|
+
- **PP** (Pivot Points) — `pivotPoints.ts` — classic pivot points with
|
|
57
|
+
R1–R3 resistance and S1–S3 support levels.
|
|
58
|
+
- **CORR** (Correlation Coefficient) — `correlationCoefficient.ts` —
|
|
59
|
+
Pearson's R between close and linear sequence 1..N.
|
|
60
|
+
- **LinReg** (Linear Regression) — `linearRegression.ts` — least-squares
|
|
61
|
+
regression line on close prices.
|
|
62
|
+
- **AMA** (Adaptive Moving Average / KAMA) — `adaptiveMovingAverage.ts` —
|
|
63
|
+
Kaufman's adaptive MA with efficiency-ratio smoothing.
|
|
64
|
+
- **HMA** (Hull Moving Average) — `hullMovingAverage.ts` — WMA-based
|
|
65
|
+
lag-reduced moving average.
|
|
66
|
+
- **ZZ** (ZigZag) — `zigzag.ts` — pivot-based trend-reversal detection
|
|
67
|
+
with configurable deviation percentage.
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
|
|
71
|
+
- **Demo page expanded** — category-organised indicator picker displaying all
|
|
72
|
+
50 indicators with tooltips, overlay vs. sub-pane visual distinction
|
|
73
|
+
(amber/green), and active-indicator status bar with counts.
|
|
74
|
+
- **`INDICATOR_COMPARISON.md`** fully rewritten to track all indicators,
|
|
75
|
+
coverage percentages per category, and completed roadmap.
|
|
76
|
+
|
|
77
|
+
### Fixed
|
|
78
|
+
|
|
79
|
+
- **SuperTrend state tracking** — replaced fragile float comparison
|
|
80
|
+
`prevSuperTrend === upperBand` with `direction` variable for correct
|
|
81
|
+
trend-state transitions.
|
|
82
|
+
- **HMA performance** — reduced from O(n³) to O(n²) by pre-computing
|
|
83
|
+
`2*WMA(n/2) - WMA(n)` values before the final WMA pass.
|
|
84
|
+
- **ZigZag pivot detection** — replaced adjacent-bar comparison with
|
|
85
|
+
running extreme tracking to reliably capture peaks/troughs during
|
|
86
|
+
consolidation phases.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Added — TradingView Competitive Parity
|
|
91
|
+
|
|
92
|
+
- **Heikin-Ashi candle type** — `barStyle="heikin_ashi"` prop. `heikinAshi(data)` exported.
|
|
93
|
+
- **Crosshair sync** in `MultiChartLayout` — `onCrosshairMove()` / `setCrosshair()` on handle.
|
|
94
|
+
- **Measure tool** — 18th drawing tool in extension. Pixel distance label + risk/reward line.
|
|
95
|
+
- **Magnet/Snap helpers** — `snapToOhlc()` and `snapAngle()` in `DrawingSnapper`.
|
|
96
|
+
- **Undo/Redo manager** — `UndoManager` class using `serializeState()`/`loadState()`.
|
|
97
|
+
- **Extended keyboard shortcuts** — arrow keys pan, Page/Home/End, mouse wheel zoom at cursor.
|
|
98
|
+
- **Copy/paste drawings** — Ctrl+C copies overlays as JSON, Ctrl+V pastes.
|
|
99
|
+
- **Session Visualizer** — `SessionVisualizer` renders session high/low/open/close lines.
|
|
100
|
+
- **Volume Profile** — `volumeProfilePlugin` horizontal histogram with POC + Value Area.
|
|
101
|
+
- **Position Visualizer** — `PositionVisualizer` entry/stop/target lines on chart.
|
|
102
|
+
- **Compare Overlay** — `createCompareIndicator()` overlays second symbol normalized to %.
|
|
103
|
+
- **Lock all drawings** — `lockAllDrawings(locked)` on `AstroneumHandle`.
|
|
104
|
+
- **Drawing live preview** — `DrawingTemplates.preview()` + `applyColor()` per-overlay.
|
|
105
|
+
- **Price axis scaling** — `priceScale='linear'|'log'|'percent'|'indexed'` prop + `PriceScaleTransform`.
|
|
106
|
+
- **Chart templates** — `ChartTemplateManager` singleton saves/loads named configs to localStorage.
|
|
107
|
+
- **Multi-timeframe resampling** — `resampleBars()`, `forwardFill()`, `mtfIndicator()`.
|
|
108
|
+
- **Non-time-based bars** — `generateRenko()`, `generateKagi()`, `generateTickBars()`, `generateRangeBars()`.
|
|
109
|
+
- **Point & Figure** — `generatePointAndFigure()`, `computePFColumns()`, `pfColumnsToBars()`.
|
|
110
|
+
- **Multi-period layout** — `MultiPeriodLayout` stacked same-symbol different periods.
|
|
111
|
+
- **Auto pattern detection** — `zigzag()`, `detectSupportResistance()`, `zigzagPlugin`.
|
|
112
|
+
- **DOM visualization** — `domPlugin` bid/ask volume ladder.
|
|
113
|
+
|
|
114
|
+
### Fixed — Bug, Perf & Security Hardening
|
|
115
|
+
|
|
116
|
+
- **Bug: `rafMergeTick` low-merge inverted** — comparison operator fixed (was `<`, now `>`).
|
|
117
|
+
- **Bug: `ScriptEngine` figures mutation** — shared `this.figures` now uses `[...result.figures]`.
|
|
118
|
+
- **Bug: Plugin `figureKeys` closure leak** — moved to per-instance `extendData`.
|
|
119
|
+
- **Bug: `Math.max(...arr)` stack overflow risk** — replaced with iterative loops in `DrawingSnapper`/`GlyphAtlas`.
|
|
120
|
+
- **Bug: LTTB decimation NaN** — empty bucket guard added in `PerformanceMode.decimate()`.
|
|
121
|
+
- **Bug: `virtualizeWindow` overlap** — startIdx/endIdx clamp added.
|
|
122
|
+
- **Bug: `useKeyboardShortcuts` stale ref** — fixed stable wrapper pattern.
|
|
123
|
+
- **Perf: Tooltip style objects pre-computed** at module scope (no per-render allocation).
|
|
124
|
+
- **Perf: `adjustFromTo()` integer math** for week/month/year (eliminates `new Date()` allocations).
|
|
125
|
+
- **Perf: `serializeState()` uses `structuredClone`** instead of recursive `deepClone`.
|
|
126
|
+
- **Perf: 6 `useEffect` hooks batched** into one for engine prop sync.
|
|
127
|
+
- **Perf: `sortBarsAsc()` O(n) validation** before sort (99% of API responses are pre-sorted).
|
|
128
|
+
- **Perf: Shared color helpers** extracted to `candleShaders.ts` (~160 lines duplicated code removed).
|
|
129
|
+
- **Perf: `TaskScheduler` priority queue** — data > indicator > overlay priority ordering.
|
|
130
|
+
- **Perf: `IndicatorWorkerPool` SAB transfer** when `crossOriginIsolated`.
|
|
131
|
+
- **Perf: `packBars()` optional columns** bitmap for skipping unused columns.
|
|
132
|
+
- **Perf: `SharedIndicatorGLCanvas` FinalizationRegistry** for auto-cleanup.
|
|
133
|
+
- **Perf: aria-live string buffer reuse** instead of template-string allocation per move.
|
|
134
|
+
- **Security: ScriptEngine sandbox hardened** — `Object.freeze(Object/Array.prototype)` + `eval` blocked.
|
|
135
|
+
- **Security: AlertManager webhook URL validated** — https-only, block private IPs/localhost.
|
|
136
|
+
- **Security: localStorage writes debounced** — `AlertManager.check()` saves at most 1/s.
|
|
137
|
+
- **Security: localStorage schema validation** on load — corrupted data rejected.
|
|
138
|
+
- **Security: WebSocket URL scheme validation** — `wss://`/`ws://` required.
|
|
139
|
+
- **Security: Polygon API key** moved from URL query param to `Authorization: Bearer` header.
|
|
140
|
+
- **Security: `#apiKey` private class field** — non-enumerable, safe from `JSON.stringify`.
|
|
141
|
+
- **Security: Locale strings stripped of HTML tags** — XSS prevention.
|
|
142
|
+
- **Security: `BarsCodec.decode()` capped** at 500k bars to prevent OOM.
|
|
143
|
+
- **Security: `pnpm audit` in all CI workflows.**
|
|
144
|
+
- **Security: TA surface gating + OPFS path safety** documented.
|
|
145
|
+
|
|
146
|
+
## [0.3.0] — 2026-06-15
|
|
147
|
+
|
|
148
|
+
### Added — v0.5 Polish (partial)
|
|
149
|
+
|
|
150
|
+
- **Lazy locale loading** ([src/i18n/index.ts](src/i18n/index.ts)) —
|
|
151
|
+
only `en-US` is bundled eagerly; the other 18 locales are loaded on
|
|
152
|
+
demand via dynamic `import()`. New public exports:
|
|
153
|
+
- `loadLocale(key)` — async loader for built-in locales
|
|
154
|
+
- `BUILTIN_LOCALES` — the canonical list
|
|
155
|
+
- Existing `loadLocales(key, dictionary)` continues to work for custom
|
|
156
|
+
translations.
|
|
157
|
+
- **Drawing & layout persistence** — `serializeState()` and `loadState(state)`
|
|
158
|
+
on `AstroneumHandle` capture / restore theme, locale, timezone, symbol,
|
|
159
|
+
period, styles, indicators, and overlays as JSON.
|
|
160
|
+
See [docs/api.md](docs/api.md#serializestate--loadstate).
|
|
161
|
+
- **Accessibility pass** — opt-in via the new `accessible` prop on
|
|
162
|
+
`<AstroneumChart>`. When enabled, the chart container gets `tabindex=0`,
|
|
163
|
+
`role="img"`, and an `aria-label`; a visually-hidden `aria-live="polite"`
|
|
164
|
+
region announces OHLCV on crosshair changes (throttled to ~10/s).
|
|
165
|
+
- **High-contrast theme** — set `theme="high-contrast"` for a
|
|
166
|
+
WCAG-conscious black/white/yellow palette with strong focus rings.
|
|
167
|
+
- **Benchmark CI workflow**
|
|
168
|
+
([.github/workflows/benchmark.yml](.github/workflows/benchmark.yml)) —
|
|
169
|
+
runs `pnpm size` and the perf tests on every PR and posts the perf
|
|
170
|
+
output as a sticky comment.
|
|
171
|
+
|
|
172
|
+
### Changed
|
|
173
|
+
|
|
174
|
+
- `WasmIndicators.ts` renamed to **`TypedArrayIndicators.ts`** to match
|
|
175
|
+
what it actually is (a column-store TS implementation). A back-compat
|
|
176
|
+
shim is kept at the old path with `@deprecated` JSDoc and will be
|
|
177
|
+
removed in v1.0.
|
|
178
|
+
|
|
179
|
+
### Deferred
|
|
180
|
+
|
|
181
|
+
Still tracked for v0.6 – v1.0; not in this release:
|
|
182
|
+
|
|
183
|
+
- WebGPU renderer / real Rust + WASM SIMD indicators
|
|
184
|
+
- `OrderManager` + broker package
|
|
185
|
+
- Heatmap / footprint / options-chain panes
|
|
186
|
+
- Full mobile audit & Storybook site
|
|
187
|
+
- React component tests (jsdom + RTL) + Playwright visual regression
|
|
188
|
+
- Compare overlay UI
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## [0.2.0] — 2026-05-30
|
|
193
|
+
|
|
194
|
+
### Added — v0.3 Hardening
|
|
195
|
+
|
|
196
|
+
- **Subpath exports** for tree-shakeable, opt-in feature modules
|
|
197
|
+
([#roadmap-4](README.md#v04--modularization)):
|
|
198
|
+
- `astroneum/replay` — `BarReplay`
|
|
199
|
+
- `astroneum/multichart` — `MultiChartLayout`
|
|
200
|
+
- `astroneum/watchlist` — `WatchlistManager`
|
|
201
|
+
- `astroneum/portfolio` — `PortfolioTracker`
|
|
202
|
+
- `astroneum/alerts` — `AlertManager`
|
|
203
|
+
- `astroneum/script` — `ScriptEngine`
|
|
204
|
+
- `astroneum/datafeeds/polygon` — `DefaultDatafeed` + `WebSocketDatafeed`
|
|
205
|
+
- `astroneum/datafeeds/crypto` — `createStandardCryptoDatafeed` + adapters
|
|
206
|
+
- **`size-limit` budget** ([.size-limit.json](.size-limit.json)) with one
|
|
207
|
+
budget per entry. Run `pnpm size` after `pnpm build`.
|
|
208
|
+
- **Datafeed contract tests** ([src/__tests__/datafeed-contract.test.ts](src/__tests__/datafeed-contract.test.ts))
|
|
209
|
+
— type-level + behavioural checks for any `Datafeed` implementation.
|
|
210
|
+
- **SSR smoke tests** ([src/__tests__/ssr-smoke.test.ts](src/__tests__/ssr-smoke.test.ts))
|
|
211
|
+
— verifies the root entry and all subpath entries import cleanly with no
|
|
212
|
+
DOM globals defined, and that the root entry's public API surface is stable.
|
|
213
|
+
- **`CONTRIBUTING.md`**, **`SECURITY.md`**, **`CODE_OF_CONDUCT.md`**,
|
|
214
|
+
and this `CHANGELOG.md`.
|
|
215
|
+
- **Browser support matrix** documented in [README](README.md#browser-support).
|
|
216
|
+
|
|
217
|
+
### Changed
|
|
218
|
+
|
|
219
|
+
- `pnpm verify` order is now `lint → typecheck → build → test` so SSR and
|
|
220
|
+
bundle tests can assert against fresh `dist/` output.
|
|
221
|
+
- `tsup.config.ts` now bundles every subpath entry and injects `'use client'`
|
|
222
|
+
into every emitted JS file (not just `dist/index.js`).
|
|
223
|
+
- `package.json#files` widened from `dist/*.{js,css,d.ts}` to
|
|
224
|
+
`dist/**/*.{js,css,d.ts}` so nested subpath artifacts ship.
|
|
225
|
+
|
|
226
|
+
### Fixed
|
|
227
|
+
|
|
228
|
+
- `src/index.ts` no longer side-imports the non-existent
|
|
229
|
+
`./styles/index.less` (was a leftover from a SCSS migration and caused the
|
|
230
|
+
build to fail outright on a clean install).
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## [0.2.0-baseline] — 2026-05-30
|
|
235
|
+
|
|
236
|
+
Initial public roadmap baseline. See git history for details prior to this
|
|
237
|
+
changelog being introduced.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kowit Charoenratchatabhan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Astroneum
|
|
2
|
+
|
|
3
|
+
Professional financial charting library for React applications — now with
|
|
4
|
+
TradingView-class features, zero licensing fees, and MIT license.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/astroneum)
|
|
7
|
+
[](https://www.npmjs.com/package/astroneum)
|
|
8
|
+
[](https://react.dev/)
|
|
9
|
+
[](https://www.typescriptlang.org/)
|
|
10
|
+
[](https://nodejs.org/)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
### Chart Types
|
|
20
|
+
- **Candlestick, OHLC, bar, area, line, Heikin-Ashi** — rendered via Canvas2D / WebGL2 with GPU acceleration
|
|
21
|
+
- **Non-time-based bars** — Renko, Kagi, Tick, Range, and Point & Figure generators
|
|
22
|
+
- **Multi-chart grid** (2/4/8/16 panes) and **multi-period stacked layout** (e.g. 4H + 1H + 15m)
|
|
23
|
+
|
|
24
|
+
### Indicators & Analysis
|
|
25
|
+
- **28 built-in indicators** — SMA, EMA, MACD, RSI, KDJ, Bollinger Bands, TRIX, SAR, and more
|
|
26
|
+
- **Volume Profile** — horizontal histogram with POC, Value Area, and price-level bucketing
|
|
27
|
+
- **ZigZag + auto pattern detection** — swing highs/lows, support/resistance clustering
|
|
28
|
+
- **Depth of Market** — bid/ask volume ladder visualization
|
|
29
|
+
- **Compare/Overlay** — second symbol normalized to percentage on same pane
|
|
30
|
+
- **Multi-timeframe indicators** — resample any TF, forward-fill to lower TF bars
|
|
31
|
+
- **Custom indicator plugins** via `registerIndicatorPlugin()` with Canvas2D or WebGL2 render path
|
|
32
|
+
- **Script editor** — sandboxed Pine-Script–inspired JS environment for custom indicators
|
|
33
|
+
|
|
34
|
+
### Drawing Tools
|
|
35
|
+
- **18 drawing tools** — trend lines, Fibonacci (circle, spiral, extension, segment, fan), Gann boxes, pitchforks, Elliott waves, harmonic patterns (ABCD, XABCD), and **measure/ruler tool**
|
|
36
|
+
- **Magnet/Snap** — snap to bar OHLC within 8px, angle snap to 0°/30°/45°/60°/90°
|
|
37
|
+
- **Drawing style presets** (7 built-in + custom) with live preview and per-drawing color
|
|
38
|
+
- **Undo/Redo** — `UndoManager` with 50-entry depth via Ctrl+Z / Ctrl+Y
|
|
39
|
+
- **Copy/Paste drawings** — Ctrl+C/V across charts via clipboard
|
|
40
|
+
- **Lock all drawings** toggle
|
|
41
|
+
- **Session visualizer** — auto session high/low/open/close lines
|
|
42
|
+
|
|
43
|
+
### Navigation & UX
|
|
44
|
+
- **Keyboard shortcuts** — arrows pan, Page/Home/End scroll/jump, mouse wheel zoom at cursor
|
|
45
|
+
- **Crosshair sync** across multi-chart and multi-period layouts
|
|
46
|
+
- **Price axis scaling** — linear, log, percentage, indexed-to-100
|
|
47
|
+
- **Chart templates** — save/load named configurations to localStorage
|
|
48
|
+
- **Accessibility** — `accessible` prop with aria-live OHLCV announcement
|
|
49
|
+
- **State serialization** — full chart state persistence & recovery via `serializeState()`/`loadState()`
|
|
50
|
+
|
|
51
|
+
### Data & Performance
|
|
52
|
+
- **Off-main-thread indicator pool** — Web Workers + TypedArray column store
|
|
53
|
+
- **OPFS historical cache** — binary bar data persisted to Origin Private File System
|
|
54
|
+
- **FlatBuffers binary codec** (`BarsCodec`) — 40 bytes per bar, efficient storage & transfer
|
|
55
|
+
- **TickAnimator** — smooth close/high/low interpolation at 60fps
|
|
56
|
+
- **TaskScheduler** with priority queue (data > indicator > overlay)
|
|
57
|
+
- **SharedArrayBuffer** ring buffer when `crossOriginIsolated`
|
|
58
|
+
|
|
59
|
+
### Datafeeds
|
|
60
|
+
- **StandardCryptoDatafeed** — 100+ symbols, Binance/Bitget/OKX futures, real-time WebSocket
|
|
61
|
+
- **DefaultDatafeed & WebSocketDatafeed** — Polygon.io REST + WebSocket
|
|
62
|
+
- **WebTransportDatafeed** — experimental HTTP/3 QUIC support
|
|
63
|
+
- **BYO datafeed** — 4-method interface (`searchSymbols`, `getHistoryData`, `subscribe`, `unsubscribe`)
|
|
64
|
+
|
|
65
|
+
### Developer Experience
|
|
66
|
+
- **Fully typed TypeScript** — branded financial types (`Price`, `Volume`, `Timestamp`)
|
|
67
|
+
- **8 tree-shakeable subpath exports** — import only what you need
|
|
68
|
+
- **19 locales** — lazy-loaded on demand, dark/light/high-contrast themes
|
|
69
|
+
- **SSR-safe** — `'use client'` on every entry, Next.js App Router compatible
|
|
70
|
+
- **MIT license** — no usage limits, no watermark, no "Powered by" branding
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Install
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm install astroneum
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`react` and `react-dom` ≥ 18 are peer dependencies.
|
|
81
|
+
|
|
82
|
+
## Quick Start
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { useMemo, useRef, useState } from 'react'
|
|
86
|
+
import {
|
|
87
|
+
AstroneumChart,
|
|
88
|
+
createStandardCryptoDatafeed,
|
|
89
|
+
STANDARD_CRYPTO_SYMBOLS,
|
|
90
|
+
type AstroneumHandle,
|
|
91
|
+
type Period,
|
|
92
|
+
type SymbolInfo,
|
|
93
|
+
} from '@tony01/astroneum'
|
|
94
|
+
import 'astroneum/style.css'
|
|
95
|
+
|
|
96
|
+
export default function App() {
|
|
97
|
+
const chartRef = useRef<AstroneumHandle>(null)
|
|
98
|
+
const datafeed = useMemo(() => createStandardCryptoDatafeed(), [])
|
|
99
|
+
const [symbol] = useState<SymbolInfo>(STANDARD_CRYPTO_SYMBOLS[0])
|
|
100
|
+
const [period] = useState<Period>({ multiplier: 1, timespan: 'hour', text: '1H' })
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<AstroneumChart
|
|
104
|
+
ref={chartRef}
|
|
105
|
+
symbol={symbol}
|
|
106
|
+
period={period}
|
|
107
|
+
datafeed={datafeed}
|
|
108
|
+
theme="dark"
|
|
109
|
+
subIndicators={['VOL']}
|
|
110
|
+
style={{ width: '100%', height: 560 }}
|
|
111
|
+
/>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Key Props
|
|
117
|
+
|
|
118
|
+
| Prop | Type | Description |
|
|
119
|
+
|------|------|-------------|
|
|
120
|
+
| `symbol` | `SymbolInfo` | Symbol to display |
|
|
121
|
+
| `period` | `Period` | Timeframe (1m, 5m, 1H, 4H, D, etc.) |
|
|
122
|
+
| `datafeed` | `Datafeed` | Data source (crypto, Polygon, or custom) |
|
|
123
|
+
| `theme` | `string` | `'dark'`, `'light'`, or `'high-contrast'` |
|
|
124
|
+
| `barStyle` | `'candle' \| 'heikin_ashi'` | Candle rendering style |
|
|
125
|
+
| `priceScale` | `'linear' \| 'log' \| 'percent' \| 'indexed'` | Price axis scale |
|
|
126
|
+
| `locale` | `string` | BCP-47 locale (e.g. `'ja-JP'`) |
|
|
127
|
+
| `drawingBarVisible` | `boolean` | Show drawing toolbar |
|
|
128
|
+
| `mainIndicators` | `IndicatorDef[]` | Main pane indicators |
|
|
129
|
+
| `subIndicators` | `string[]` | Sub-pane indicators (`['VOL', 'MACD', 'RSI']`) |
|
|
130
|
+
| `plugins` | `ChartPlugin[]` | Custom plugins with lifecycle hooks |
|
|
131
|
+
| `accessible` | `boolean` | Screen-reader support |
|
|
132
|
+
| `style` / `className` | | Container styling |
|
|
133
|
+
|
|
134
|
+
## Subpath Exports
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
// Main entry
|
|
138
|
+
import { AstroneumChart, DefaultDatafeed } from '@tony01/astroneum'
|
|
139
|
+
|
|
140
|
+
// Tree-shakeable subpaths
|
|
141
|
+
import { BarReplay } from '@tony01/astroneum/replay'
|
|
142
|
+
import { MultiChartLayout } from '@tony01/astroneum/multichart'
|
|
143
|
+
import { MultiPeriodLayout } from '@tony01/astroneum' // same symbol, stacked periods
|
|
144
|
+
import { WatchlistManager } from '@tony01/astroneum/watchlist'
|
|
145
|
+
import { PortfolioTracker } from '@tony01/astroneum/portfolio'
|
|
146
|
+
import { AlertManager } from '@tony01/astroneum/alerts'
|
|
147
|
+
import { ScriptEngine } from '@tony01/astroneum/script'
|
|
148
|
+
import { UndoManager } from '@tony01/astroneum'
|
|
149
|
+
import { ChartTemplateManager } from '@tony01/astroneum'
|
|
150
|
+
import { SessionVisualizer } from '@tony01/astroneum'
|
|
151
|
+
|
|
152
|
+
// Datafeeds
|
|
153
|
+
import { createStandardCryptoDatafeed, STANDARD_CRYPTO_SYMBOLS } from '@tony01/astroneum/datafeeds/crypto'
|
|
154
|
+
import { DefaultDatafeed, WebSocketDatafeed } from '@tony01/astroneum/datafeeds/polygon'
|
|
155
|
+
|
|
156
|
+
// Utilities
|
|
157
|
+
import { heikinAshi } from '@tony01/astroneum' // OHLC → Heikin-Ashi transform
|
|
158
|
+
import { zigzag, detectSupportResistance } from '@tony01/astroneum' // pattern detection
|
|
159
|
+
import { resampleBars, forwardFill } from '@tony01/astroneum' // multi-TF resampling
|
|
160
|
+
import { generateRenko, generateKagi,
|
|
161
|
+
generateTickBars, generateRangeBars,
|
|
162
|
+
generatePointAndFigure } from '@tony01/astroneum' // non-time-based bars
|
|
163
|
+
import { transformCandles, untransformPrice } from '@tony01/astroneum' // price scale transforms
|
|
164
|
+
|
|
165
|
+
// Plugins
|
|
166
|
+
import { volumeProfilePlugin, domPlugin, zigzagPlugin,
|
|
167
|
+
pointAndFigurePlugin } from '@tony01/astroneum' // registerIndicatorPlugin(...)
|
|
168
|
+
import { createCompareIndicator } from '@tony01/astroneum' // compare symbols overlay
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Browser Support
|
|
172
|
+
|
|
173
|
+
| Browser | Minimum | Notes |
|
|
174
|
+
|---------|---------|-------|
|
|
175
|
+
| Chrome / Edge | 110+ | Full WebGL2 + OPFS |
|
|
176
|
+
| Firefox | 115+ | Full WebGL2 |
|
|
177
|
+
| Safari | 16.4+ | Full WebGL2, OPFS on 17+ |
|
|
178
|
+
| iOS Safari | 16.4+ | Touch + pinch |
|
|
179
|
+
|
|
180
|
+
Graceful fallback: no WebGL2 → Canvas2D, no OPFS → in-memory cache, no OffscreenCanvas → main-thread calc.
|
|
181
|
+
|
|
182
|
+
## Next.js Usage
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
// next.config.ts
|
|
186
|
+
const nextConfig = { transpilePackages: ['astroneum'] }
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// app/layout.tsx
|
|
191
|
+
import 'astroneum/style.css'
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
The library ships with `'use client'` built in — no extra directive needed.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT — use it anywhere, no fees, no limits, no branding requirement.
|