@christtrade/depth 0.12.21
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/LICENSE.md +201 -0
- package/NOTICE +15 -0
- package/README.md +159 -0
- package/depth.cjs +1136 -0
- package/depth.css +2 -0
- package/depth.mjs +1136 -0
- package/depth.nopreflight.css +2 -0
- package/index.d.ts +1 -0
- package/package.json +32 -0
- package/types/ChartInner.d.ts +114 -0
- package/types/ChartOuter.d.ts +31 -0
- package/types/components/account/AccountSummary.d.ts +8 -0
- package/types/components/chart/chart-context-menu.d.ts +30 -0
- package/types/components/chart/chart-settings-dialog.d.ts +15 -0
- package/types/components/chart/chart-status-overlay.d.ts +24 -0
- package/types/components/chart/data-status.d.ts +10 -0
- package/types/components/chart/pane-legend.d.ts +37 -0
- package/types/components/chart/session-status-badge.d.ts +14 -0
- package/types/components/chart/status-bar.d.ts +9 -0
- package/types/components/chart/symbol-icon.d.ts +9 -0
- package/types/components/chart/tz.d.ts +10 -0
- package/types/components/drawings/drawing-icons.d.ts +2 -0
- package/types/components/drawings/drawing-settings-bar.d.ts +15 -0
- package/types/components/drawings/drawing-settings-dialog.d.ts +268 -0
- package/types/components/drawings/drawing-toolbar.d.ts +14 -0
- package/types/components/drawings/drawing-tools.d.ts +23 -0
- package/types/components/indicators/indicators-dialog.d.ts +20 -0
- package/types/components/indicators/indicators-settings-dialog.d.ts +164 -0
- package/types/components/multi-chart/GridDividers.d.ts +12 -0
- package/types/components/multi-chart/LayoutPicker.d.ts +19 -0
- package/types/components/plugin-panels/BottomBarPluginHost.d.ts +7 -0
- package/types/components/plugin-panels/PluginFixedPanelHost.d.ts +18 -0
- package/types/components/plugin-panels/PluginToolbarHost.d.ts +7 -0
- package/types/components/plugin-panels/PluginWindowsDropdown.d.ts +7 -0
- package/types/components/plugins/plugin-manager-dialog.d.ts +14 -0
- package/types/components/toolbar/SymbolSwitcher.d.ts +8 -0
- package/types/components/toolbar/chart-icons.d.ts +16 -0
- package/types/components/toolbar/chart-type-selector.d.ts +11 -0
- package/types/components/toolbar/timeframe-selector.d.ts +15 -0
- package/types/components/trading/OrderPanel.d.ts +36 -0
- package/types/components/trading/QuickTradingButtons.d.ts +7 -0
- package/types/components/trading/order-math.d.ts +94 -0
- package/types/components/ui/button.d.ts +11 -0
- package/types/components/ui/checkbox.d.ts +4 -0
- package/types/components/ui/color-picker.d.ts +12 -0
- package/types/components/ui/dialog.d.ts +19 -0
- package/types/components/ui/dropdown-menu.d.ts +27 -0
- package/types/components/ui/hover-card.d.ts +6 -0
- package/types/components/ui/input.d.ts +4 -0
- package/types/components/ui/popover.d.ts +7 -0
- package/types/components/ui/resizable.d.ts +23 -0
- package/types/components/ui/separator.d.ts +4 -0
- package/types/components/ui/slider.d.ts +4 -0
- package/types/components/ui/switch.d.ts +4 -0
- package/types/components/ui/tooltip.d.ts +7 -0
- package/types/core/AccountManager.d.ts +142 -0
- package/types/core/ChartModel.d.ts +84 -0
- package/types/core/ChartState.d.ts +51 -0
- package/types/core/ChartTypeRegistry.d.ts +27 -0
- package/types/core/DataEngine.d.ts +143 -0
- package/types/core/DataSourceRegistry.d.ts +106 -0
- package/types/core/DepthChart.d.ts +458 -0
- package/types/core/DrawingRegistry.d.ts +133 -0
- package/types/core/DrawingStore.d.ts +26 -0
- package/types/core/ExecutionEngine.d.ts +95 -0
- package/types/core/GlobalChartBus.d.ts +32 -0
- package/types/core/Playback.d.ts +48 -0
- package/types/core/PlaybackStateRegistry.d.ts +25 -0
- package/types/core/PluginRegistry.d.ts +67 -0
- package/types/core/PluginSchedule.d.ts +15 -0
- package/types/core/RenderEngine.d.ts +143 -0
- package/types/core/ScriptedPlugin.d.ts +153 -0
- package/types/core/SessionMapper.d.ts +54 -0
- package/types/core/SessionUtils.d.ts +53 -0
- package/types/core/TypedEventBus.d.ts +691 -0
- package/types/core/WasmPluginHost.d.ts +39 -0
- package/types/core/index.d.ts +70 -0
- package/types/core/plugin-startup.d.ts +33 -0
- package/types/core/processing/data-chunk.d.ts +37 -0
- package/types/core/processing/data-level.d.ts +13 -0
- package/types/core/processing/l2-processor.d.ts +10 -0
- package/types/core/processing/l3-processor.d.ts +26 -0
- package/types/core/processing/ohlcv-processor.d.ts +14 -0
- package/types/core/processing/tick-processor.d.ts +14 -0
- package/types/core/script-dsl.d.ts +20 -0
- package/types/core/script-scope.d.ts +4 -0
- package/types/core/script.worker.d.ts +1 -0
- package/types/hooks/useCellBridges.d.ts +36 -0
- package/types/hooks/useChartData.d.ts +153 -0
- package/types/hooks/useChartHandlers.d.ts +94 -0
- package/types/hooks/useChartInteraction.d.ts +160 -0
- package/types/hooks/useChartLayout.d.ts +21 -0
- package/types/hooks/useChartPlugin.d.ts +34 -0
- package/types/hooks/useChartSettings.d.ts +44 -0
- package/types/hooks/useChartSubscriptions.d.ts +64 -0
- package/types/hooks/useChartView.d.ts +47 -0
- package/types/hooks/usePlaybackEngine.d.ts +85 -0
- package/types/hooks/useRenderEngine.d.ts +64 -0
- package/types/hooks/useTradeLines.d.ts +80 -0
- package/types/hooks/useTradingState.d.ts +135 -0
- package/types/interfaces/IAccountAdapter.d.ts +38 -0
- package/types/interfaces/ICoordinateTransformer.d.ts +105 -0
- package/types/interfaces/IDataAdapter.d.ts +402 -0
- package/types/interfaces/IExecutionAdapter.d.ts +71 -0
- package/types/interfaces/plugins/IChartPlugin.d.ts +254 -0
- package/types/interfaces/plugins/IChartTypePlugin.d.ts +126 -0
- package/types/interfaces/plugins/IDataSourcePlugin.d.ts +20 -0
- package/types/interfaces/plugins/IDrawingPlugin.d.ts +62 -0
- package/types/interfaces/plugins/IIndicatorPlugin.d.ts +97 -0
- package/types/interfaces/plugins/index.d.ts +5 -0
- package/types/lib/bar-grid.d.ts +6 -0
- package/types/lib/book.d.ts +5 -0
- package/types/lib/clock.d.ts +7 -0
- package/types/lib/compact-buffer.d.ts +66 -0
- package/types/lib/constants.d.ts +5 -0
- package/types/lib/createSimulatedAdapter.d.ts +42 -0
- package/types/lib/dpr.d.ts +27 -0
- package/types/lib/heatmap.worker.d.ts +1 -0
- package/types/lib/indicator-stdlib.d.ts +426 -0
- package/types/lib/indicator-worker.d.ts +65 -0
- package/types/lib/matchingEngine.d.ts +144 -0
- package/types/lib/notifications/tradeToast.d.ts +31 -0
- package/types/lib/pointer-lock.d.ts +5 -0
- package/types/lib/priceFormat.d.ts +17 -0
- package/types/lib/priceTransition.d.ts +22 -0
- package/types/lib/renderers/drawFootprintChart.d.ts +5 -0
- package/types/lib/renderers/drawTradeLines.d.ts +112 -0
- package/types/lib/renderers/drawings-renderer.d.ts +57 -0
- package/types/lib/renderers/renderer.d.ts +113 -0
- package/types/lib/sampler.d.ts +7 -0
- package/types/lib/series/japaneseCharts.d.ts +88 -0
- package/types/lib/slice-worker-client.d.ts +138 -0
- package/types/lib/slice.worker.d.ts +139 -0
- package/types/lib/storage.d.ts +108 -0
- package/types/lib/symbol-info.d.ts +12 -0
- package/types/lib/symbol-search.d.ts +29 -0
- package/types/lib/timeframes.d.ts +46 -0
- package/types/lib/tradingview-import.d.ts +32 -0
- package/types/lib/types/chart-settings.d.ts +90 -0
- package/types/lib/types/drawing-types.d.ts +393 -0
- package/types/lib/types/footprint.d.ts +119 -0
- package/types/lib/types/heatmap-types.d.ts +30 -0
- package/types/lib/types/index.d.ts +147 -0
- package/types/lib/types/indicator-types.d.ts +123 -0
- package/types/lib/types/layout-sync.d.ts +43 -0
- package/types/lib/types/trading-types.d.ts +323 -0
- package/types/lib/use-forwarded-ref.d.ts +1 -0
- package/types/lib/utils.d.ts +2 -0
- package/types/plugins/alligator.d.ts +1 -0
- package/types/plugins/atr.d.ts +1 -0
- package/types/plugins/awesome-oscillator.d.ts +1 -0
- package/types/plugins/bollinger-bands.d.ts +1 -0
- package/types/plugins/cci.d.ts +1 -0
- package/types/plugins/cvd.d.ts +1 -0
- package/types/plugins/donchian.d.ts +1 -0
- package/types/plugins/ichimoku.d.ts +1 -0
- package/types/plugins/index.d.ts +25 -0
- package/types/plugins/keltner.d.ts +1 -0
- package/types/plugins/macd.d.ts +1 -0
- package/types/plugins/mfi.d.ts +1 -0
- package/types/plugins/moving-average.d.ts +1 -0
- package/types/plugins/obv.d.ts +1 -0
- package/types/plugins/psar.d.ts +1 -0
- package/types/plugins/rsi.d.ts +1 -0
- package/types/plugins/sessions.d.ts +1 -0
- package/types/plugins/stochastic.d.ts +1 -0
- package/types/plugins/supertrend.d.ts +1 -0
- package/types/plugins/volume.d.ts +1 -0
- package/types/plugins/vwap.d.ts +1 -0
- package/types/plugins/williams-r.d.ts +1 -0
- package/types/react/useDepthChart.d.ts +6 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
export type DrawingTool = 'cursor' | 'hline' | 'vline' | 'extended-line' | 'line' | 'cross-line' | 'info-line' | 'trend-angle' | 'ray' | 'hray' | 'parallel-channel' | 'rect' | 'triangle' | 'fib' | 'text' | 'fvp' | 'long' | 'short' | 'flat-channel' | 'disjoint-channel' | 'regression-trend' | 'pitchfork' | 'schiff-pitchfork' | 'modified-schiff-pitchfork' | 'inside-pitchfork' | 'fib-extension' | 'fib-trend-extension' | 'fib-channel' | 'fib-time-zone' | 'fib-speed-fan' | 'fib-circles' | 'fib-spiral' | 'fib-wedge' | 'gann-box' | 'gann-square' | 'gann-fan' | 'xabcd' | 'cypher' | 'abcd' | 'three-drives' | 'head-shoulders' | 'triangle-pattern' | 'elliott-impulse' | 'elliott-correction' | 'elliott-triangle' | 'elliott-double-combo' | 'elliott-triple-combo' | 'rotated-rect' | 'ellipse' | 'circle' | 'polygon' | 'arc' | 'curve' | 'double-curve' | 'polyline' | 'path' | 'anchored-text' | 'note' | 'callout' | 'comment' | 'price-label' | 'signpost' | 'flag' | 'pin' | 'table' | 'arrow' | 'arrow-marker' | 'arrow-up' | 'arrow-down' | 'brush' | 'highlighter' | 'forecast' | 'projection' | 'bars-pattern' | 'ghost-feed' | 'price-range' | 'date-range' | 'date-price-range' | 'anchored-volume-profile' | 'fixed-range-volume' | 'anchored-vwap' | 'ruler';
|
|
2
|
+
type AllKeys<T> = T extends any ? keyof T : never;
|
|
3
|
+
type ValueOfKey<T, K extends PropertyKey> = T extends any ? K extends keyof T ? T[K] : never : never;
|
|
4
|
+
/** A drawing of unknown tool: read any field, get `undefined` if absent. */
|
|
5
|
+
export type AnyDrawing = {
|
|
6
|
+
[K in AllKeys<Drawing>]?: ValueOfKey<Drawing, K>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* What the chart is currently armed with, or what is currently selected.
|
|
10
|
+
*
|
|
11
|
+
* - `name` - the tool, `'cursor'` when nothing is armed.
|
|
12
|
+
* - `id` - identity of the drawing: the selected one, or the id the next
|
|
13
|
+
* committed drawing will carry.
|
|
14
|
+
* - `state` - its fields. For an armed tool that is the style it will be
|
|
15
|
+
* created with; for a selection it is the live drawing.
|
|
16
|
+
*/
|
|
17
|
+
export type ActiveDrawingTool = {
|
|
18
|
+
name: DrawingTool;
|
|
19
|
+
id: string;
|
|
20
|
+
state: AnyDrawing;
|
|
21
|
+
};
|
|
22
|
+
/** The idle tool. Shared so every "back to cursor" site agrees on the shape. */
|
|
23
|
+
export declare const CURSOR_TOOL: ActiveDrawingTool;
|
|
24
|
+
export type Anchor = {
|
|
25
|
+
ts: bigint;
|
|
26
|
+
price: number;
|
|
27
|
+
};
|
|
28
|
+
export type TextAlign = 'left' | 'center' | 'right';
|
|
29
|
+
export type VerticalAlign = 'top' | 'middle' | 'bottom';
|
|
30
|
+
export type LabelStyle = {
|
|
31
|
+
label?: string;
|
|
32
|
+
labelColor?: string;
|
|
33
|
+
labelFontSize?: number;
|
|
34
|
+
labelBold?: boolean;
|
|
35
|
+
labelItalic?: boolean;
|
|
36
|
+
labelHorizontalAlign?: TextAlign;
|
|
37
|
+
labelVerticalAlign?: VerticalAlign;
|
|
38
|
+
labelTextOrientation?: 'horizontal' | 'vertical';
|
|
39
|
+
};
|
|
40
|
+
export type DrawingAnchorId = 'a' | 'b' | 'c' | 'anchor' | 'body' | 'tl' | 'tr' | 'bl' | 'br' | 'mt' | 'mb' | 'ml' | 'mr' | 'all' | `a${number}`;
|
|
41
|
+
export type HitResult = {
|
|
42
|
+
drawingId: string;
|
|
43
|
+
anchor: DrawingAnchorId;
|
|
44
|
+
} | null;
|
|
45
|
+
export type HLineDrawing = {
|
|
46
|
+
id: string;
|
|
47
|
+
tool: 'hline';
|
|
48
|
+
price: number;
|
|
49
|
+
color: string;
|
|
50
|
+
lineWidth: number;
|
|
51
|
+
dash: number[];
|
|
52
|
+
locked?: boolean;
|
|
53
|
+
visible?: boolean;
|
|
54
|
+
} & LabelStyle;
|
|
55
|
+
export type VLineDrawing = {
|
|
56
|
+
id: string;
|
|
57
|
+
tool: 'vline';
|
|
58
|
+
ts: bigint;
|
|
59
|
+
color: string;
|
|
60
|
+
lineWidth: number;
|
|
61
|
+
dash: number[];
|
|
62
|
+
locked?: boolean;
|
|
63
|
+
visible?: boolean;
|
|
64
|
+
} & LabelStyle;
|
|
65
|
+
export type ExtLineDrawing = {
|
|
66
|
+
id: string;
|
|
67
|
+
tool: 'extended-line';
|
|
68
|
+
a: Anchor;
|
|
69
|
+
b: Anchor;
|
|
70
|
+
color: string;
|
|
71
|
+
lineWidth: number;
|
|
72
|
+
dash: number[];
|
|
73
|
+
extendLeft: boolean;
|
|
74
|
+
extendRight: boolean;
|
|
75
|
+
locked?: boolean;
|
|
76
|
+
visible?: boolean;
|
|
77
|
+
} & LabelStyle;
|
|
78
|
+
export type LineDrawing = {
|
|
79
|
+
id: string;
|
|
80
|
+
tool: 'line';
|
|
81
|
+
a: Anchor;
|
|
82
|
+
b: Anchor;
|
|
83
|
+
color: string;
|
|
84
|
+
lineWidth: number;
|
|
85
|
+
dash: number[];
|
|
86
|
+
extendLeft: boolean;
|
|
87
|
+
extendRight: boolean;
|
|
88
|
+
locked?: boolean;
|
|
89
|
+
visible?: boolean;
|
|
90
|
+
} & LabelStyle;
|
|
91
|
+
export type CrossLineDrawing = {
|
|
92
|
+
id: string;
|
|
93
|
+
tool: 'cross-line';
|
|
94
|
+
price: number;
|
|
95
|
+
ts: bigint;
|
|
96
|
+
color: string;
|
|
97
|
+
lineWidth: number;
|
|
98
|
+
dash: number[];
|
|
99
|
+
locked?: boolean;
|
|
100
|
+
visible?: boolean;
|
|
101
|
+
} & LabelStyle;
|
|
102
|
+
export type InfoLineDrawing = {
|
|
103
|
+
id: string;
|
|
104
|
+
tool: 'info-line';
|
|
105
|
+
a: Anchor;
|
|
106
|
+
b: Anchor;
|
|
107
|
+
color: string;
|
|
108
|
+
lineWidth: number;
|
|
109
|
+
dash: number[];
|
|
110
|
+
extendLeft?: boolean;
|
|
111
|
+
extendRight?: boolean;
|
|
112
|
+
locked?: boolean;
|
|
113
|
+
visible?: boolean;
|
|
114
|
+
} & LabelStyle;
|
|
115
|
+
export type TrendAngleDrawing = {
|
|
116
|
+
id: string;
|
|
117
|
+
tool: 'trend-angle';
|
|
118
|
+
a: Anchor;
|
|
119
|
+
b: Anchor;
|
|
120
|
+
color: string;
|
|
121
|
+
lineWidth: number;
|
|
122
|
+
dash: number[];
|
|
123
|
+
extendLeft?: boolean;
|
|
124
|
+
extendRight?: boolean;
|
|
125
|
+
locked?: boolean;
|
|
126
|
+
visible?: boolean;
|
|
127
|
+
} & LabelStyle;
|
|
128
|
+
export type RayDrawing = {
|
|
129
|
+
id: string;
|
|
130
|
+
tool: 'ray';
|
|
131
|
+
a: Anchor;
|
|
132
|
+
b: Anchor;
|
|
133
|
+
color: string;
|
|
134
|
+
lineWidth: number;
|
|
135
|
+
dash: number[];
|
|
136
|
+
locked?: boolean;
|
|
137
|
+
visible?: boolean;
|
|
138
|
+
} & LabelStyle;
|
|
139
|
+
export type HorzRayDrawing = {
|
|
140
|
+
id: string;
|
|
141
|
+
tool: 'hray';
|
|
142
|
+
price: number;
|
|
143
|
+
ts: bigint;
|
|
144
|
+
color: string;
|
|
145
|
+
lineWidth: number;
|
|
146
|
+
dash: number[];
|
|
147
|
+
locked?: boolean;
|
|
148
|
+
visible?: boolean;
|
|
149
|
+
} & LabelStyle;
|
|
150
|
+
export interface ChannelLevel {
|
|
151
|
+
id: string;
|
|
152
|
+
value: number | string;
|
|
153
|
+
color: string;
|
|
154
|
+
lineWidth: number;
|
|
155
|
+
dash: number[];
|
|
156
|
+
enabled: boolean;
|
|
157
|
+
}
|
|
158
|
+
export type ParallelChannelDrawing = {
|
|
159
|
+
id: string;
|
|
160
|
+
tool: 'parallel-channel';
|
|
161
|
+
a: Anchor;
|
|
162
|
+
b: Anchor;
|
|
163
|
+
height: number;
|
|
164
|
+
enableBackground: boolean;
|
|
165
|
+
backgroundColor: string;
|
|
166
|
+
dash: number[];
|
|
167
|
+
levels?: ChannelLevel[];
|
|
168
|
+
extendLeft?: boolean;
|
|
169
|
+
extendRight?: boolean;
|
|
170
|
+
locked?: boolean;
|
|
171
|
+
visible?: boolean;
|
|
172
|
+
} & LabelStyle;
|
|
173
|
+
export type RectDrawing = {
|
|
174
|
+
id: string;
|
|
175
|
+
tool: 'rect';
|
|
176
|
+
a: Anchor;
|
|
177
|
+
b: Anchor;
|
|
178
|
+
color: string;
|
|
179
|
+
borderColor?: string;
|
|
180
|
+
borderLineWidth?: number;
|
|
181
|
+
borderDash?: number[];
|
|
182
|
+
fillColor?: string;
|
|
183
|
+
fillOpacity: number;
|
|
184
|
+
locked?: boolean;
|
|
185
|
+
visible?: boolean;
|
|
186
|
+
} & LabelStyle;
|
|
187
|
+
export type TriangleDrawing = {
|
|
188
|
+
id: string;
|
|
189
|
+
tool: 'triangle';
|
|
190
|
+
a: Anchor;
|
|
191
|
+
b: Anchor;
|
|
192
|
+
c: Anchor;
|
|
193
|
+
color: string;
|
|
194
|
+
borderColor?: string;
|
|
195
|
+
borderLineWidth?: number;
|
|
196
|
+
borderDash?: number[];
|
|
197
|
+
fillColor?: string;
|
|
198
|
+
fillOpacity: number;
|
|
199
|
+
locked?: boolean;
|
|
200
|
+
visible?: boolean;
|
|
201
|
+
} & LabelStyle;
|
|
202
|
+
export interface FibLevel {
|
|
203
|
+
id: string;
|
|
204
|
+
value: string;
|
|
205
|
+
color: string;
|
|
206
|
+
enabled: boolean;
|
|
207
|
+
}
|
|
208
|
+
export type FibDrawing = {
|
|
209
|
+
id: string;
|
|
210
|
+
tool: 'fib';
|
|
211
|
+
a: Anchor;
|
|
212
|
+
b: Anchor;
|
|
213
|
+
color: string;
|
|
214
|
+
levels: FibLevel[];
|
|
215
|
+
locked?: boolean;
|
|
216
|
+
visible?: boolean;
|
|
217
|
+
extendLeft: boolean;
|
|
218
|
+
extendRight: boolean;
|
|
219
|
+
dash: number[];
|
|
220
|
+
lineWidth: number;
|
|
221
|
+
showPrices: boolean;
|
|
222
|
+
showLevels: boolean;
|
|
223
|
+
backgroundColor: string;
|
|
224
|
+
enableBackground: boolean;
|
|
225
|
+
labelAlign: string;
|
|
226
|
+
} & LabelStyle;
|
|
227
|
+
export type TextDrawing = {
|
|
228
|
+
id: string;
|
|
229
|
+
tool: 'text';
|
|
230
|
+
anchor: Anchor;
|
|
231
|
+
text: string;
|
|
232
|
+
color: string;
|
|
233
|
+
fontSize: number;
|
|
234
|
+
bold?: boolean;
|
|
235
|
+
italic?: boolean;
|
|
236
|
+
textAlign?: TextAlign;
|
|
237
|
+
locked?: boolean;
|
|
238
|
+
visible?: boolean;
|
|
239
|
+
screenAnchored?: boolean;
|
|
240
|
+
screenX?: number;
|
|
241
|
+
screenY?: number;
|
|
242
|
+
};
|
|
243
|
+
export type PositionDrawing = {
|
|
244
|
+
id: string;
|
|
245
|
+
a: Anchor;
|
|
246
|
+
b: Anchor;
|
|
247
|
+
/** Zone above the entry: target for a long, stop for a short. */
|
|
248
|
+
upColor: string;
|
|
249
|
+
/** Zone below the entry: stop for a long, target for a short. */
|
|
250
|
+
downColor: string;
|
|
251
|
+
/** Entry line + box border. */
|
|
252
|
+
entryColor: string;
|
|
253
|
+
upAmount: number;
|
|
254
|
+
downAmount: number;
|
|
255
|
+
/** Contracts/shares - sizes the order the settings bar can place. */
|
|
256
|
+
qty: number;
|
|
257
|
+
drawInfo: boolean;
|
|
258
|
+
fontSize: number;
|
|
259
|
+
textColor: string;
|
|
260
|
+
locked?: boolean;
|
|
261
|
+
visible?: boolean;
|
|
262
|
+
extendLeft: boolean;
|
|
263
|
+
extendRight: boolean;
|
|
264
|
+
};
|
|
265
|
+
export type LongDrawing = PositionDrawing & {
|
|
266
|
+
tool: 'long';
|
|
267
|
+
};
|
|
268
|
+
export type ShortDrawing = PositionDrawing & {
|
|
269
|
+
tool: 'short';
|
|
270
|
+
};
|
|
271
|
+
export type PluginDrawing = {
|
|
272
|
+
id: string;
|
|
273
|
+
tool: string;
|
|
274
|
+
anchors: Anchor[];
|
|
275
|
+
data?: unknown;
|
|
276
|
+
locked?: boolean;
|
|
277
|
+
visible?: boolean;
|
|
278
|
+
};
|
|
279
|
+
export type PluginDraftDrawing = {
|
|
280
|
+
tool?: undefined;
|
|
281
|
+
pluginToolId: string;
|
|
282
|
+
anchors: Anchor[];
|
|
283
|
+
data?: unknown;
|
|
284
|
+
};
|
|
285
|
+
export type VpDataCache = {
|
|
286
|
+
prices: Float64Array;
|
|
287
|
+
buyVol: Float64Array;
|
|
288
|
+
sellVol: Float64Array;
|
|
289
|
+
totalVol: Float64Array;
|
|
290
|
+
poc: number;
|
|
291
|
+
};
|
|
292
|
+
export type FvpProfileMode = 'stacked' | 'split' | 'delta' | 'total';
|
|
293
|
+
export type FixedVolumeProfileDrawing = {
|
|
294
|
+
id: string;
|
|
295
|
+
tool: 'fvp';
|
|
296
|
+
a: Anchor;
|
|
297
|
+
b: Anchor;
|
|
298
|
+
profileMode: FvpProfileMode;
|
|
299
|
+
barsWidth: number;
|
|
300
|
+
barOpacity: number;
|
|
301
|
+
enableBuyColor: boolean;
|
|
302
|
+
buyColor: string;
|
|
303
|
+
enableSellColor: boolean;
|
|
304
|
+
sellColor: string;
|
|
305
|
+
totalColor: string;
|
|
306
|
+
deltaNegColor: string;
|
|
307
|
+
showVolNumbers: boolean;
|
|
308
|
+
volNumbersFontSize: number;
|
|
309
|
+
showPoc: boolean;
|
|
310
|
+
pocColor: string;
|
|
311
|
+
showPocLabel: boolean;
|
|
312
|
+
pocExtendLeft: boolean;
|
|
313
|
+
pocExtendRight: boolean;
|
|
314
|
+
showValueArea: boolean;
|
|
315
|
+
valueAreaPct: number;
|
|
316
|
+
valueAreaFillColor: string;
|
|
317
|
+
showVaHLines: boolean;
|
|
318
|
+
vaLineColor: string;
|
|
319
|
+
vaLineExtendLeft: boolean;
|
|
320
|
+
vaLineExtendRight: boolean;
|
|
321
|
+
showDevPoc: boolean;
|
|
322
|
+
devPocColor: string;
|
|
323
|
+
showDevVa: boolean;
|
|
324
|
+
devVaColor: string;
|
|
325
|
+
enableBg: boolean;
|
|
326
|
+
bgColor: string;
|
|
327
|
+
enableBorder: boolean;
|
|
328
|
+
borderColor: string;
|
|
329
|
+
borderDash: number[];
|
|
330
|
+
highlightPocBar: boolean;
|
|
331
|
+
pocBarLineWidth: number;
|
|
332
|
+
vaBarDimming: boolean;
|
|
333
|
+
vaOutsideDimFrac: number;
|
|
334
|
+
labelPills: boolean;
|
|
335
|
+
splitCenterLine: boolean;
|
|
336
|
+
barGap: boolean;
|
|
337
|
+
/** Runtime-only - never serialized. */
|
|
338
|
+
vpData?: VpDataCache;
|
|
339
|
+
} & LabelStyle;
|
|
340
|
+
export type Drawing = HLineDrawing | VLineDrawing | ExtLineDrawing | LineDrawing | CrossLineDrawing | InfoLineDrawing | TrendAngleDrawing | RayDrawing | HorzRayDrawing | ParallelChannelDrawing | RectDrawing | TriangleDrawing | FibDrawing | TextDrawing | FixedVolumeProfileDrawing | LongDrawing | ShortDrawing | PluginDrawing;
|
|
341
|
+
export declare const DEFAULT_FIB_LEVELS: FibLevel[];
|
|
342
|
+
export declare const DEFAULT_CHANNEL_LEVELS: ChannelLevel[];
|
|
343
|
+
export declare function defaultStyleForTool(tool: DrawingTool): Partial<Drawing>;
|
|
344
|
+
/**
|
|
345
|
+
* Arm a tool for creation. The id is minted here so the tool, the draft and the
|
|
346
|
+
* committed drawing all share one identity - `getActiveTool().id` names the
|
|
347
|
+
* drawing that is about to exist.
|
|
348
|
+
*/
|
|
349
|
+
export declare function armTool(tool: DrawingTool, style?: Partial<Drawing>): ActiveDrawingTool;
|
|
350
|
+
/** Describe an existing drawing in the same shape an armed tool uses. */
|
|
351
|
+
export declare function toolFromDrawing(d: Drawing): ActiveDrawingTool;
|
|
352
|
+
export declare const HIT_TOLERANCE_PX = 7;
|
|
353
|
+
export type DraftDrawing = {
|
|
354
|
+
tool: 'hline';
|
|
355
|
+
price: number;
|
|
356
|
+
} | {
|
|
357
|
+
tool: 'vline';
|
|
358
|
+
ts: bigint;
|
|
359
|
+
} | {
|
|
360
|
+
tool: 'hray' | 'cross-line';
|
|
361
|
+
price: number;
|
|
362
|
+
ts: bigint;
|
|
363
|
+
} | {
|
|
364
|
+
tool: 'line' | 'ray' | 'extended-line' | 'info-line' | 'trend-angle' | 'parallel-channel';
|
|
365
|
+
a: Anchor;
|
|
366
|
+
b: Anchor | null;
|
|
367
|
+
} | {
|
|
368
|
+
tool: 'rect' | 'fib';
|
|
369
|
+
a: Anchor;
|
|
370
|
+
b: Anchor | null;
|
|
371
|
+
} | {
|
|
372
|
+
tool: 'triangle';
|
|
373
|
+
a: Anchor;
|
|
374
|
+
b: Anchor | null;
|
|
375
|
+
} | {
|
|
376
|
+
tool: 'text';
|
|
377
|
+
anchor: Anchor;
|
|
378
|
+
} | {
|
|
379
|
+
tool: 'fvp';
|
|
380
|
+
a: Anchor;
|
|
381
|
+
b: Anchor | null;
|
|
382
|
+
} | PluginDraftDrawing;
|
|
383
|
+
export type DrawingStyleTemplate = {
|
|
384
|
+
id: string;
|
|
385
|
+
name: string;
|
|
386
|
+
tool: DrawingTool;
|
|
387
|
+
style: Partial<Drawing>;
|
|
388
|
+
createdAt: number;
|
|
389
|
+
};
|
|
390
|
+
export declare function loadTemplates(): DrawingStyleTemplate[];
|
|
391
|
+
export declare function saveTemplate(tpl: DrawingStyleTemplate): void;
|
|
392
|
+
export declare function deleteTemplate(id: string): void;
|
|
393
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { MboEvent } from '.';
|
|
2
|
+
/** Volume at a single price level inside one bar. */
|
|
3
|
+
export type FootprintLevel = {
|
|
4
|
+
price: number;
|
|
5
|
+
bidVol: number;
|
|
6
|
+
askVol: number;
|
|
7
|
+
delta: number;
|
|
8
|
+
totalVol: number;
|
|
9
|
+
/** Bid volume significantly exceeds ask at this level (sell imbalance). */
|
|
10
|
+
bidImbalance: boolean;
|
|
11
|
+
/** Ask volume significantly exceeds bid at this level (buy imbalance). */
|
|
12
|
+
askImbalance: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* DIAGONAL IMBALANCE
|
|
15
|
+
* Sierra Chart / Bookmap definition: compares the ASK at this level
|
|
16
|
+
* against the BID one tick BELOW, and the BID at this level against the
|
|
17
|
+
* ASK one tick ABOVE. This surfaces diagonal pressure in the tape.
|
|
18
|
+
*
|
|
19
|
+
* diagAskImbalance: ask[n] >= threshold x bid[n-1] -> upward diagonal pressure
|
|
20
|
+
* diagBidImbalance: bid[n] >= threshold x ask[n+1] -> downward diagonal pressure
|
|
21
|
+
*/
|
|
22
|
+
diagAskImbalance: boolean;
|
|
23
|
+
diagBidImbalance: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* ABSORPTION
|
|
26
|
+
* Large volume that didn't move price - the market "absorbed" the flow.
|
|
27
|
+
* Detected when totalVol >= absorptionThreshold AND the level is inside
|
|
28
|
+
* the bar body (between open and close), AND the delta is small relative
|
|
29
|
+
* to the volume (i.e. both sides traded heavily).
|
|
30
|
+
*/
|
|
31
|
+
absorption: boolean;
|
|
32
|
+
};
|
|
33
|
+
/** All price levels for a single candle bar. */
|
|
34
|
+
export type FootprintBar = {
|
|
35
|
+
/** Bar open timestamp (nanoseconds, floored to barNs boundary). */
|
|
36
|
+
ts: bigint;
|
|
37
|
+
open: number;
|
|
38
|
+
high: number;
|
|
39
|
+
low: number;
|
|
40
|
+
close: number;
|
|
41
|
+
totalVol: number;
|
|
42
|
+
totalDelta: number;
|
|
43
|
+
maxLevelVol: number;
|
|
44
|
+
maxAbsDelta: number;
|
|
45
|
+
/** Sorted high->low. */
|
|
46
|
+
levels: FootprintLevel[];
|
|
47
|
+
isBullish: boolean;
|
|
48
|
+
poc: number;
|
|
49
|
+
/**
|
|
50
|
+
* STACKED IMBALANCE (buy side)
|
|
51
|
+
* Price range [stackedBuyLow, stackedBuyHigh] where >= stackMinCount
|
|
52
|
+
* consecutive levels all have askImbalance === true.
|
|
53
|
+
* Can be multiple non-overlapping stacks per bar.
|
|
54
|
+
*/
|
|
55
|
+
stackedBuyZones: PriceRange[];
|
|
56
|
+
/**
|
|
57
|
+
* STACKED IMBALANCE (sell side)
|
|
58
|
+
* Price range where >= stackMinCount consecutive levels all have bidImbalance.
|
|
59
|
+
*/
|
|
60
|
+
stackedSellZones: PriceRange[];
|
|
61
|
+
/**
|
|
62
|
+
* UNFINISHED AUCTION (high)
|
|
63
|
+
* The bar high has zero (or near-zero) ask volume - buyers ran out of
|
|
64
|
+
* sellers at the top, price "unfinished" - likely to revisit.
|
|
65
|
+
*/
|
|
66
|
+
unfinishedTop: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* UNFINISHED AUCTION (low)
|
|
69
|
+
* The bar low has zero (or near-zero) bid volume - sellers ran out of
|
|
70
|
+
* buyers at the bottom.
|
|
71
|
+
*/
|
|
72
|
+
unfinishedBottom: boolean;
|
|
73
|
+
/** Number of levels with absorption signal in this bar. */
|
|
74
|
+
absorptionCount: number;
|
|
75
|
+
/** Dominant diagonal imbalance direction for the bar ('buy'|'sell'|'none'). */
|
|
76
|
+
diagDominant: 'buy' | 'sell' | 'none';
|
|
77
|
+
};
|
|
78
|
+
export type PriceRange = {
|
|
79
|
+
low: number;
|
|
80
|
+
high: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Display mode for footprint cells.
|
|
84
|
+
*
|
|
85
|
+
* 'bid-ask' - two columns per level: sell vol (left) | buy vol (right)
|
|
86
|
+
* 'profile' - single bar, width = total vol, green/red by dominant side
|
|
87
|
+
* 'delta' - bar width = |delta|, coloured by direction
|
|
88
|
+
* 'total' - bar width = total vol, neutral grey
|
|
89
|
+
*/
|
|
90
|
+
export type FootprintMode = 'bid-ask' | 'profile' | 'delta' | 'total';
|
|
91
|
+
export type FootprintOptions = {
|
|
92
|
+
tickSize?: number;
|
|
93
|
+
/** Ratio threshold for a level to be considered imbalanced (default 3.0 = 300%). */
|
|
94
|
+
imbalanceRatio?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Minimum consecutive imbalanced levels to form a stacked imbalance zone
|
|
97
|
+
* (default 3).
|
|
98
|
+
*/
|
|
99
|
+
stackMinCount?: number;
|
|
100
|
+
/**
|
|
101
|
+
* Volume threshold multiplier for absorption detection.
|
|
102
|
+
* A level is "absorbed" when totalVol >= absorptionMult x bar average level vol
|
|
103
|
+
* AND |delta / totalVol| <= absorptionDeltaFrac (default 0.25).
|
|
104
|
+
*/
|
|
105
|
+
absorptionMult?: number;
|
|
106
|
+
absorptionDeltaFrac?: number;
|
|
107
|
+
/**
|
|
108
|
+
* How many ticks from the bar extreme to look for unfinished auction.
|
|
109
|
+
* Default 1 = only the exact high/low tick.
|
|
110
|
+
*/
|
|
111
|
+
unfinishedTicks?: number;
|
|
112
|
+
/**
|
|
113
|
+
* Diagonal imbalance ratio threshold.
|
|
114
|
+
* ask[n] / bid[n-1] >= diagRatio -> diagAskImbalance
|
|
115
|
+
* Default: same as imbalanceRatio.
|
|
116
|
+
*/
|
|
117
|
+
diagRatio?: number;
|
|
118
|
+
};
|
|
119
|
+
export declare function buildFootprint(events: MboEvent[], barNs: bigint, options?: FootprintOptions): FootprintBar[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MboEvent } from '.';
|
|
2
|
+
import type { ViewBounds } from '.';
|
|
3
|
+
export type SerializedBounds = {
|
|
4
|
+
tMin: string;
|
|
5
|
+
tMax: string;
|
|
6
|
+
pMin: number;
|
|
7
|
+
pMax: number;
|
|
8
|
+
};
|
|
9
|
+
export type WorkerInitMessage = {
|
|
10
|
+
type: 'init';
|
|
11
|
+
events: MboEvent[];
|
|
12
|
+
};
|
|
13
|
+
export type HeatmapRequest = {
|
|
14
|
+
type: 'render';
|
|
15
|
+
requestId: number;
|
|
16
|
+
bounds: SerializedBounds;
|
|
17
|
+
chartW: number;
|
|
18
|
+
chartH: number;
|
|
19
|
+
/** Optional playback horizon (nanoseconds as string). When set, the worker
|
|
20
|
+
* stops adding new snapshot columns at this timestamp but forward-fills the
|
|
21
|
+
* last column to the right edge of the canvas - showing the last known book
|
|
22
|
+
* state held flat into the future, matching trades/bid-ask line behaviour. */
|
|
23
|
+
horizonNs?: string;
|
|
24
|
+
};
|
|
25
|
+
export type HeatmapResponse = {
|
|
26
|
+
requestId: number;
|
|
27
|
+
bitmap: ImageBitmap;
|
|
28
|
+
bounds: SerializedBounds;
|
|
29
|
+
};
|
|
30
|
+
export declare function serializeBounds(b: ViewBounds): SerializedBounds;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export type MboEvent = {
|
|
2
|
+
ts_event: string;
|
|
3
|
+
action: 'A' | 'C' | 'M' | 'T' | 'F' | 'R';
|
|
4
|
+
side: 'B' | 'A' | 'N';
|
|
5
|
+
price: number | null;
|
|
6
|
+
size: number;
|
|
7
|
+
order_id: string;
|
|
8
|
+
sequence: number;
|
|
9
|
+
flags: number;
|
|
10
|
+
};
|
|
11
|
+
export type Order = {
|
|
12
|
+
price: number;
|
|
13
|
+
size: number;
|
|
14
|
+
};
|
|
15
|
+
export type BookState = {
|
|
16
|
+
bids: Map<string, Order>;
|
|
17
|
+
asks: Map<string, Order>;
|
|
18
|
+
/** Cached best bid price - maintained incrementally by applyEvent(). O(1) read. */
|
|
19
|
+
bestBid: number | null;
|
|
20
|
+
/** Cached best ask price - maintained incrementally by applyEvent(). O(1) read. */
|
|
21
|
+
bestAsk: number | null;
|
|
22
|
+
};
|
|
23
|
+
export type TradePoint = {
|
|
24
|
+
ts: bigint;
|
|
25
|
+
price: number;
|
|
26
|
+
size: number;
|
|
27
|
+
side: 'B' | 'A';
|
|
28
|
+
};
|
|
29
|
+
export type PriceHistory = {
|
|
30
|
+
ts: bigint;
|
|
31
|
+
bestAsk: number;
|
|
32
|
+
bestBid: number;
|
|
33
|
+
};
|
|
34
|
+
export type BookSnapshot = {
|
|
35
|
+
ts: bigint;
|
|
36
|
+
bids: Map<number, number>;
|
|
37
|
+
asks: Map<number, number>;
|
|
38
|
+
};
|
|
39
|
+
export type ChartType = 'line' | 'area' | 'step' | 'candles' | 'hollow' | 'heikin-ashi' | 'bars' | 'baseline' | 'renko' | 'kagi' | 'line-break' | 'footprint' | (string & {});
|
|
40
|
+
export type DataResponse = {
|
|
41
|
+
requestId: string;
|
|
42
|
+
events: any;
|
|
43
|
+
};
|
|
44
|
+
export type DataRequest = {
|
|
45
|
+
requestId: string;
|
|
46
|
+
event: string;
|
|
47
|
+
};
|
|
48
|
+
export type TradeLineKind = 'entry' | 'sl' | 'tp' | 'be' | 'limit' | 'stop' | 'stop_limit' | 'alert' | 'custom';
|
|
49
|
+
export type TradeLineSide = 'long' | 'short' | 'neutral';
|
|
50
|
+
export type TradeLine = {
|
|
51
|
+
id?: string;
|
|
52
|
+
kind: TradeLineKind;
|
|
53
|
+
side?: TradeLineSide;
|
|
54
|
+
price: number;
|
|
55
|
+
/** If set the line snaps to the nearest tick multiple on drag */
|
|
56
|
+
tickSize?: number;
|
|
57
|
+
label?: string;
|
|
58
|
+
qty?: number;
|
|
59
|
+
pnl?: number;
|
|
60
|
+
pnlPct?: number;
|
|
61
|
+
pnlLabel?: string;
|
|
62
|
+
entryPrice?: number;
|
|
63
|
+
color?: string;
|
|
64
|
+
lineWidth?: number;
|
|
65
|
+
lineDash?: number[];
|
|
66
|
+
opacity?: number;
|
|
67
|
+
/** Show a subtle filled band between this line and `bandToPrice` */
|
|
68
|
+
bandToPrice?: number;
|
|
69
|
+
bandOpacity?: number;
|
|
70
|
+
/**
|
|
71
|
+
* When true on an `entry` line: renders two small draggable mini-pills
|
|
72
|
+
* (TP and SL) to the left of the main pill.
|
|
73
|
+
* Drag them vertically to set a take-profit or stop-loss price.
|
|
74
|
+
* The band from entry->TP/SL is drawn while dragging.
|
|
75
|
+
* Multiple TP/SL pairs are supported - use `onGhostMove` in useTradeLines
|
|
76
|
+
* to persist prices. Ghost state is managed by useTradeLines.
|
|
77
|
+
* `numGhosts` controls how many TP/SL pairs to show (default 1).
|
|
78
|
+
*/
|
|
79
|
+
ghosts?: boolean;
|
|
80
|
+
/** Number of TP/SL ghost pill pairs to render (default 1). */
|
|
81
|
+
numGhosts?: number;
|
|
82
|
+
align?: 'left' | 'right';
|
|
83
|
+
/** Margin from the aligned edge in px or % */
|
|
84
|
+
margin?: number;
|
|
85
|
+
marginType?: 'px' | 'percent';
|
|
86
|
+
showPricePill?: boolean;
|
|
87
|
+
showLinePill?: boolean;
|
|
88
|
+
showPnlPill?: boolean;
|
|
89
|
+
/** Extra badges shown in the inline pill, e.g. ["2 NQ", "+$420", "1.3R"] */
|
|
90
|
+
badges?: string[];
|
|
91
|
+
/**
|
|
92
|
+
* An order that hasn't been placed - drawn where it would land.
|
|
93
|
+
*
|
|
94
|
+
* Styling only, and deliberately separate from `locked`: a proposal is
|
|
95
|
+
* still something you grab and move. It draws dotted and darkened so it
|
|
96
|
+
* reads as intent rather than as a position you actually hold.
|
|
97
|
+
*/
|
|
98
|
+
preview?: boolean;
|
|
99
|
+
movable?: boolean;
|
|
100
|
+
locked?: boolean;
|
|
101
|
+
/** Called when user finishes dragging (mouseup). New price passed in. */
|
|
102
|
+
onMove?: (newPrice: number) => void;
|
|
103
|
+
afterMove?: (newPrice: number) => void;
|
|
104
|
+
/** Called when user clicks the x button */
|
|
105
|
+
onClose?: () => void;
|
|
106
|
+
/** Called when user clicks the reverse/flip button */
|
|
107
|
+
onReverse?: () => void;
|
|
108
|
+
/** Called when user right-clicks the line */
|
|
109
|
+
onContextMenu?: (price: number, y: number) => void;
|
|
110
|
+
/** Called when user double-clicks the line */
|
|
111
|
+
onDoubleClick?: (price: number) => void;
|
|
112
|
+
onClick?: (price: number) => void;
|
|
113
|
+
visible?: boolean;
|
|
114
|
+
/** Hide below this chart height in px */
|
|
115
|
+
minChartHeightToShow?: number;
|
|
116
|
+
};
|
|
117
|
+
export type CreateOrderEvent = {
|
|
118
|
+
side: TradeLineSide;
|
|
119
|
+
price: number;
|
|
120
|
+
type: 'market' | 'limit' | 'stop' | 'stop_limit';
|
|
121
|
+
qty: number;
|
|
122
|
+
stop?: number;
|
|
123
|
+
};
|
|
124
|
+
export type ViewBounds = {
|
|
125
|
+
tMin: bigint;
|
|
126
|
+
tMax: bigint;
|
|
127
|
+
pMin: number;
|
|
128
|
+
pMax: number;
|
|
129
|
+
pRef?: number;
|
|
130
|
+
};
|
|
131
|
+
export type SerialTrade = {
|
|
132
|
+
ts: bigint;
|
|
133
|
+
price: number;
|
|
134
|
+
size: number;
|
|
135
|
+
side: 'B' | 'A';
|
|
136
|
+
};
|
|
137
|
+
export type OhlcvBarMs = {
|
|
138
|
+
time: number;
|
|
139
|
+
open: number;
|
|
140
|
+
high: number;
|
|
141
|
+
low: number;
|
|
142
|
+
close: number;
|
|
143
|
+
volume: number;
|
|
144
|
+
};
|
|
145
|
+
export interface DomPanelHandle {
|
|
146
|
+
update(state: BookState): void;
|
|
147
|
+
}
|