@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,71 @@
|
|
|
1
|
+
import type { PlaceOrderRequest } from '../lib/matchingEngine';
|
|
2
|
+
import type { BracketAmendment, Fill, Order, Position, PositionClose, PriceTick } from '../lib/types/trading-types';
|
|
3
|
+
import type { MboEvent, OhlcvBar } from './IDataAdapter';
|
|
4
|
+
import type { SerialTrade } from '../lib/types';
|
|
5
|
+
import type { PriceHistory } from '../lib/types';
|
|
6
|
+
export interface IExecutionAdapter {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Called once per L3 event during playback or live streaming.
|
|
10
|
+
* The adapter decides internally whether to process it.
|
|
11
|
+
*/
|
|
12
|
+
onMboEvent(event: MboEvent, ts: bigint): void;
|
|
13
|
+
/**
|
|
14
|
+
* Called every time the best bid/ask changes.
|
|
15
|
+
* The adapter uses this to check order triggers.
|
|
16
|
+
*/
|
|
17
|
+
onTick(tick: PriceTick): void;
|
|
18
|
+
placeOrder(request: PlaceOrderRequest): string | Promise<string>;
|
|
19
|
+
cancelOrder(orderId: string): void | Promise<void>;
|
|
20
|
+
amendOrder(orderId: string, newPrice: number): void | Promise<void>;
|
|
21
|
+
amendBracket(amendment: BracketAmendment): void | Promise<void>;
|
|
22
|
+
closePosition(positionId: string): void | Promise<void>;
|
|
23
|
+
reversePosition?(positionId: string): void;
|
|
24
|
+
getOpenPositions(): Position[];
|
|
25
|
+
getWorkingOrders(): Order[];
|
|
26
|
+
getClosedPositions(): PositionClose[];
|
|
27
|
+
getPrice(): number;
|
|
28
|
+
/** Data pipeline hooks - called by ExecutionEngine when new data arrives. */
|
|
29
|
+
ingestCompactBuf?(buf: ArrayBuffer): void;
|
|
30
|
+
/** `barNs` is the bar period; without it the adapter must infer it from bar spacing. */
|
|
31
|
+
ingestOhlcvBars?(bars: OhlcvBar[], barNs?: bigint): void;
|
|
32
|
+
/**
|
|
33
|
+
* Bars streamed in ahead of the playhead, as an extension of what the
|
|
34
|
+
* adapter already holds. Implement it if ingestOhlcvBars replaces state
|
|
35
|
+
* rather than merging; without it, extensions fall back to ingestOhlcvBars.
|
|
36
|
+
*/
|
|
37
|
+
appendOhlcvBars?(bars: OhlcvBar[], barNs?: bigint): void;
|
|
38
|
+
ingestSupplementalBars?(bars: Array<{
|
|
39
|
+
time: number;
|
|
40
|
+
open: number;
|
|
41
|
+
high: number;
|
|
42
|
+
low: number;
|
|
43
|
+
close: number;
|
|
44
|
+
volume: number;
|
|
45
|
+
}>): void;
|
|
46
|
+
appendSupplementalBars?(bars: Array<{
|
|
47
|
+
time: number;
|
|
48
|
+
open: number;
|
|
49
|
+
high: number;
|
|
50
|
+
low: number;
|
|
51
|
+
close: number;
|
|
52
|
+
volume: number;
|
|
53
|
+
}>): void;
|
|
54
|
+
ingestTicks?(trades: SerialTrade[]): void;
|
|
55
|
+
ingestPriceHistory?(history: PriceHistory[]): void;
|
|
56
|
+
/** Streamed extensions; fall back to the ingest form when not implemented. */
|
|
57
|
+
appendTicks?(trades: SerialTrade[]): void;
|
|
58
|
+
appendPriceHistory?(history: PriceHistory[]): void;
|
|
59
|
+
appendCompactBuf?(buf: ArrayBuffer): void;
|
|
60
|
+
seekTo?(tNs: bigint): void;
|
|
61
|
+
totalFeesPaid?(): number;
|
|
62
|
+
totalRealizedPnl?(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Subscribe to engine output events.
|
|
65
|
+
* The ExecutionEngine calls this so adapters can push fills
|
|
66
|
+
* back to the chart without knowing about the event bus.
|
|
67
|
+
*/
|
|
68
|
+
onFill?: (fill: Fill) => void;
|
|
69
|
+
onPositionUpdate?: (position: Position) => void;
|
|
70
|
+
destroy(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base contract for all DepthChart plugins. Every plugin type
|
|
3
|
+
* (drawing, chart-type, indicator, data-source, extension) extends
|
|
4
|
+
* ChartPlugin and is installed through PluginContext.
|
|
5
|
+
*/
|
|
6
|
+
import type { TypedEventBus, InterceptableEvent, Interceptor } from '../../core/TypedEventBus';
|
|
7
|
+
import type { RenderEngine, DrawHook } from '../../core/RenderEngine';
|
|
8
|
+
import type { ExecutionEngine } from '../../core/ExecutionEngine';
|
|
9
|
+
import type { GlobalChartBus } from '../../core/GlobalChartBus';
|
|
10
|
+
import type { LiveTransformer } from '../ICoordinateTransformer';
|
|
11
|
+
import type { DataLevel, OhlcvBar, SymbolInfo, TickEvent } from '../IDataAdapter';
|
|
12
|
+
import type { SerialTrade, PriceHistory } from '../../lib/types';
|
|
13
|
+
import type { FootprintBar } from '../../lib/types/footprint';
|
|
14
|
+
import type { BracketAmendment } from '../../lib/types/trading-types';
|
|
15
|
+
import type { PlaceOrderRequest } from '../../lib/matchingEngine';
|
|
16
|
+
export type PluginType = 'indicator' | 'drawing' | 'chart-type' | 'data-source' | 'extension';
|
|
17
|
+
export type Permission = 'data:read' | 'data:write' | 'eventbus:emit' | 'eventbus:intercept' | 'ui:pane' | 'ui:panel' | 'ui:toolbar' | 'ui:context-menu' | 'render:overlay' | 'render:shader' | 'drawing:register' | 'chart-type:register' | 'theme:register' | 'audio' | 'network' | 'storage' | 'intercept' | 'execution:read' | 'execution:write';
|
|
18
|
+
export interface ToolbarItem {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
icon?: React.ReactNode;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
active?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface BottomBarHandle {
|
|
27
|
+
rerender(): void;
|
|
28
|
+
destroy(): void;
|
|
29
|
+
}
|
|
30
|
+
export interface FloatingPanelOpts {
|
|
31
|
+
element: React.ReactNode;
|
|
32
|
+
title?: string;
|
|
33
|
+
initialPosition?: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
};
|
|
37
|
+
initialSize?: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
41
|
+
resizable?: boolean;
|
|
42
|
+
visible?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ContextMenuItem {
|
|
45
|
+
id: string;
|
|
46
|
+
label: string;
|
|
47
|
+
icon?: React.ReactNode;
|
|
48
|
+
shortcut?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
separator?: boolean;
|
|
51
|
+
onClick: () => void;
|
|
52
|
+
}
|
|
53
|
+
export interface ThemeDef {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
/** CSS variables to inject - keys are var names without the leading '--'. */
|
|
57
|
+
vars: Record<string, string>;
|
|
58
|
+
}
|
|
59
|
+
export type SettingSchemaType = 'number' | 'string' | 'boolean' | 'color' | 'select';
|
|
60
|
+
export interface SettingSchema {
|
|
61
|
+
type: SettingSchemaType;
|
|
62
|
+
label?: string;
|
|
63
|
+
default?: unknown;
|
|
64
|
+
min?: number;
|
|
65
|
+
max?: number;
|
|
66
|
+
step?: number;
|
|
67
|
+
options?: Array<{
|
|
68
|
+
value: unknown;
|
|
69
|
+
label: string;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
export interface PluginStorage {
|
|
73
|
+
get<T>(key: string, fallback: T): T;
|
|
74
|
+
set<T>(key: string, value: T): void;
|
|
75
|
+
delete(key: string): void;
|
|
76
|
+
/** Clears only this plugin's keys. */
|
|
77
|
+
clear(): void;
|
|
78
|
+
}
|
|
79
|
+
export type ServiceApi = Record<string, (...args: any[]) => any>;
|
|
80
|
+
export interface ServiceObserver<T extends ServiceApi> {
|
|
81
|
+
onAvailable: (api: T) => void;
|
|
82
|
+
onRemoved?: () => void;
|
|
83
|
+
}
|
|
84
|
+
export interface PluginServices {
|
|
85
|
+
register<T extends ServiceApi>(name: string, api: T): () => void;
|
|
86
|
+
get<T extends ServiceApi>(name: string): T | null;
|
|
87
|
+
on<T extends ServiceApi>(name: string, observer: ServiceObserver<T>): () => void;
|
|
88
|
+
}
|
|
89
|
+
export interface PluginSchedule {
|
|
90
|
+
/** Managed repeating timer - auto-cancelled on plugin teardown. */
|
|
91
|
+
interval(ms: number, fn: () => void): () => void;
|
|
92
|
+
/** Managed one-shot timer - auto-cancelled on plugin teardown. */
|
|
93
|
+
timeout(ms: number, fn: () => void): () => void;
|
|
94
|
+
/** Managed animation-frame callback - auto-cancelled on plugin teardown. */
|
|
95
|
+
raf(fn: () => void): () => void;
|
|
96
|
+
}
|
|
97
|
+
export type NotifyLevel = 'info' | 'success' | 'warn' | 'error';
|
|
98
|
+
export interface NotifyOptions {
|
|
99
|
+
title: string;
|
|
100
|
+
body?: string;
|
|
101
|
+
level?: NotifyLevel;
|
|
102
|
+
/** ms. Default 4000. Pass Infinity for sticky. */
|
|
103
|
+
duration?: number;
|
|
104
|
+
action?: {
|
|
105
|
+
label: string;
|
|
106
|
+
onClick: () => void;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface PluginStateSnapshot {
|
|
110
|
+
serialize(): unknown;
|
|
111
|
+
restore(state: unknown): void;
|
|
112
|
+
}
|
|
113
|
+
export interface PluginExecutionSurface {
|
|
114
|
+
placeOrder(req: PlaceOrderRequest): string | Promise<string> | undefined;
|
|
115
|
+
cancelOrder(orderId: string): void;
|
|
116
|
+
amendOrder(orderId: string, newPrice: number): void;
|
|
117
|
+
amendBracket(amendment: BracketAmendment): void;
|
|
118
|
+
closePosition(positionId: string): void;
|
|
119
|
+
reversePosition(positionId: string): void;
|
|
120
|
+
totalRealizedPnl(): number;
|
|
121
|
+
totalFeesPaid(): number;
|
|
122
|
+
}
|
|
123
|
+
export interface PluginLifecycle {
|
|
124
|
+
onSymbolChange(cb: (symbol: string) => void): () => void;
|
|
125
|
+
onTimeframeChange(cb: (tf: string) => void): () => void;
|
|
126
|
+
onThemeChange(cb: (theme: 'light' | 'dark') => void): () => void;
|
|
127
|
+
onFocus(cb: (id: number) => void): () => void;
|
|
128
|
+
onBlur(cb: () => void): () => void;
|
|
129
|
+
}
|
|
130
|
+
export interface PaneOptions {
|
|
131
|
+
heightRatio?: number;
|
|
132
|
+
minHeightRatio?: number;
|
|
133
|
+
}
|
|
134
|
+
export interface PluginDataSnapshot {
|
|
135
|
+
trades: SerialTrade[];
|
|
136
|
+
footprintBars: FootprintBar[];
|
|
137
|
+
priceHistory: PriceHistory[];
|
|
138
|
+
/** Always present - synthesised from footprintBars when dataLevel is l3/tick. */
|
|
139
|
+
ohlcvBars: OhlcvBar[];
|
|
140
|
+
/** Populated when dataLevel is tick or l3. */
|
|
141
|
+
ticks: TickEvent[];
|
|
142
|
+
barNs: bigint;
|
|
143
|
+
dataStart: number;
|
|
144
|
+
dataEnd: number;
|
|
145
|
+
symbolInfo: SymbolInfo | null;
|
|
146
|
+
dataLevel: DataLevel;
|
|
147
|
+
}
|
|
148
|
+
export interface BottomBarItem {
|
|
149
|
+
id: string;
|
|
150
|
+
render: () => React.ReactNode;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The surface passed to every plugin's install() method. All capabilities
|
|
154
|
+
* are gated by the plugin's declared permissions - calls without the required
|
|
155
|
+
* permission throw at runtime.
|
|
156
|
+
*/
|
|
157
|
+
export interface PluginContext {
|
|
158
|
+
global: GlobalChartBus;
|
|
159
|
+
eventBus: TypedEventBus;
|
|
160
|
+
renderEngine: RenderEngine;
|
|
161
|
+
executionEngine: ExecutionEngine;
|
|
162
|
+
transformer: LiveTransformer;
|
|
163
|
+
dataLevel: DataLevel;
|
|
164
|
+
horizon: () => number;
|
|
165
|
+
getData(): Readonly<PluginDataSnapshot>;
|
|
166
|
+
/**
|
|
167
|
+
* The bar still being built at the playback horizon, or `null` before any
|
|
168
|
+
* data has arrived.
|
|
169
|
+
*
|
|
170
|
+
* This is the one you want for "what is the price right now". The last entry
|
|
171
|
+
* of `getData().ohlcvBars` is the last bar that was *loaded*, which during
|
|
172
|
+
* replay is somewhere in the future and at the fetch resolution rather than
|
|
173
|
+
* the charted timeframe.
|
|
174
|
+
*
|
|
175
|
+
* A snapshot - it is copied out of the live bar, so holding onto it gives you
|
|
176
|
+
* a stale bar. Call it again.
|
|
177
|
+
*/
|
|
178
|
+
openBar(): OhlcvBar | null;
|
|
179
|
+
registerPane(id: string, opts?: PaneOptions): () => void;
|
|
180
|
+
registerPanel(id: string, element: React.ReactNode, title?: string, visible?: boolean): () => void;
|
|
181
|
+
getSettings<T>(defaults: T): T;
|
|
182
|
+
saveSettings<T>(patch: Partial<T>): void;
|
|
183
|
+
addOverlay(phase: 'before-base' | 'after-base' | 'after-ui', hook: DrawHook): () => void;
|
|
184
|
+
registerToolbarItem(item: ToolbarItem): () => void;
|
|
185
|
+
registerBottomBarItem(id: string, render: () => React.ReactNode): BottomBarHandle;
|
|
186
|
+
registerContextMenuItem(item: ContextMenuItem): () => void;
|
|
187
|
+
/** See PluginDrawingToolDef in core/DrawingRegistry for the full type. */
|
|
188
|
+
registerDrawingTool(tool: {
|
|
189
|
+
id: string;
|
|
190
|
+
name: string;
|
|
191
|
+
anchorCount: number | 'dynamic';
|
|
192
|
+
render(ctx: any): void;
|
|
193
|
+
hitTest(ctx: any): boolean | string | null;
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
}): () => void;
|
|
196
|
+
registerTheme(theme: ThemeDef): () => void;
|
|
197
|
+
playSound(id: string | AudioBuffer): void;
|
|
198
|
+
/**
|
|
199
|
+
* Claim symbols and serve their data yourself - a derived instrument, or a
|
|
200
|
+
* whole venue behind the user's own API key. A source is an IDataAdapter
|
|
201
|
+
* with a claim on top; see PluginDataSource in core/DataSourceRegistry.
|
|
202
|
+
*/
|
|
203
|
+
registerDataSource(source: {
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
}): () => void;
|
|
206
|
+
storage: PluginStorage;
|
|
207
|
+
/** Sandboxed fetch - only allowed origins declared in the plugin manifest. */
|
|
208
|
+
fetch(url: string, init?: RequestInit): Promise<Response>;
|
|
209
|
+
intercept<K extends InterceptableEvent>(event: K, interceptor: Interceptor<K>): () => void;
|
|
210
|
+
/** null when neither execution:read nor execution:write is declared. */
|
|
211
|
+
execution: PluginExecutionSurface | null;
|
|
212
|
+
services: PluginServices;
|
|
213
|
+
schedule: PluginSchedule;
|
|
214
|
+
lifecycle: PluginLifecycle;
|
|
215
|
+
notify(opts: NotifyOptions): void;
|
|
216
|
+
playback: {
|
|
217
|
+
registerState(snapshot: PluginStateSnapshot): () => void;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
export interface ChartPlugin {
|
|
221
|
+
readonly id: string;
|
|
222
|
+
readonly name: string;
|
|
223
|
+
readonly version: string;
|
|
224
|
+
readonly type: PluginType;
|
|
225
|
+
readonly permissions?: Permission[];
|
|
226
|
+
/**
|
|
227
|
+
* Origins `ctx.fetch` may talk to, e.g. `['https://api.massive.com']`.
|
|
228
|
+
* Anything else throws. A plugin holding the user's API key can only send
|
|
229
|
+
* it where it declared it would.
|
|
230
|
+
*/
|
|
231
|
+
readonly origins?: string[];
|
|
232
|
+
readonly category?: string;
|
|
233
|
+
/** Source code string - used by the scripted plugin system. */
|
|
234
|
+
readonly code: string;
|
|
235
|
+
/**
|
|
236
|
+
* Minimum data level this plugin requires. Defaults to 'ohlcv'.
|
|
237
|
+
* The registry skips the plugin and emits 'plugin:incompatible' if the
|
|
238
|
+
* chart's data level does not satisfy this.
|
|
239
|
+
*/
|
|
240
|
+
readonly require?: DataLevel;
|
|
241
|
+
install(ctx: PluginContext): void | (() => void) | Promise<void | (() => void)>;
|
|
242
|
+
uninstall?(ctx: PluginContext): void;
|
|
243
|
+
}
|
|
244
|
+
export interface PluginManifest {
|
|
245
|
+
id: string;
|
|
246
|
+
name: string;
|
|
247
|
+
version: string;
|
|
248
|
+
type: PluginType;
|
|
249
|
+
script: string;
|
|
250
|
+
permissions: Permission[];
|
|
251
|
+
/** Origins `ctx.fetch` may reach. See ChartPlugin.origins. */
|
|
252
|
+
origins?: string[];
|
|
253
|
+
settings?: Record<string, SettingSchema>;
|
|
254
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for plugins that register a custom chart type (e.g. a Renko,
|
|
3
|
+
* Kagi, or custom orderflow renderer). Plugins declare type: 'chart-type'
|
|
4
|
+
* and require the 'chart-type:register' permission.
|
|
5
|
+
*
|
|
6
|
+
* Computation runs in a dedicated worker (workerInit / workerUpdate), then
|
|
7
|
+
* the main thread receives the output via hydrate / appendHydrate and draws
|
|
8
|
+
* it each frame via draw().
|
|
9
|
+
*/
|
|
10
|
+
import type { ChartPlugin, BottomBarHandle } from './IChartPlugin';
|
|
11
|
+
import type { LiveTransformer } from '../ICoordinateTransformer';
|
|
12
|
+
import type { TypedEventBus } from '../../core/TypedEventBus';
|
|
13
|
+
import type { ViewBounds } from '../../lib/types';
|
|
14
|
+
import type { FootprintBar } from '../../lib/types/footprint';
|
|
15
|
+
import type { TradePoint, PriceHistory } from '../../lib/types';
|
|
16
|
+
import type { Rect } from '../../lib/types/indicator-types';
|
|
17
|
+
import type { ChartSettings } from '../../lib/types/chart-settings';
|
|
18
|
+
import type { StyleField } from '../../components/drawings/drawing-settings-dialog';
|
|
19
|
+
export interface ChartTypeActiveContext {
|
|
20
|
+
requestRedraw(): void;
|
|
21
|
+
setCursor(cursor: string): void;
|
|
22
|
+
eventBus: TypedEventBus;
|
|
23
|
+
registerBottomBarItem(id: string, render: () => React.ReactNode): BottomBarHandle;
|
|
24
|
+
}
|
|
25
|
+
export interface ChartTypePointerEvent {
|
|
26
|
+
/** Data-space timestamp (nanoseconds). */
|
|
27
|
+
ts: bigint;
|
|
28
|
+
price: number;
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
shiftKey: boolean;
|
|
32
|
+
ctrlKey: boolean;
|
|
33
|
+
altKey: boolean;
|
|
34
|
+
buttons: number;
|
|
35
|
+
ctx: ChartTypeActiveContext;
|
|
36
|
+
}
|
|
37
|
+
export interface ChartTypeKeyEvent {
|
|
38
|
+
key: string;
|
|
39
|
+
code: string;
|
|
40
|
+
shiftKey: boolean;
|
|
41
|
+
ctrlKey: boolean;
|
|
42
|
+
ctx: ChartTypeActiveContext;
|
|
43
|
+
}
|
|
44
|
+
export interface ChartTypeRenderContext {
|
|
45
|
+
ctx: CanvasRenderingContext2D;
|
|
46
|
+
rect: Rect;
|
|
47
|
+
view: ViewBounds;
|
|
48
|
+
transformer: LiveTransformer;
|
|
49
|
+
footprintBars: FootprintBar[];
|
|
50
|
+
trades: TradePoint[];
|
|
51
|
+
priceHistory: PriceHistory[];
|
|
52
|
+
barNs: bigint;
|
|
53
|
+
chartSettings: ChartSettings;
|
|
54
|
+
/** The hydrated computed state (whatever workerInit / appendHydrate returned). */
|
|
55
|
+
computed: unknown;
|
|
56
|
+
}
|
|
57
|
+
export interface ChartTypePlugin extends ChartPlugin {
|
|
58
|
+
type: 'chart-type';
|
|
59
|
+
/** Unique identifier registered with ChartTypeRegistry. */
|
|
60
|
+
chartTypeId: string;
|
|
61
|
+
/** Human-readable label shown in the chart type picker. */
|
|
62
|
+
label: string;
|
|
63
|
+
/** Icon shown in the chart type picker. */
|
|
64
|
+
icon: React.ReactNode;
|
|
65
|
+
/**
|
|
66
|
+
* Fields shown in the chart settings dialog while this chart type is
|
|
67
|
+
* active. Build them with the `StyleField` helpers exported alongside the
|
|
68
|
+
* drawing settings dialog.
|
|
69
|
+
*/
|
|
70
|
+
settingsSchema?: StyleField[];
|
|
71
|
+
/** Starting value for every key in `settingsSchema`. */
|
|
72
|
+
defaultSettings?: Record<string, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* The user changed a setting. Receives the full set, not just the change.
|
|
75
|
+
* Values are persisted with the chart under `ChartSettings.pluginSettings`,
|
|
76
|
+
* keyed by `chartTypeId`, and are also on the render context as
|
|
77
|
+
* `chartSettings.pluginSettings[chartTypeId]`.
|
|
78
|
+
*/
|
|
79
|
+
onSettingsChange?(settings: Record<string, unknown>): void;
|
|
80
|
+
/**
|
|
81
|
+
* Serialized pure function - runs in the chart type's dedicated worker on
|
|
82
|
+
* initial load, backward seek, or timeframe change.
|
|
83
|
+
*
|
|
84
|
+
* Signature: ({ data, barNs, params }) => State
|
|
85
|
+
*
|
|
86
|
+
* Must be pure - no imports, no closures, no side effects.
|
|
87
|
+
*/
|
|
88
|
+
workerInit?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Serialized pure function - runs in the worker on every horizon tick.
|
|
91
|
+
*
|
|
92
|
+
* Signature: ({ newData, data, state, barNs, horizon, params }) => { points, state }
|
|
93
|
+
*
|
|
94
|
+
* Must be pure - no imports, no closures, no side effects.
|
|
95
|
+
*/
|
|
96
|
+
workerUpdate?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Called on the main thread after workerInit completes.
|
|
99
|
+
* Receives the full computed state and should replace any stored output.
|
|
100
|
+
*/
|
|
101
|
+
hydrate?(data: unknown, barNs: bigint): void;
|
|
102
|
+
/**
|
|
103
|
+
* Called on the main thread after workerUpdate completes.
|
|
104
|
+
* Receives the incremental output - append it, do not replace.
|
|
105
|
+
*/
|
|
106
|
+
appendHydrate?(points: unknown, barNs: bigint): void;
|
|
107
|
+
/** Called every frame by RenderEngine to draw the chart type. Required. */
|
|
108
|
+
draw(context: ChartTypeRenderContext): void;
|
|
109
|
+
/** Return custom y-axis bounds, or null to use default price scaling. */
|
|
110
|
+
getAutoYBounds?(tMin: bigint, tMax: bigint, horizon: bigint): {
|
|
111
|
+
min: number;
|
|
112
|
+
max: number;
|
|
113
|
+
} | null;
|
|
114
|
+
/** Called when the user switches TO this chart type. */
|
|
115
|
+
onActivate?(ctx: ChartTypeActiveContext): void;
|
|
116
|
+
/** Called when the user switches AWAY from this chart type. */
|
|
117
|
+
onDeactivate?(): void;
|
|
118
|
+
onPointerDown?(event: ChartTypePointerEvent): boolean | void;
|
|
119
|
+
onPointerMove?(event: ChartTypePointerEvent): boolean | void;
|
|
120
|
+
onPointerUp?(event: ChartTypePointerEvent): boolean | void;
|
|
121
|
+
onKeyDown?(event: ChartTypeKeyEvent): boolean | void;
|
|
122
|
+
/** Called when the crosshair hovers over a bar. */
|
|
123
|
+
onBarHover?(ts: bigint, price: number, barNs: bigint): void;
|
|
124
|
+
/** Return a custom crosshair tooltip string, or null for the default. */
|
|
125
|
+
getTooltip?(ts: bigint, price: number): string | null;
|
|
126
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for plugins that provide a custom data source (adapter factory).
|
|
3
|
+
* A data-source plugin creates an IDataAdapter on demand, enabling remote
|
|
4
|
+
* or community-built data feeds to be loaded as plugins.
|
|
5
|
+
*
|
|
6
|
+
* Requires the 'data:write' permission.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChartPlugin } from './IChartPlugin';
|
|
9
|
+
import type { IDataAdapter } from '../IDataAdapter';
|
|
10
|
+
export interface DataSourcePlugin extends ChartPlugin {
|
|
11
|
+
type: 'data-source';
|
|
12
|
+
/**
|
|
13
|
+
* Factory called by the engine when the user selects a symbol served by
|
|
14
|
+
* this plugin. Return a fully initialised IDataAdapter.
|
|
15
|
+
*
|
|
16
|
+
* @param symbol The symbol string the user requested.
|
|
17
|
+
* @param config Arbitrary config passed from the plugin's settings schema.
|
|
18
|
+
*/
|
|
19
|
+
createAdapter(symbol: string, config: unknown): IDataAdapter;
|
|
20
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for plugins that register a custom drawing tool.
|
|
3
|
+
* Drawing plugins declare type: 'drawing' and require the
|
|
4
|
+
* 'drawing:register' permission. The actual tool definition
|
|
5
|
+
* is registered via ctx.registerDrawingTool(tool) inside install().
|
|
6
|
+
*
|
|
7
|
+
* For a simpler path to custom drawing tools, implement PluginDrawingToolDef
|
|
8
|
+
* directly and register it from any extension plugin - a full DrawingPlugin
|
|
9
|
+
* is only necessary when you need plugin lifecycle hooks (settings, state).
|
|
10
|
+
*/
|
|
11
|
+
import type { ChartPlugin } from './IChartPlugin';
|
|
12
|
+
import type { Anchor } from '../../lib/types/drawing-types';
|
|
13
|
+
import type { PluginDrawingRenderContext, PluginDrawingHitContext } from '../../core/DrawingRegistry';
|
|
14
|
+
import type { OhlcvBar } from '../IDataAdapter';
|
|
15
|
+
export interface Point {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}
|
|
19
|
+
export type AnchorConfig = {
|
|
20
|
+
ts: bigint;
|
|
21
|
+
price: number;
|
|
22
|
+
};
|
|
23
|
+
export interface DrawingPlugin extends ChartPlugin {
|
|
24
|
+
type: 'drawing';
|
|
25
|
+
/** ID of the drawing tool this plugin registers - must be globally unique. */
|
|
26
|
+
toolId: string;
|
|
27
|
+
/** SVG string or emoji shown in the drawing toolbar. */
|
|
28
|
+
icon?: string;
|
|
29
|
+
/**
|
|
30
|
+
* How many anchor clicks are needed to commit the drawing.
|
|
31
|
+
* 'dynamic' = user keeps clicking and presses Escape to finish.
|
|
32
|
+
*/
|
|
33
|
+
anchorCount: number | 'dynamic';
|
|
34
|
+
/**
|
|
35
|
+
* Return initial anchor positions when the user starts placing the drawing.
|
|
36
|
+
* `start` is the first click in data space.
|
|
37
|
+
*/
|
|
38
|
+
createAnchors(start: AnchorConfig): AnchorConfig[];
|
|
39
|
+
/**
|
|
40
|
+
* Full render of the committed drawing. Called every canvas frame.
|
|
41
|
+
* Receives the full PluginDrawingRenderContext including resolved pixel positions.
|
|
42
|
+
*/
|
|
43
|
+
render(ctx: PluginDrawingRenderContext): void;
|
|
44
|
+
/**
|
|
45
|
+
* Live preview while the user is still placing anchors.
|
|
46
|
+
* `cursor` is the current mouse position in data space.
|
|
47
|
+
*/
|
|
48
|
+
preview?(anchors: Anchor[], cursor: AnchorConfig): void;
|
|
49
|
+
/**
|
|
50
|
+
* Return true (or the anchor id that was hit) if the mouse is over this drawing.
|
|
51
|
+
* Return false for no hit.
|
|
52
|
+
*/
|
|
53
|
+
hitTest(ctx: PluginDrawingHitContext): boolean | string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Optionally snap an anchor to the nearest bar OHLC value during placement.
|
|
56
|
+
*/
|
|
57
|
+
snap?(anchor: Anchor, bars: OhlcvBar[]): Anchor;
|
|
58
|
+
/** Serialise anchor positions to a JSON-safe value for persistence. */
|
|
59
|
+
serialize(anchors: Anchor[]): unknown;
|
|
60
|
+
/** Restore anchors from a previously serialised value. */
|
|
61
|
+
deserialize(data: unknown): Anchor[];
|
|
62
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract for indicator plugins. Indicators extend ChartPlugin with
|
|
3
|
+
* type: 'indicator' and a declarative rendering model mirroring ChartTypePlugin:
|
|
4
|
+
* heavy computation runs in a worker (workerInit / workerUpdate), the main
|
|
5
|
+
* thread receives the output via hydrate / appendHydrate, and drawBase /
|
|
6
|
+
* drawUI are called every frame.
|
|
7
|
+
*
|
|
8
|
+
* Requires at minimum 'data:read' + 'render:overlay' permissions.
|
|
9
|
+
* Pane-layout indicators additionally require 'ui:pane'.
|
|
10
|
+
*/
|
|
11
|
+
import type { ChartPlugin } from './IChartPlugin';
|
|
12
|
+
import type { LiveTransformer } from '../ICoordinateTransformer';
|
|
13
|
+
import type { Rect } from '../../lib/types/indicator-types';
|
|
14
|
+
/**
|
|
15
|
+
* Everything an indicator needs to draw one frame.
|
|
16
|
+
* Coordinates are in LOCAL pane space - origin is the top-left of this pane.
|
|
17
|
+
*/
|
|
18
|
+
export interface IndicatorRenderContext {
|
|
19
|
+
ctx: CanvasRenderingContext2D;
|
|
20
|
+
/** Pane bounding rect in local coordinates. */
|
|
21
|
+
rect: Rect;
|
|
22
|
+
/** Visible time range (nanoseconds). */
|
|
23
|
+
tMin: bigint;
|
|
24
|
+
tMax: bigint;
|
|
25
|
+
/** Pane price/value axis range. */
|
|
26
|
+
yMin: number;
|
|
27
|
+
yMax: number;
|
|
28
|
+
/** Active bar duration in nanoseconds. 0n = tick/raw mode. */
|
|
29
|
+
barNs: bigint;
|
|
30
|
+
/**
|
|
31
|
+
* Current playback horizon in nanoseconds.
|
|
32
|
+
* Never draw data beyond this timestamp - doing so leaks future data.
|
|
33
|
+
* 0n means live / full-history mode.
|
|
34
|
+
*/
|
|
35
|
+
horizon: bigint;
|
|
36
|
+
transformer: LiveTransformer;
|
|
37
|
+
}
|
|
38
|
+
export interface IndicatorCrosshair {
|
|
39
|
+
/** Canvas pixel x. */
|
|
40
|
+
x: number;
|
|
41
|
+
/** Canvas pixel y. */
|
|
42
|
+
y: number;
|
|
43
|
+
}
|
|
44
|
+
export interface IndicatorPlugin extends ChartPlugin {
|
|
45
|
+
type: 'indicator';
|
|
46
|
+
/** Where the indicator renders. */
|
|
47
|
+
layout: 'overlay' | 'pane';
|
|
48
|
+
/**
|
|
49
|
+
* Pane id to render in when layout === 'pane'.
|
|
50
|
+
* If omitted, a new pane is created automatically.
|
|
51
|
+
*/
|
|
52
|
+
paneId?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Serialized pure function - runs in the indicator worker on initial load,
|
|
55
|
+
* backward seek, or timeframe change.
|
|
56
|
+
*
|
|
57
|
+
* Signature:
|
|
58
|
+
* (input: { trades: SerialTrade[], ohlcv: OhlcvBar[], barNs: bigint, params?: unknown }) => State
|
|
59
|
+
*
|
|
60
|
+
* Must be pure - no imports, no closures, no side effects.
|
|
61
|
+
*/
|
|
62
|
+
workerInit?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Serialized pure function - runs in the worker on every horizon tick.
|
|
65
|
+
*
|
|
66
|
+
* Signature:
|
|
67
|
+
* (input: { newTrades: SerialTrade[], state: State, barNs: bigint, horizon: bigint, params?: unknown }) => { points: Points, state: State }
|
|
68
|
+
*
|
|
69
|
+
* Must be pure - no imports, no closures, no side effects.
|
|
70
|
+
*/
|
|
71
|
+
workerUpdate?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Called on the main thread after workerInit completes.
|
|
74
|
+
* Receives the full computed state - replace all stored output.
|
|
75
|
+
*/
|
|
76
|
+
hydrate?(data: unknown, barNs: bigint): void;
|
|
77
|
+
/**
|
|
78
|
+
* Called on the main thread after workerUpdate completes.
|
|
79
|
+
* Receives incremental output - append, do not replace.
|
|
80
|
+
*/
|
|
81
|
+
appendHydrate?(points: unknown, barNs: bigint): void;
|
|
82
|
+
/**
|
|
83
|
+
* Draw the indicator lines / fills / bars.
|
|
84
|
+
* Called every frame after the base chart layer.
|
|
85
|
+
*/
|
|
86
|
+
drawBase?(ctx: IndicatorRenderContext): void;
|
|
87
|
+
/**
|
|
88
|
+
* Draw crosshair-aware UI: value labels, legend markers, tooltip overlays.
|
|
89
|
+
* Called every frame when the crosshair is visible.
|
|
90
|
+
*/
|
|
91
|
+
drawUI?(ctx: IndicatorRenderContext, crosshair: IndicatorCrosshair | null): void;
|
|
92
|
+
/** Return custom y-axis bounds for this pane, or null to use auto-scaling. */
|
|
93
|
+
getAutoYBounds?(tMin: bigint, tMax: bigint, horizon: bigint): {
|
|
94
|
+
min: number;
|
|
95
|
+
max: number;
|
|
96
|
+
} | null;
|
|
97
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { PluginType, Permission, ToolbarItem, BottomBarHandle, BottomBarItem, FloatingPanelOpts, ContextMenuItem, ThemeDef, SettingSchema, SettingSchemaType, PluginStorage, ServiceApi, ServiceObserver, PluginServices, PluginSchedule, NotifyLevel, NotifyOptions, PluginStateSnapshot, PluginExecutionSurface, PluginLifecycle, PaneOptions, PluginDataSnapshot, PluginContext, ChartPlugin, PluginManifest, } from './IChartPlugin';
|
|
2
|
+
export type { DrawingPlugin, Point, AnchorConfig } from './IDrawingPlugin';
|
|
3
|
+
export type { ChartTypePlugin, ChartTypeRenderContext, ChartTypeActiveContext, ChartTypePointerEvent, ChartTypeKeyEvent, } from './IChartTypePlugin';
|
|
4
|
+
export type { DataSourcePlugin } from './IDataSourcePlugin';
|
|
5
|
+
export type { IndicatorPlugin, IndicatorRenderContext, IndicatorCrosshair, } from './IIndicatorPlugin';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SessionMapper } from '../core/SessionMapper';
|
|
2
|
+
export declare function ohlcvBucketRange(tsNs: bigint, barNs: bigint, sessionMapper?: SessionMapper | null): {
|
|
3
|
+
start: bigint;
|
|
4
|
+
end: bigint;
|
|
5
|
+
};
|
|
6
|
+
export declare function snapTsToBarGrid(tsNs: bigint, barNs: bigint, sessionMapper?: SessionMapper | null): bigint;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BookState, MboEvent } from './types';
|
|
2
|
+
export declare function createBook(): BookState;
|
|
3
|
+
export declare function applyEvent(book: BookState, event: MboEvent): void;
|
|
4
|
+
export declare function getBestBid(book: BookState): number | null;
|
|
5
|
+
export declare function getBestAsk(book: BookState): number | null;
|