react-native-vroom-chart 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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +27 -0
  3. package/android/README.md +7 -0
  4. package/cpp/README.md +11 -0
  5. package/cpp/VroomChartHostObject.cpp +458 -0
  6. package/cpp/VroomChartHostObject.h +36 -0
  7. package/cpp/VroomJsiInstaller.cpp +69 -0
  8. package/cpp/VroomJsiInstaller.h +10 -0
  9. package/cpp/VroomSkiaContext.cpp +25 -0
  10. package/cpp/VroomSkiaContext.h +30 -0
  11. package/cpp/_core_include/vroom/vroom_chart.h +195 -0
  12. package/cpp/_core_src/candles.cpp +74 -0
  13. package/cpp/_core_src/candles.h +34 -0
  14. package/cpp/_core_src/chart.cpp +317 -0
  15. package/cpp/_core_src/chart.h +167 -0
  16. package/cpp/_core_src/chart_facade.cpp +570 -0
  17. package/cpp/_core_src/chart_internal.h +30 -0
  18. package/cpp/_core_src/crosshair.cpp +65 -0
  19. package/cpp/_core_src/crosshair.h +32 -0
  20. package/cpp/_core_src/fonts.cpp +22 -0
  21. package/cpp/_core_src/fonts.h +25 -0
  22. package/cpp/_core_src/labels.cpp +340 -0
  23. package/cpp/_core_src/labels.h +85 -0
  24. package/cpp/_core_src/ma.cpp +53 -0
  25. package/cpp/_core_src/ma.h +39 -0
  26. package/cpp/_core_src/ma_overlay.cpp +73 -0
  27. package/cpp/_core_src/ma_overlay.h +42 -0
  28. package/cpp/_core_src/macd.cpp +68 -0
  29. package/cpp/_core_src/macd.h +29 -0
  30. package/cpp/_core_src/macd_pane.cpp +199 -0
  31. package/cpp/_core_src/macd_pane.h +41 -0
  32. package/cpp/_core_src/price_indicator.cpp +106 -0
  33. package/cpp/_core_src/price_indicator.h +29 -0
  34. package/cpp/_core_src/rsi.cpp +70 -0
  35. package/cpp/_core_src/rsi.h +32 -0
  36. package/cpp/_core_src/rsi_pane.cpp +167 -0
  37. package/cpp/_core_src/rsi_pane.h +39 -0
  38. package/cpp/_core_src/theme.cpp +41 -0
  39. package/cpp/_core_src/theme.h +23 -0
  40. package/cpp/_core_src/ticks.cpp +49 -0
  41. package/cpp/_core_src/ticks.h +30 -0
  42. package/cpp/_core_src/viewport.cpp +141 -0
  43. package/cpp/_core_src/viewport.h +100 -0
  44. package/cpp/_core_src/volume.cpp +70 -0
  45. package/cpp/_core_src/volume.h +34 -0
  46. package/cpp/_core_src/vwap.cpp +51 -0
  47. package/cpp/_core_src/vwap.h +27 -0
  48. package/ios/README.md +7 -0
  49. package/ios/VroomChartModule.h +11 -0
  50. package/ios/VroomChartModule.mm +44 -0
  51. package/lib/index.d.mts +185 -0
  52. package/lib/index.d.ts +185 -0
  53. package/lib/index.js +429 -0
  54. package/lib/index.js.map +1 -0
  55. package/lib/index.mjs +396 -0
  56. package/lib/index.mjs.map +1 -0
  57. package/package.json +75 -0
  58. package/react-native-vroom-chart.podspec +79 -0
  59. package/src/NativeVroomChart.ts +12 -0
  60. package/src/VroomChart.tsx +382 -0
  61. package/src/index.ts +14 -0
  62. package/src/jsi.d.ts +128 -0
  63. package/src/packCandles.ts +24 -0
  64. package/src/theme.ts +43 -0
  65. package/src/types.ts +27 -0
  66. package/src/useChartCore.ts +135 -0
