@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.
Files changed (171) hide show
  1. package/LICENSE.md +201 -0
  2. package/NOTICE +15 -0
  3. package/README.md +159 -0
  4. package/depth.cjs +1136 -0
  5. package/depth.css +2 -0
  6. package/depth.mjs +1136 -0
  7. package/depth.nopreflight.css +2 -0
  8. package/index.d.ts +1 -0
  9. package/package.json +32 -0
  10. package/types/ChartInner.d.ts +114 -0
  11. package/types/ChartOuter.d.ts +31 -0
  12. package/types/components/account/AccountSummary.d.ts +8 -0
  13. package/types/components/chart/chart-context-menu.d.ts +30 -0
  14. package/types/components/chart/chart-settings-dialog.d.ts +15 -0
  15. package/types/components/chart/chart-status-overlay.d.ts +24 -0
  16. package/types/components/chart/data-status.d.ts +10 -0
  17. package/types/components/chart/pane-legend.d.ts +37 -0
  18. package/types/components/chart/session-status-badge.d.ts +14 -0
  19. package/types/components/chart/status-bar.d.ts +9 -0
  20. package/types/components/chart/symbol-icon.d.ts +9 -0
  21. package/types/components/chart/tz.d.ts +10 -0
  22. package/types/components/drawings/drawing-icons.d.ts +2 -0
  23. package/types/components/drawings/drawing-settings-bar.d.ts +15 -0
  24. package/types/components/drawings/drawing-settings-dialog.d.ts +268 -0
  25. package/types/components/drawings/drawing-toolbar.d.ts +14 -0
  26. package/types/components/drawings/drawing-tools.d.ts +23 -0
  27. package/types/components/indicators/indicators-dialog.d.ts +20 -0
  28. package/types/components/indicators/indicators-settings-dialog.d.ts +164 -0
  29. package/types/components/multi-chart/GridDividers.d.ts +12 -0
  30. package/types/components/multi-chart/LayoutPicker.d.ts +19 -0
  31. package/types/components/plugin-panels/BottomBarPluginHost.d.ts +7 -0
  32. package/types/components/plugin-panels/PluginFixedPanelHost.d.ts +18 -0
  33. package/types/components/plugin-panels/PluginToolbarHost.d.ts +7 -0
  34. package/types/components/plugin-panels/PluginWindowsDropdown.d.ts +7 -0
  35. package/types/components/plugins/plugin-manager-dialog.d.ts +14 -0
  36. package/types/components/toolbar/SymbolSwitcher.d.ts +8 -0
  37. package/types/components/toolbar/chart-icons.d.ts +16 -0
  38. package/types/components/toolbar/chart-type-selector.d.ts +11 -0
  39. package/types/components/toolbar/timeframe-selector.d.ts +15 -0
  40. package/types/components/trading/OrderPanel.d.ts +36 -0
  41. package/types/components/trading/QuickTradingButtons.d.ts +7 -0
  42. package/types/components/trading/order-math.d.ts +94 -0
  43. package/types/components/ui/button.d.ts +11 -0
  44. package/types/components/ui/checkbox.d.ts +4 -0
  45. package/types/components/ui/color-picker.d.ts +12 -0
  46. package/types/components/ui/dialog.d.ts +19 -0
  47. package/types/components/ui/dropdown-menu.d.ts +27 -0
  48. package/types/components/ui/hover-card.d.ts +6 -0
  49. package/types/components/ui/input.d.ts +4 -0
  50. package/types/components/ui/popover.d.ts +7 -0
  51. package/types/components/ui/resizable.d.ts +23 -0
  52. package/types/components/ui/separator.d.ts +4 -0
  53. package/types/components/ui/slider.d.ts +4 -0
  54. package/types/components/ui/switch.d.ts +4 -0
  55. package/types/components/ui/tooltip.d.ts +7 -0
  56. package/types/core/AccountManager.d.ts +142 -0
  57. package/types/core/ChartModel.d.ts +84 -0
  58. package/types/core/ChartState.d.ts +51 -0
  59. package/types/core/ChartTypeRegistry.d.ts +27 -0
  60. package/types/core/DataEngine.d.ts +143 -0
  61. package/types/core/DataSourceRegistry.d.ts +106 -0
  62. package/types/core/DepthChart.d.ts +458 -0
  63. package/types/core/DrawingRegistry.d.ts +133 -0
  64. package/types/core/DrawingStore.d.ts +26 -0
  65. package/types/core/ExecutionEngine.d.ts +95 -0
  66. package/types/core/GlobalChartBus.d.ts +32 -0
  67. package/types/core/Playback.d.ts +48 -0
  68. package/types/core/PlaybackStateRegistry.d.ts +25 -0
  69. package/types/core/PluginRegistry.d.ts +67 -0
  70. package/types/core/PluginSchedule.d.ts +15 -0
  71. package/types/core/RenderEngine.d.ts +143 -0
  72. package/types/core/ScriptedPlugin.d.ts +153 -0
  73. package/types/core/SessionMapper.d.ts +54 -0
  74. package/types/core/SessionUtils.d.ts +53 -0
  75. package/types/core/TypedEventBus.d.ts +691 -0
  76. package/types/core/WasmPluginHost.d.ts +39 -0
  77. package/types/core/index.d.ts +70 -0
  78. package/types/core/plugin-startup.d.ts +33 -0
  79. package/types/core/processing/data-chunk.d.ts +37 -0
  80. package/types/core/processing/data-level.d.ts +13 -0
  81. package/types/core/processing/l2-processor.d.ts +10 -0
  82. package/types/core/processing/l3-processor.d.ts +26 -0
  83. package/types/core/processing/ohlcv-processor.d.ts +14 -0
  84. package/types/core/processing/tick-processor.d.ts +14 -0
  85. package/types/core/script-dsl.d.ts +20 -0
  86. package/types/core/script-scope.d.ts +4 -0
  87. package/types/core/script.worker.d.ts +1 -0
  88. package/types/hooks/useCellBridges.d.ts +36 -0
  89. package/types/hooks/useChartData.d.ts +153 -0
  90. package/types/hooks/useChartHandlers.d.ts +94 -0
  91. package/types/hooks/useChartInteraction.d.ts +160 -0
  92. package/types/hooks/useChartLayout.d.ts +21 -0
  93. package/types/hooks/useChartPlugin.d.ts +34 -0
  94. package/types/hooks/useChartSettings.d.ts +44 -0
  95. package/types/hooks/useChartSubscriptions.d.ts +64 -0
  96. package/types/hooks/useChartView.d.ts +47 -0
  97. package/types/hooks/usePlaybackEngine.d.ts +85 -0
  98. package/types/hooks/useRenderEngine.d.ts +64 -0
  99. package/types/hooks/useTradeLines.d.ts +80 -0
  100. package/types/hooks/useTradingState.d.ts +135 -0
  101. package/types/interfaces/IAccountAdapter.d.ts +38 -0
  102. package/types/interfaces/ICoordinateTransformer.d.ts +105 -0
  103. package/types/interfaces/IDataAdapter.d.ts +402 -0
  104. package/types/interfaces/IExecutionAdapter.d.ts +71 -0
  105. package/types/interfaces/plugins/IChartPlugin.d.ts +254 -0
  106. package/types/interfaces/plugins/IChartTypePlugin.d.ts +126 -0
  107. package/types/interfaces/plugins/IDataSourcePlugin.d.ts +20 -0
  108. package/types/interfaces/plugins/IDrawingPlugin.d.ts +62 -0
  109. package/types/interfaces/plugins/IIndicatorPlugin.d.ts +97 -0
  110. package/types/interfaces/plugins/index.d.ts +5 -0
  111. package/types/lib/bar-grid.d.ts +6 -0
  112. package/types/lib/book.d.ts +5 -0
  113. package/types/lib/clock.d.ts +7 -0
  114. package/types/lib/compact-buffer.d.ts +66 -0
  115. package/types/lib/constants.d.ts +5 -0
  116. package/types/lib/createSimulatedAdapter.d.ts +42 -0
  117. package/types/lib/dpr.d.ts +27 -0
  118. package/types/lib/heatmap.worker.d.ts +1 -0
  119. package/types/lib/indicator-stdlib.d.ts +426 -0
  120. package/types/lib/indicator-worker.d.ts +65 -0
  121. package/types/lib/matchingEngine.d.ts +144 -0
  122. package/types/lib/notifications/tradeToast.d.ts +31 -0
  123. package/types/lib/pointer-lock.d.ts +5 -0
  124. package/types/lib/priceFormat.d.ts +17 -0
  125. package/types/lib/priceTransition.d.ts +22 -0
  126. package/types/lib/renderers/drawFootprintChart.d.ts +5 -0
  127. package/types/lib/renderers/drawTradeLines.d.ts +112 -0
  128. package/types/lib/renderers/drawings-renderer.d.ts +57 -0
  129. package/types/lib/renderers/renderer.d.ts +113 -0
  130. package/types/lib/sampler.d.ts +7 -0
  131. package/types/lib/series/japaneseCharts.d.ts +88 -0
  132. package/types/lib/slice-worker-client.d.ts +138 -0
  133. package/types/lib/slice.worker.d.ts +139 -0
  134. package/types/lib/storage.d.ts +108 -0
  135. package/types/lib/symbol-info.d.ts +12 -0
  136. package/types/lib/symbol-search.d.ts +29 -0
  137. package/types/lib/timeframes.d.ts +46 -0
  138. package/types/lib/tradingview-import.d.ts +32 -0
  139. package/types/lib/types/chart-settings.d.ts +90 -0
  140. package/types/lib/types/drawing-types.d.ts +393 -0
  141. package/types/lib/types/footprint.d.ts +119 -0
  142. package/types/lib/types/heatmap-types.d.ts +30 -0
  143. package/types/lib/types/index.d.ts +147 -0
  144. package/types/lib/types/indicator-types.d.ts +123 -0
  145. package/types/lib/types/layout-sync.d.ts +43 -0
  146. package/types/lib/types/trading-types.d.ts +323 -0
  147. package/types/lib/use-forwarded-ref.d.ts +1 -0
  148. package/types/lib/utils.d.ts +2 -0
  149. package/types/plugins/alligator.d.ts +1 -0
  150. package/types/plugins/atr.d.ts +1 -0
  151. package/types/plugins/awesome-oscillator.d.ts +1 -0
  152. package/types/plugins/bollinger-bands.d.ts +1 -0
  153. package/types/plugins/cci.d.ts +1 -0
  154. package/types/plugins/cvd.d.ts +1 -0
  155. package/types/plugins/donchian.d.ts +1 -0
  156. package/types/plugins/ichimoku.d.ts +1 -0
  157. package/types/plugins/index.d.ts +25 -0
  158. package/types/plugins/keltner.d.ts +1 -0
  159. package/types/plugins/macd.d.ts +1 -0
  160. package/types/plugins/mfi.d.ts +1 -0
  161. package/types/plugins/moving-average.d.ts +1 -0
  162. package/types/plugins/obv.d.ts +1 -0
  163. package/types/plugins/psar.d.ts +1 -0
  164. package/types/plugins/rsi.d.ts +1 -0
  165. package/types/plugins/sessions.d.ts +1 -0
  166. package/types/plugins/stochastic.d.ts +1 -0
  167. package/types/plugins/supertrend.d.ts +1 -0
  168. package/types/plugins/volume.d.ts +1 -0
  169. package/types/plugins/vwap.d.ts +1 -0
  170. package/types/plugins/williams-r.d.ts +1 -0
  171. package/types/react/useDepthChart.d.ts +6 -0
