@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":"index.d.ts","sourceRoot":"","sources":["../../../src/components/footprint/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACR,aAAa,EACb,KAAK,EACL,aAAa,EACb,YAAY,EACZ,eAAe,EACf,mBAAmB,GACtB,MAAM,SAAS,CAAA;AAChB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChF,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,GAC5B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { classifyExplicit, classifyTickRule, classifyLeeReady, } from './aggressor';
|
|
2
|
+
export { computeDelta, computeCumulativeDelta, computeDiagonalImbalances, } from './perBarStats';
|
|
3
|
+
export { createFootprintController } from './createFootprintController';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/footprint/index.ts"],"names":[],"mappings":"AASA,OAAO,EACH,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,yBAAyB,GAC5B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-bar derived statistics for the footprint data model.
|
|
3
|
+
*
|
|
4
|
+
* - `computeDelta` — Σ(askVol − bidVol) across a bar's cells
|
|
5
|
+
* - `computeCumulativeDelta` — running sum of per-bar deltas
|
|
6
|
+
* - `computeDiagonalImbalances` — Bookmap/Sierra-style 3× diagonal flags
|
|
7
|
+
*
|
|
8
|
+
* These are the lightweight CPU-side helpers. The compute-shader path
|
|
9
|
+
* (`computeShader.wgsl.md`) parallelises them per-bar in a single dispatch
|
|
10
|
+
* for the heavy historical scan; the values produced here are byte-identical
|
|
11
|
+
* to that GPU path's eventual output.
|
|
12
|
+
*
|
|
13
|
+
* See `docs/ROADMAP.md` §3.3 for the diagonal-imbalance rationale.
|
|
14
|
+
*/
|
|
15
|
+
import type { FootprintBarCell, FootprintImbalance } from './types';
|
|
16
|
+
export type { FootprintBarCell, FootprintImbalance };
|
|
17
|
+
/**
|
|
18
|
+
* Net buy-vs-sell volume for one bar. Positive values are buyer-dominated.
|
|
19
|
+
*
|
|
20
|
+
* Iterates the cells once; the order of cells does not affect the result.
|
|
21
|
+
* An empty cell list yields 0 (the additive identity, sensible for a no-trade
|
|
22
|
+
* bar so it does not break the running cumulative sum downstream).
|
|
23
|
+
*/
|
|
24
|
+
export declare function computeDelta(cells: ReadonlyArray<FootprintBarCell>): number;
|
|
25
|
+
/**
|
|
26
|
+
* Running sum of per-bar deltas. `result[i] = Σ deltas[0..i]`.
|
|
27
|
+
*
|
|
28
|
+
* Empty input yields an empty array. We allocate a fresh array (not a typed
|
|
29
|
+
* array) so consumers can splice/copy cheaply at the controller boundary.
|
|
30
|
+
*/
|
|
31
|
+
export declare function computeCumulativeDelta(perBarDeltas: ReadonlyArray<number>): number[];
|
|
32
|
+
/**
|
|
33
|
+
* Diagonal imbalance detection.
|
|
34
|
+
*
|
|
35
|
+
* Aggressive buyers eat the ASK at a price they cross — the ASK at price
|
|
36
|
+
* p is filled by buyers who were willing to pay p, and conversely, sellers
|
|
37
|
+
* who hit the BID at price p-1 (one tick below) were also "leaning"
|
|
38
|
+
* against that same level. So the right comparison is *diagonal*:
|
|
39
|
+
*
|
|
40
|
+
* buy-imbalance at cell i:
|
|
41
|
+
* cell[i].askVol >= ratio * cell[i-1].bidVol AND cell[i-1].bidVol > 0
|
|
42
|
+
*
|
|
43
|
+
* sell-imbalance at cell i:
|
|
44
|
+
* cell[i].bidVol >= ratio * cell[i+1].askVol AND cell[i+1].askVol > 0
|
|
45
|
+
*
|
|
46
|
+
* Edge handling: a buy-imbalance at i=0 has no `i-1` so it is never reported;
|
|
47
|
+
* a sell-imbalance at the last index has no `i+1` so it is never reported.
|
|
48
|
+
*
|
|
49
|
+
* The `priceIndex` in the result is the index of the *dominant* cell — the
|
|
50
|
+
* one carrying the heavy volume — not its diagonal counterpart.
|
|
51
|
+
*
|
|
52
|
+
* `ratio` is `dominant / weaker`, capped at `Number.POSITIVE_INFINITY` when
|
|
53
|
+
* the weaker side is zero (caller can choose to render that as "∞").
|
|
54
|
+
*
|
|
55
|
+
* Default threshold: 3.0 (Bookmap / Sierra Chart convention). Pass any
|
|
56
|
+
* positive ratio. A ratio of 1.0 would degenerate to "every diagonal pair
|
|
57
|
+
* with non-zero asymmetry is an imbalance" — usually too noisy for display.
|
|
58
|
+
*
|
|
59
|
+
* @param cells bar cells, ascending by price
|
|
60
|
+
* @param ratioThreshold minimum dominant/weaker ratio to flag
|
|
61
|
+
*/
|
|
62
|
+
export declare function computeDiagonalImbalances(cells: ReadonlyArray<FootprintBarCell>, ratioThreshold: number): ReadonlyArray<FootprintImbalance>;
|
|
63
|
+
//# sourceMappingURL=perBarStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perBarStats.d.ts","sourceRoot":"","sources":["../../../src/components/footprint/perBarStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEnE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAA;AAMpD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAQ3E;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,GACpC,MAAM,EAAE,CAQV;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,EACtC,cAAc,EAAE,MAAM,GACvB,aAAa,CAAC,kBAAkB,CAAC,CAyCnC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-bar derived statistics for the footprint data model.
|
|
3
|
+
*
|
|
4
|
+
* - `computeDelta` — Σ(askVol − bidVol) across a bar's cells
|
|
5
|
+
* - `computeCumulativeDelta` — running sum of per-bar deltas
|
|
6
|
+
* - `computeDiagonalImbalances` — Bookmap/Sierra-style 3× diagonal flags
|
|
7
|
+
*
|
|
8
|
+
* These are the lightweight CPU-side helpers. The compute-shader path
|
|
9
|
+
* (`computeShader.wgsl.md`) parallelises them per-bar in a single dispatch
|
|
10
|
+
* for the heavy historical scan; the values produced here are byte-identical
|
|
11
|
+
* to that GPU path's eventual output.
|
|
12
|
+
*
|
|
13
|
+
* See `docs/ROADMAP.md` §3.3 for the diagonal-imbalance rationale.
|
|
14
|
+
*/
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Delta and cumulative delta
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
/**
|
|
19
|
+
* Net buy-vs-sell volume for one bar. Positive values are buyer-dominated.
|
|
20
|
+
*
|
|
21
|
+
* Iterates the cells once; the order of cells does not affect the result.
|
|
22
|
+
* An empty cell list yields 0 (the additive identity, sensible for a no-trade
|
|
23
|
+
* bar so it does not break the running cumulative sum downstream).
|
|
24
|
+
*/
|
|
25
|
+
export function computeDelta(cells) {
|
|
26
|
+
let sum = 0;
|
|
27
|
+
for (let i = 0; i < cells.length; i++) {
|
|
28
|
+
const c = cells[i];
|
|
29
|
+
if (c === undefined)
|
|
30
|
+
continue;
|
|
31
|
+
sum += c.askVol - c.bidVol;
|
|
32
|
+
}
|
|
33
|
+
return sum;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Running sum of per-bar deltas. `result[i] = Σ deltas[0..i]`.
|
|
37
|
+
*
|
|
38
|
+
* Empty input yields an empty array. We allocate a fresh array (not a typed
|
|
39
|
+
* array) so consumers can splice/copy cheaply at the controller boundary.
|
|
40
|
+
*/
|
|
41
|
+
export function computeCumulativeDelta(perBarDeltas) {
|
|
42
|
+
const out = new Array(perBarDeltas.length);
|
|
43
|
+
let running = 0;
|
|
44
|
+
for (let i = 0; i < perBarDeltas.length; i++) {
|
|
45
|
+
running += perBarDeltas[i] ?? 0;
|
|
46
|
+
out[i] = running;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Diagonal imbalance
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
/**
|
|
54
|
+
* Diagonal imbalance detection.
|
|
55
|
+
*
|
|
56
|
+
* Aggressive buyers eat the ASK at a price they cross — the ASK at price
|
|
57
|
+
* p is filled by buyers who were willing to pay p, and conversely, sellers
|
|
58
|
+
* who hit the BID at price p-1 (one tick below) were also "leaning"
|
|
59
|
+
* against that same level. So the right comparison is *diagonal*:
|
|
60
|
+
*
|
|
61
|
+
* buy-imbalance at cell i:
|
|
62
|
+
* cell[i].askVol >= ratio * cell[i-1].bidVol AND cell[i-1].bidVol > 0
|
|
63
|
+
*
|
|
64
|
+
* sell-imbalance at cell i:
|
|
65
|
+
* cell[i].bidVol >= ratio * cell[i+1].askVol AND cell[i+1].askVol > 0
|
|
66
|
+
*
|
|
67
|
+
* Edge handling: a buy-imbalance at i=0 has no `i-1` so it is never reported;
|
|
68
|
+
* a sell-imbalance at the last index has no `i+1` so it is never reported.
|
|
69
|
+
*
|
|
70
|
+
* The `priceIndex` in the result is the index of the *dominant* cell — the
|
|
71
|
+
* one carrying the heavy volume — not its diagonal counterpart.
|
|
72
|
+
*
|
|
73
|
+
* `ratio` is `dominant / weaker`, capped at `Number.POSITIVE_INFINITY` when
|
|
74
|
+
* the weaker side is zero (caller can choose to render that as "∞").
|
|
75
|
+
*
|
|
76
|
+
* Default threshold: 3.0 (Bookmap / Sierra Chart convention). Pass any
|
|
77
|
+
* positive ratio. A ratio of 1.0 would degenerate to "every diagonal pair
|
|
78
|
+
* with non-zero asymmetry is an imbalance" — usually too noisy for display.
|
|
79
|
+
*
|
|
80
|
+
* @param cells bar cells, ascending by price
|
|
81
|
+
* @param ratioThreshold minimum dominant/weaker ratio to flag
|
|
82
|
+
*/
|
|
83
|
+
export function computeDiagonalImbalances(cells, ratioThreshold) {
|
|
84
|
+
const out = [];
|
|
85
|
+
const n = cells.length;
|
|
86
|
+
if (n === 0)
|
|
87
|
+
return out;
|
|
88
|
+
for (let i = 0; i < n; i++) {
|
|
89
|
+
const c = cells[i];
|
|
90
|
+
if (c === undefined)
|
|
91
|
+
continue;
|
|
92
|
+
// Buy imbalance: compare ask at i to bid at i-1 (the diagonal below).
|
|
93
|
+
if (i > 0) {
|
|
94
|
+
const below = cells[i - 1];
|
|
95
|
+
if (below !== undefined && below.bidVol > 0) {
|
|
96
|
+
const ratio = c.askVol / below.bidVol;
|
|
97
|
+
if (ratio >= ratioThreshold) {
|
|
98
|
+
out.push({
|
|
99
|
+
priceIndex: i,
|
|
100
|
+
direction: 'buy-imbalance',
|
|
101
|
+
ratio,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Sell imbalance: compare bid at i to ask at i+1 (the diagonal above).
|
|
107
|
+
if (i < n - 1) {
|
|
108
|
+
const above = cells[i + 1];
|
|
109
|
+
if (above !== undefined && above.askVol > 0) {
|
|
110
|
+
const ratio = c.bidVol / above.askVol;
|
|
111
|
+
if (ratio >= ratioThreshold) {
|
|
112
|
+
out.push({
|
|
113
|
+
priceIndex: i,
|
|
114
|
+
direction: 'sell-imbalance',
|
|
115
|
+
ratio,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return out;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=perBarStats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perBarStats.js","sourceRoot":"","sources":["../../../src/components/footprint/perBarStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,8EAA8E;AAC9E,6BAA6B;AAC7B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,KAAsC;IAC/D,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,IAAI,CAAC,KAAK,SAAS;YAAE,SAAQ;QAC7B,GAAG,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAA;IAC9B,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAClC,YAAmC;IAEnC,MAAM,GAAG,GAAa,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;IACpD,IAAI,OAAO,GAAG,CAAC,CAAA;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,OAAO,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;IACpB,CAAC;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAED,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,yBAAyB,CACrC,KAAsC,EACtC,cAAsB;IAEtB,MAAM,GAAG,GAAyB,EAAE,CAAA;IACpC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAA;IACtB,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IAEvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,IAAI,CAAC,KAAK,SAAS;YAAE,SAAQ;QAE7B,sEAAsE;QACtE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACR,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;gBACrC,IAAI,KAAK,IAAI,cAAc,EAAE,CAAC;oBAC1B,GAAG,CAAC,IAAI,CAAC;wBACL,UAAU,EAAE,CAAC;wBACb,SAAS,EAAE,eAAe;wBAC1B,KAAK;qBACR,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC;QAED,uEAAuE;QACvE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;YAC1B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;gBACrC,IAAI,KAAK,IAAI,cAAc,EAAE,CAAC;oBAC1B,GAAG,CAAC,IAAI,CAAC;wBACL,UAAU,EAAE,CAAC;wBACb,SAAS,EAAE,gBAAgB;wBAC3B,KAAK;qBACR,CAAC,CAAA;gBACN,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footprint Chart — public type contract.
|
|
3
|
+
*
|
|
4
|
+
* A Footprint chart expands each candle internally to show, at every price
|
|
5
|
+
* level, how much aggressive buying (lifting the ASK) and aggressive selling
|
|
6
|
+
* (hitting the BID) traded. It is the core tool of "order flow" reading:
|
|
7
|
+
* traders use it to answer "did this bar rise because there were real buyers,
|
|
8
|
+
* or only because sellers withdrew?".
|
|
9
|
+
*
|
|
10
|
+
* This module owns the **data model + classification math only**. Rendering
|
|
11
|
+
* belongs to the `@klinechart-quant/core` Renderer/Scene layer; the planned
|
|
12
|
+
* GPU compute path is sketched in `computeShader.wgsl.md`.
|
|
13
|
+
*
|
|
14
|
+
* See `docs/ROADMAP.md` §3.3 (Footprint) for the algorithm rationale and §0
|
|
15
|
+
* for how this controller fits the seven-module core layering.
|
|
16
|
+
*
|
|
17
|
+
* Cross-references:
|
|
18
|
+
* - `aggressor.ts` — buy/sell classification (explicit, tick rule, Lee-Ready)
|
|
19
|
+
* - `perBarStats.ts` — delta, cumulative delta, diagonal imbalance
|
|
20
|
+
* - `createFootprintController.ts` — streaming controller (Signal<bars>)
|
|
21
|
+
*/
|
|
22
|
+
import type { Signal } from '../../reactivity';
|
|
23
|
+
/**
|
|
24
|
+
* Which side of the resting book a trade hit.
|
|
25
|
+
*
|
|
26
|
+
* - 'buy' — aggressor lifted the ASK (resting seller was passive)
|
|
27
|
+
* - 'sell' — aggressor hit the BID (resting buyer was passive)
|
|
28
|
+
*
|
|
29
|
+
* Note: this is the **aggressor**'s side, NOT the "buyer"'s side. Binance's
|
|
30
|
+
* `isBuyerMaker=true` means the buyer was the maker (passive) and so the
|
|
31
|
+
* aggressor is the seller — see `classifyExplicit` in `aggressor.ts`.
|
|
32
|
+
*/
|
|
33
|
+
export type AggressorSide = 'buy' | 'sell';
|
|
34
|
+
/**
|
|
35
|
+
* A classification's confidence flag.
|
|
36
|
+
*
|
|
37
|
+
* - `inferred: false` — derived from an explicit exchange flag (zero error)
|
|
38
|
+
* - `inferred: true` — derived from a heuristic (tick rule or Lee-Ready);
|
|
39
|
+
* the consumer should mark this as approximate so it
|
|
40
|
+
* can be visually distinguished and excluded from
|
|
41
|
+
* strict order-flow analytics
|
|
42
|
+
*
|
|
43
|
+
* Every classifier in `aggressor.ts` must set this honestly. We rely on it
|
|
44
|
+
* downstream when surfacing "(estimated)" warnings on bars whose flow was
|
|
45
|
+
* inferred — this is the explicit boundary mandated by ROADMAP §3.3.
|
|
46
|
+
*/
|
|
47
|
+
export interface AggressorWithConfidence {
|
|
48
|
+
side: AggressorSide;
|
|
49
|
+
inferred: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A single trade print. The minimum shape needed for footprint aggregation.
|
|
53
|
+
*
|
|
54
|
+
* `timestamp` is epoch ms (chosen because `Math.floor(ts / barIntervalMs)`
|
|
55
|
+
* cleanly produces a bar index). `size` is in base units (BTC, AAPL shares,
|
|
56
|
+
* not USD value).
|
|
57
|
+
*/
|
|
58
|
+
export interface Trade {
|
|
59
|
+
timestamp: number;
|
|
60
|
+
price: number;
|
|
61
|
+
size: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A trade carrying the exchange's aggressor flag. Binance-style:
|
|
65
|
+
* `isBuyerMaker=true` ⇒ the buyer was the passive maker, so the SELLER was
|
|
66
|
+
* the aggressor. Optional — if the exchange does not include it the
|
|
67
|
+
* controller falls back to the configured heuristic classifier.
|
|
68
|
+
*/
|
|
69
|
+
export interface TradeWithFlag extends Trade {
|
|
70
|
+
isBuyerMaker?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* One price level inside a footprint bar.
|
|
74
|
+
*
|
|
75
|
+
* Cells are sorted by `price` ascending. `askVol` and `bidVol` are gross
|
|
76
|
+
* (not net) — the delta is computed separately.
|
|
77
|
+
*/
|
|
78
|
+
export interface FootprintBarCell {
|
|
79
|
+
/** representative price of the bin (quantised to tickSize). */
|
|
80
|
+
price: number;
|
|
81
|
+
/** volume of trades classified as `buy` (aggressor lifted the ASK). */
|
|
82
|
+
askVol: number;
|
|
83
|
+
/** volume of trades classified as `sell` (aggressor hit the BID). */
|
|
84
|
+
bidVol: number;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Direction of a diagonal imbalance — see `perBarStats.ts` for the math.
|
|
88
|
+
*/
|
|
89
|
+
export type ImbalanceDirection = 'buy-imbalance' | 'sell-imbalance';
|
|
90
|
+
/**
|
|
91
|
+
* One imbalance flag inside a bar.
|
|
92
|
+
*
|
|
93
|
+
* `priceIndex` is the index into `FootprintBar.cells` of the dominant side
|
|
94
|
+
* (not the cell it was compared against). `ratio` is `dominant / weaker`
|
|
95
|
+
* (always ≥ the configured threshold; capped at `Number.POSITIVE_INFINITY`
|
|
96
|
+
* when the weaker side is zero — see `computeDiagonalImbalances`).
|
|
97
|
+
*/
|
|
98
|
+
export interface FootprintImbalance {
|
|
99
|
+
priceIndex: number;
|
|
100
|
+
direction: ImbalanceDirection;
|
|
101
|
+
ratio: number;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The materialised view of one bar (the unit a renderer consumes).
|
|
105
|
+
*
|
|
106
|
+
* All fields are derived from the controller's internal streaming aggregate;
|
|
107
|
+
* `cells` and `imbalances` are recomputed lazily on `bars` signal read.
|
|
108
|
+
*/
|
|
109
|
+
export interface FootprintBar {
|
|
110
|
+
/** stable index = `Math.floor(timestamp / barIntervalMs)`. */
|
|
111
|
+
barIndex: number;
|
|
112
|
+
/** inclusive start of the bar window (epoch ms). */
|
|
113
|
+
startTime: number;
|
|
114
|
+
/** exclusive end of the bar window (epoch ms). */
|
|
115
|
+
endTime: number;
|
|
116
|
+
/** per-price-level cells, ascending by `price`. */
|
|
117
|
+
cells: ReadonlyArray<FootprintBarCell>;
|
|
118
|
+
/** Σ(askVol − bidVol) across cells. Positive ⇒ buyers led. */
|
|
119
|
+
delta: number;
|
|
120
|
+
/** Σ(askVol + bidVol). */
|
|
121
|
+
totalVolume: number;
|
|
122
|
+
/** diagonal imbalance flags; usually 0–5 per bar. */
|
|
123
|
+
imbalances: ReadonlyArray<FootprintImbalance>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Controller config. All fields required at the controller surface — the
|
|
127
|
+
* factory fills missing fields with sensible defaults so callers can pass
|
|
128
|
+
* a partial.
|
|
129
|
+
*/
|
|
130
|
+
export interface FootprintConfig {
|
|
131
|
+
/** quantise trade prices to this tick size (e.g. 0.01 for BTCUSDT). */
|
|
132
|
+
tickSize: number;
|
|
133
|
+
/** ms per bar (e.g. 60_000 for 1m). */
|
|
134
|
+
barIntervalMs: number;
|
|
135
|
+
/**
|
|
136
|
+
* Diagonal imbalance threshold. Default 3 — i.e. a cell must have at
|
|
137
|
+
* least 3× the volume of its diagonal counterpart to flag.
|
|
138
|
+
*/
|
|
139
|
+
imbalanceRatio: number;
|
|
140
|
+
/**
|
|
141
|
+
* Classifier to fall back to when a trade has no explicit
|
|
142
|
+
* `isBuyerMaker` flag.
|
|
143
|
+
*
|
|
144
|
+
* - 'tick-rule' — price-change rule; default. Doesn't need bid/ask.
|
|
145
|
+
* - 'lee-ready' — uses bid/ask; controller's `ingestTrade` must
|
|
146
|
+
* receive `bid` and `ask` for this path.
|
|
147
|
+
*/
|
|
148
|
+
fallbackClassifier: 'tick-rule' | 'lee-ready';
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Framework-agnostic controller — mirrors `IndicatorSelectorController`'s
|
|
152
|
+
* shape (signals for state, plain functions for mutations, idempotent
|
|
153
|
+
* `dispose`).
|
|
154
|
+
*/
|
|
155
|
+
export interface FootprintController {
|
|
156
|
+
/** Current config; re-emits when `setConfig` is called. */
|
|
157
|
+
readonly config: Signal<FootprintConfig>;
|
|
158
|
+
/** Materialised bars, ascending by `barIndex`. Empty before first trade. */
|
|
159
|
+
readonly bars: Signal<ReadonlyArray<FootprintBar>>;
|
|
160
|
+
/**
|
|
161
|
+
* Cumulative delta series, parallel to `bars`. `cumulativeDelta[i]`
|
|
162
|
+
* corresponds to `bars[i]`.
|
|
163
|
+
*/
|
|
164
|
+
readonly cumulativeDelta: Signal<ReadonlyArray<number>>;
|
|
165
|
+
/**
|
|
166
|
+
* Ingest one trade — canonical method, aligned with the cross-controller
|
|
167
|
+
* `ingest()` convention (VolumeProfile, OrderBookHeatmap). `bid`/`ask` are
|
|
168
|
+
* optional and only consulted when the trade lacks an explicit
|
|
169
|
+
* `isBuyerMaker` flag AND the configured fallback is `lee-ready`.
|
|
170
|
+
*
|
|
171
|
+
* Closes API-audit BLOCKER-001 (5-verb intake proliferation) by
|
|
172
|
+
* harmonising on `ingest` as the stream-accumulator verb across
|
|
173
|
+
* `VolumeProfile`, `OrderBookHeatmap`, and `Footprint`.
|
|
174
|
+
*/
|
|
175
|
+
ingest(trade: TradeWithFlag, bid?: number, ask?: number): void;
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated since 0.1.0-alpha.1 — use {@link FootprintController.ingest}.
|
|
178
|
+
* Kept as a non-removing alias for at least 6 months for migration. Will
|
|
179
|
+
* be removed in 0.2.0.
|
|
180
|
+
*/
|
|
181
|
+
ingestTrade(trade: TradeWithFlag, bid?: number, ask?: number): void;
|
|
182
|
+
/**
|
|
183
|
+
* Patch the config. Changing `barIntervalMs` or `tickSize` invalidates
|
|
184
|
+
* the buckets so the state is cleared. Changing only `imbalanceRatio`
|
|
185
|
+
* just re-materialises on the next read.
|
|
186
|
+
*/
|
|
187
|
+
setConfig(next: Partial<FootprintConfig>): void;
|
|
188
|
+
/** Clear all bars and cumulative delta. Does not change config. */
|
|
189
|
+
reset(): void;
|
|
190
|
+
/**
|
|
191
|
+
* Stop emitting. Subsequent calls to ingest/setConfig/reset are silent
|
|
192
|
+
* no-ops; previously-attached subscribers receive no further
|
|
193
|
+
* notifications. Idempotent.
|
|
194
|
+
*/
|
|
195
|
+
dispose(): void;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/footprint/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAM9C;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAA;AAE1C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,uBAAuB;IACpC,IAAI,EAAE,aAAa,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CACpB;AAMD;;;;;;GAMG;AACH,MAAM,WAAW,KAAK;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,KAAK;IACxC,YAAY,CAAC,EAAE,OAAO,CAAA;CACzB;AAMD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAA;IACb,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAA;IACd,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,gBAAgB,CAAA;AAEnE;;;;;;;GAOG;AACH,MAAM,WAAW,kBAAkB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,kBAAkB,CAAA;IAC7B,KAAK,EAAE,MAAM,CAAA;CAChB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IACzB,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAA;IAChB,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAA;IACjB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAA;IACf,mDAAmD;IACnD,KAAK,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;IACtC,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,qDAAqD;IACrD,UAAU,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAA;CAChD;AAMD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B,uEAAuE;IACvE,QAAQ,EAAE,MAAM,CAAA;IAChB,uCAAuC;IACvC,aAAa,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;;;OAOG;IACH,kBAAkB,EAAE,WAAW,GAAG,WAAW,CAAA;CAChD;AAMD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,2DAA2D;IAC3D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,CAAC,CAAA;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAA;IAClD;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;IAEvD;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE9D;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEnE;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;IAE/C,mEAAmE;IACnE,KAAK,IAAI,IAAI,CAAA;IAEb;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAA;CAClB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Footprint Chart — public type contract.
|
|
3
|
+
*
|
|
4
|
+
* A Footprint chart expands each candle internally to show, at every price
|
|
5
|
+
* level, how much aggressive buying (lifting the ASK) and aggressive selling
|
|
6
|
+
* (hitting the BID) traded. It is the core tool of "order flow" reading:
|
|
7
|
+
* traders use it to answer "did this bar rise because there were real buyers,
|
|
8
|
+
* or only because sellers withdrew?".
|
|
9
|
+
*
|
|
10
|
+
* This module owns the **data model + classification math only**. Rendering
|
|
11
|
+
* belongs to the `@klinechart-quant/core` Renderer/Scene layer; the planned
|
|
12
|
+
* GPU compute path is sketched in `computeShader.wgsl.md`.
|
|
13
|
+
*
|
|
14
|
+
* See `docs/ROADMAP.md` §3.3 (Footprint) for the algorithm rationale and §0
|
|
15
|
+
* for how this controller fits the seven-module core layering.
|
|
16
|
+
*
|
|
17
|
+
* Cross-references:
|
|
18
|
+
* - `aggressor.ts` — buy/sell classification (explicit, tick rule, Lee-Ready)
|
|
19
|
+
* - `perBarStats.ts` — delta, cumulative delta, diagonal imbalance
|
|
20
|
+
* - `createFootprintController.ts` — streaming controller (Signal<bars>)
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/footprint/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forward-fill a higher-timeframe series onto the base bar index, with strict
|
|
3
|
+
* no-lookahead semantics.
|
|
4
|
+
*
|
|
5
|
+
* The rule, restated:
|
|
6
|
+
* A higher-tf bar opens at `hbar.timestamp` and covers the half-open
|
|
7
|
+
* interval `[hbar.timestamp, hbar.timestamp + targetIntervalMs)`. The
|
|
8
|
+
* higher-tf value at that bar is available to every base bar whose
|
|
9
|
+
* timestamp falls inside that interval — and only those base bars.
|
|
10
|
+
*
|
|
11
|
+
* Forward fill is implicit: because higher-tf bars are contiguous in time
|
|
12
|
+
* (within the input series), a base bar at time `t` reads the value of the
|
|
13
|
+
* higher-tf bar whose half-open interval contains `t`. If no such bar exists
|
|
14
|
+
* (i.e. `t` is before the first higher-tf bar's open), the output is `null`.
|
|
15
|
+
*
|
|
16
|
+
* Gap handling: if the higher-tf series has a hole (bar N+1's open is more
|
|
17
|
+
* than `targetIntervalMs` after bar N's open), base bars in that hole get the
|
|
18
|
+
* value of bar N. This matches the forward-fill intuition users have — once
|
|
19
|
+
* a higher-tf value exists, it stays visible until the next bucket opens.
|
|
20
|
+
*
|
|
21
|
+
* Lookahead-bias test (spelled out so it survives regressions):
|
|
22
|
+
* - hbar opens at 09:00 with value 100, targetIntervalMs = 1h.
|
|
23
|
+
* - base bar at 09:00 → value 100 (open of the bucket).
|
|
24
|
+
* - base bar at 09:59 → value 100 (still inside the bucket).
|
|
25
|
+
* - base bar at 08:55 → null (before the bucket opens — using 100 here
|
|
26
|
+
* would be lookahead).
|
|
27
|
+
*
|
|
28
|
+
* Performance: O(B + H) using a synced two-pointer walk (both inputs are
|
|
29
|
+
* sorted by timestamp). Callers typically have B ≫ H (many fine bars per
|
|
30
|
+
* coarse bar), so we step through `baseBars` linearly while advancing the
|
|
31
|
+
* higher-tf cursor whenever the next bucket opens at or before `t`.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @internal — building block used by `createMtfController`. Reachable today
|
|
35
|
+
* via the top-level `@klinechart-quant/core` barrel but **NOT
|
|
36
|
+
* part of the supported public API**. typedoc / api-extractor
|
|
37
|
+
* hide it from generated docs. Prefer the controller factory
|
|
38
|
+
* for stable user code. Closes API audit BLOCKER-002.
|
|
39
|
+
*/
|
|
40
|
+
export declare function alignToBaseIndex<TValue>(baseBars: ReadonlyArray<{
|
|
41
|
+
timestamp: number;
|
|
42
|
+
}>, higherTfBars: ReadonlyArray<{
|
|
43
|
+
timestamp: number;
|
|
44
|
+
}>, higherTfValues: ReadonlyArray<TValue>, targetIntervalMs: number): ReadonlyArray<TValue | null>;
|
|
45
|
+
//# sourceMappingURL=alignToBaseIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignToBaseIndex.d.ts","sourceRoot":"","sources":["../../../src/components/mtfOverlay/alignToBaseIndex.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EACnC,QAAQ,EAAE,aAAa,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,EAC9C,YAAY,EAAE,aAAa,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,cAAc,EAAE,aAAa,CAAC,MAAM,CAAC,EACrC,gBAAgB,EAAE,MAAM,GACzB,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,CA6D9B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { KLineChartError } from '../../errors';
|
|
2
|
+
/**
|
|
3
|
+
* Forward-fill a higher-timeframe series onto the base bar index, with strict
|
|
4
|
+
* no-lookahead semantics.
|
|
5
|
+
*
|
|
6
|
+
* The rule, restated:
|
|
7
|
+
* A higher-tf bar opens at `hbar.timestamp` and covers the half-open
|
|
8
|
+
* interval `[hbar.timestamp, hbar.timestamp + targetIntervalMs)`. The
|
|
9
|
+
* higher-tf value at that bar is available to every base bar whose
|
|
10
|
+
* timestamp falls inside that interval — and only those base bars.
|
|
11
|
+
*
|
|
12
|
+
* Forward fill is implicit: because higher-tf bars are contiguous in time
|
|
13
|
+
* (within the input series), a base bar at time `t` reads the value of the
|
|
14
|
+
* higher-tf bar whose half-open interval contains `t`. If no such bar exists
|
|
15
|
+
* (i.e. `t` is before the first higher-tf bar's open), the output is `null`.
|
|
16
|
+
*
|
|
17
|
+
* Gap handling: if the higher-tf series has a hole (bar N+1's open is more
|
|
18
|
+
* than `targetIntervalMs` after bar N's open), base bars in that hole get the
|
|
19
|
+
* value of bar N. This matches the forward-fill intuition users have — once
|
|
20
|
+
* a higher-tf value exists, it stays visible until the next bucket opens.
|
|
21
|
+
*
|
|
22
|
+
* Lookahead-bias test (spelled out so it survives regressions):
|
|
23
|
+
* - hbar opens at 09:00 with value 100, targetIntervalMs = 1h.
|
|
24
|
+
* - base bar at 09:00 → value 100 (open of the bucket).
|
|
25
|
+
* - base bar at 09:59 → value 100 (still inside the bucket).
|
|
26
|
+
* - base bar at 08:55 → null (before the bucket opens — using 100 here
|
|
27
|
+
* would be lookahead).
|
|
28
|
+
*
|
|
29
|
+
* Performance: O(B + H) using a synced two-pointer walk (both inputs are
|
|
30
|
+
* sorted by timestamp). Callers typically have B ≫ H (many fine bars per
|
|
31
|
+
* coarse bar), so we step through `baseBars` linearly while advancing the
|
|
32
|
+
* higher-tf cursor whenever the next bucket opens at or before `t`.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* @internal — building block used by `createMtfController`. Reachable today
|
|
36
|
+
* via the top-level `@klinechart-quant/core` barrel but **NOT
|
|
37
|
+
* part of the supported public API**. typedoc / api-extractor
|
|
38
|
+
* hide it from generated docs. Prefer the controller factory
|
|
39
|
+
* for stable user code. Closes API audit BLOCKER-002.
|
|
40
|
+
*/
|
|
41
|
+
export function alignToBaseIndex(baseBars, higherTfBars, higherTfValues, targetIntervalMs) {
|
|
42
|
+
if (!Number.isFinite(targetIntervalMs) || targetIntervalMs <= 0) {
|
|
43
|
+
throw new KLineChartError('MTF_CONFIG_INVALID', 'alignToBaseIndex: targetIntervalMs must be a positive finite number');
|
|
44
|
+
}
|
|
45
|
+
if (higherTfBars.length !== higherTfValues.length) {
|
|
46
|
+
throw new KLineChartError('MTF_CONFIG_INVALID', `alignToBaseIndex: higherTfBars.length (${higherTfBars.length}) must ` +
|
|
47
|
+
`equal higherTfValues.length (${higherTfValues.length})`);
|
|
48
|
+
}
|
|
49
|
+
const B = baseBars.length;
|
|
50
|
+
const H = higherTfBars.length;
|
|
51
|
+
const out = new Array(B);
|
|
52
|
+
if (B === 0)
|
|
53
|
+
return out;
|
|
54
|
+
if (H === 0) {
|
|
55
|
+
for (let i = 0; i < B; i++)
|
|
56
|
+
out[i] = null;
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
// Two-pointer walk. `h` is the index of the higher-tf bar that COULD
|
|
60
|
+
// cover the current base bar — meaning `higherTfBars[h].timestamp <= t`.
|
|
61
|
+
// We advance `h` greedily as base bars march forward.
|
|
62
|
+
let h = -1; // -1 ≡ "no higher-tf bar has opened yet"
|
|
63
|
+
for (let i = 0; i < B; i++) {
|
|
64
|
+
const t = baseBars[i].timestamp;
|
|
65
|
+
// Advance `h` to the latest higher-tf bar whose open is ≤ t. This is
|
|
66
|
+
// the "no lookahead" gate: a bar whose open > t is invisible to us.
|
|
67
|
+
while (h + 1 < H && higherTfBars[h + 1].timestamp <= t) {
|
|
68
|
+
h++;
|
|
69
|
+
}
|
|
70
|
+
if (h < 0) {
|
|
71
|
+
// No higher-tf bar has opened at or before t → leading null.
|
|
72
|
+
out[i] = null;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
// We have a candidate bar `h`. Final check: is t still inside its
|
|
76
|
+
// half-open interval? If `higherTfBars[h+1]` exists and its open is
|
|
77
|
+
// ≤ t, the while loop above would have advanced — so we only need to
|
|
78
|
+
// check the upper bound for the last bar, or in a gap.
|
|
79
|
+
const bucketStart = higherTfBars[h].timestamp;
|
|
80
|
+
if (t < bucketStart + targetIntervalMs) {
|
|
81
|
+
out[i] = higherTfValues[h];
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// t falls into a gap after bar h's closed interval and before
|
|
85
|
+
// the next bar opens (or after the end of the series). Forward
|
|
86
|
+
// fill: keep bar h's value visible.
|
|
87
|
+
out[i] = higherTfValues[h];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=alignToBaseIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignToBaseIndex.js","sourceRoot":"","sources":["../../../src/components/mtfOverlay/alignToBaseIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC5B,QAA8C,EAC9C,YAAkD,EAClD,cAAqC,EACrC,gBAAwB;IAExB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,IAAI,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,eAAe,CACrB,oBAAoB,EACpB,qEAAqE,CACxE,CAAA;IACL,CAAC;IACD,IAAI,YAAY,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE,CAAC;QAChD,MAAM,IAAI,eAAe,CACrB,oBAAoB,EACpB,0CAA0C,YAAY,CAAC,MAAM,SAAS;YAClE,gCAAgC,cAAc,CAAC,MAAM,GAAG,CAC/D,CAAA;IACL,CAAC;IAED,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAA;IACzB,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAA;IAC7B,MAAM,GAAG,GAAsB,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;IAE3C,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,CAAA;IACvB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAAE,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;QACzC,OAAO,GAAG,CAAA;IACd,CAAC;IAED,qEAAqE;IACrE,yEAAyE;IACzE,sDAAsD;IACtD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA,CAAC,yCAAyC;IAEpD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAE/B,qEAAqE;QACrE,oEAAoE;QACpE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;YACrD,CAAC,EAAE,CAAA;QACP,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACR,6DAA6D;YAC7D,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;YACb,SAAQ;QACZ,CAAC;QAED,kEAAkE;QAClE,oEAAoE;QACpE,qEAAqE;QACrE,uDAAuD;QACvD,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;QAC7C,IAAI,CAAC,GAAG,WAAW,GAAG,gBAAgB,EAAE,CAAC;YACrC,GAAG,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;QAC9B,CAAC;aAAM,CAAC;YACJ,8DAA8D;YAC9D,+DAA+D;YAC/D,oCAAoC;YACpC,GAAG,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAA;QAC9B,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAA;AACd,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BaseBar, MtfController } from './types';
|
|
2
|
+
export interface CreateMtfControllerInit {
|
|
3
|
+
initialBars?: ReadonlyArray<BaseBar>;
|
|
4
|
+
baseIntervalMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function createMtfController(init?: CreateMtfControllerInit): MtfController;
|
|
7
|
+
//# sourceMappingURL=createMtfController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMtfController.d.ts","sourceRoot":"","sources":["../../../src/components/mtfOverlay/createMtfController.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAER,OAAO,EACP,aAAa,EAGhB,MAAM,SAAS,CAAA;AAEhB,MAAM,WAAW,uBAAuB;IACpC,WAAW,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IACpC,cAAc,CAAC,EAAE,MAAM,CAAA;CAC1B;AAED,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,uBAA4B,GAAG,aAAa,CAoJrF"}
|