@363045841yyt/klinechart-core 0.8.11-alpha.0 → 0.8.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alerts/createAlertController.d.ts +30 -0
- package/dist/alerts/createAlertController.d.ts.map +1 -0
- package/dist/alerts/createAlertController.js +261 -0
- package/dist/alerts/createAlertController.js.map +1 -0
- package/dist/alerts/index.d.ts +5 -0
- package/dist/alerts/index.d.ts.map +1 -0
- package/dist/alerts/index.js +4 -0
- package/dist/alerts/index.js.map +1 -0
- package/dist/alerts/predicates.d.ts +28 -0
- package/dist/alerts/predicates.d.ts.map +1 -0
- package/dist/alerts/predicates.js +211 -0
- package/dist/alerts/predicates.js.map +1 -0
- package/dist/alerts/rollingVolume.d.ts +15 -0
- package/dist/alerts/rollingVolume.d.ts.map +1 -0
- package/dist/alerts/rollingVolume.js +42 -0
- package/dist/alerts/rollingVolume.js.map +1 -0
- package/dist/alerts/ruleSchema.d.ts +42 -0
- package/dist/alerts/ruleSchema.d.ts.map +1 -0
- package/dist/alerts/ruleSchema.js +240 -0
- package/dist/alerts/ruleSchema.js.map +1 -0
- package/dist/alerts/types.d.ts +169 -0
- package/dist/alerts/types.d.ts.map +1 -0
- package/dist/alerts/types.js +24 -0
- package/dist/alerts/types.js.map +1 -0
- package/dist/chartTypes/heikinAshi.d.ts +49 -0
- package/dist/chartTypes/heikinAshi.d.ts.map +1 -0
- package/dist/chartTypes/heikinAshi.js +94 -0
- package/dist/chartTypes/heikinAshi.js.map +1 -0
- package/dist/chartTypes/index.d.ts +6 -0
- package/dist/chartTypes/index.d.ts.map +1 -0
- package/dist/chartTypes/index.js +5 -0
- package/dist/chartTypes/index.js.map +1 -0
- package/dist/chartTypes/pointAndFigure.d.ts +83 -0
- package/dist/chartTypes/pointAndFigure.d.ts.map +1 -0
- package/dist/chartTypes/pointAndFigure.js +159 -0
- package/dist/chartTypes/pointAndFigure.js.map +1 -0
- package/dist/chartTypes/rangeBars.d.ts +61 -0
- package/dist/chartTypes/rangeBars.d.ts.map +1 -0
- package/dist/chartTypes/rangeBars.js +181 -0
- package/dist/chartTypes/rangeBars.js.map +1 -0
- package/dist/chartTypes/renko.d.ts +94 -0
- package/dist/chartTypes/renko.d.ts.map +1 -0
- package/dist/chartTypes/renko.js +207 -0
- package/dist/chartTypes/renko.js.map +1 -0
- package/dist/chartTypes/types.d.ts +97 -0
- package/dist/chartTypes/types.d.ts.map +1 -0
- package/dist/chartTypes/types.js +39 -0
- package/dist/chartTypes/types.js.map +1 -0
- package/dist/components/anchoredVwap/computeAnchoredVwap.d.ts +76 -0
- package/dist/components/anchoredVwap/computeAnchoredVwap.d.ts.map +1 -0
- package/dist/components/anchoredVwap/computeAnchoredVwap.js +155 -0
- package/dist/components/anchoredVwap/computeAnchoredVwap.js.map +1 -0
- package/dist/components/anchoredVwap/createAnchoredVwapController.d.ts +28 -0
- package/dist/components/anchoredVwap/createAnchoredVwapController.d.ts.map +1 -0
- package/dist/components/anchoredVwap/createAnchoredVwapController.js +282 -0
- package/dist/components/anchoredVwap/createAnchoredVwapController.js.map +1 -0
- package/dist/components/anchoredVwap/index.d.ts +11 -0
- package/dist/components/anchoredVwap/index.d.ts.map +1 -0
- package/dist/components/anchoredVwap/index.js +10 -0
- package/dist/components/anchoredVwap/index.js.map +1 -0
- package/dist/components/anchoredVwap/types.d.ts +171 -0
- package/dist/components/anchoredVwap/types.d.ts.map +1 -0
- package/dist/components/anchoredVwap/types.js +25 -0
- package/dist/components/anchoredVwap/types.js.map +1 -0
- package/dist/components/crosshairSync/createCrosshairSync.d.ts +94 -0
- package/dist/components/crosshairSync/createCrosshairSync.d.ts.map +1 -0
- package/dist/components/crosshairSync/createCrosshairSync.js +118 -0
- package/dist/components/crosshairSync/createCrosshairSync.js.map +1 -0
- package/dist/components/crosshairSync/index.d.ts +2 -0
- package/dist/components/crosshairSync/index.d.ts.map +1 -0
- package/dist/components/crosshairSync/index.js +2 -0
- package/dist/components/crosshairSync/index.js.map +1 -0
- package/dist/components/footprint/aggressor.d.ts +89 -0
- package/dist/components/footprint/aggressor.d.ts.map +1 -0
- package/dist/components/footprint/aggressor.js +106 -0
- package/dist/components/footprint/aggressor.js.map +1 -0
- package/dist/components/footprint/createFootprintController.d.ts +29 -0
- package/dist/components/footprint/createFootprintController.d.ts.map +1 -0
- package/dist/components/footprint/createFootprintController.js +264 -0
- package/dist/components/footprint/createFootprintController.js.map +1 -0
- package/dist/components/footprint/index.d.ts +7 -0
- package/dist/components/footprint/index.d.ts.map +1 -0
- package/dist/components/footprint/index.js +4 -0
- package/dist/components/footprint/index.js.map +1 -0
- package/dist/components/footprint/perBarStats.d.ts +63 -0
- package/dist/components/footprint/perBarStats.d.ts.map +1 -0
- package/dist/components/footprint/perBarStats.js +123 -0
- package/dist/components/footprint/perBarStats.js.map +1 -0
- package/dist/components/footprint/types.d.ts +197 -0
- package/dist/components/footprint/types.d.ts.map +1 -0
- package/dist/components/footprint/types.js +23 -0
- package/dist/components/footprint/types.js.map +1 -0
- package/dist/components/mtfOverlay/alignToBaseIndex.d.ts +45 -0
- package/dist/components/mtfOverlay/alignToBaseIndex.d.ts.map +1 -0
- package/dist/components/mtfOverlay/alignToBaseIndex.js +92 -0
- package/dist/components/mtfOverlay/alignToBaseIndex.js.map +1 -0
- package/dist/components/mtfOverlay/createMtfController.d.ts +7 -0
- package/dist/components/mtfOverlay/createMtfController.d.ts.map +1 -0
- package/dist/components/mtfOverlay/createMtfController.js +134 -0
- package/dist/components/mtfOverlay/createMtfController.js.map +1 -0
- package/dist/components/mtfOverlay/index.d.ts +19 -0
- package/dist/components/mtfOverlay/index.d.ts.map +1 -0
- package/dist/components/mtfOverlay/index.js +18 -0
- package/dist/components/mtfOverlay/index.js.map +1 -0
- package/dist/components/mtfOverlay/resampleBars.d.ts +37 -0
- package/dist/components/mtfOverlay/resampleBars.d.ts.map +1 -0
- package/dist/components/mtfOverlay/resampleBars.js +93 -0
- package/dist/components/mtfOverlay/resampleBars.js.map +1 -0
- package/dist/components/mtfOverlay/types.d.ts +132 -0
- package/dist/components/mtfOverlay/types.d.ts.map +1 -0
- package/dist/components/mtfOverlay/types.js +22 -0
- package/dist/components/mtfOverlay/types.js.map +1 -0
- package/dist/components/orderBookHeatmap/createHeatmapController.d.ts +21 -0
- package/dist/components/orderBookHeatmap/createHeatmapController.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/createHeatmapController.js +234 -0
- package/dist/components/orderBookHeatmap/createHeatmapController.js.map +1 -0
- package/dist/components/orderBookHeatmap/createOrderBookState.d.ts +18 -0
- package/dist/components/orderBookHeatmap/createOrderBookState.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/createOrderBookState.js +102 -0
- package/dist/components/orderBookHeatmap/createOrderBookState.js.map +1 -0
- package/dist/components/orderBookHeatmap/deltaArchive.d.ts +25 -0
- package/dist/components/orderBookHeatmap/deltaArchive.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/deltaArchive.js +106 -0
- package/dist/components/orderBookHeatmap/deltaArchive.js.map +1 -0
- package/dist/components/orderBookHeatmap/index.d.ts +13 -0
- package/dist/components/orderBookHeatmap/index.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/index.js +12 -0
- package/dist/components/orderBookHeatmap/index.js.map +1 -0
- package/dist/components/orderBookHeatmap/logColorScale.d.ts +20 -0
- package/dist/components/orderBookHeatmap/logColorScale.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/logColorScale.js +71 -0
- package/dist/components/orderBookHeatmap/logColorScale.js.map +1 -0
- package/dist/components/orderBookHeatmap/snapshotRing.d.ts +16 -0
- package/dist/components/orderBookHeatmap/snapshotRing.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/snapshotRing.js +61 -0
- package/dist/components/orderBookHeatmap/snapshotRing.js.map +1 -0
- package/dist/components/orderBookHeatmap/types.d.ts +128 -0
- package/dist/components/orderBookHeatmap/types.d.ts.map +1 -0
- package/dist/components/orderBookHeatmap/types.js +16 -0
- package/dist/components/orderBookHeatmap/types.js.map +1 -0
- package/dist/components/volumeProfile/binning.d.ts +54 -0
- package/dist/components/volumeProfile/binning.d.ts.map +1 -0
- package/dist/components/volumeProfile/binning.js +123 -0
- package/dist/components/volumeProfile/binning.js.map +1 -0
- package/dist/components/volumeProfile/createVolumeProfileController.d.ts +31 -0
- package/dist/components/volumeProfile/createVolumeProfileController.d.ts.map +1 -0
- package/dist/components/volumeProfile/createVolumeProfileController.js +179 -0
- package/dist/components/volumeProfile/createVolumeProfileController.js.map +1 -0
- package/dist/components/volumeProfile/index.d.ts +6 -0
- package/dist/components/volumeProfile/index.d.ts.map +1 -0
- package/dist/components/volumeProfile/index.js +5 -0
- package/dist/components/volumeProfile/index.js.map +1 -0
- package/dist/components/volumeProfile/poc.d.ts +35 -0
- package/dist/components/volumeProfile/poc.d.ts.map +1 -0
- package/dist/components/volumeProfile/poc.js +51 -0
- package/dist/components/volumeProfile/poc.js.map +1 -0
- package/dist/components/volumeProfile/types.d.ts +138 -0
- package/dist/components/volumeProfile/types.d.ts.map +1 -0
- package/dist/components/volumeProfile/types.js +19 -0
- package/dist/components/volumeProfile/types.js.map +1 -0
- package/dist/components/volumeProfile/valueArea.d.ts +58 -0
- package/dist/components/volumeProfile/valueArea.d.ts.map +1 -0
- package/dist/components/volumeProfile/valueArea.js +172 -0
- package/dist/components/volumeProfile/valueArea.js.map +1 -0
- package/dist/controllers/createChartController.d.ts.map +1 -1
- package/dist/controllers/createChartController.js +22 -11
- package/dist/controllers/createChartController.js.map +1 -1
- package/dist/controllers/types.d.ts +3 -1
- package/dist/controllers/types.d.ts.map +1 -1
- package/dist/data-fetchers/baostock.d.ts.map +1 -1
- package/dist/data-fetchers/baostock.js +2 -1
- package/dist/data-fetchers/baostock.js.map +1 -1
- package/dist/data-fetchers/dataBuffer.effects.d.ts.map +1 -1
- package/dist/data-fetchers/dataBuffer.effects.js +2 -1
- package/dist/data-fetchers/dataBuffer.effects.js.map +1 -1
- package/dist/data-fetchers/fetcherDefinitionRegistry.d.ts.map +1 -1
- package/dist/data-fetchers/fetcherDefinitionRegistry.js +2 -1
- package/dist/data-fetchers/fetcherDefinitionRegistry.js.map +1 -1
- package/dist/data-fetchers/gotdx.js +4 -3
- package/dist/data-fetchers/gotdx.js.map +1 -1
- package/dist/data-fetchers/router.d.ts.map +1 -1
- package/dist/data-fetchers/router.js +4 -3
- package/dist/data-fetchers/router.js.map +1 -1
- package/dist/data-fetchers/tradingview.js +3 -2
- package/dist/data-fetchers/tradingview.js.map +1 -1
- package/dist/engine/chart.d.ts +13 -0
- package/dist/engine/chart.d.ts.map +1 -1
- package/dist/engine/chart.js +109 -0
- package/dist/engine/chart.js.map +1 -1
- package/dist/engine/data/chartDataManager.d.ts +1 -0
- package/dist/engine/data/chartDataManager.d.ts.map +1 -1
- package/dist/engine/data/chartDataManager.js +27 -4
- package/dist/engine/data/chartDataManager.js.map +1 -1
- package/dist/engine/drawing/toolConfig.d.ts.map +1 -1
- package/dist/engine/drawing/toolConfig.js +2 -1
- package/dist/engine/drawing/toolConfig.js.map +1 -1
- package/dist/engine/indicators/chartIndicatorManager.d.ts.map +1 -1
- package/dist/engine/indicators/chartIndicatorManager.js +2 -1
- package/dist/engine/indicators/chartIndicatorManager.js.map +1 -1
- package/dist/engine/indicators/indicatorDefinitionRegistry.d.ts.map +1 -1
- package/dist/engine/indicators/indicatorDefinitionRegistry.js +2 -1
- package/dist/engine/indicators/indicatorDefinitionRegistry.js.map +1 -1
- package/dist/engine/indicators/indicatorMetadata.d.ts.map +1 -1
- package/dist/engine/indicators/indicatorMetadata.js +2 -1
- package/dist/engine/indicators/indicatorMetadata.js.map +1 -1
- package/dist/engine/indicators/indicatorRegistry.d.ts.map +1 -1
- package/dist/engine/indicators/indicatorRegistry.js +6 -5
- package/dist/engine/indicators/indicatorRegistry.js.map +1 -1
- package/dist/engine/indicators/registerBuiltins.d.ts.map +1 -1
- package/dist/engine/indicators/registerBuiltins.js +2 -1
- package/dist/engine/indicators/registerBuiltins.js.map +1 -1
- package/dist/engine/indicators/scheduler.d.ts +6 -0
- package/dist/engine/indicators/scheduler.d.ts.map +1 -1
- package/dist/engine/indicators/scheduler.js +12 -0
- package/dist/engine/indicators/scheduler.js.map +1 -1
- package/dist/engine/indicators/soa.d.ts.map +1 -1
- package/dist/engine/indicators/soa.js +2 -1
- package/dist/engine/indicators/soa.js.map +1 -1
- package/dist/engine/indicators/stateComposer.d.ts.map +1 -1
- package/dist/engine/indicators/stateComposer.js +2 -1
- package/dist/engine/indicators/stateComposer.js.map +1 -1
- package/dist/engine/subPaneManager.d.ts.map +1 -1
- package/dist/engine/subPaneManager.js +2 -1
- package/dist/engine/subPaneManager.js.map +1 -1
- package/dist/engine/utils/chartZoomController.d.ts +2 -0
- package/dist/engine/utils/chartZoomController.d.ts.map +1 -1
- package/dist/engine/utils/chartZoomController.js +5 -1
- package/dist/engine/utils/chartZoomController.js.map +1 -1
- package/dist/errors-help.d.ts +72 -0
- package/dist/errors-help.d.ts.map +1 -0
- package/dist/errors-help.js +149 -0
- package/dist/errors-help.js.map +1 -0
- package/dist/errors.d.ts +64 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/indicators/alma.d.ts +27 -0
- package/dist/indicators/alma.d.ts.map +1 -0
- package/dist/indicators/alma.js +36 -0
- package/dist/indicators/alma.js.map +1 -0
- package/dist/indicators/awesomeOscillator.d.ts +19 -0
- package/dist/indicators/awesomeOscillator.d.ts.map +1 -0
- package/dist/indicators/awesomeOscillator.js +36 -0
- package/dist/indicators/awesomeOscillator.js.map +1 -0
- package/dist/indicators/dpo.d.ts +17 -0
- package/dist/indicators/dpo.d.ts.map +1 -0
- package/dist/indicators/dpo.js +24 -0
- package/dist/indicators/dpo.js.map +1 -0
- package/dist/indicators/fisherTransform.d.ts +26 -0
- package/dist/indicators/fisherTransform.d.ts.map +1 -0
- package/dist/indicators/fisherTransform.js +44 -0
- package/dist/indicators/fisherTransform.js.map +1 -0
- package/dist/indicators/frama.d.ts +25 -0
- package/dist/indicators/frama.d.ts.map +1 -0
- package/dist/indicators/frama.js +61 -0
- package/dist/indicators/frama.js.map +1 -0
- package/dist/indicators/index.d.ts +24 -0
- package/dist/indicators/index.d.ts.map +1 -0
- package/dist/indicators/index.js +26 -0
- package/dist/indicators/index.js.map +1 -0
- package/dist/indicators/lsma.d.ts +21 -0
- package/dist/indicators/lsma.d.ts.map +1 -0
- package/dist/indicators/lsma.js +37 -0
- package/dist/indicators/lsma.js.map +1 -0
- package/dist/indicators/schaffTrendCycle.d.ts +24 -0
- package/dist/indicators/schaffTrendCycle.d.ts.map +1 -0
- package/dist/indicators/schaffTrendCycle.js +70 -0
- package/dist/indicators/schaffTrendCycle.js.map +1 -0
- package/dist/indicators/stochRSI.d.ts +24 -0
- package/dist/indicators/stochRSI.d.ts.map +1 -0
- package/dist/indicators/stochRSI.js +86 -0
- package/dist/indicators/stochRSI.js.map +1 -0
- package/dist/indicators/t3.d.ts +31 -0
- package/dist/indicators/t3.d.ts.map +1 -0
- package/dist/indicators/t3.js +63 -0
- package/dist/indicators/t3.js.map +1 -0
- package/dist/indicators/ultimateOscillator.d.ts +26 -0
- package/dist/indicators/ultimateOscillator.d.ts.map +1 -0
- package/dist/indicators/ultimateOscillator.js +59 -0
- package/dist/indicators/ultimateOscillator.js.map +1 -0
- package/dist/indicators/vidya.d.ts +24 -0
- package/dist/indicators/vidya.d.ts.map +1 -0
- package/dist/indicators/vidya.js +54 -0
- package/dist/indicators/vidya.js.map +1 -0
- package/dist/indicators/zlema.d.ts +16 -0
- package/dist/indicators/zlema.d.ts.map +1 -0
- package/dist/indicators/zlema.js +26 -0
- package/dist/indicators/zlema.js.map +1 -0
- package/dist/input/gesture.d.ts +125 -0
- package/dist/input/gesture.d.ts.map +1 -0
- package/dist/input/gesture.js +249 -0
- package/dist/input/gesture.js.map +1 -0
- package/dist/input/index.d.ts +9 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/index.js +9 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/keyboard.d.ts +140 -0
- package/dist/input/keyboard.d.ts.map +1 -0
- package/dist/input/keyboard.js +260 -0
- package/dist/input/keyboard.js.map +1 -0
- package/dist/mcp/chartBridge.d.ts +2 -2
- package/dist/mcp/chartBridge.d.ts.map +1 -1
- package/dist/mcp/chartBridge.js +27 -21
- package/dist/mcp/chartBridge.js.map +1 -1
- package/dist/plugin/PluginHost.d.ts +0 -3
- package/dist/plugin/PluginHost.d.ts.map +1 -1
- package/dist/plugin/PluginHost.js +7 -3
- package/dist/plugin/PluginHost.js.map +1 -1
- package/dist/plugin/PluginRegistry.d.ts +0 -3
- package/dist/plugin/PluginRegistry.d.ts.map +1 -1
- package/dist/plugin/PluginRegistry.js +5 -1
- package/dist/plugin/PluginRegistry.js.map +1 -1
- package/dist/render/Renderer.d.ts +116 -0
- package/dist/render/Renderer.d.ts.map +1 -0
- package/dist/render/Renderer.js +31 -0
- package/dist/render/Renderer.js.map +1 -0
- package/dist/render/SurfaceBackend.d.ts +83 -0
- package/dist/render/SurfaceBackend.d.ts.map +1 -0
- package/dist/render/SurfaceBackend.js +27 -0
- package/dist/render/SurfaceBackend.js.map +1 -0
- package/dist/render/index.d.ts +12 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +11 -0
- package/dist/render/index.js.map +1 -0
- package/dist/renderer-tier/detectRendererTier.d.ts +57 -0
- package/dist/renderer-tier/detectRendererTier.d.ts.map +1 -0
- package/dist/renderer-tier/detectRendererTier.js +143 -0
- package/dist/renderer-tier/detectRendererTier.js.map +1 -0
- package/dist/renderer-tier/index.d.ts +12 -0
- package/dist/renderer-tier/index.d.ts.map +1 -0
- package/dist/renderer-tier/index.js +12 -0
- package/dist/renderer-tier/index.js.map +1 -0
- package/dist/renderer-tier/selectBackend.d.ts +106 -0
- package/dist/renderer-tier/selectBackend.d.ts.map +1 -0
- package/dist/renderer-tier/selectBackend.js +113 -0
- package/dist/renderer-tier/selectBackend.js.map +1 -0
- package/dist/renderer-tier/types.d.ts +50 -0
- package/dist/renderer-tier/types.d.ts.map +1 -0
- package/dist/renderer-tier/types.js +24 -0
- package/dist/renderer-tier/types.js.map +1 -0
- package/dist/replay/createReplayController.d.ts +3 -0
- package/dist/replay/createReplayController.d.ts.map +1 -0
- package/dist/replay/createReplayController.js +251 -0
- package/dist/replay/createReplayController.js.map +1 -0
- package/dist/replay/index.d.ts +5 -0
- package/dist/replay/index.d.ts.map +1 -0
- package/dist/replay/index.js +3 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/replay/timeline.d.ts +50 -0
- package/dist/replay/timeline.d.ts.map +1 -0
- package/dist/replay/timeline.js +104 -0
- package/dist/replay/timeline.js.map +1 -0
- package/dist/replay/types.d.ts +94 -0
- package/dist/replay/types.d.ts.map +1 -0
- package/dist/replay/types.js +21 -0
- package/dist/replay/types.js.map +1 -0
- package/dist/scale/anchoredZoom.d.ts +64 -0
- package/dist/scale/anchoredZoom.d.ts.map +1 -0
- package/dist/scale/anchoredZoom.js +67 -0
- package/dist/scale/anchoredZoom.js.map +1 -0
- package/dist/scale/createPriceScale.d.ts +49 -0
- package/dist/scale/createPriceScale.d.ts.map +1 -0
- package/dist/scale/createPriceScale.js +175 -0
- package/dist/scale/createPriceScale.js.map +1 -0
- package/dist/scale/createTimeScale.d.ts +27 -0
- package/dist/scale/createTimeScale.d.ts.map +1 -0
- package/dist/scale/createTimeScale.js +139 -0
- package/dist/scale/createTimeScale.js.map +1 -0
- package/dist/scale/index.d.ts +6 -0
- package/dist/scale/index.d.ts.map +1 -0
- package/dist/scale/index.js +5 -0
- package/dist/scale/index.js.map +1 -0
- package/dist/scale/originShift.d.ts +69 -0
- package/dist/scale/originShift.d.ts.map +1 -0
- package/dist/scale/originShift.js +41 -0
- package/dist/scale/originShift.js.map +1 -0
- package/dist/scale/types.d.ts +90 -0
- package/dist/scale/types.d.ts.map +1 -0
- package/dist/scale/types.js +17 -0
- package/dist/scale/types.js.map +1 -0
- package/dist/scene/createScene.d.ts +22 -0
- package/dist/scene/createScene.d.ts.map +1 -0
- package/dist/scene/createScene.js +114 -0
- package/dist/scene/createScene.js.map +1 -0
- package/dist/scene/index.d.ts +13 -0
- package/dist/scene/index.d.ts.map +1 -0
- package/dist/scene/index.js +11 -0
- package/dist/scene/index.js.map +1 -0
- package/dist/scene/layerRegistry.d.ts +83 -0
- package/dist/scene/layerRegistry.d.ts.map +1 -0
- package/dist/scene/layerRegistry.js +43 -0
- package/dist/scene/layerRegistry.js.map +1 -0
- package/dist/scene/types.d.ts +128 -0
- package/dist/scene/types.d.ts.map +1 -0
- package/dist/scene/types.js +21 -0
- package/dist/scene/types.js.map +1 -0
- package/dist/scheduler/createFrameBudget.d.ts +91 -0
- package/dist/scheduler/createFrameBudget.d.ts.map +1 -0
- package/dist/scheduler/createFrameBudget.js +232 -0
- package/dist/scheduler/createFrameBudget.js.map +1 -0
- package/dist/scheduler/index.d.ts +2 -0
- package/dist/scheduler/index.d.ts.map +1 -0
- package/dist/scheduler/index.js +2 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/tokens/themeToCssVars.d.ts.map +1 -1
- package/dist/tokens/themeToCssVars.js +2 -28
- package/dist/tokens/themeToCssVars.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
- package/src/__bench__/indicators.bench.ts +215 -0
- package/src/__bench__/orderBookHeatmap.bench.ts +68 -0
- package/src/__bench__/scale.bench.ts +80 -0
- package/src/__bench__/signal.bench.ts +41 -0
- package/src/__bench__/volumeProfile.bench.ts +66 -0
- package/src/__tests__/errors-help.test.ts +184 -0
- package/src/__tests__/errors.test.ts +187 -0
- package/src/alerts/__tests__/controller.test.ts +231 -0
- package/src/alerts/__tests__/predicates.test.ts +374 -0
- package/src/alerts/__tests__/ruleSchema.test.ts +180 -0
- package/src/alerts/createAlertController.ts +312 -0
- package/src/alerts/index.ts +18 -0
- package/src/alerts/predicates.ts +231 -0
- package/src/alerts/rollingVolume.ts +51 -0
- package/src/alerts/ruleSchema.ts +278 -0
- package/src/alerts/types.ts +177 -0
- package/src/chartTypes/__tests__/heikinAshi.test.ts +122 -0
- package/src/chartTypes/__tests__/pointAndFigure.test.ts +167 -0
- package/src/chartTypes/__tests__/rangeBars.test.ts +146 -0
- package/src/chartTypes/__tests__/renko.test.ts +160 -0
- package/src/chartTypes/heikinAshi.ts +116 -0
- package/src/chartTypes/index.ts +5 -0
- package/src/chartTypes/pointAndFigure.ts +278 -0
- package/src/chartTypes/rangeBars.ts +303 -0
- package/src/chartTypes/renko.ts +311 -0
- package/src/chartTypes/types.ts +99 -0
- package/src/components/anchoredVwap/__tests__/computeAnchoredVwap.test.ts +331 -0
- package/src/components/anchoredVwap/__tests__/controller.test.ts +430 -0
- package/src/components/anchoredVwap/computeAnchoredVwap.ts +174 -0
- package/src/components/anchoredVwap/createAnchoredVwapController.ts +358 -0
- package/src/components/anchoredVwap/index.ts +17 -0
- package/src/components/anchoredVwap/types.ts +187 -0
- package/src/components/crosshairSync/__tests__/crosshairSync.test.ts +261 -0
- package/src/components/crosshairSync/createCrosshairSync.ts +187 -0
- package/src/components/crosshairSync/index.ts +5 -0
- package/src/components/footprint/__tests__/aggressor.test.ts +127 -0
- package/src/components/footprint/__tests__/controller.test.ts +130 -0
- package/src/components/footprint/__tests__/perBarStats.test.ts +114 -0
- package/src/components/footprint/aggressor.ts +165 -0
- package/src/components/footprint/createFootprintController.ts +338 -0
- package/src/components/footprint/index.ts +21 -0
- package/src/components/footprint/perBarStats.ts +137 -0
- package/src/components/footprint/types.ts +232 -0
- package/src/components/mtfOverlay/__tests__/alignToBaseIndex.test.ts +103 -0
- package/src/components/mtfOverlay/__tests__/controller.test.ts +172 -0
- package/src/components/mtfOverlay/__tests__/resampleBars.test.ts +106 -0
- package/src/components/mtfOverlay/alignToBaseIndex.ts +108 -0
- package/src/components/mtfOverlay/createMtfController.ts +180 -0
- package/src/components/mtfOverlay/index.ts +26 -0
- package/src/components/mtfOverlay/resampleBars.ts +134 -0
- package/src/components/mtfOverlay/types.ts +148 -0
- package/src/components/orderBookHeatmap/__tests__/controller.test.ts +237 -0
- package/src/components/orderBookHeatmap/__tests__/deltaArchive.test.ts +88 -0
- package/src/components/orderBookHeatmap/__tests__/logColorScale.test.ts +69 -0
- package/src/components/orderBookHeatmap/__tests__/orderBookState.test.ts +113 -0
- package/src/components/orderBookHeatmap/__tests__/snapshotRing.test.ts +53 -0
- package/src/components/orderBookHeatmap/computeShader.wgsl.md +130 -0
- package/src/components/orderBookHeatmap/createHeatmapController.ts +273 -0
- package/src/components/orderBookHeatmap/createOrderBookState.ts +116 -0
- package/src/components/orderBookHeatmap/deltaArchive.ts +113 -0
- package/src/components/orderBookHeatmap/index.ts +25 -0
- package/src/components/orderBookHeatmap/logColorScale.ts +77 -0
- package/src/components/orderBookHeatmap/snapshotRing.ts +65 -0
- package/src/components/orderBookHeatmap/types.ts +168 -0
- package/src/components/volumeProfile/__tests__/binning.test.ts +133 -0
- package/src/components/volumeProfile/__tests__/poc.test.ts +44 -0
- package/src/components/volumeProfile/__tests__/valueArea.test.ts +177 -0
- package/src/components/volumeProfile/binning.ts +133 -0
- package/src/components/volumeProfile/createVolumeProfileController.ts +213 -0
- package/src/components/volumeProfile/index.ts +12 -0
- package/src/components/volumeProfile/poc.ts +53 -0
- package/src/components/volumeProfile/types.ts +148 -0
- package/src/components/volumeProfile/valueArea.ts +187 -0
- package/src/controllers/createChartController.ts +23 -10
- package/src/controllers/types.ts +5 -1
- package/src/data-fetchers/baostock.ts +2 -1
- package/src/data-fetchers/dataBuffer.effects.ts +3 -1
- package/src/data-fetchers/fetcherDefinitionRegistry.ts +2 -1
- package/src/data-fetchers/gotdx.ts +4 -3
- package/src/data-fetchers/router.ts +6 -3
- package/src/data-fetchers/tradingview.ts +3 -2
- package/src/engine/chart.ts +126 -3
- package/src/engine/data/chartDataManager.ts +26 -4
- package/src/engine/drawing/toolConfig.ts +2 -1
- package/src/engine/indicators/chartIndicatorManager.ts +2 -1
- package/src/engine/indicators/indicatorDefinitionRegistry.ts +2 -1
- package/src/engine/indicators/indicatorMetadata.ts +2 -1
- package/src/engine/indicators/indicatorRegistry.ts +6 -5
- package/src/engine/indicators/registerBuiltins.ts +2 -1
- package/src/engine/indicators/scheduler.ts +15 -0
- package/src/engine/indicators/soa.ts +2 -1
- package/src/engine/indicators/stateComposer.ts +2 -1
- package/src/engine/subPaneManager.ts +2 -1
- package/src/engine/utils/chartZoomController.ts +7 -1
- package/src/errors-help.ts +218 -0
- package/src/errors.ts +128 -0
- package/src/index.ts +37 -0
- package/src/indicators/__tests__/maFamily.test.ts +159 -0
- package/src/indicators/__tests__/oscillators.test.ts +150 -0
- package/src/indicators/alma.ts +61 -0
- package/src/indicators/awesomeOscillator.ts +54 -0
- package/src/indicators/dpo.ts +37 -0
- package/src/indicators/fisherTransform.ts +63 -0
- package/src/indicators/frama.ts +87 -0
- package/src/indicators/index.ts +39 -0
- package/src/indicators/lsma.ts +58 -0
- package/src/indicators/schaffTrendCycle.ts +92 -0
- package/src/indicators/stochRSI.ts +108 -0
- package/src/indicators/t3.ts +96 -0
- package/src/indicators/ultimateOscillator.ts +83 -0
- package/src/indicators/vidya.ts +80 -0
- package/src/indicators/zlema.ts +41 -0
- package/src/input/__tests__/gesture.test.ts +271 -0
- package/src/input/__tests__/keyboard.test.ts +317 -0
- package/src/input/gesture.ts +357 -0
- package/src/input/index.ts +26 -0
- package/src/input/keyboard.ts +373 -0
- package/src/mcp/chartBridge.ts +98 -72
- package/src/plugin/PluginHost.ts +4 -3
- package/src/plugin/PluginRegistry.ts +2 -1
- package/src/render/Renderer.ts +127 -0
- package/src/render/SurfaceBackend.ts +94 -0
- package/src/render/__tests__/contract.test.ts +176 -0
- package/src/render/index.ts +27 -0
- package/src/renderer-tier/__tests__/detectRendererTier.test.ts +180 -0
- package/src/renderer-tier/__tests__/selectBackend.test.ts +253 -0
- package/src/renderer-tier/detectRendererTier.ts +168 -0
- package/src/renderer-tier/index.ts +30 -0
- package/src/renderer-tier/selectBackend.ts +201 -0
- package/src/renderer-tier/types.ts +59 -0
- package/src/replay/__tests__/controller.test.ts +309 -0
- package/src/replay/__tests__/timeline.test.ts +99 -0
- package/src/replay/createReplayController.ts +302 -0
- package/src/replay/index.ts +15 -0
- package/src/replay/timeline.ts +106 -0
- package/src/replay/types.ts +107 -0
- package/src/scale/__tests__/anchoredZoom.test.ts +125 -0
- package/src/scale/__tests__/originShift.test.ts +97 -0
- package/src/scale/__tests__/priceScale.test.ts +219 -0
- package/src/scale/__tests__/timeScale.test.ts +119 -0
- package/src/scale/anchoredZoom.ts +104 -0
- package/src/scale/createPriceScale.ts +226 -0
- package/src/scale/createTimeScale.ts +150 -0
- package/src/scale/index.ts +9 -0
- package/src/scale/originShift.ts +111 -0
- package/src/scale/types.ts +100 -0
- package/src/scene/__tests__/layerRegistry.test.ts +207 -0
- package/src/scene/__tests__/scene.test.ts +411 -0
- package/src/scene/createScene.ts +117 -0
- package/src/scene/index.ts +29 -0
- package/src/scene/layerRegistry.ts +117 -0
- package/src/scene/types.ts +143 -0
- package/src/scheduler/__tests__/createFrameBudget.test.ts +315 -0
- package/src/scheduler/createFrameBudget.ts +316 -0
- package/src/scheduler/index.ts +7 -0
- package/src/tokens/themeToCssVars.ts +3 -1
- package/src/version.ts +1 -1
- package/dist/data-fetchers/gotdx/gotdx.d.ts +0 -7
- package/dist/data-fetchers/gotdx/gotdx.d.ts.map +0 -1
- package/dist/data-fetchers/gotdx/gotdx.js +0 -7
- package/dist/data-fetchers/gotdx/gotdx.js.map +0 -1
- package/src/data-fetchers/gotdx/gotdx.ts +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logColorScale.js","sourceRoot":"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EAAE,GAAG,OAAO,CAAA;QACZ,SAAS,EAAE,CAAA;IACf,CAAC;IAED,SAAS,KAAK;QACV,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IACvC,CAAC;IAED,SAAS,EAAE,CAAA;IACX,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AACzC,CAAC;AAED,SAAS,QAAQ,CAAC,EAAU,EAAE,EAAU;IACpC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,eAAe,CAAC,wBAAwB,EAAE,+DAA+D,CAAC,CAAA;IACxH,CAAC;IACD,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;QACpC,MAAM,IAAI,eAAe,CAAC,wBAAwB,EAAE,+DAA+D,CAAC,CAAA;IACxH,CAAC;IACD,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;QACV,MAAM,IAAI,eAAe,CAAC,wBAAwB,EAAE,gDAAgD,CAAC,CAAA;IACzG,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-capacity ring buffer of recent book snapshots.
|
|
3
|
+
*
|
|
4
|
+
* Live render path: the heatmap shader samples a 2-D grid of intensity
|
|
5
|
+
* values keyed by (column = snapshot index, row = price). The ring stores
|
|
6
|
+
* the columns. Capacity is chosen so that ring duration covers the visible
|
|
7
|
+
* heatmap window — e.g. 600 entries @ 100 ms cadence = 60 s.
|
|
8
|
+
*
|
|
9
|
+
* Storage is a pre-allocated array with a head pointer; older entries are
|
|
10
|
+
* overwritten in place once full. `toArray()` walks the ring in
|
|
11
|
+
* oldest → newest order so consumers can upload it as a single contiguous
|
|
12
|
+
* GPU buffer.
|
|
13
|
+
*/
|
|
14
|
+
import type { SnapshotRing } from './types';
|
|
15
|
+
export declare function createSnapshotRing(capacity: number): SnapshotRing;
|
|
16
|
+
//# sourceMappingURL=snapshotRing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotRing.d.ts","sourceRoot":"","sources":["../../../src/components/orderBookHeatmap/snapshotRing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CA+CjE"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixed-capacity ring buffer of recent book snapshots.
|
|
3
|
+
*
|
|
4
|
+
* Live render path: the heatmap shader samples a 2-D grid of intensity
|
|
5
|
+
* values keyed by (column = snapshot index, row = price). The ring stores
|
|
6
|
+
* the columns. Capacity is chosen so that ring duration covers the visible
|
|
7
|
+
* heatmap window — e.g. 600 entries @ 100 ms cadence = 60 s.
|
|
8
|
+
*
|
|
9
|
+
* Storage is a pre-allocated array with a head pointer; older entries are
|
|
10
|
+
* overwritten in place once full. `toArray()` walks the ring in
|
|
11
|
+
* oldest → newest order so consumers can upload it as a single contiguous
|
|
12
|
+
* GPU buffer.
|
|
13
|
+
*/
|
|
14
|
+
import { KLineChartError } from '../../errors';
|
|
15
|
+
export function createSnapshotRing(capacity) {
|
|
16
|
+
if (!Number.isInteger(capacity) || capacity <= 0) {
|
|
17
|
+
throw new KLineChartError('HEATMAP_CONFIG_INVALID', 'createSnapshotRing: capacity must be a positive integer');
|
|
18
|
+
}
|
|
19
|
+
const cap = capacity;
|
|
20
|
+
const slots = new Array(cap).fill(null);
|
|
21
|
+
let head = 0; // index of the next write slot
|
|
22
|
+
let count = 0; // number of populated slots; saturates at cap
|
|
23
|
+
function push(snapshot) {
|
|
24
|
+
slots[head] = snapshot;
|
|
25
|
+
head = (head + 1) % cap;
|
|
26
|
+
if (count < cap)
|
|
27
|
+
count++;
|
|
28
|
+
}
|
|
29
|
+
function toArray() {
|
|
30
|
+
if (count === 0)
|
|
31
|
+
return [];
|
|
32
|
+
const out = new Array(count);
|
|
33
|
+
// Oldest index when full = head (next write slot); when not full = 0.
|
|
34
|
+
const start = count < cap ? 0 : head;
|
|
35
|
+
for (let i = 0; i < count; i++) {
|
|
36
|
+
const slot = slots[(start + i) % cap];
|
|
37
|
+
// Guarded above by count; slots[(start+i)%cap] is non-null.
|
|
38
|
+
out[i] = slot;
|
|
39
|
+
}
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
function size() {
|
|
43
|
+
return count;
|
|
44
|
+
}
|
|
45
|
+
function clear() {
|
|
46
|
+
for (let i = 0; i < cap; i++)
|
|
47
|
+
slots[i] = null;
|
|
48
|
+
head = 0;
|
|
49
|
+
count = 0;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
get capacity() {
|
|
53
|
+
return cap;
|
|
54
|
+
},
|
|
55
|
+
push,
|
|
56
|
+
toArray,
|
|
57
|
+
size,
|
|
58
|
+
clear,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=snapshotRing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotRing.js","sourceRoot":"","sources":["../../../src/components/orderBookHeatmap/snapshotRing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IAC/C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,IAAI,eAAe,CAAC,wBAAwB,EAAE,yDAAyD,CAAC,CAAA;IAClH,CAAC;IACD,MAAM,GAAG,GAAG,Q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O;QACH,IAAI,QAAQ;YACR,OAAO,GAAG,CAAA;QACd,CAAC;QACD,IAAI;QACJ,OAAO;QACP,IAAI;QACJ,KAAK;KACR,CAAA;AACL,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L2 Order Book Heatmap — public types.
|
|
3
|
+
*
|
|
4
|
+
* Implements the data model described in `docs/ROADMAP.md` §3.2.
|
|
5
|
+
*
|
|
6
|
+
* Critique addressed (PR23): the live render path uses fixed-cadence
|
|
7
|
+
* snapshots (cheap to upload to a GPU storage buffer), while a parallel
|
|
8
|
+
* append-only delta archive preserves the full event stream so that
|
|
9
|
+
* sub-snapshot "flash orders" can be replayed exactly. Snapshot ring is
|
|
10
|
+
* the render source; delta archive is the source of truth.
|
|
11
|
+
*
|
|
12
|
+
* No file in this module imports from `src/` — this component is part of
|
|
13
|
+
* the additive `packages/core/` work.
|
|
14
|
+
*/
|
|
15
|
+
import type { Signal } from '../../reactivity';
|
|
16
|
+
/**
|
|
17
|
+
* One exchange-pushed delta. `size === 0` means the price level is removed.
|
|
18
|
+
*
|
|
19
|
+
* Timestamp is the **exchange** wall-clock in milliseconds — we use it as
|
|
20
|
+
* the controller's clock so the system is deterministic for tests and
|
|
21
|
+
* correct under bursty traffic (no setInterval).
|
|
22
|
+
*/
|
|
23
|
+
export interface OrderBookDelta {
|
|
24
|
+
side: 'bid' | 'ask';
|
|
25
|
+
price: number;
|
|
26
|
+
size: number;
|
|
27
|
+
timestamp: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Immutable view of the book at one instant. Prices in this object are
|
|
31
|
+
* always returned in their **dequantized** (real-world) form — clients
|
|
32
|
+
* never see the integer tick index.
|
|
33
|
+
*
|
|
34
|
+
* Bids are sorted descending (best bid first), asks ascending (best ask
|
|
35
|
+
* first). Each entry is `[price, size]`.
|
|
36
|
+
*/
|
|
37
|
+
export interface BookSnapshot {
|
|
38
|
+
readonly bids: ReadonlyArray<readonly [number, number]>;
|
|
39
|
+
readonly asks: ReadonlyArray<readonly [number, number]>;
|
|
40
|
+
readonly timestamp: number;
|
|
41
|
+
}
|
|
42
|
+
export interface OrderBookStateOptions {
|
|
43
|
+
/** quantize all input prices to this tick (e.g. 0.01 = cents) */
|
|
44
|
+
tickSize: number;
|
|
45
|
+
/** keep at most this many levels per side; oldest-by-distance dropped */
|
|
46
|
+
maxLevels?: number;
|
|
47
|
+
}
|
|
48
|
+
export interface OrderBookState {
|
|
49
|
+
/** Apply one delta. `size === 0` removes the level. */
|
|
50
|
+
applyDelta(delta: OrderBookDelta): void;
|
|
51
|
+
/** Take a fresh snapshot (prices dequantized). */
|
|
52
|
+
snapshot(): BookSnapshot;
|
|
53
|
+
/** Empty both sides. */
|
|
54
|
+
clear(): void;
|
|
55
|
+
/** Latest timestamp seen via {@link applyDelta}. */
|
|
56
|
+
lastTimestamp(): number;
|
|
57
|
+
}
|
|
58
|
+
export interface SnapshotRing {
|
|
59
|
+
readonly capacity: number;
|
|
60
|
+
push(snapshot: BookSnapshot): void;
|
|
61
|
+
/** snapshots oldest → newest; never contains gaps */
|
|
62
|
+
toArray(): ReadonlyArray<BookSnapshot>;
|
|
63
|
+
size(): number;
|
|
64
|
+
clear(): void;
|
|
65
|
+
}
|
|
66
|
+
export interface DeltaArchive {
|
|
67
|
+
append(delta: OrderBookDelta): void;
|
|
68
|
+
/** inclusive range; deltas with `from <= ts <= to` */
|
|
69
|
+
range(fromTimestamp: number, toTimestamp: number): ReadonlyArray<OrderBookDelta>;
|
|
70
|
+
size(): number;
|
|
71
|
+
clear(): void;
|
|
72
|
+
/** drop oldest deltas until total size ≤ maxSize */
|
|
73
|
+
trim(maxSize: number): void;
|
|
74
|
+
}
|
|
75
|
+
export interface DeltaArchiveOptions {
|
|
76
|
+
/** when set, the archive self-trims after each {@link DeltaArchive.append} */
|
|
77
|
+
maxSize?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface LogColorScale {
|
|
80
|
+
/** returns intensity in [0,1] for the given size */
|
|
81
|
+
intensity(size: number): number;
|
|
82
|
+
/** swap the size range (does not retroactively rescale anything) */
|
|
83
|
+
setRange(sizeMin: number, sizeMax: number): void;
|
|
84
|
+
/** current range (for callers that need to mirror it into GPU uniforms) */
|
|
85
|
+
range(): {
|
|
86
|
+
sizeMin: number;
|
|
87
|
+
sizeMax: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export interface HeatmapControllerConfig {
|
|
91
|
+
tickSize: number;
|
|
92
|
+
snapshotIntervalMs: number;
|
|
93
|
+
snapshotRingCapacity: number;
|
|
94
|
+
deltaArchiveMaxSize: number;
|
|
95
|
+
logColorRange: {
|
|
96
|
+
sizeMin: number;
|
|
97
|
+
sizeMax: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export interface HeatmapState {
|
|
101
|
+
readonly latestSnapshot: BookSnapshot | null;
|
|
102
|
+
readonly snapshotCount: number;
|
|
103
|
+
readonly deltaCount: number;
|
|
104
|
+
}
|
|
105
|
+
export interface HeatmapController {
|
|
106
|
+
readonly state: Signal<HeatmapState>;
|
|
107
|
+
/**
|
|
108
|
+
* Ingest one L2 delta — canonical method, aligned with the cross-controller
|
|
109
|
+
* `ingest()` convention (VolumeProfile, Footprint). Closes API audit
|
|
110
|
+
* BLOCKER-001 (5-verb intake proliferation).
|
|
111
|
+
*/
|
|
112
|
+
ingest(delta: OrderBookDelta): void;
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated since 0.1.0-alpha.1 — use {@link HeatmapController.ingest}.
|
|
115
|
+
* Kept as a non-removing alias for at least 6 months for migration.
|
|
116
|
+
*/
|
|
117
|
+
ingestDelta(delta: OrderBookDelta): void;
|
|
118
|
+
/** Force a snapshot now using the controller's current state. */
|
|
119
|
+
forceSnapshot(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Reconstruct snapshots at a regular cadence by replaying the delta archive.
|
|
122
|
+
* `from` is the first snapshot timestamp, `to` is exclusive upper bound.
|
|
123
|
+
*/
|
|
124
|
+
replay(fromTimestamp: number, toTimestamp: number, snapshotIntervalMs: number): ReadonlyArray<BookSnapshot>;
|
|
125
|
+
setConfig(next: Partial<HeatmapControllerConfig>): void;
|
|
126
|
+
dispose(): void;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/orderBookHeatmap/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAM9C;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,KAAK,GAAG,KAAK,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;CACpB;AAMD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACvD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IACvD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAC7B;AAMD,MAAM,WAAW,qBAAqB;IAClC,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAA;IAChB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,cAAc;IAC3B,uDAAuD;IACvD,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IACvC,kDAAkD;IAClD,QAAQ,IAAI,YAAY,CAAA;IACxB,wBAAwB;IACxB,KAAK,IAAI,IAAI,CAAA;IACb,oDAAoD;IACpD,aAAa,IAAI,MAAM,CAAA;CAC1B;AAMD,MAAM,WAAW,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AAC,cAAc,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,CAAA;IAEpC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IAEnC;;;OAGG;IACH,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC,iEAAiE;IACjE,aAAa,IAAI,IAAI,CAAA;IACrB;;;OAGG;IACH,MAAM,CACF,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,kBAAkB,EAAE,MAAM,GAC3B,aAAa,CAAC,YAAY,CAAC,CAAA;IAE9B,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAA;IACvD,OAAO,IAAI,IAAI,CAAA;CAClB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* L2 Order Book Heatmap — public types.
|
|
3
|
+
*
|
|
4
|
+
* Implements the data model described in `docs/ROADMAP.md` §3.2.
|
|
5
|
+
*
|
|
6
|
+
* Critique addressed (PR23): the live render path uses fixed-cadence
|
|
7
|
+
* snapshots (cheap to upload to a GPU storage buffer), while a parallel
|
|
8
|
+
* append-only delta archive preserves the full event stream so that
|
|
9
|
+
* sub-snapshot "flash orders" can be replayed exactly. Snapshot ring is
|
|
10
|
+
* the render source; delta archive is the source of truth.
|
|
11
|
+
*
|
|
12
|
+
* No file in this module imports from `src/` — this component is part of
|
|
13
|
+
* the additive `packages/core/` work.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/orderBookHeatmap/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bar-to-bucket volume distribution.
|
|
3
|
+
*
|
|
4
|
+
* Two modes, both described in `docs/ROADMAP.md` §3.1:
|
|
5
|
+
*
|
|
6
|
+
* - `typical-price` (fast, default): the bar's entire volume is added to the
|
|
7
|
+
* bucket containing the typical price `(high + low + close) / 3`. O(1) per
|
|
8
|
+
* bar. Good enough for live profiles and the case where each bar is small
|
|
9
|
+
* relative to the bucket size.
|
|
10
|
+
*
|
|
11
|
+
* - `proportional` (accurate): the bar's volume is split across every bucket
|
|
12
|
+
* that overlaps `[low, high]`, weighted by that bucket's price-range
|
|
13
|
+
* overlap with the bar. O(spanned buckets) per bar. Use this when bars
|
|
14
|
+
* span many buckets (e.g. higher timeframes, wide ranges).
|
|
15
|
+
*
|
|
16
|
+
* Both modes mutate the `buckets` array in place — the function is called in
|
|
17
|
+
* a tight loop and we want zero allocations on the hot path. The controller
|
|
18
|
+
* is responsible for zeroing the buckets before the first call.
|
|
19
|
+
*
|
|
20
|
+
* Out-of-range handling:
|
|
21
|
+
* - In `typical-price` mode a bar whose typical price falls outside
|
|
22
|
+
* `[binMin, binMin + binCount*binSize)` is **dropped silently**. The
|
|
23
|
+
* controller is responsible for sizing the price range so this only
|
|
24
|
+
* happens for accidentally bad inputs (e.g. zero-volume bars in a
|
|
25
|
+
* degenerate range).
|
|
26
|
+
* - In `proportional` mode the overlap with `[binMin, binMax]` is the
|
|
27
|
+
* effective contribution; a bar fully outside contributes nothing, a bar
|
|
28
|
+
* partially overlapping contributes proportionally.
|
|
29
|
+
*/
|
|
30
|
+
import type { BinningMode, VolumeProfileBar } from './types';
|
|
31
|
+
/**
|
|
32
|
+
* Distribute one bar's volume into `buckets`.
|
|
33
|
+
*
|
|
34
|
+
* Preconditions (not checked, hot path):
|
|
35
|
+
* - `buckets.length === binCount`
|
|
36
|
+
* - `binSize > 0`
|
|
37
|
+
* - `binCount >= 1`
|
|
38
|
+
*
|
|
39
|
+
* @param bar The OHLC bar (only `high`/`low`/`close`/`volume` are read).
|
|
40
|
+
* @param buckets Histogram array — written in place.
|
|
41
|
+
* @param binMin Low edge of bucket 0.
|
|
42
|
+
* @param binSize Price width of one bucket.
|
|
43
|
+
* @param binCount Number of buckets (must equal `buckets.length`).
|
|
44
|
+
* @param mode `typical-price` (fast) or `proportional` (accurate).
|
|
45
|
+
*
|
|
46
|
+
* @internal — building block used by the corresponding controller
|
|
47
|
+
* factory. Reachable today via the top-level `@klinechart-quant/core`
|
|
48
|
+
* barrel but **NOT part of the supported public API**. typedoc / api-
|
|
49
|
+
* extractor hide it from generated docs. Prefer the controller
|
|
50
|
+
* factory (e.g. `createVolumeProfileController`) for stable user code.
|
|
51
|
+
* Closes API audit BLOCKER-002 (export * leakage taxonomy).
|
|
52
|
+
*/
|
|
53
|
+
export declare function binBarToBuckets(bar: VolumeProfileBar, buckets: Float64Array, binMin: number, binSize: number, binCount: number, mode: BinningMode): void;
|
|
54
|
+
//# sourceMappingURL=binning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binning.d.ts","sourceRoot":"","sources":["../../../src/components/volumeProfile/binning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,gBAAgB,EACrB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,GAClB,IAAI,CAuEN"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bar-to-bucket volume distribution.
|
|
3
|
+
*
|
|
4
|
+
* Two modes, both described in `docs/ROADMAP.md` §3.1:
|
|
5
|
+
*
|
|
6
|
+
* - `typical-price` (fast, default): the bar's entire volume is added to the
|
|
7
|
+
* bucket containing the typical price `(high + low + close) / 3`. O(1) per
|
|
8
|
+
* bar. Good enough for live profiles and the case where each bar is small
|
|
9
|
+
* relative to the bucket size.
|
|
10
|
+
*
|
|
11
|
+
* - `proportional` (accurate): the bar's volume is split across every bucket
|
|
12
|
+
* that overlaps `[low, high]`, weighted by that bucket's price-range
|
|
13
|
+
* overlap with the bar. O(spanned buckets) per bar. Use this when bars
|
|
14
|
+
* span many buckets (e.g. higher timeframes, wide ranges).
|
|
15
|
+
*
|
|
16
|
+
* Both modes mutate the `buckets` array in place — the function is called in
|
|
17
|
+
* a tight loop and we want zero allocations on the hot path. The controller
|
|
18
|
+
* is responsible for zeroing the buckets before the first call.
|
|
19
|
+
*
|
|
20
|
+
* Out-of-range handling:
|
|
21
|
+
* - In `typical-price` mode a bar whose typical price falls outside
|
|
22
|
+
* `[binMin, binMin + binCount*binSize)` is **dropped silently**. The
|
|
23
|
+
* controller is responsible for sizing the price range so this only
|
|
24
|
+
* happens for accidentally bad inputs (e.g. zero-volume bars in a
|
|
25
|
+
* degenerate range).
|
|
26
|
+
* - In `proportional` mode the overlap with `[binMin, binMax]` is the
|
|
27
|
+
* effective contribution; a bar fully outside contributes nothing, a bar
|
|
28
|
+
* partially overlapping contributes proportionally.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Distribute one bar's volume into `buckets`.
|
|
32
|
+
*
|
|
33
|
+
* Preconditions (not checked, hot path):
|
|
34
|
+
* - `buckets.length === binCount`
|
|
35
|
+
* - `binSize > 0`
|
|
36
|
+
* - `binCount >= 1`
|
|
37
|
+
*
|
|
38
|
+
* @param bar The OHLC bar (only `high`/`low`/`close`/`volume` are read).
|
|
39
|
+
* @param buckets Histogram array — written in place.
|
|
40
|
+
* @param binMin Low edge of bucket 0.
|
|
41
|
+
* @param binSize Price width of one bucket.
|
|
42
|
+
* @param binCount Number of buckets (must equal `buckets.length`).
|
|
43
|
+
* @param mode `typical-price` (fast) or `proportional` (accurate).
|
|
44
|
+
*
|
|
45
|
+
* @internal — building block used by the corresponding controller
|
|
46
|
+
* factory. Reachable today via the top-level `@klinechart-quant/core`
|
|
47
|
+
* barrel but **NOT part of the supported public API**. typedoc / api-
|
|
48
|
+
* extractor hide it from generated docs. Prefer the controller
|
|
49
|
+
* factory (e.g. `createVolumeProfileController`) for stable user code.
|
|
50
|
+
* Closes API audit BLOCKER-002 (export * leakage taxonomy).
|
|
51
|
+
*/
|
|
52
|
+
export function binBarToBuckets(bar, buckets, binMin, binSize, binCount, mode) {
|
|
53
|
+
if (bar.volume === 0 || binCount === 0 || binSize <= 0)
|
|
54
|
+
return;
|
|
55
|
+
if (mode === 'typical-price') {
|
|
56
|
+
const tp = (bar.high + bar.low + bar.close) / 3;
|
|
57
|
+
const idx = Math.floor((tp - binMin) / binSize);
|
|
58
|
+
if (idx < 0 || idx >= binCount)
|
|
59
|
+
return;
|
|
60
|
+
buckets[idx] = (buckets[idx] ?? 0) + bar.volume;
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Proportional mode — split the bar's volume across [low, high] by
|
|
64
|
+
// per-bucket overlap with the bar's range.
|
|
65
|
+
//
|
|
66
|
+
// The bar's price extent is [low, high]; the buckets cover the price
|
|
67
|
+
// axis at [binMin + i*binSize, binMin + (i+1)*binSize). We compute the
|
|
68
|
+
// overlap of each touched bucket with [low, high] and weight by it.
|
|
69
|
+
//
|
|
70
|
+
// Degenerate-range bars (high === low, e.g. a doji at exactly one
|
|
71
|
+
// tick) fall back to the typical-price behaviour — putting the volume
|
|
72
|
+
// in the bucket containing `low` is the correct limit as
|
|
73
|
+
// `high - low -> 0`.
|
|
74
|
+
const binMax = binMin + binCount * binSize;
|
|
75
|
+
const barLow = bar.low;
|
|
76
|
+
const barHigh = bar.high;
|
|
77
|
+
// Drop bars fully outside the configured price range — they can't
|
|
78
|
+
// contribute to any bucket.
|
|
79
|
+
if (barHigh < binMin || barLow >= binMax)
|
|
80
|
+
return;
|
|
81
|
+
if (barHigh === barLow) {
|
|
82
|
+
const idx = Math.floor((barLow - binMin) / binSize);
|
|
83
|
+
if (idx < 0 || idx >= binCount)
|
|
84
|
+
return;
|
|
85
|
+
buckets[idx] = (buckets[idx] ?? 0) + bar.volume;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// Clamp the bar's range to the bucket grid so overlap math doesn't
|
|
89
|
+
// include the out-of-range portion.
|
|
90
|
+
const lo = barLow < binMin ? binMin : barLow;
|
|
91
|
+
const hi = barHigh > binMax ? binMax : barHigh;
|
|
92
|
+
const firstIdx = Math.floor((lo - binMin) / binSize);
|
|
93
|
+
// For `hi` we use ceiling-of-(hi - binMin)/binSize, minus 1, so the
|
|
94
|
+
// top boundary `hi === binMin + k*binSize` belongs to bucket k-1
|
|
95
|
+
// (consistent with the half-open bucket convention `[lo, hi)`).
|
|
96
|
+
let lastIdx = Math.ceil((hi - binMin) / binSize) - 1;
|
|
97
|
+
if (lastIdx < firstIdx)
|
|
98
|
+
lastIdx = firstIdx;
|
|
99
|
+
// Effective span used as the denominator. We weight against the
|
|
100
|
+
// *clamped* span (the part actually inside the bucket grid) so a bar
|
|
101
|
+
// that hangs off the bottom doesn't get "phantom" volume into the
|
|
102
|
+
// visible buckets. Trade-off: this means a bar partially outside
|
|
103
|
+
// contributes only its inside-range fraction. This matches the
|
|
104
|
+
// intuition of "what fraction of the bar's range fell into the
|
|
105
|
+
// profile window".
|
|
106
|
+
const span = hi - lo;
|
|
107
|
+
if (span <= 0)
|
|
108
|
+
return;
|
|
109
|
+
const volPerUnit = bar.volume / (barHigh - barLow);
|
|
110
|
+
for (let i = firstIdx; i <= lastIdx; i++) {
|
|
111
|
+
if (i < 0 || i >= binCount)
|
|
112
|
+
continue;
|
|
113
|
+
const bucketLow = binMin + i * binSize;
|
|
114
|
+
const bucketHigh = bucketLow + binSize;
|
|
115
|
+
const overlapLow = lo > bucketLow ? lo : bucketLow;
|
|
116
|
+
const overlapHigh = hi < bucketHigh ? hi : bucketHigh;
|
|
117
|
+
const overlap = overlapHigh - overlapLow;
|
|
118
|
+
if (overlap <= 0)
|
|
119
|
+
continue;
|
|
120
|
+
buckets[i] = (buckets[i] ?? 0) + overlap * volPerUnit;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=binning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binning.js","sourceRoot":"","sources":["../../../src/components/volumeProfile/binning.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,eAAe,CAC3B,GAAqB,EACrB,OAAqB,EACrB,MAAc,EACd,OAAe,EACf,QAAgB,EAChB,IAAiB;IAEjB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,KAAK,CAAC,IAAI,OAAO,IAAI,CAAC;QAAE,OAAM;IAE9D,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,CAAA;QAC/C,IAAI,GAAG,GAAG,CAAC,IAAI,GAAG,IAAI,QAAQ;YAAE,OAAM;QACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAA;QAC/C,OAAM;IACV,CAAC;IAED,mEAAmE;IACnE,2CAA2C;IAC3C,EAAE;IACF,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,OAAO,GAAG,QAAQ,CAAA;IAE1C,gEAAgE;IAChE,qEAAqE;IACrE,kEAAkE;IAClE,iEAAiE;IACjE,+DAA+D;IAC/D,+DAA+D;IAC/D,mBAAmB;IACnB,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,CAAA;IACpB,IAAI,IAAI,IAAI,CAAC;QAAE,OAAM;IAErB,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC,CAAA;IAElD,KAAK,IAAI,CAAC,GAAG,QAAQ,EAAE,CAAC,IAAI,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,QAAQ;YAAE,SAAQ;QACpC,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,GAAG,OAAO,CAAA;QACtC,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;QACtC,MAAM,UAAU,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAClD,MAAM,WAAW,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAA;QACrD,MAAM,OAAO,GAAG,WAAW,GAAG,UAAU,CAAA;QACxC,IAAI,OAAO,IAAI,CAAC;YAAE,SAAQ;QAC1B,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,UAAU,CAAA;IACzD,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Volume Profile controller — framework-agnostic, signal-based.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the dispose-guard pattern from `createIndicatorSelectorController`
|
|
5
|
+
* so React/Vue/Angular adapters bridge identically. The controller is pure
|
|
6
|
+
* data — no DOM, no rendering, no canvas. It plays the same role as
|
|
7
|
+
* `src/core/indicators/volumeProfileState.ts` (the maintainer's legacy state
|
|
8
|
+
* module) but with the new reactive contract; the legacy state file and the
|
|
9
|
+
* legacy renderer at `src/core/renderers/Indicator/volumeProfile.ts` are
|
|
10
|
+
* intentionally NOT touched (per branch policy).
|
|
11
|
+
*
|
|
12
|
+
* Flow on `ingest`:
|
|
13
|
+
* 1. Walk the bars once to learn `[minLow, maxHigh]`.
|
|
14
|
+
* 2. Derive `binMin`/`binSize` from that range + config.binCount.
|
|
15
|
+
* 3. Allocate a fresh `Float64Array(binCount)` (or reuse if size unchanged).
|
|
16
|
+
* 4. For each bar, call `binBarToBuckets` (typical-price or proportional).
|
|
17
|
+
* 5. `findPOCIndex` → `computeValueArea` → assemble `VolumeProfileState`.
|
|
18
|
+
*
|
|
19
|
+
* Non-goals:
|
|
20
|
+
* - Incremental ingest. `ingest` always recomputes from scratch. The
|
|
21
|
+
* incremental path comes with the WebGPU compute shader (see
|
|
22
|
+
* `computeShader.wgsl.md`).
|
|
23
|
+
* - Auto-binning by tick size. The current heuristic (range / binCount) is
|
|
24
|
+
* adequate for visual profiles; tick-snapped binning is a future option.
|
|
25
|
+
*/
|
|
26
|
+
import type { VolumeProfileConfig, VolumeProfileController } from './types';
|
|
27
|
+
export interface VolumeProfileControllerInit {
|
|
28
|
+
config?: Partial<VolumeProfileConfig>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createVolumeProfileController(init?: VolumeProfileControllerInit): VolumeProfileController;
|
|
31
|
+
//# sourceMappingURL=createVolumeProfileController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createVolumeProfileController.d.ts","sourceRoot":"","sources":["../../../src/components/volumeProfile/createVolumeProfileController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,OAAO,KAAK,EAER,mBAAmB,EACnB,uBAAuB,EAE1B,MAAM,SAAS,CAAA;AAahB,MAAM,WAAW,2BAA2B;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAA;CACxC;AAED,wBAAgB,6BAA6B,CACzC,IAAI,CAAC,EAAE,2BAA2B,GACnC,uBAAuB,CA8JzB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Volume Profile controller — framework-agnostic, signal-based.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the dispose-guard pattern from `createIndicatorSelectorController`
|
|
5
|
+
* so React/Vue/Angular adapters bridge identically. The controller is pure
|
|
6
|
+
* data — no DOM, no rendering, no canvas. It plays the same role as
|
|
7
|
+
* `src/core/indicators/volumeProfileState.ts` (the maintainer's legacy state
|
|
8
|
+
* module) but with the new reactive contract; the legacy state file and the
|
|
9
|
+
* legacy renderer at `src/core/renderers/Indicator/volumeProfile.ts` are
|
|
10
|
+
* intentionally NOT touched (per branch policy).
|
|
11
|
+
*
|
|
12
|
+
* Flow on `ingest`:
|
|
13
|
+
* 1. Walk the bars once to learn `[minLow, maxHigh]`.
|
|
14
|
+
* 2. Derive `binMin`/`binSize` from that range + config.binCount.
|
|
15
|
+
* 3. Allocate a fresh `Float64Array(binCount)` (or reuse if size unchanged).
|
|
16
|
+
* 4. For each bar, call `binBarToBuckets` (typical-price or proportional).
|
|
17
|
+
* 5. `findPOCIndex` → `computeValueArea` → assemble `VolumeProfileState`.
|
|
18
|
+
*
|
|
19
|
+
* Non-goals:
|
|
20
|
+
* - Incremental ingest. `ingest` always recomputes from scratch. The
|
|
21
|
+
* incremental path comes with the WebGPU compute shader (see
|
|
22
|
+
* `computeShader.wgsl.md`).
|
|
23
|
+
* - Auto-binning by tick size. The current heuristic (range / binCount) is
|
|
24
|
+
* adequate for visual profiles; tick-snapped binning is a future option.
|
|
25
|
+
*/
|
|
26
|
+
import { createSignal } from '../../reactivity';
|
|
27
|
+
import { binBarToBuckets } from './binning';
|
|
28
|
+
import { findPOCIndex } from './poc';
|
|
29
|
+
import { computeValueArea } from './valueArea';
|
|
30
|
+
const DEFAULT_CONFIG = {
|
|
31
|
+
binCount: 100,
|
|
32
|
+
binningMode: 'typical-price',
|
|
33
|
+
valueAreaPercent: 0.7,
|
|
34
|
+
};
|
|
35
|
+
// Smallest binSize we will use. Prevents a degenerate "all bars same price"
|
|
36
|
+
// input from producing a division-by-zero. The value is arbitrary but small
|
|
37
|
+
// enough that real markets never hit it.
|
|
38
|
+
const MIN_BIN_SIZE = 1e-12;
|
|
39
|
+
export function createVolumeProfileController(init) {
|
|
40
|
+
// -------------------------------------------------------------------
|
|
41
|
+
// Signals
|
|
42
|
+
// -------------------------------------------------------------------
|
|
43
|
+
const initialConfig = {
|
|
44
|
+
...DEFAULT_CONFIG,
|
|
45
|
+
...(init?.config ?? {}),
|
|
46
|
+
};
|
|
47
|
+
// Defensive clamp: percent in [0, 1], binCount >= 1.
|
|
48
|
+
if (initialConfig.valueAreaPercent < 0)
|
|
49
|
+
initialConfig.valueAreaPercent = 0;
|
|
50
|
+
if (initialConfig.valueAreaPercent > 1)
|
|
51
|
+
initialConfig.valueAreaPercent = 1;
|
|
52
|
+
if (initialConfig.binCount < 1)
|
|
53
|
+
initialConfig.binCount = 1;
|
|
54
|
+
const config = createSignal(initialConfig);
|
|
55
|
+
const state = createSignal(null);
|
|
56
|
+
// -------------------------------------------------------------------
|
|
57
|
+
// ingest — full recompute
|
|
58
|
+
// -------------------------------------------------------------------
|
|
59
|
+
function ingest(bars) {
|
|
60
|
+
const cfg = config.peek();
|
|
61
|
+
if (bars.length === 0) {
|
|
62
|
+
state.set(null);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
// First pass: range of the data.
|
|
66
|
+
let minLow = Infinity;
|
|
67
|
+
let maxHigh = -Infinity;
|
|
68
|
+
for (let i = 0; i < bars.length; i++) {
|
|
69
|
+
const b = bars[i];
|
|
70
|
+
if (b === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
if (b.low < minLow)
|
|
73
|
+
minLow = b.low;
|
|
74
|
+
if (b.high > maxHigh)
|
|
75
|
+
maxHigh = b.high;
|
|
76
|
+
}
|
|
77
|
+
if (!Number.isFinite(minLow) || !Number.isFinite(maxHigh)) {
|
|
78
|
+
state.set(null);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const range = maxHigh - minLow;
|
|
82
|
+
// Degenerate range: every bar at the same price. We still want a
|
|
83
|
+
// non-zero binSize so the math works; centre a tiny window on the
|
|
84
|
+
// price so the single bucket captures everything.
|
|
85
|
+
const binSize = range > MIN_BIN_SIZE ? range / cfg.binCount : MIN_BIN_SIZE;
|
|
86
|
+
const binMin = minLow;
|
|
87
|
+
// Allocate or reuse the buckets. Reuse only if the size matches —
|
|
88
|
+
// changing `binCount` via `setConfig` requires a fresh array.
|
|
89
|
+
const prev = state.peek();
|
|
90
|
+
const buckets = prev !== null && prev.buckets.length === cfg.binCount
|
|
91
|
+
? prev.buckets
|
|
92
|
+
: new Float64Array(cfg.binCount);
|
|
93
|
+
// Zero it (whether reused or freshly allocated) — `fill(0)` is cheap
|
|
94
|
+
// on typed arrays.
|
|
95
|
+
buckets.fill(0);
|
|
96
|
+
// Second pass: drop volume into buckets.
|
|
97
|
+
for (let i = 0; i < bars.length; i++) {
|
|
98
|
+
const b = bars[i];
|
|
99
|
+
if (b === undefined)
|
|
100
|
+
continue;
|
|
101
|
+
binBarToBuckets(b, buckets, binMin, binSize, cfg.binCount, cfg.binningMode);
|
|
102
|
+
}
|
|
103
|
+
// POC + VA.
|
|
104
|
+
const pocIdx = findPOCIndex(buckets);
|
|
105
|
+
// findPOCIndex returns -1 only on empty arrays — guarded above.
|
|
106
|
+
const va = computeValueArea(buckets, pocIdx < 0 ? 0 : pocIdx, cfg.valueAreaPercent);
|
|
107
|
+
// Prices: each bucket spans `[binMin + i*binSize, binMin + (i+1)*binSize)`.
|
|
108
|
+
// We report POC as the bucket *center*, VAH as the upper bucket's high
|
|
109
|
+
// edge, VAL as the lower bucket's low edge — this matches how a
|
|
110
|
+
// renderer wants to draw them: POC as a centerline, VAH/VAL as
|
|
111
|
+
// envelope edges.
|
|
112
|
+
const pocPrice = binMin + (va.pocIndex + 0.5) * binSize;
|
|
113
|
+
const vahPrice = binMin + (va.vahIndex + 1) * binSize;
|
|
114
|
+
const valPrice = binMin + va.valIndex * binSize;
|
|
115
|
+
const next = {
|
|
116
|
+
buckets,
|
|
117
|
+
binMin,
|
|
118
|
+
binSize,
|
|
119
|
+
poc: pocPrice,
|
|
120
|
+
vah: vahPrice,
|
|
121
|
+
val: valPrice,
|
|
122
|
+
totalVolume: va.totalVolume,
|
|
123
|
+
vaVolume: va.vaVolume,
|
|
124
|
+
};
|
|
125
|
+
state.set(next);
|
|
126
|
+
}
|
|
127
|
+
// -------------------------------------------------------------------
|
|
128
|
+
// setConfig — patch + invalidate
|
|
129
|
+
// -------------------------------------------------------------------
|
|
130
|
+
function setConfig(next) {
|
|
131
|
+
const cur = config.peek();
|
|
132
|
+
const merged = { ...cur, ...next };
|
|
133
|
+
// Re-apply the defensive clamps.
|
|
134
|
+
if (merged.valueAreaPercent < 0)
|
|
135
|
+
merged.valueAreaPercent = 0;
|
|
136
|
+
if (merged.valueAreaPercent > 1)
|
|
137
|
+
merged.valueAreaPercent = 1;
|
|
138
|
+
if (merged.binCount < 1)
|
|
139
|
+
merged.binCount = 1;
|
|
140
|
+
// If binCount changed, the existing buckets are stale (different
|
|
141
|
+
// resolution) — clear state so callers know to re-ingest. Other
|
|
142
|
+
// field changes leave the data untouched until next ingest.
|
|
143
|
+
if (merged.binCount !== cur.binCount) {
|
|
144
|
+
state.set(null);
|
|
145
|
+
}
|
|
146
|
+
config.set(merged);
|
|
147
|
+
}
|
|
148
|
+
// -------------------------------------------------------------------
|
|
149
|
+
// reset — clear state, keep config
|
|
150
|
+
// -------------------------------------------------------------------
|
|
151
|
+
function reset() {
|
|
152
|
+
state.set(null);
|
|
153
|
+
}
|
|
154
|
+
// -------------------------------------------------------------------
|
|
155
|
+
// dispose — silence mutators (same pattern as IndicatorSelectorController)
|
|
156
|
+
// -------------------------------------------------------------------
|
|
157
|
+
let disposed = false;
|
|
158
|
+
function dispose() {
|
|
159
|
+
if (disposed)
|
|
160
|
+
return;
|
|
161
|
+
disposed = true;
|
|
162
|
+
}
|
|
163
|
+
function guard(fn) {
|
|
164
|
+
return ((...args) => {
|
|
165
|
+
if (disposed)
|
|
166
|
+
return undefined;
|
|
167
|
+
return fn(...args);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
config,
|
|
172
|
+
state,
|
|
173
|
+
ingest: guard(ingest),
|
|
174
|
+
setConfig: guard(setConfig),
|
|
175
|
+
reset: guard(reset),
|
|
176
|
+
dispose,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=createVolumeProfileController.js.map
|