@supersolutions/super-chart-core 0.0.0 → 0.1.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/dist/index.js ADDED
@@ -0,0 +1,222 @@
1
+ import {
2
+ DATA_DRIVEN_DRAWING_LIMITS,
3
+ DATA_DRIVEN_DRAWING_TYPES,
4
+ DEFAULT_BARS,
5
+ DRAWING_IMAGE_LIMITS,
6
+ DRAWING_TYPES,
7
+ DataLoader,
8
+ DrawingStore,
9
+ ENGINE_CHART_TYPES,
10
+ EngineIndicators,
11
+ HistoryCache,
12
+ MARKET_ZONE_SCAN_LIMIT,
13
+ MAX_FREEHAND_POINTS,
14
+ MIN_BARS,
15
+ MIN_REPLAY_BARS,
16
+ REPLAY_BASE_STEP_MS,
17
+ RealtimeSeries,
18
+ RealtimeView,
19
+ TickCoalescer,
20
+ UNIT_MS,
21
+ WORKSPACE_DOCUMENT_LIMITS,
22
+ WorkspaceEventBus,
23
+ WorkspaceLoadQueue,
24
+ addPeriods,
25
+ applyRealtimeViewport,
26
+ barRemaining,
27
+ buildEngineFrame,
28
+ buildFinancialChartModel,
29
+ chartKeys,
30
+ clampContinuousViewport,
31
+ clampViewport,
32
+ copyWorkspaceMarket,
33
+ createBarCountdown,
34
+ createPriceScale,
35
+ createRealtimeChartFrame,
36
+ createRuntimeEnvironment,
37
+ createTimedReplay,
38
+ decideUnit,
39
+ defaultViewport,
40
+ derivePrecision,
41
+ detectFairValueGaps,
42
+ detectOrderBlocks,
43
+ dimensions,
44
+ drawingAnchorCount,
45
+ drawingUsesText,
46
+ fail,
47
+ financialGeometry,
48
+ formatBarDate,
49
+ formatCountdown,
50
+ fullViewport,
51
+ getBarCountdown,
52
+ hasHoles,
53
+ hasIssues,
54
+ header,
55
+ historyKey,
56
+ hitTestDrawingGeometry,
57
+ indexAtOrBefore,
58
+ indicatorSeries,
59
+ isHeikinAshiUp,
60
+ mergeBar,
61
+ mergeKind,
62
+ nearestBarIndex,
63
+ nearestChartIndex,
64
+ nextBarClose,
65
+ normalizeBar,
66
+ normalizeBars,
67
+ olderThan,
68
+ openingBars,
69
+ panViewport,
70
+ parsePeriod,
71
+ parseWorkspaceDocument,
72
+ periodKey,
73
+ prependReplay,
74
+ priceSeries,
75
+ projectAdditionalDrawing,
76
+ projectDataDrivenDrawing,
77
+ projectDrawing,
78
+ projectFreehandDrawing,
79
+ projectMarketOverlays,
80
+ pxToBars,
81
+ railSegment,
82
+ raster,
83
+ replayApply,
84
+ replayAtEnd,
85
+ replayBars,
86
+ requestRange,
87
+ resolvePeriod,
88
+ resolvePricePrecision,
89
+ resolveViewportLimits,
90
+ resolveXType,
91
+ samePeriod,
92
+ sameSymbol,
93
+ startReplay,
94
+ stepReplay,
95
+ symbolKey,
96
+ ta,
97
+ tickReplay,
98
+ toHeikinAshi,
99
+ validateDrawingImage,
100
+ validateEngineLayout,
101
+ validatePriceScale,
102
+ valueAtChartIndex,
103
+ viewportLimitsForWidth,
104
+ viewportSpan,
105
+ volumeProfile,
106
+ workspaceMarketKey,
107
+ zoomContinuousViewport,
108
+ zoomViewport
109
+ } from "./chunk-5EZU3YKZ.js";
110
+ import {
111
+ previousRangeHighLow
112
+ } from "./chunk-B2X7UKEZ.js";
113
+ export {
114
+ DATA_DRIVEN_DRAWING_LIMITS,
115
+ DATA_DRIVEN_DRAWING_TYPES,
116
+ DEFAULT_BARS,
117
+ DRAWING_IMAGE_LIMITS,
118
+ DRAWING_TYPES,
119
+ DataLoader,
120
+ DrawingStore,
121
+ ENGINE_CHART_TYPES,
122
+ EngineIndicators,
123
+ HistoryCache,
124
+ MARKET_ZONE_SCAN_LIMIT,
125
+ MAX_FREEHAND_POINTS,
126
+ MIN_BARS,
127
+ MIN_REPLAY_BARS,
128
+ REPLAY_BASE_STEP_MS,
129
+ RealtimeSeries,
130
+ RealtimeView,
131
+ TickCoalescer,
132
+ UNIT_MS,
133
+ WORKSPACE_DOCUMENT_LIMITS,
134
+ WorkspaceEventBus,
135
+ WorkspaceLoadQueue,
136
+ addPeriods,
137
+ applyRealtimeViewport,
138
+ barRemaining,
139
+ buildEngineFrame,
140
+ buildFinancialChartModel,
141
+ chartKeys,
142
+ clampContinuousViewport,
143
+ clampViewport,
144
+ copyWorkspaceMarket,
145
+ createBarCountdown,
146
+ createPriceScale,
147
+ createRealtimeChartFrame,
148
+ createRuntimeEnvironment,
149
+ createTimedReplay,
150
+ decideUnit,
151
+ defaultViewport,
152
+ derivePrecision,
153
+ detectFairValueGaps,
154
+ detectOrderBlocks,
155
+ dimensions,
156
+ drawingAnchorCount,
157
+ drawingUsesText,
158
+ fail,
159
+ financialGeometry,
160
+ formatBarDate,
161
+ formatCountdown,
162
+ fullViewport,
163
+ getBarCountdown,
164
+ hasHoles,
165
+ hasIssues,
166
+ header,
167
+ historyKey,
168
+ hitTestDrawingGeometry,
169
+ indexAtOrBefore,
170
+ isHeikinAshiUp,
171
+ mergeBar,
172
+ mergeKind,
173
+ indicatorSeries as nativeIndicatorSeries,
174
+ nearestBarIndex,
175
+ nearestChartIndex,
176
+ nextBarClose,
177
+ normalizeBar,
178
+ normalizeBars,
179
+ olderThan,
180
+ openingBars,
181
+ panViewport,
182
+ parsePeriod,
183
+ parseWorkspaceDocument,
184
+ periodKey,
185
+ prependReplay,
186
+ previousRangeHighLow,
187
+ priceSeries,
188
+ projectAdditionalDrawing,
189
+ projectDataDrivenDrawing,
190
+ projectDrawing,
191
+ projectFreehandDrawing,
192
+ projectMarketOverlays,
193
+ pxToBars,
194
+ railSegment,
195
+ raster,
196
+ replayApply,
197
+ replayAtEnd,
198
+ replayBars,
199
+ requestRange,
200
+ resolvePeriod,
201
+ resolvePricePrecision,
202
+ resolveViewportLimits,
203
+ resolveXType,
204
+ samePeriod,
205
+ sameSymbol,
206
+ startReplay,
207
+ stepReplay,
208
+ symbolKey,
209
+ ta,
210
+ tickReplay,
211
+ toHeikinAshi,
212
+ validateDrawingImage,
213
+ validateEngineLayout,
214
+ validatePriceScale,
215
+ valueAtChartIndex,
216
+ viewportLimitsForWidth,
217
+ viewportSpan,
218
+ volumeProfile,
219
+ workspaceMarketKey,
220
+ zoomContinuousViewport,
221
+ zoomViewport
222
+ };
@@ -0,0 +1,126 @@
1
+ /** Platform-neutral chart data. Extracted for Web and React Native, 2026-10-29. */
2
+ export interface MarketBar {
3
+ timestamp: number;
4
+ open: number;
5
+ high: number;
6
+ low: number;
7
+ close: number;
8
+ volume?: number;
9
+ turnover?: number;
10
+ /** Preserve the Web feed extension-field contract; OHLCV fields stay numeric. */
11
+ [key: string]: any;
12
+ }
13
+ export interface IndicatorFigure {
14
+ readonly key: string;
15
+ readonly title: string;
16
+ readonly color?: string;
17
+ readonly type: "line" | "bar" | "circle";
18
+ readonly lineWidth?: number;
19
+ readonly dash?: readonly number[];
20
+ /** Histogram origin in indicator units. */
21
+ readonly base?: number;
22
+ }
23
+ export type IndicatorRow = Readonly<Record<string, number | null>>;
24
+ export type IndicatorPane = "price" | "separate";
25
+ export interface IndicatorDefinition {
26
+ readonly name: string;
27
+ readonly params?: readonly number[];
28
+ readonly pane: IndicatorPane;
29
+ readonly figures: readonly IndicatorFigure[];
30
+ /** Pure calculation: one row per input bar, null for unavailable/warmup values. */
31
+ readonly calculate: (bars: readonly MarketBar[], params: readonly number[]) => readonly IndicatorRow[];
32
+ /** Validate a candidate parameter change before an instance is mutated. */
33
+ readonly validateParams?: (params: readonly number[]) => void;
34
+ }
35
+ /**
36
+ * Existing SC formulas, independent of their old template/drawing layer.
37
+ * These definitions deliberately use the same owned core functions and seeds.
38
+ * All calculations return full-series rows with explicit null gaps. The generic
39
+ * registry reuses results for viewport-only changes, but these optional kernels
40
+ * share owned OHLC input arrays within one compute call. Stateful SC_SMA,
41
+ * SC_RSI and SC_MACD reuse the matching incremental owned kernels. Donchian
42
+ * and Ichimoku tail edits recompute their finite dependency windows, including
43
+ * Ichimoku's lagging rows before the edited bar. Corrections/prepends rebuild.
44
+ *
45
+ * VWAP preserves the fixed-offset session buckets and skips the first loaded
46
+ * bucket because it may be partial. Missing volume follows the existing core's
47
+ * zero-contribution semantics; no synthetic volume is inserted into the bars.
48
+ * BBP remains unbounded outside [0, 1]. Supertrend starts down when ATR becomes
49
+ * available; separate up/down lines preserve gaps at every direction change.
50
+ *
51
+ * Ichimoku values are shifted by displacement - 1 exactly as in SC_ICHIMOKU.
52
+ * Like that implementation, this row-based pack cannot draw futureA/futureB
53
+ * beyond the last real bar, or a filled cloud. It exposes the five existing-bar
54
+ * lines only; no future candles or projection coordinates are invented.
55
+ *
56
+ * SC_RSI/SC_MACD/SC_SMA preserve their owned formulas and defaults. SC_SMA
57
+ * uses the compensated core sum; the former template's naive tail-only sum
58
+ * can differ in final floating-point bits. These optional names now share the
59
+ * incremental MA/RSI/MACD kernels by calculation identity, with their original
60
+ * defaults and row keys. History corrections/prepends still rebuild.
61
+ * Oscillator reference levels and MACD's four-color histogram require renderer
62
+ * metadata, and are not represented by these line/bar figures.
63
+ *
64
+ * SC_PDHL retains the existing full-dataset, latest-loaded-period UTC lookup,
65
+ * including the most recent available earlier day/week when history has gaps.
66
+ * Its constant rows are current reference levels, NOT rolling historical
67
+ * values suitable for backtesting. The line renderer includes them in price
68
+ * autoscaling; the old draw-only template did not. Dashed axis-spanning labels
69
+ * also require renderer metadata. A dataset within one period has null levels.
70
+ *
71
+ * SC_VRVP, SC_ORDER_BLOCKS and SC_FVG are intentionally not registered here:
72
+ * they need visible-range volume-profile or rectangle rendering, rather than
73
+ * scalar rows. Their existing pure geometry/detection helpers remain available.
74
+ * Registering an empty or unrelated line would falsely advertise support.
75
+ *
76
+ * Default/missing parameters retain the SC defaults. Explicit invalid periods,
77
+ * multipliers and anchor selections are rejected at calculation time rather
78
+ * than using the old UI template's silent fallbacks.
79
+ */
80
+ export declare const TECHNICAL_INDICATOR_DEFINITIONS: readonly IndicatorDefinition[];
81
+ /**
82
+ * Explicit owned conventions, not a claim of numeric compatibility with the
83
+ * legacy engine's same-named formulas. Full window warmup is required; a
84
+ * previous-bar comparison first becomes available at index 1, not index 0.
85
+ * Zero denominators and nonfinite results are gaps (except flat DMI: DI/DX 0).
86
+ * Each optional definition currently recomputes after data changes; viewport
87
+ * changes reuse EngineIndicators' results. There are no renderer/UI imports.
88
+ *
89
+ * - CCI/OBV/ROC use the existing owned core. OBV starts at zero and the
90
+ * core treats missing volume as zero contribution; its SMA signal waits for
91
+ * its complete window. SAR's public factors retain stored hundredths [2,2,20].
92
+ * SAR has its own Wilder recurrence with prior-two-extrema clamping. It seeds
93
+ * direction from the second close, keeps the first bar null, uses strict
94
+ * reversal comparisons and restarts after a missing/invalid OHLC sample.
95
+ * - DMI uses Wilder RMA for DM/TR and ADX, not rolling sums/EMA; ADXR is the
96
+ * mean of ADX now and ADX `adxPeriod` bars earlier. DM/TR seed from transitions.
97
+ * - TRIX uses three SMA-seeded EMAs, one-bar percent change, then an EMA signal.
98
+ * With [12,9], TRIX first appears at index 34 and its signal at index 42.
99
+ * - WR is one conventional negative Williams %R line (-100..0), default 14;
100
+ * this is not a positive 0..100 or multi-period legacy display convention.
101
+ * - CR uses the previous high/low midpoint and unshifted SMA signal lines.
102
+ * - EMV is unscaled midpoint movement * range / volume, SMA then signal SMA;
103
+ * it is not a turnover-based, rolling-sum or 1e8-scaled variant.
104
+ * - PVT starts at zero; missing/invalid volume or a zero previous close makes
105
+ * a gap and leaves the known subtotal unchanged. No missing flow is invented.
106
+ * - BIAS has three fixed lines (default 6/12/24). SMA means the true arithmetic
107
+ * mean (the existing chart's SC_SMA alias), not a Chinese recursive SMA.
108
+ * - AO is the 5/34 midpoint SMA difference; histogram values are preserved,
109
+ * but per-bar rising/falling colors belong to the renderer, not this pack.
110
+ *
111
+ * Formula references used independently of any upstream implementation:
112
+ * https://www.tradingview.com/support/solutions/43000589099-average-directional-index-adx/
113
+ * https://www.tradingview.com/support/solutions/43000502331-trix/
114
+ * https://www.tradingview.com/support/solutions/43000501985-williams-r-r/
115
+ * https://www.tradingview.com/support/solutions/43000502256-ease-of-movement-eom/
116
+ * https://www.tradingview.com/support/solutions/43000502345-price-volume-trend-pvt/
117
+ * https://www.tradingview.com/support/solutions/43000501826-awesome-oscillator-ao/
118
+ * https://www.tradingview.com/support/solutions/43000502597-parabolic-sar-sar/
119
+ * https://www.moomoo.com/sg/support/topic3_248
120
+ * https://www.moomoo.com/jp/support/topic3_815
121
+ * https://www.moomoo.com/ca/hant/support/topic3_157
122
+ * https://support.futunn.com/topic656
123
+ */
124
+ export declare const CLASSIC_INDICATOR_DEFINITIONS: readonly IndicatorDefinition[];
125
+
126
+ export {};