@@ -0,0 +1,34 @@
1
+ // Volume bars — one bottom-anchored bar per candle, centered on the candle and
2
+ // matching its body width, growing upward with the candle's volume. Drawn under
3
+ // the candles (candles z-above). Its own module alongside candles / labels so
4
+ // the chart orchestrator stays thin.
5
+
6
+ #pragma once
7
+
8
+ #include <cstddef>
9
+ #include <cstdint>
10
+
11
+ #include "vroom/vroom_chart.h"
12
+
13
+ class SkCanvas;
14
+
15
+ namespace vroom {
16
+ struct Layout;
17
+ struct Theme;
18
+ } // namespace vroom
19
+
20
+ namespace vroom::volume {
21
+
22
+ // Draws a volume bar for each candle in [visible, visible + n). Bars share the
23
+ // candles' x/width (via candle_center_x / candle_body_width) so they scroll and
24
+ // resize with the candles. Heights auto-fit to the max volume in the slice.
25
+ void draw(SkCanvas* canvas,
26
+ const ::VroomCandle* visible,
27
+ std::size_t n,
28
+ const Layout& lay,
29
+ const Theme& theme,
30
+ int64_t window_ms,
31
+ int64_t visible_start_ms,
32
+ int64_t candle_duration_ms);
33
+
34
+ } // namespace vroom::volume
@@ -0,0 +1,51 @@
1
+ #include "vwap.h"
2
+
3
+ #include <cmath> // std::nan
4
+ #include <cstdint>
5
+
6
+ namespace vroom::vwap {
7
+
8
+ namespace {
9
+ constexpr int64_t kDayMs = 86'400'000;
10
+
11
+ // Floor division (rounds toward -inf), so a candle before the shifted day start
12
+ // buckets into the previous session rather than truncating toward zero.
13
+ int64_t floor_div(int64_t a, int64_t b) {
14
+ int64_t q = a / b;
15
+ int64_t r = a % b;
16
+ if (r != 0 && ((r < 0) != (b < 0))) --q;
17
+ return q;
18
+ }
19
+ } // namespace
20
+
21
+ void compute(const ::VroomCandle* candles, std::size_t n, int reset_offset_min,
22
+ std::vector<double>& vwap_out,
23
+ std::vector<unsigned char>& break_out) {
24
+ vwap_out.assign(n, std::nan(""));
25
+ break_out.assign(n, 0);
26
+ if (!candles) return;
27
+
28
+ const int64_t offset_ms = static_cast<int64_t>(reset_offset_min) * 60'000;
29
+ double cum_pv = 0.0;
30
+ double cum_v = 0.0;
31
+ int64_t prev_key = 0;
32
+ bool have_prev = false;
33
+
34
+ for (std::size_t i = 0; i < n; ++i) {
35
+ const int64_t key = floor_div(candles[i].time_ms - offset_ms, kDayMs);
36
+ if (!have_prev || key != prev_key) {
37
+ cum_pv = 0.0;
38
+ cum_v = 0.0;
39
+ if (have_prev) break_out[i] = 1; // new session (not the first)
40
+ have_prev = true;
41
+ prev_key = key;
42
+ }
43
+ const double typical =
44
+ (candles[i].high + candles[i].low + candles[i].close) / 3.0;
45
+ cum_pv += typical * candles[i].volume;
46
+ cum_v += candles[i].volume;
47
+ if (cum_v > 0.0) vwap_out[i] = cum_pv / cum_v;
48
+ }
49
+ }
50
+
51
+ } // namespace vroom::vwap
@@ -0,0 +1,27 @@
1
+ // VWAP (Volume-Weighted Average Price) — pure, no Skia, so it builds into the
2
+ // unit-test target. Session anchor only: cumulative sums reset each UTC day
3
+ // shifted by a configurable offset.
4
+ //
5
+ // VWAP = sum(typical*volume) / sum(volume) over the current session
6
+ // typical = (high + low + close) / 3 (hlc3)
7
+
8
+ #pragma once
9
+
10
+ #include <cstddef>
11
+ #include <vector>
12
+
13
+ #include "vroom/vroom_chart.h" // ::VroomCandle
14
+
15
+ namespace vroom::vwap {
16
+
17
+ // Computes session VWAP over [candles, candles+n). The session boundary is the
18
+ // UTC day shifted by `reset_offset_min` minutes (e.g. 60 -> sessions start at
19
+ // 01:00 UTC). Fills:
20
+ // vwap_out (resized to n): VWAP at candle i, NaN where cumulative volume is 0
21
+ // break_out (resized to n): 1 at the first candle of each new session after
22
+ // the first (so the renderer lifts the pen across resets), else 0.
23
+ void compute(const ::VroomCandle* candles, std::size_t n, int reset_offset_min,
24
+ std::vector<double>& vwap_out,
25
+ std::vector<unsigned char>& break_out);
26
+
27
+ } // namespace vroom::vwap
package/ios/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # iOS shim (placeholder)
2
+
3
+ When native is wired up, this directory will hold the Objective-C++ view
4
+ and module that host the chart and forward gestures into the C++ core.
5
+
6
+ The accompanying `react-native-vroom-chart.podspec` at the package root will
7
+ build `cpp/` + `ios/` + the linked `@vroomchart/core` static library.
@@ -0,0 +1,11 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <React/RCTBridgeModule.h>
3
+
4
+ #ifdef RCT_NEW_ARCH_ENABLED
5
+ #import <VroomChartSpec/VroomChartSpec.h>
6
+ @interface VroomChartModule : NSObject <NativeVroomChartSpec>
7
+ #else
8
+ @interface VroomChartModule : NSObject <RCTBridgeModule>
9
+ #endif
10
+
11
+ @end
@@ -0,0 +1,44 @@
1
+ #import "VroomChartModule.h"
2
+
3
+ #import <React/RCTBridge+Private.h>
4
+ #import <ReactCommon/CallInvoker.h>
5
+ #import <jsi/jsi.h>
6
+
7
+ #include "VroomJsiInstaller.h"
8
+
9
+ using namespace facebook;
10
+
11
+ @implementation VroomChartModule
12
+
13
+ RCT_EXPORT_MODULE(VroomChartModule)
14
+
15
+ // Called from JS via NativeVroomChart.install(). Grabs the JSI runtime from the
16
+ // bridge and asks the C++ installer to expose global.VroomChartJSI.
17
+ //
18
+ // The TurboModule version (new arch) and the legacy version both end up here.
19
+ - (NSNumber *)install
20
+ {
21
+ RCTBridge *bridge = [RCTBridge currentBridge];
22
+ RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
23
+ if (cxxBridge == nil) {
24
+ return @NO;
25
+ }
26
+
27
+ jsi::Runtime *runtime = (jsi::Runtime *)cxxBridge.runtime;
28
+ if (runtime == nullptr) {
29
+ return @NO;
30
+ }
31
+
32
+ vroom::installJsi(*runtime);
33
+ return @YES;
34
+ }
35
+
36
+ #ifdef RCT_NEW_ARCH_ENABLED
37
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
38
+ (const facebook::react::ObjCTurboModule::InitParams &)params
39
+ {
40
+ return std::make_shared<facebook::react::NativeVroomChartSpecJSI>(params);
41
+ }
42
+ #endif
43
+
44
+ @end
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ /** A single OHLCV bar. `candles` is an array of these. */
5
+ type Candle = {
6
+ /** Bar open time as Unix epoch milliseconds. */
7
+ timeMs: number;
8
+ /** Opening price. */
9
+ open: number;
10
+ /** Highest price during the bar. */
11
+ high: number;
12
+ /** Lowest price during the bar. */
13
+ low: number;
14
+ /** Closing price. */
15
+ close: number;
16
+ /** Traded volume during the bar. */
17
+ volume: number;
18
+ };
19
+ /** Payload passed to `onCrosshair` as the crosshair shows, moves, or hides. */
20
+ type CrosshairEvent = {
21
+ /** True while the crosshair is showing; false when it's dismissed. */
22
+ active: boolean;
23
+ /** OHLCV of the candle under the crosshair, or null when inactive. */
24
+ candle: Candle | null;
25
+ /**
26
+ * Why this event fired — lets the host react differently (e.g. haptics):
27
+ * 'show' — long-press activated the crosshair
28
+ * 'move' — the crosshair snapped to a *different* candle (one per candle
29
+ * crossed; not per drag frame)
30
+ * 'hide' — the crosshair was dismissed
31
+ * The library never plays haptics itself; the host decides.
32
+ */
33
+ reason: 'show' | 'move' | 'hide';
34
+ };
35
+ /**
36
+ * A color value: a hex string (`'#0d1117'`, or 8-digit `'#aarrggbb'`) or a
37
+ * packed ARGB number. In `VroomTheme` every field is optional — omitted colors
38
+ * keep the library default.
39
+ */
40
+ type VroomColor = string | number;
41
+ /** Color overrides for the chart, passed via the `theme` prop. */
42
+ type VroomTheme = {
43
+ /** Chart + axis-strip background. */
44
+ background?: VroomColor;
45
+ /** Up candles (also bull wicks, bull volume bars, rising price indicator). */
46
+ bull?: VroomColor;
47
+ /** Down candles (also bear wicks, bear volume bars, falling price indicator). */
48
+ bear?: VroomColor;
49
+ /** Gridlines. */
50
+ grid?: VroomColor;
51
+ /** Axis label text (price + time). */
52
+ axisText?: VroomColor;
53
+ /** Crosshair dashed lines. */
54
+ crosshair?: VroomColor;
55
+ /** Crosshair target — the hollow ring/dot at the intersection. */
56
+ crosshairTarget?: VroomColor;
57
+ };
58
+ /** A time window over the candle data, as Unix epoch milliseconds. */
59
+ type VisibleRange = {
60
+ /** Window start (inclusive), Unix epoch milliseconds. */
61
+ startMs: number;
62
+ /** Window end (inclusive), Unix epoch milliseconds. */
63
+ endMs: number;
64
+ };
65
+ /** RSI indicator config. Rendered in a pane below the candles when enabled. */
66
+ type RSIConfig = {
67
+ enabled?: boolean;
68
+ /** Lookback period in candle counts. Default 14, clamped to >= 2. */
69
+ period?: number;
70
+ /** Overbought band level (0..100). Default 70. */
71
+ upperBand?: number;
72
+ /** Oversold band level (0..100). Default 30. */
73
+ lowerBand?: number;
74
+ /** Show the RSI-based moving-average trendline. Default true. */
75
+ maEnabled?: boolean;
76
+ /** Trendline (MA of RSI) length. Default 14, clamped to >= 1. */
77
+ maPeriod?: number;
78
+ };
79
+ /** Price source for a moving average. */
80
+ type MASource = 'close' | 'open' | 'high' | 'low' | 'hl2' | 'hlc3' | 'ohlc4';
81
+ /**
82
+ * A moving-average overlay line drawn on the price pane. Provide an array of
83
+ * these via `movingAverages` to render a ribbon of SMA/EMA lines.
84
+ */
85
+ type MovingAverageOverlay = {
86
+ /** 'sma' (simple) or 'ema' (exponential). */
87
+ kind: 'sma' | 'ema';
88
+ /** Lookback in candles. */
89
+ length: number;
90
+ /** Price source. Default 'close'. */
91
+ source?: MASource;
92
+ /** Line color (hex string or packed ARGB number). */
93
+ color?: string | number;
94
+ /** Stroke width in px. Default 1.5. */
95
+ width?: number;
96
+ };
97
+ /**
98
+ * VWAP overlay config (session anchor). Drawn as a single line on the price
99
+ * pane, resetting each session.
100
+ */
101
+ type VWAPConfig = {
102
+ enabled?: boolean;
103
+ /** Session reset offset from UTC midnight, in minutes (default 0). */
104
+ resetMinutes?: number;
105
+ /** Line color (hex string or packed ARGB number). */
106
+ color?: string | number;
107
+ /** Stroke width in px. Default 1.5. */
108
+ width?: number;
109
+ };
110
+ /** MACD indicator config. Rendered in its own pane below the candles. */
111
+ type MACDConfig = {
112
+ enabled?: boolean;
113
+ /** Fast EMA length. Default 12. */
114
+ fast?: number;
115
+ /** Slow EMA length (forced > fast). Default 26. */
116
+ slow?: number;
117
+ /** Signal-line EMA length. Default 9. */
118
+ signal?: number;
119
+ };
120
+ /**
121
+ * Platform-agnostic props shared by every vroom chart component. Each platform
122
+ * extends this with its own `style` typing (and any platform-only props) to
123
+ * form its public `VroomChartProps`.
124
+ */
125
+ type VroomChartCoreProps = {
126
+ /** OHLCV bars to render. The only required prop. */
127
+ candles: Candle[];
128
+ /**
129
+ * Explicit size overrides in logical px. When omitted, the chart fills its
130
+ * parent (measured at runtime). Prefer layout-driven sizing via the
131
+ * platform's `style` (flex / aspect-ratio / absolute fill) over hard-coding.
132
+ */
133
+ width?: number;
134
+ height?: number;
135
+ /** Time window to render. Omit (or both 0) to show every candle. */
136
+ visibleRange?: VisibleRange;
137
+ theme?: VroomTheme;
138
+ /** RSI indicator (pane below the candles). Omit/disable to hide it. */
139
+ rsi?: RSIConfig;
140
+ /** MACD indicator (its own pane below the candles). Omit/disable to hide it. */
141
+ macd?: MACDConfig;
142
+ /** Moving-average overlay lines (SMA/EMA) drawn on the price pane. */
143
+ movingAverages?: MovingAverageOverlay[];
144
+ /** VWAP overlay (session anchor, configurable reset). */
145
+ vwap?: VWAPConfig;
146
+ /**
147
+ * Pixels the crosshair dot / horizontal line sit *above* the touch point so
148
+ * they aren't hidden under the thumb. The vertical line stays centered on the
149
+ * touch x. Default 40.
150
+ */
151
+ crosshairOffset?: number;
152
+ onCrosshair?: (e: CrosshairEvent) => void;
153
+ onViewportChange?: (startMs: number, endMs: number) => void;
154
+ };
155
+
156
+ /**
157
+ * Props for the {@link VroomChart} component. The cross-platform props come
158
+ * from {@link VroomChartCoreProps}; `style` is the React Native flavor.
159
+ */
160
+ type VroomChartProps = VroomChartCoreProps & {
161
+ /** Style for the chart's root view. Defaults to filling the parent. */
162
+ style?: StyleProp<ViewStyle>;
163
+ };
164
+
165
+ // Ambient declaration for the JSI HostObject installed by VroomChartModule.
166
+
167
+
168
+
169
+ declare global {
170
+ // eslint-disable-next-line no-var
171
+ var VroomChartJSI: VroomChartJSI | undefined;
172
+ }
173
+
174
+ /**
175
+ * Skia-rendered candlestick chart. Pass OHLCV `candles` and size it via `style`
176
+ * (it fills its parent by default). Pan to scroll, pinch to zoom, drag the
177
+ * price/time axes to rescale, and long-press for the crosshair. Optional
178
+ * indicators (`rsi`, `macd`, `movingAverages`, `vwap`), colors (`theme`), and
179
+ * events (`onCrosshair`, `onViewportChange`) are configured through props.
180
+ *
181
+ * @see {@link VroomChartProps} for the full prop reference.
182
+ */
183
+ declare function VroomChart(props: VroomChartProps): React.JSX.Element;
184
+
185
+ export { type Candle, type CrosshairEvent, type MACDConfig, type MASource, type MovingAverageOverlay, type RSIConfig, type VWAPConfig, type VisibleRange, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme };
package/lib/index.d.ts ADDED
@@ -0,0 +1,185 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ /** A single OHLCV bar. `candles` is an array of these. */
5
+ type Candle = {
6
+ /** Bar open time as Unix epoch milliseconds. */
7
+ timeMs: number;
8
+ /** Opening price. */
9
+ open: number;
10
+ /** Highest price during the bar. */
11
+ high: number;
12
+ /** Lowest price during the bar. */
13
+ low: number;
14
+ /** Closing price. */
15
+ close: number;
16
+ /** Traded volume during the bar. */
17
+ volume: number;
18
+ };
19
+ /** Payload passed to `onCrosshair` as the crosshair shows, moves, or hides. */
20
+ type CrosshairEvent = {
21
+ /** True while the crosshair is showing; false when it's dismissed. */
22
+ active: boolean;
23
+ /** OHLCV of the candle under the crosshair, or null when inactive. */
24
+ candle: Candle | null;
25
+ /**
26
+ * Why this event fired — lets the host react differently (e.g. haptics):
27
+ * 'show' — long-press activated the crosshair
28
+ * 'move' — the crosshair snapped to a *different* candle (one per candle
29
+ * crossed; not per drag frame)
30
+ * 'hide' — the crosshair was dismissed
31
+ * The library never plays haptics itself; the host decides.
32
+ */
33
+ reason: 'show' | 'move' | 'hide';
34
+ };
35
+ /**
36
+ * A color value: a hex string (`'#0d1117'`, or 8-digit `'#aarrggbb'`) or a
37
+ * packed ARGB number. In `VroomTheme` every field is optional — omitted colors
38
+ * keep the library default.
39
+ */
40
+ type VroomColor = string | number;
41
+ /** Color overrides for the chart, passed via the `theme` prop. */
42
+ type VroomTheme = {
43
+ /** Chart + axis-strip background. */
44
+ background?: VroomColor;
45
+ /** Up candles (also bull wicks, bull volume bars, rising price indicator). */
46
+ bull?: VroomColor;
47
+ /** Down candles (also bear wicks, bear volume bars, falling price indicator). */
48
+ bear?: VroomColor;
49
+ /** Gridlines. */
50
+ grid?: VroomColor;
51
+ /** Axis label text (price + time). */
52
+ axisText?: VroomColor;
53
+ /** Crosshair dashed lines. */
54
+ crosshair?: VroomColor;
55
+ /** Crosshair target — the hollow ring/dot at the intersection. */
56
+ crosshairTarget?: VroomColor;
57
+ };
58
+ /** A time window over the candle data, as Unix epoch milliseconds. */
59
+ type VisibleRange = {
60
+ /** Window start (inclusive), Unix epoch milliseconds. */
61
+ startMs: number;
62
+ /** Window end (inclusive), Unix epoch milliseconds. */
63
+ endMs: number;
64
+ };
65
+ /** RSI indicator config. Rendered in a pane below the candles when enabled. */
66
+ type RSIConfig = {
67
+ enabled?: boolean;
68
+ /** Lookback period in candle counts. Default 14, clamped to >= 2. */
69
+ period?: number;
70
+ /** Overbought band level (0..100). Default 70. */
71
+ upperBand?: number;
72
+ /** Oversold band level (0..100). Default 30. */
73
+ lowerBand?: number;
74
+ /** Show the RSI-based moving-average trendline. Default true. */
75
+ maEnabled?: boolean;
76
+ /** Trendline (MA of RSI) length. Default 14, clamped to >= 1. */
77
+ maPeriod?: number;
78
+ };
79
+ /** Price source for a moving average. */
80
+ type MASource = 'close' | 'open' | 'high' | 'low' | 'hl2' | 'hlc3' | 'ohlc4';
81
+ /**
82
+ * A moving-average overlay line drawn on the price pane. Provide an array of
83
+ * these via `movingAverages` to render a ribbon of SMA/EMA lines.
84
+ */
85
+ type MovingAverageOverlay = {
86
+ /** 'sma' (simple) or 'ema' (exponential). */
87
+ kind: 'sma' | 'ema';
88
+ /** Lookback in candles. */
89
+ length: number;
90
+ /** Price source. Default 'close'. */
91
+ source?: MASource;
92
+ /** Line color (hex string or packed ARGB number). */
93
+ color?: string | number;
94
+ /** Stroke width in px. Default 1.5. */
95
+ width?: number;
96
+ };
97
+ /**
98
+ * VWAP overlay config (session anchor). Drawn as a single line on the price
99
+ * pane, resetting each session.
100
+ */
101
+ type VWAPConfig = {
102
+ enabled?: boolean;
103
+ /** Session reset offset from UTC midnight, in minutes (default 0). */
104
+ resetMinutes?: number;
105
+ /** Line color (hex string or packed ARGB number). */
106
+ color?: string | number;
107
+ /** Stroke width in px. Default 1.5. */
108
+ width?: number;
109
+ };
110
+ /** MACD indicator config. Rendered in its own pane below the candles. */
111
+ type MACDConfig = {
112
+ enabled?: boolean;
113
+ /** Fast EMA length. Default 12. */
114
+ fast?: number;
115
+ /** Slow EMA length (forced > fast). Default 26. */
116
+ slow?: number;
117
+ /** Signal-line EMA length. Default 9. */
118
+ signal?: number;
119
+ };
120
+ /**
121
+ * Platform-agnostic props shared by every vroom chart component. Each platform
122
+ * extends this with its own `style` typing (and any platform-only props) to
123
+ * form its public `VroomChartProps`.
124
+ */
125
+ type VroomChartCoreProps = {
126
+ /** OHLCV bars to render. The only required prop. */
127
+ candles: Candle[];
128
+ /**
129
+ * Explicit size overrides in logical px. When omitted, the chart fills its
130
+ * parent (measured at runtime). Prefer layout-driven sizing via the
131
+ * platform's `style` (flex / aspect-ratio / absolute fill) over hard-coding.
132
+ */
133
+ width?: number;
134
+ height?: number;
135
+ /** Time window to render. Omit (or both 0) to show every candle. */
136
+ visibleRange?: VisibleRange;
137
+ theme?: VroomTheme;
138
+ /** RSI indicator (pane below the candles). Omit/disable to hide it. */
139
+ rsi?: RSIConfig;
140
+ /** MACD indicator (its own pane below the candles). Omit/disable to hide it. */
141
+ macd?: MACDConfig;
142
+ /** Moving-average overlay lines (SMA/EMA) drawn on the price pane. */
143
+ movingAverages?: MovingAverageOverlay[];
144
+ /** VWAP overlay (session anchor, configurable reset). */
145
+ vwap?: VWAPConfig;
146
+ /**
147
+ * Pixels the crosshair dot / horizontal line sit *above* the touch point so
148
+ * they aren't hidden under the thumb. The vertical line stays centered on the
149
+ * touch x. Default 40.
150
+ */
151
+ crosshairOffset?: number;
152
+ onCrosshair?: (e: CrosshairEvent) => void;
153
+ onViewportChange?: (startMs: number, endMs: number) => void;
154
+ };
155
+
156
+ /**
157
+ * Props for the {@link VroomChart} component. The cross-platform props come
158
+ * from {@link VroomChartCoreProps}; `style` is the React Native flavor.
159
+ */
160
+ type VroomChartProps = VroomChartCoreProps & {
161
+ /** Style for the chart's root view. Defaults to filling the parent. */
162
+ style?: StyleProp<ViewStyle>;
163
+ };
164
+
165
+ // Ambient declaration for the JSI HostObject installed by VroomChartModule.
166
+
167
+
168
+
169
+ declare global {
170
+ // eslint-disable-next-line no-var
171
+ var VroomChartJSI: VroomChartJSI | undefined;
172
+ }
173
+
174
+ /**
175
+ * Skia-rendered candlestick chart. Pass OHLCV `candles` and size it via `style`
176
+ * (it fills its parent by default). Pan to scroll, pinch to zoom, drag the
177
+ * price/time axes to rescale, and long-press for the crosshair. Optional
178
+ * indicators (`rsi`, `macd`, `movingAverages`, `vwap`), colors (`theme`), and
179
+ * events (`onCrosshair`, `onViewportChange`) are configured through props.
180
+ *
181
+ * @see {@link VroomChartProps} for the full prop reference.
182
+ */
183
+ declare function VroomChart(props: VroomChartProps): React.JSX.Element;
184
+
185
+ export { type Candle, type CrosshairEvent, type MACDConfig, type MASource, type MovingAverageOverlay, type RSIConfig, type VWAPConfig, type VisibleRange, VroomChart, type VroomChartProps, type VroomColor, type VroomTheme };