@@ -0,0 +1 @@
1
+ export declare const volumeIndi = "\nconst volumeIndi = plugin({\n name: \"Volume\",\n shortName: \"VOL\",\n description: \"Per-bar volume with a moving average\",\n type: PluginType.indicator,\n require: DataLevel.ohlcv,\n layout: Layout.pane,\n version: \"1.0.0\",\n lookback: 100,\n params: {\n length: { label: \"Average\", type: \"number\", default: 20, min: 0, max: 500 },\n up: { label: \"Up bar\", type: \"color\", default: \"#26a69a\" },\n down: { label: \"Down bar\", type: \"color\", default: \"#ef5350\" },\n avg: { label: \"Average\", type: \"color\", default: \"#f5a623\" },\n opacity:{ label: \"Bar opacity\", type: \"opacity\", default: 65 }\n }\n})\n\nvolumeIndi.init = function({ data, params }) {\n const bars = data.ohlcv\n const suffix = Math.round(Math.max(0, Math.min(100, params.opacity)) * 2.55).toString(16).padStart(2, '0')\n\n const pts = []\n const colors = []\n for (const bar of bars) {\n pts.push({ t: bar.ts, price: bar.volume })\n colors.push((bar.close >= bar.open ? params.up : params.down) + suffix)\n }\n\n return {\n pts,\n colors,\n avg: params.length >= 2\n ? toPoints(bars.map(b => b.ts), sma(bars.map(b => b.volume), params.length))\n : [],\n avgColor: params.avg\n }\n}\n\nvolumeIndi.draw = function(s) {\n const out = [drawHistogram(s.pts, s.colors, 0, 0.25)]\n if (s.avg.length) out.push(drawLine(s.avg, s.avgColor, 1))\n return out\n}";
@@ -0,0 +1 @@
1
+ export declare const vwapIndi = "\nconst vwapIndi = plugin({\n name: \"VWAP\",\n shortName: \"VWAP\",\n description: \"Session volume-weighted average with deviation bands\",\n type: PluginType.indicator,\n require: DataLevel.ohlcv,\n version: \"1.0.0\",\n lookback: 300,\n params: {\n anchorHour: { label: \"Session start (UTC)\", type: \"number\", default: 0, min: 0, max: 23 },\n bands: { label: \"Band multipliers\", type: \"text\", default: \"1, 2\", placeholder: \"1, 2, 3\" },\n line: { label: \"VWAP\", type: \"color\", default: \"#f5a623\" },\n band: { label: \"Bands\", type: \"color\", default: \"#08b3de\" }\n }\n})\n\nconst DAY_MS = 86400000\n\nfunction parseMultipliers(raw) {\n const out = []\n for (const part of String(raw).split(',')) {\n const v = parseFloat(part)\n if (isFinite(v) && v > 0) out.push(v)\n }\n return out.slice(0, 4)\n}\n\nvwapIndi.init = function({ data, params }) {\n const bars = data.ohlcv\n const mults = parseMultipliers(params.bands)\n\n const vwap = []\n const bands = mults.map(() => ({ upper: [], lower: [] }))\n\n let sumPV = 0, sumV = 0, sumPPV = 0, session = NaN\n\n for (const bar of bars) {\n const ms = Number(bar.ts / 1000000n)\n const day = Math.floor((ms - params.anchorHour * 3600000) / DAY_MS)\n if (day !== session) {\n sumPV = 0; sumV = 0; sumPPV = 0\n session = day\n }\n\n const tp = (bar.high + bar.low + bar.close) / 3\n sumPV += tp * bar.volume\n sumV += bar.volume\n sumPPV += tp * tp * bar.volume\n if (sumV <= 0) continue\n\n const mean = sumPV / sumV\n vwap.push({ t: bar.ts, price: mean })\n\n // Volume-weighted variance, so the bands widen with participation.\n const sd = Math.sqrt(Math.max(0, sumPPV / sumV - mean * mean))\n for (let i = 0; i < mults.length; i++) {\n bands[i].upper.push({ t: bar.ts, price: mean + mults[i] * sd })\n bands[i].lower.push({ t: bar.ts, price: mean - mults[i] * sd })\n }\n }\n\n return { vwap, bands, line: params.line, band: params.band }\n}\n\nvwapIndi.draw = function(s) {\n const out = []\n\n for (let i = s.bands.length - 1; i >= 0; i--) {\n out.push(fillBetween(s.bands[i].upper, s.bands[i].lower, {\n mode: 'solid',\n color: s.band + '0c'\n }))\n }\n for (const b of s.bands) {\n out.push(drawLine(b.upper, s.band + '80', 1, [3, 3]))\n out.push(drawLine(b.lower, s.band + '80', 1, [3, 3]))\n }\n\n out.push(drawLine(s.vwap, s.line, 2))\n return out\n}";
@@ -0,0 +1 @@
1
+ export declare const williamsRIndi = "\nconst williams = plugin({\n name: \"Williams %R\",\n shortName: \"%R\",\n description: \"Where the close sits inside the period's range\",\n type: PluginType.indicator,\n require: DataLevel.ohlcv,\n layout: Layout.pane,\n version: \"1.0.0\",\n lookback: 100,\n params: {\n length: { label: \"Length\", type: \"number\", default: 14, min: 1, max: 300 },\n overbought: { label: \"Overbought\", type: \"number\", default: -20, min: -50, max: 0 },\n oversold: { label: \"Oversold\", type: \"number\", default: -80, min: -100, max: -50 },\n line: { label: \"%R\", type: \"color\", default: \"#7e57c2\" }\n }\n})\n\nwilliams.init = function({ data, params }) {\n const bars = data.ohlcv\n\n return {\n r: toPoints(bars.map(b => b.ts), williamsR(bars, params.length)),\n overbought: params.overbought,\n oversold: params.oversold,\n line: params.line\n }\n}\n\nwilliams.draw = function(s) {\n return [\n fillBetween(s.overbought, s.oversold, { mode: 'solid', color: '#ffffff08' }),\n drawHLine(s.overbought, \"#ffffff1f\", 1, [4, 4]),\n drawHLine(s.oversold, \"#ffffff1f\", 1, [4, 4]),\n drawLine(s.r, s.line, 2)\n ]\n}";
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { DepthChart, type ChartOptions } from '../core/DepthChart';
3
+ export declare function useDepthChart(options: ChartOptions): {
4
+ chart: DepthChart;
5
+ element: React.FunctionComponentElement<import("../ChartOuter").DepthProps>;
6
+ };