@vninvestcharts/widget 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE.md +83 -0
- package/README.md +851 -3
- package/dist/AlertsModal-WKEUDTUZ.js +2 -0
- package/dist/ConnectedTradingPanel-KWJMIKTN.css +2 -0
- package/dist/ConnectedTradingPanel-XDKMOQY5.js +2 -0
- package/dist/PineEditorPanel-AUXB4FD3.js +2 -0
- package/dist/PineEditorPanel-V6YN2OTU.css +2 -0
- package/dist/RightSidebarDockHost-6FPZ6EKV.css +2 -0
- package/dist/RightSidebarDockHost-OBFXKSIY.js +2 -0
- package/dist/StrategyTesterPanel-6IUTS2P4.js +2 -0
- package/dist/StrategyTesterPanel-LEWEUMXP.css +2 -0
- package/dist/VolumeProfileWorker-UREKVPUE.js +189 -0
- package/dist/adapters/index.cjs +2532 -0
- package/dist/adapters/index.d.mts +673 -0
- package/dist/adapters/index.d.ts +673 -0
- package/dist/adapters/index.js +2521 -0
- package/dist/adapters/index.umd.js +2535 -0
- package/dist/chunk-5T6DGB3V.js +2 -0
- package/dist/chunk-66JBEGR3.js +4 -0
- package/dist/chunk-6D7DVBIK.js +2 -0
- package/dist/chunk-76E7CKUD.js +2 -0
- package/dist/chunk-AKWVXRQ6.js +2 -0
- package/dist/chunk-FHHSTO6Z.js +2 -0
- package/dist/chunk-HPL723JA.js +2 -0
- package/dist/chunk-NVGTF73S.js +2 -0
- package/dist/chunk-PNIB4OM3.js +2 -0
- package/dist/chunk-UKJ5AKQX.js +595 -0
- package/dist/chunk-UYJTX3SD.js +2 -0
- package/dist/combined.css +3068 -0
- package/dist/css-modules-manifest.json +297 -0
- package/dist/dist-Y6PZ2RN3.js +12 -0
- package/dist/drawing/index.cjs +53 -0
- package/dist/drawing/index.d.mts +2 -0
- package/dist/drawing/index.d.ts +2 -0
- package/dist/drawing/index.js +2 -0
- package/dist/drawing/index.umd.js +54 -0
- package/dist/dts/drawing-shim.d.ts +3 -0
- package/dist/dts/index.d.ts +31 -0
- package/dist/dts/lib/Chart.d.ts +31 -0
- package/dist/dts/lib/ChartContext.d.ts +10 -0
- package/dist/dts/lib/EventCapture.d.ts +3 -0
- package/dist/dts/lib/GenericChartComponent.d.ts +5 -0
- package/dist/dts/lib/GenericComponent.d.ts +124 -0
- package/dist/dts/lib/StockChartContext.d.ts +53 -0
- package/dist/dts/lib/adapters/BaseAdapter.d.ts +25 -0
- package/dist/dts/lib/adapters/BinanceAdapter.d.ts +51 -0
- package/dist/dts/lib/adapters/CSVAdapter.d.ts +17 -0
- package/dist/dts/lib/adapters/ContinuousContractAdapter.d.ts +63 -0
- package/dist/dts/lib/adapters/ContinuousContractTypes.d.ts +154 -0
- package/dist/dts/lib/adapters/DBAdapter.d.ts +16 -0
- package/dist/dts/lib/adapters/DataAdapter.d.ts +136 -0
- package/dist/dts/lib/adapters/DjangoVnstockAdapter.d.ts +15 -0
- package/dist/dts/lib/adapters/LocalCacheAdapter.d.ts +18 -0
- package/dist/dts/lib/adapters/MockAdapter.d.ts +22 -0
- package/dist/dts/lib/adapters/RESTAdapter.d.ts +16 -0
- package/dist/dts/lib/adapters/StockDataAdapter.d.ts +1 -0
- package/dist/dts/lib/adapters/UDFDataAdapter.d.ts +29 -0
- package/dist/dts/lib/adapters/VNStocksAdapter.d.ts +8 -0
- package/dist/dts/lib/adapters/WSAdapter.d.ts +30 -0
- package/dist/dts/lib/adapters/gapFixture.d.ts +71 -0
- package/dist/dts/lib/adapters/index.d.ts +15 -0
- package/dist/dts/lib/adapters/rollAlgorithms.d.ts +68 -0
- package/dist/dts/lib/advisory/AdvisoryPanel.d.ts +5 -0
- package/dist/dts/lib/alerts/AlertEvaluator.d.ts +5 -0
- package/dist/dts/lib/alerts/AlertManager.d.ts +123 -0
- package/dist/dts/lib/alerts/types.d.ts +58 -0
- package/dist/dts/lib/cache/cacheDebug.d.ts +3 -0
- package/dist/dts/lib/calendars/ExchangeCalendar.d.ts +23 -0
- package/dist/dts/lib/calendars/calendarRegistry.d.ts +10 -0
- package/dist/dts/lib/calendars/index.d.ts +3 -0
- package/dist/dts/lib/core/ChartPane.d.ts +8 -0
- package/dist/dts/lib/core/ChartSplitter.d.ts +70 -0
- package/dist/dts/lib/core/ChartTerminal.d.ts +12 -0
- package/dist/dts/lib/core/ErrorBoundary.d.ts +17 -0
- package/dist/dts/lib/core/IndicatorLegend.d.ts +47 -0
- package/dist/dts/lib/core/PaneHeader.d.ts +24 -0
- package/dist/dts/lib/core/PaneLabel.d.ts +8 -0
- package/dist/dts/lib/core/PaneSplitter.d.ts +9 -0
- package/dist/dts/lib/core/SeriesPicker.d.ts +10 -0
- package/dist/dts/lib/core/calculators/alignBarsByDate.d.ts +38 -0
- package/dist/dts/lib/core/calculators/buildIndicatorComputationPlan.d.ts +16 -0
- package/dist/dts/lib/core/calculators/calcCVDApprox.d.ts +6 -0
- package/dist/dts/lib/core/calculators/calcStrengthElder.d.ts +7 -0
- package/dist/dts/lib/core/calculators/calcWhaleApprox.d.ts +6 -0
- package/dist/dts/lib/core/calculators/computationHelpers.d.ts +12 -0
- package/dist/dts/lib/core/calculators/computeIndicatorComputationResult.d.ts +3 -0
- package/dist/dts/lib/core/calculators/computeMarketStructure.d.ts +8 -0
- package/dist/dts/lib/core/calculators/computeMomentum.d.ts +22 -0
- package/dist/dts/lib/core/calculators/computeMovingAverage.d.ts +15 -0
- package/dist/dts/lib/core/calculators/computeProfile.d.ts +9 -0
- package/dist/dts/lib/core/calculators/computeTrend.d.ts +10 -0
- package/dist/dts/lib/core/calculators/computeVolatility.d.ts +14 -0
- package/dist/dts/lib/core/calculators/computeVolumeFlow.d.ts +19 -0
- package/dist/dts/lib/core/calculators/enrichData.d.ts +7 -0
- package/dist/dts/lib/core/calculators/enrichDataWithCanonicalStore.d.ts +33 -0
- package/dist/dts/lib/core/calculators/exoticChartData.d.ts +140 -0
- package/dist/dts/lib/core/calculators/fixtures/mockData.d.ts +2 -0
- package/dist/dts/lib/core/calculators/indicatorComputation.d.ts +27 -0
- package/dist/dts/lib/core/calculators/indicatorComputationTypes.d.ts +249 -0
- package/dist/dts/lib/core/calculators/materializeIndicatorValues.d.ts +3 -0
- package/dist/dts/lib/core/calculators/normalizePrices.d.ts +36 -0
- package/dist/dts/lib/core/calculators/resolveCalculationOrder.d.ts +17 -0
- package/dist/dts/lib/core/calculators/types.d.ts +269 -0
- package/dist/dts/lib/core/canvas/ChartRenderContext.d.ts +14 -0
- package/dist/dts/lib/core/canvas/OverlayCanvas.d.ts +19 -0
- package/dist/dts/lib/core/context/ChartSyncContext.d.ts +21 -0
- package/dist/dts/lib/core/context/DataContext.d.ts +15 -0
- package/dist/dts/lib/core/context/PaneManagerContext.d.ts +10 -0
- package/dist/dts/lib/core/hooks/paneSizingHelpers.d.ts +13 -0
- package/dist/dts/lib/core/hooks/useCanvasResize.d.ts +8 -0
- package/dist/dts/lib/core/hooks/useChartTheme.d.ts +12 -0
- package/dist/dts/lib/core/hooks/useDynamicPanes.d.ts +155 -0
- package/dist/dts/lib/core/hooks/useIndicatorSets.d.ts +20 -0
- package/dist/dts/lib/core/hooks/usePaneManager.d.ts +39 -0
- package/dist/dts/lib/core/hooks/usePaneSizes.d.ts +52 -0
- package/dist/dts/lib/core/index.d.ts +41 -0
- package/dist/dts/lib/core/paneScaleSlotDomains.d.ts +3 -0
- package/dist/dts/lib/core/registry/SeriesRegistry.d.ts +22 -0
- package/dist/dts/lib/core/registry/filterPanesBySeriesTier.d.ts +43 -0
- package/dist/dts/lib/core/registry/marketStructure.d.ts +7 -0
- package/dist/dts/lib/core/registry/momentum.d.ts +20 -0
- package/dist/dts/lib/core/registry/movingAverage.d.ts +14 -0
- package/dist/dts/lib/core/registry/priceChartTypes.d.ts +16 -0
- package/dist/dts/lib/core/registry/profile.d.ts +8 -0
- package/dist/dts/lib/core/registry/registerAll.d.ts +1 -0
- package/dist/dts/lib/core/registry/registerPhaseOne.d.ts +3 -0
- package/dist/dts/lib/core/registry/registryCore.d.ts +77 -0
- package/dist/dts/lib/core/registry/trend.d.ts +11 -0
- package/dist/dts/lib/core/registry/volatility.d.ts +11 -0
- package/dist/dts/lib/core/registry/volumeFlow.d.ts +20 -0
- package/dist/dts/lib/core/replay/BarReplayController.d.ts +62 -0
- package/dist/dts/lib/core/replay/ReplayEventBus.d.ts +68 -0
- package/dist/dts/lib/core/replay/ReplayFillSimulator.d.ts +33 -0
- package/dist/dts/lib/core/replay/ReplayOrderBook.d.ts +24 -0
- package/dist/dts/lib/core/replay/ReplayPositionManager.d.ts +30 -0
- package/dist/dts/lib/core/replay/ReplaySessionAnalytics.d.ts +31 -0
- package/dist/dts/lib/core/replay/createReplayTradeMarkerPrimitives.d.ts +7 -0
- package/dist/dts/lib/core/replay/pnlUtils.d.ts +2 -0
- package/dist/dts/lib/core/replay/replayBrokerAdapters.d.ts +51 -0
- package/dist/dts/lib/core/replay/replayTradingTypes.d.ts +61 -0
- package/dist/dts/lib/core/scales/computeScales.d.ts +8 -0
- package/dist/dts/lib/core/seriesValueResolver.d.ts +27 -0
- package/dist/dts/lib/core/sets/builtins.d.ts +2 -0
- package/dist/dts/lib/core/sets/indicatorSetCodec.d.ts +15 -0
- package/dist/dts/lib/core/trading/AnalyticsEngine.d.ts +56 -0
- package/dist/dts/lib/core/trading/BrokerAPI.d.ts +40 -0
- package/dist/dts/lib/core/trading/ExecutionSimulator.d.ts +53 -0
- package/dist/dts/lib/core/trading/FillSettlement.d.ts +38 -0
- package/dist/dts/lib/core/trading/MarketDataPort.d.ts +41 -0
- package/dist/dts/lib/core/trading/MarketRules.d.ts +58 -0
- package/dist/dts/lib/core/trading/OrderManagementSystem.d.ts +57 -0
- package/dist/dts/lib/core/trading/PositionManager.d.ts +79 -0
- package/dist/dts/lib/core/trading/RiskEngine.d.ts +40 -0
- package/dist/dts/lib/core/trading/SettlementCalendar.d.ts +10 -0
- package/dist/dts/lib/core/trading/VirtualBrokerEngine.d.ts +92 -0
- package/dist/dts/lib/core/trading/orderMargin.d.ts +3 -0
- package/dist/dts/lib/core/trading/storage/InMemoryStorageAdapter.d.ts +10 -0
- package/dist/dts/lib/core/trading/storage/TradingStorage.d.ts +34 -0
- package/dist/dts/lib/core/trading/types.d.ts +99 -0
- package/dist/dts/lib/core/types/chart.d.ts +21 -0
- package/dist/dts/lib/core/types/indicator-catalog.d.ts +38 -0
- package/dist/dts/lib/core/types/indicator-set.d.ts +19 -0
- package/dist/dts/lib/core/types/pane-descriptor.d.ts +46 -0
- package/dist/dts/lib/core/types/seriesComponents.d.ts +15 -0
- package/dist/dts/lib/credentials/credentialStore.d.ts +93 -0
- package/dist/dts/lib/helper/SaveChartAsImage.d.ts +90 -0
- package/dist/dts/lib/indicator/defaultOptionsForAppearance.d.ts +105 -0
- package/dist/dts/lib/indicators/builtin/MTFWrapper.d.ts +3 -0
- package/dist/dts/lib/indicators/builtin/VolumeProfileWorker.d.ts +19 -0
- package/dist/dts/lib/indicators/builtin/ac.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/alligator.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/anchoredVwap.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ao.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/bbi.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/bias.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/bollinger.d.ts +9 -0
- package/dist/dts/lib/indicators/builtin/brar.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cci.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/chaikinOscillator.d.ts +14 -0
- package/dist/dts/lib/indicators/builtin/chaikinVol.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/ci.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cmf.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cr.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/cvd.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/deltaProfile.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/dema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/dma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/dmi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/donchian.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/emv.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/footprint.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/fractals.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/gator.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/hma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/hv.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/ichimoku.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/kdj.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/keltner.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/ma.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/maRibbon.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/macd.d.ts +9 -0
- package/dist/dts/lib/indicators/builtin/marketProfile.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/mfi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/mtm.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/obv.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/pivotHighLow.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/pivotStandard.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/psy.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/pvt.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/roc.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/rsi.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/sar.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/sma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/smfi.d.ts +8 -0
- package/dist/dts/lib/indicators/builtin/stdDev.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/strengthRelative.d.ts +7 -0
- package/dist/dts/lib/indicators/builtin/supertrend.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/tema.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/trix.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volOsc.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volume.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/volumeProfile.d.ts +8 -0
- package/dist/dts/lib/indicators/builtin/vr.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/vwap.d.ts +5 -0
- package/dist/dts/lib/indicators/builtin/vwma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/wma.d.ts +4 -0
- package/dist/dts/lib/indicators/builtin/wr.d.ts +10 -0
- package/dist/dts/lib/indicators/builtin/wyckoffWave.d.ts +15 -0
- package/dist/dts/lib/indicators/index.d.ts +63 -0
- package/dist/dts/lib/indicators/indicatorValueShapes.d.ts +15 -0
- package/dist/dts/lib/indicators/outputKeys.d.ts +50 -0
- package/dist/dts/lib/indicators/overlays/CVDIndicator.d.ts +26 -0
- package/dist/dts/lib/indicators/overlays/DarkFlowBadge.d.ts +19 -0
- package/dist/dts/lib/indicators/overlays/ExternalCVDOverlay.d.ts +15 -0
- package/dist/dts/lib/indicators/overlays/WhaleBubbleOverlay.d.ts +14 -0
- package/dist/dts/lib/indicators/overlays/WhaleMarketBubbleOverlay.d.ts +27 -0
- package/dist/dts/lib/indicators/overlays/whaleDetector.d.ts +66 -0
- package/dist/dts/lib/indicators/registry.d.ts +6 -0
- package/dist/dts/lib/indicators/types.d.ts +5 -0
- package/dist/dts/lib/indicators/utils.d.ts +259 -0
- package/dist/dts/lib/pinescript/PineCompiler.d.ts +34 -0
- package/dist/dts/lib/pinescript/ast.d.ts +73 -0
- package/dist/dts/lib/pinescript/compile.d.ts +40 -0
- package/dist/dts/lib/pinescript/grammar.d.ts +12 -0
- package/dist/dts/lib/pinescript/pine.worker.d.ts +1 -0
- package/dist/dts/lib/pinescript/pineBlocks.d.ts +54 -0
- package/dist/dts/lib/pinescript/pineBuiltins.d.ts +47 -0
- package/dist/dts/lib/pinescript/pineEnv.d.ts +46 -0
- package/dist/dts/lib/pinescript/pineMath.d.ts +13 -0
- package/dist/dts/lib/pinescript/pineParse.d.ts +25 -0
- package/dist/dts/lib/pinescript/pineStrings.d.ts +50 -0
- package/dist/dts/lib/pinescript/runtime.d.ts +5 -0
- package/dist/dts/lib/pinescript/scriptRegistry.d.ts +40 -0
- package/dist/dts/lib/pinescript/series-value.d.ts +64 -0
- package/dist/dts/lib/pinescript/vnscript-completion.d.ts +1 -0
- package/dist/dts/lib/pinescript/vnscript-grammar.d.ts +19 -0
- package/dist/dts/lib/scale/discontinuousTimeScaleProvider.d.ts +3 -0
- package/dist/dts/lib/scale/financeDiscontinuousScale.d.ts +15 -0
- package/dist/dts/lib/scale/index.d.ts +1 -0
- package/dist/dts/lib/scale/levels.d.ts +12 -0
- package/dist/dts/lib/series/AlternatingFillAreaSeries.d.ts +13 -0
- package/dist/dts/lib/series/AreaOnlySeries.d.ts +10 -0
- package/dist/dts/lib/series/AreaSeries.d.ts +30 -0
- package/dist/dts/lib/series/BarSeries.d.ts +40 -0
- package/dist/dts/lib/series/BollingerSeries.d.ts +11 -0
- package/dist/dts/lib/series/CandlestickSeries.d.ts +56 -0
- package/dist/dts/lib/series/CircleMarker.d.ts +28 -0
- package/dist/dts/lib/series/ElderRaySeries.d.ts +14 -0
- package/dist/dts/lib/series/FootprintSeries.d.ts +21 -0
- package/dist/dts/lib/series/GroupedBarSeries.d.ts +9 -0
- package/dist/dts/lib/series/HTFOverlaySeries.d.ts +32 -0
- package/dist/dts/lib/series/HistogramSeries.d.ts +51 -0
- package/dist/dts/lib/series/KagiSeries.d.ts +9 -0
- package/dist/dts/lib/series/LineBreakSeries.d.ts +28 -0
- package/dist/dts/lib/series/LineSeries.d.ts +54 -0
- package/dist/dts/lib/series/MACDSeries.d.ts +28 -0
- package/dist/dts/lib/series/MarketProfileSeries.d.ts +18 -0
- package/dist/dts/lib/series/OHLCSeries.d.ts +9 -0
- package/dist/dts/lib/series/OverlayBarSeries.d.ts +9 -0
- package/dist/dts/lib/series/PointAndFigureSeries.d.ts +45 -0
- package/dist/dts/lib/series/RSISeries.d.ts +38 -0
- package/dist/dts/lib/series/RenkoSeries.d.ts +9 -0
- package/dist/dts/lib/series/SARSeries.d.ts +10 -0
- package/dist/dts/lib/series/SVGComponent.d.ts +5 -0
- package/dist/dts/lib/series/ScatterSeries.d.ts +9 -0
- package/dist/dts/lib/series/SquareMarker.d.ts +28 -0
- package/dist/dts/lib/series/StackedBarSeries.d.ts +19 -0
- package/dist/dts/lib/series/StochasticSeries.d.ts +9 -0
- package/dist/dts/lib/series/StraightLine.d.ts +18 -0
- package/dist/dts/lib/series/TriangleMarker.d.ts +30 -0
- package/dist/dts/lib/series/VolumeProfileSeries.d.ts +9 -0
- package/dist/dts/lib/series/index.d.ts +28 -0
- package/dist/dts/lib/strategy/BrokerSimulator.d.ts +11 -0
- package/dist/dts/lib/strategy/types.d.ts +35 -0
- package/dist/dts/lib/tape/TapePanel.d.ts +5 -0
- package/dist/dts/lib/types/adapter.d.ts +1 -0
- package/dist/dts/lib/types/index.d.ts +5 -0
- package/dist/dts/lib/types/indicator.d.ts +11 -0
- package/dist/dts/lib/types/ohlcv.d.ts +1 -0
- package/dist/dts/lib/types/pane.d.ts +23 -0
- package/dist/dts/lib/types/runtime.d.ts +11 -0
- package/dist/dts/lib/types/vninvest.d.ts +320 -0
- package/dist/dts/lib/types.d.ts +45 -0
- package/dist/dts/lib/utils/ChartDataUtil.d.ts +26 -0
- package/dist/dts/lib/utils/PureComponent.d.ts +5 -0
- package/dist/dts/lib/utils/accumulatingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/axisPriceFormat.d.ts +6 -0
- package/dist/dts/lib/utils/barWidth.d.ts +14 -0
- package/dist/dts/lib/utils/identity.d.ts +1 -0
- package/dist/dts/lib/utils/index.d.ts +70 -0
- package/dist/dts/lib/utils/logger.d.ts +28 -0
- package/dist/dts/lib/utils/mappedSlidingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/merge.d.ts +6 -0
- package/dist/dts/lib/utils/noop.d.ts +1 -0
- package/dist/dts/lib/utils/rebind.d.ts +1 -0
- package/dist/dts/lib/utils/shallowEqual.d.ts +1 -0
- package/dist/dts/lib/utils/slidingWindow.d.ts +1 -0
- package/dist/dts/lib/utils/storage.d.ts +32 -0
- package/dist/dts/lib/utils/strokeDasharray.d.ts +3 -0
- package/dist/dts/lib/utils/timezoneFormatter.d.ts +14 -0
- package/dist/dts/lib/utils/zipper.d.ts +4 -0
- package/dist/dts/public-api.d.ts +31 -0
- package/dist/dts/widget/BackfillWorkerFlags.d.ts +12 -0
- package/dist/dts/widget/CanaryRollbackHelper.d.ts +95 -0
- package/dist/dts/widget/CanaryRolloutConfig.d.ts +100 -0
- package/dist/dts/widget/DrawingPriceLabelsOverlay.d.ts +20 -0
- package/dist/dts/widget/ForkDrawingsOverlay.d.ts +16 -0
- package/dist/dts/widget/MeasurementOverlay.d.ts +24 -0
- package/dist/dts/widget/VNInvestCharts.d.ts +5 -0
- package/dist/dts/widget/VNInvestChartsProps.d.ts +302 -0
- package/dist/dts/widget/VNInvestMultiCharts.d.ts +8 -0
- package/dist/dts/widget/VNInvestMultiCharts.types.d.ts +130 -0
- package/dist/dts/widget/WidgetEmptyState.d.ts +11 -0
- package/dist/dts/widget/WidgetErrorBoundary.d.ts +26 -0
- package/dist/dts/widget/adapters/ContinuousFuturesStockDataAdapter.d.ts +18 -0
- package/dist/dts/widget/adapters/DataProviderAdapterWrapper.d.ts +14 -0
- package/dist/dts/widget/adapters/MultiSourceDataAdapter.d.ts +24 -0
- package/dist/dts/widget/adapters/VNInvestClient.d.ts +161 -0
- package/dist/dts/widget/adapters/VNInvestDataAdapter.d.ts +77 -0
- package/dist/dts/widget/adapters/VNInvestWebSocketClient.d.ts +79 -0
- package/dist/dts/widget/adapters/barsPagingPolicy.d.ts +18 -0
- package/dist/dts/widget/adapters/corporateEvents.d.ts +13 -0
- package/dist/dts/widget/adapters/index.d.ts +20 -0
- package/dist/dts/widget/adapters/nativeShapes.d.ts +32 -0
- package/dist/dts/widget/adapters/watchlistRealtimeSync.d.ts +16 -0
- package/dist/dts/widget/alerts/DrawingAlertsHost.d.ts +18 -0
- package/dist/dts/widget/alerts/useDrawingAlerts.d.ts +37 -0
- package/dist/dts/widget/canaryBarFiltering.d.ts +35 -0
- package/dist/dts/widget/capabilities/CapabilityResolver.d.ts +71 -0
- package/dist/dts/widget/capabilities/capabilityProbe.d.ts +28 -0
- package/dist/dts/widget/capabilities/useTierGatedFeatures.d.ts +48 -0
- package/dist/dts/widget/components/BottomPanelHost.d.ts +80 -0
- package/dist/dts/widget/components/BottomPanelSplitter.d.ts +15 -0
- package/dist/dts/widget/components/CapabilityGate.d.ts +65 -0
- package/dist/dts/widget/components/ChartDiagOverlay.d.ts +31 -0
- package/dist/dts/widget/components/ConfirmDialog.d.ts +12 -0
- package/dist/dts/widget/components/DowngradeBanner.d.ts +9 -0
- package/dist/dts/widget/components/ForkPaneSeparators.d.ts +11 -0
- package/dist/dts/widget/components/ForkPaneTooltips.d.ts +23 -0
- package/dist/dts/widget/components/ForkXAxisOverlay.d.ts +11 -0
- package/dist/dts/widget/components/ForkYAxisCrosshairLabels.d.ts +9 -0
- package/dist/dts/widget/components/LayoutDesigner.d.ts +26 -0
- package/dist/dts/widget/components/PremiumFeatureGate.d.ts +10 -0
- package/dist/dts/widget/components/ShortcutHelpModal.d.ts +44 -0
- package/dist/dts/widget/components/SystemMenu.d.ts +66 -0
- package/dist/dts/widget/components/Toast.d.ts +20 -0
- package/dist/dts/widget/components/canvas/BarCountdownBadge.d.ts +8 -0
- package/dist/dts/widget/components/canvas/ChartA11ySummary.d.ts +40 -0
- package/dist/dts/widget/components/canvas/ChartStatusLine.d.ts +39 -0
- package/dist/dts/widget/components/canvas/PricePaneHeader.d.ts +24 -0
- package/dist/dts/widget/components/canvas/PriceScaleMenu.d.ts +27 -0
- package/dist/dts/widget/components/canvas/TimeAxisScrollbar.d.ts +18 -0
- package/dist/dts/widget/components/common/Icons.d.ts +67 -0
- package/dist/dts/widget/components/dock/DataWindow.d.ts +7 -0
- package/dist/dts/widget/components/dock/DockUpgradeNudge.d.ts +10 -0
- package/dist/dts/widget/components/dock/RightSidebarDockHost.d.ts +57 -0
- package/dist/dts/widget/components/dock/WatchlistPanel.d.ts +7 -0
- package/dist/dts/widget/components/dock/WorkspaceRightDockSlot.d.ts +46 -0
- package/dist/dts/widget/components/dock/dockAccess.d.ts +20 -0
- package/dist/dts/widget/components/dock/drawingDockContentBuilders.d.ts +29 -0
- package/dist/dts/widget/components/drawing/DrawingDock.d.ts +47 -0
- package/dist/dts/widget/components/drawing/DrawingInspector.d.ts +94 -0
- package/dist/dts/widget/components/drawing/DrawingListPanel.d.ts +62 -0
- package/dist/dts/widget/components/drawing/DrawingSemanticPointLegend.d.ts +14 -0
- package/dist/dts/widget/components/drawing/FloatingDrawingInspector.d.ts +18 -0
- package/dist/dts/widget/components/drawing/IconPickerPanel.d.ts +5 -0
- package/dist/dts/widget/components/drawing/InlineTextEditor.d.ts +20 -0
- package/dist/dts/widget/components/drawing/PatternScanPanel.d.ts +27 -0
- package/dist/dts/widget/components/drawing/TemplateManagerPanel.d.ts +18 -0
- package/dist/dts/widget/components/events/CorporateEventsOverlay.d.ts +23 -0
- package/dist/dts/widget/components/events/EventMarkerIcon.d.ts +6 -0
- package/dist/dts/widget/components/footer/ChartFooter.d.ts +26 -0
- package/dist/dts/widget/components/footer/MultiChartsFooter.d.ts +37 -0
- package/dist/dts/widget/components/footer/TimeframeFooter.d.ts +25 -0
- package/dist/dts/widget/components/footer/useBarCountdown.d.ts +5 -0
- package/dist/dts/widget/components/header/OHLCHeader.d.ts +72 -0
- package/dist/dts/widget/components/layout/DrawingConflictNotice.d.ts +4 -0
- package/dist/dts/widget/components/layout/GridContainer.d.ts +70 -0
- package/dist/dts/widget/components/layout/GridSlotErrorBoundary.d.ts +17 -0
- package/dist/dts/widget/components/layout/Splitter.d.ts +23 -0
- package/dist/dts/widget/components/layout/gridSplitterMath.d.ts +40 -0
- package/dist/dts/widget/components/layout/useGridSplitterDrag.d.ts +18 -0
- package/dist/dts/widget/components/mobile/MobileChartCarousel.d.ts +11 -0
- package/dist/dts/widget/components/mobile/MobileToolbar.d.ts +29 -0
- package/dist/dts/widget/components/overlays/AdvisoryPanel.d.ts +25 -0
- package/dist/dts/widget/components/overlays/TapePanel.d.ts +25 -0
- package/dist/dts/widget/components/overlays/WhalePanel.d.ts +5 -0
- package/dist/dts/widget/components/panels/AdvisoryPanel.d.ts +25 -0
- package/dist/dts/widget/components/panels/PineEditorPanel.d.ts +18 -0
- package/dist/dts/widget/components/panels/StrategyTesterPanel.d.ts +7 -0
- package/dist/dts/widget/components/panels/TapePanel.d.ts +17 -0
- package/dist/dts/widget/components/panels/index.d.ts +8 -0
- package/dist/dts/widget/components/replay/FloatingReplayToolbar.d.ts +24 -0
- package/dist/dts/widget/components/replay/ReplayCutOverlay.d.ts +8 -0
- package/dist/dts/widget/components/search/SymbolCompareModal.d.ts +24 -0
- package/dist/dts/widget/components/search/SymbolSearchModal.d.ts +12 -0
- package/dist/dts/widget/components/search/VNSymbolSearch.d.ts +83 -0
- package/dist/dts/widget/components/settings/AlertsModal.d.ts +74 -0
- package/dist/dts/widget/components/settings/SettingsContext.d.ts +58 -0
- package/dist/dts/widget/components/settings/SettingsModal.d.ts +78 -0
- package/dist/dts/widget/components/settings/SettingsRangeSlider.d.ts +17 -0
- package/dist/dts/widget/components/settings/SnapshotPreviewModal.d.ts +16 -0
- package/dist/dts/widget/components/settings/WorkspaceSettingsContext.d.ts +27 -0
- package/dist/dts/widget/components/settings/helpers/seriesFormatters.d.ts +11 -0
- package/dist/dts/widget/components/settings/model/appearancePayload.d.ts +31 -0
- package/dist/dts/widget/components/settings/model/chartSettingsSchema.d.ts +100 -0
- package/dist/dts/widget/components/settings/model/defaultSettings.d.ts +5 -0
- package/dist/dts/widget/components/settings/model/indicatorShare.d.ts +29 -0
- package/dist/dts/widget/components/settings/storageKeys.d.ts +29 -0
- package/dist/dts/widget/components/settings/tabs/AppearanceSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/IndicatorParamsForm.d.ts +12 -0
- package/dist/dts/widget/components/settings/tabs/IndicatorsSettingsTab.d.ts +34 -0
- package/dist/dts/widget/components/settings/tabs/LicensingSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/PanesLayoutSettingsTab.d.ts +11 -0
- package/dist/dts/widget/components/settings/tabs/ResetSettingsTab.d.ts +8 -0
- package/dist/dts/widget/components/settings/tabs/ScalesSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/StatusLineSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/SymbolSettingsTab.d.ts +5 -0
- package/dist/dts/widget/components/settings/tabs/ThemePaletteSettingsTab.d.ts +9 -0
- package/dist/dts/widget/components/settings/tabs/TradingEventsSettingsTab.d.ts +8 -0
- package/dist/dts/widget/components/toolbar/DrawingToolIcon.d.ts +10 -0
- package/dist/dts/widget/components/toolbar/DrawingToolbar.d.ts +33 -0
- package/dist/dts/widget/components/toolbar/FloatingChartBar.d.ts +20 -0
- package/dist/dts/widget/components/toolbar/FloatingFavoritesBar.d.ts +18 -0
- package/dist/dts/widget/components/toolbar/MultiChartTopbar.d.ts +47 -0
- package/dist/dts/widget/components/toolbar/UnifiedDrawingToolbar.d.ts +28 -0
- package/dist/dts/widget/components/trading/PaperTradePanel.d.ts +41 -0
- package/dist/dts/widget/components/workspace/WorkspaceToolbar.d.ts +25 -0
- package/dist/dts/widget/config/toolGroups.d.ts +11 -0
- package/dist/dts/widget/config/toolShortcuts.d.ts +27 -0
- package/dist/dts/widget/constants/comparison.d.ts +1 -0
- package/dist/dts/widget/constants/symbolSearch.d.ts +14 -0
- package/dist/dts/widget/constants/vn30.d.ts +7 -0
- package/dist/dts/widget/context/DataProviderContext.d.ts +7 -0
- package/dist/dts/widget/context/HoverEmitter.d.ts +50 -0
- package/dist/dts/widget/context/SyncContextShare.d.ts +11 -0
- package/dist/dts/widget/context/VNInvestChartsConfigContext.d.ts +24 -0
- package/dist/dts/widget/context/VNInvestChartsContext.d.ts +70 -0
- package/dist/dts/widget/context/VNInvestChartsStateContext.d.ts +50 -0
- package/dist/dts/widget/context/WidgetI18nContext.d.ts +25 -0
- package/dist/dts/widget/context/WorkspaceLiveTradingContext.d.ts +30 -0
- package/dist/dts/widget/context/WorkspacePaperVisibilityContext.d.ts +23 -0
- package/dist/dts/widget/context/WorkspaceReplayTradingContext.d.ts +36 -0
- package/dist/dts/widget/contexts/SaaSFeatureContext.d.ts +23 -0
- package/dist/dts/widget/data/DataEnvelope.d.ts +100 -0
- package/dist/dts/widget/drawingPriceLabelInputs.d.ts +3 -0
- package/dist/dts/widget/export/chartCsv.d.ts +59 -0
- package/dist/dts/widget/forkAnchorReconciliation.d.ts +6 -0
- package/dist/dts/widget/forkInteractionHelpers.d.ts +69 -0
- package/dist/dts/widget/grid/DeviceProfiles.d.ts +49 -0
- package/dist/dts/widget/grid/GridChartRegistry.d.ts +9 -0
- package/dist/dts/widget/grid/MemoryBudgetManager.d.ts +63 -0
- package/dist/dts/widget/grid/PerformanceMonitor.d.ts +70 -0
- package/dist/dts/widget/grid/customPresets.d.ts +42 -0
- package/dist/dts/widget/grid/presets.d.ts +18 -0
- package/dist/dts/widget/grid/types.d.ts +39 -0
- package/dist/dts/widget/history/BackfillDedupContext.d.ts +63 -0
- package/dist/dts/widget/history/RequestCoordinator.d.ts +59 -0
- package/dist/dts/widget/history/SharedBarStoreContext.d.ts +22 -0
- package/dist/dts/widget/history/cache/IndexedDBCacheMatrix.d.ts +16 -0
- package/dist/dts/widget/history/cache/LocalCacheMatrix.d.ts +86 -0
- package/dist/dts/widget/history/cache/index.d.ts +3 -0
- package/dist/dts/widget/history/chunkStore.d.ts +77 -0
- package/dist/dts/widget/history/externalBarsNormalization.d.ts +9 -0
- package/dist/dts/widget/history/externalBarsNormalization.worker.d.ts +1 -0
- package/dist/dts/widget/history/externalBarsNormalizationAsync.d.ts +25 -0
- package/dist/dts/widget/history/historyDataUtils.d.ts +82 -0
- package/dist/dts/widget/history/historyWindowPlanner.d.ts +89 -0
- package/dist/dts/widget/history/inflightController.d.ts +15 -0
- package/dist/dts/widget/history/requestCoalescing.d.ts +10 -0
- package/dist/dts/widget/history/sessionGuards.d.ts +3 -0
- package/dist/dts/widget/history/singleWriterLane.d.ts +4 -0
- package/dist/dts/widget/history/useExternalBarsNormalization.d.ts +5 -0
- package/dist/dts/widget/hooks/ShortcutManager.d.ts +65 -0
- package/dist/dts/widget/hooks/overlays/PaneHeaderWrapper.d.ts +11 -0
- package/dist/dts/widget/hooks/overlays/overlayHelpers.d.ts +60 -0
- package/dist/dts/widget/hooks/overlays/useDrawingDockNode.d.ts +15 -0
- package/dist/dts/widget/hooks/overlays/useLegendChrome.d.ts +36 -0
- package/dist/dts/widget/hooks/overlays/useMultiSelectActions.d.ts +22 -0
- package/dist/dts/widget/hooks/overlays/useSidebarResize.d.ts +13 -0
- package/dist/dts/widget/hooks/resolveEntitlement.d.ts +73 -0
- package/dist/dts/widget/hooks/useBottomPanelBehavior.d.ts +38 -0
- package/dist/dts/widget/hooks/useBottomPanelHeight.d.ts +39 -0
- package/dist/dts/widget/hooks/useCanvasTheme.d.ts +24 -0
- package/dist/dts/widget/hooks/useChartImperativeHandle.d.ts +57 -0
- package/dist/dts/widget/hooks/useClockAdapter.d.ts +11 -0
- package/dist/dts/widget/hooks/useComparisonState.d.ts +29 -0
- package/dist/dts/widget/hooks/useDialogFocus.d.ts +25 -0
- package/dist/dts/widget/hooks/useDrawingToolShortcuts.d.ts +16 -0
- package/dist/dts/widget/hooks/useFeatureGate.d.ts +28 -0
- package/dist/dts/widget/hooks/useFloatingChartBar.d.ts +33 -0
- package/dist/dts/widget/hooks/useForkRuntime.d.ts +155 -0
- package/dist/dts/widget/hooks/useIndicatorsShareApplier.d.ts +1 -0
- package/dist/dts/widget/hooks/useIntersectionObserver.d.ts +49 -0
- package/dist/dts/widget/hooks/useKeyboardAdapter.d.ts +9 -0
- package/dist/dts/widget/hooks/useLayoutHistory.d.ts +8 -0
- package/dist/dts/widget/hooks/useLicenseDiagnostics.d.ts +15 -0
- package/dist/dts/widget/hooks/useMultiChartReplaySync.d.ts +31 -0
- package/dist/dts/widget/hooks/useMultiWorkspacePersistence.d.ts +49 -0
- package/dist/dts/widget/hooks/usePaperTradeConfig.d.ts +27 -0
- package/dist/dts/widget/hooks/usePaperTradeInteraction.d.ts +27 -0
- package/dist/dts/widget/hooks/usePatTierAuthentication.d.ts +42 -0
- package/dist/dts/widget/hooks/usePineScriptRestore.d.ts +23 -0
- package/dist/dts/widget/hooks/usePortalAdapter.d.ts +8 -0
- package/dist/dts/widget/hooks/useRecentSymbols.d.ts +3 -0
- package/dist/dts/widget/hooks/useReplayState.d.ts +28 -0
- package/dist/dts/widget/hooks/useReplayTrading.d.ts +26 -0
- package/dist/dts/widget/hooks/useResizeAdapter.d.ts +13 -0
- package/dist/dts/widget/hooks/useScaleOverlays.d.ts +62 -0
- package/dist/dts/widget/hooks/useScriptPersistence.d.ts +72 -0
- package/dist/dts/widget/hooks/useSymbolSearch.d.ts +30 -0
- package/dist/dts/widget/hooks/useViewportBreakpoint.d.ts +15 -0
- package/dist/dts/widget/hooks/useWidgetCoordinateBridge.d.ts +70 -0
- package/dist/dts/widget/hooks/useWidgetData.d.ts +138 -0
- package/dist/dts/widget/hooks/useWidgetDataBackfill.d.ts +67 -0
- package/dist/dts/widget/hooks/useWidgetDataEnrichment.d.ts +32 -0
- package/dist/dts/widget/hooks/useWidgetDrawings.d.ts +38 -0
- package/dist/dts/widget/hooks/useWidgetForkInteraction.d.ts +68 -0
- package/dist/dts/widget/hooks/useWidgetInteractionActions.d.ts +36 -0
- package/dist/dts/widget/hooks/useWidgetOverlays.d.ts +190 -0
- package/dist/dts/widget/hooks/useWidgetRuntime.d.ts +20 -0
- package/dist/dts/widget/hooks/useWidgetSettings.d.ts +244 -0
- package/dist/dts/widget/hooks/useWidgetWorkspaceIO.d.ts +24 -0
- package/dist/dts/widget/hooks/useWorkspaceDockPanels.d.ts +11 -0
- package/dist/dts/widget/hooks/useWorkspaceLiveTrading.d.ts +28 -0
- package/dist/dts/widget/hooks/useWorkspaceReplayTrading.d.ts +22 -0
- package/dist/dts/widget/i18n/a11y.messages.en.d.ts +8 -0
- package/dist/dts/widget/i18n/a11y.messages.vi.d.ts +3 -0
- package/dist/dts/widget/i18n/capability.messages.en.d.ts +7 -0
- package/dist/dts/widget/i18n/capability.messages.vi.d.ts +3 -0
- package/dist/dts/widget/i18n/dock.messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/dock.messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/messages.licensing.d.ts +48 -0
- package/dist/dts/widget/i18n/messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/trading.messages.en.d.ts +2 -0
- package/dist/dts/widget/i18n/trading.messages.vi.d.ts +2 -0
- package/dist/dts/widget/i18n/types.d.ts +3 -0
- package/dist/dts/widget/iframe/builtInAdapters.d.ts +63 -0
- package/dist/dts/widget/iframe/host-entry.d.ts +11 -0
- package/dist/dts/widget/iframe/hostSDK.d.ts +151 -0
- package/dist/dts/widget/iframe/iframeBridge.d.ts +165 -0
- package/dist/dts/widget/iframe/iframeEntry.d.ts +52 -0
- package/dist/dts/widget/iframe/iframeFrame.d.ts +15 -0
- package/dist/dts/widget/iframe/iframeQuotes.d.ts +20 -0
- package/dist/dts/widget/iframe/messageProtocol.d.ts +545 -0
- package/dist/dts/widget/iframe/quoteHub.d.ts +20 -0
- package/dist/dts/widget/iframe/useVNInvestChartsHost.d.ts +8 -0
- package/dist/dts/widget/iife-entry.d.ts +61 -0
- package/dist/dts/widget/iifeWidgetInstance.d.ts +60 -0
- package/dist/dts/widget/index.d.ts +56 -0
- package/dist/dts/widget/multiChartDefaults.d.ts +18 -0
- package/dist/dts/widget/paneInteractionUtils.d.ts +25 -0
- package/dist/dts/widget/patterns/autoPatternScan.d.ts +77 -0
- package/dist/dts/widget/patterns/patternDrawingFactory.d.ts +87 -0
- package/dist/dts/widget/plugin/ProPluginRegistry.d.ts +40 -0
- package/dist/dts/widget/runtime/ChartScaleAdapter.d.ts +73 -0
- package/dist/dts/widget/runtime/ChartSerializer.d.ts +12 -0
- package/dist/dts/widget/runtime/ForkRuntimeAdapter.d.ts +19 -0
- package/dist/dts/widget/runtime/IRuntimeEngine.d.ts +40 -0
- package/dist/dts/widget/runtime/WorkspaceSerializer.d.ts +31 -0
- package/dist/dts/widget/runtimePolicy.d.ts +36 -0
- package/dist/dts/widget/styles/injectStyles.d.ts +9 -0
- package/dist/dts/widget/theme/ThemeConfig.d.ts +21 -0
- package/dist/dts/widget/theme/applyTheme.d.ts +3 -0
- package/dist/dts/widget/trading/chart/DraggableOrderHandles.d.ts +15 -0
- package/dist/dts/widget/trading/chart/InteractivePositionOverlay.d.ts +19 -0
- package/dist/dts/widget/trading/chart/PendingOrderOverlay.d.ts +11 -0
- package/dist/dts/widget/trading/chart/QuickTradingHeader.d.ts +20 -0
- package/dist/dts/widget/trading/chart/TradingChartSurface.d.ts +8 -0
- package/dist/dts/widget/trading/chart/TradingOverlaysHost.d.ts +28 -0
- package/dist/dts/widget/trading/chart/priceTicks.d.ts +1 -0
- package/dist/dts/widget/trading/chart/useFloatingDrag.d.ts +40 -0
- package/dist/dts/widget/trading/chart/useTradingHotkeys.d.ts +21 -0
- package/dist/dts/widget/trading/config/paperRuntimeConfig.d.ts +53 -0
- package/dist/dts/widget/trading/context/PaperPanelRegistry.d.ts +45 -0
- package/dist/dts/widget/trading/context/TradingContext.d.ts +80 -0
- package/dist/dts/widget/trading/context/WorkspaceTradingSync.d.ts +24 -0
- package/dist/dts/widget/trading/hooks/usePaperRuntimeConfig.d.ts +36 -0
- package/dist/dts/widget/trading/index.d.ts +5 -0
- package/dist/dts/widget/trading/panel/AccountSummaryTab.d.ts +7 -0
- package/dist/dts/widget/trading/panel/ActiveChartPaperPanel.d.ts +26 -0
- package/dist/dts/widget/trading/panel/ConnectedTradingPanel.d.ts +3 -0
- package/dist/dts/widget/trading/panel/HistoryTab.d.ts +5 -0
- package/dist/dts/widget/trading/panel/MarketFallbackBanner.d.ts +4 -0
- package/dist/dts/widget/trading/panel/OrdersTab.d.ts +8 -0
- package/dist/dts/widget/trading/panel/PaperCapitalDialog.d.ts +8 -0
- package/dist/dts/widget/trading/panel/PaperSettingsModal.d.ts +17 -0
- package/dist/dts/widget/trading/panel/PositionsTab.d.ts +15 -0
- package/dist/dts/widget/trading/panel/TradeHistoryTab.d.ts +5 -0
- package/dist/dts/widget/trading/panel/TradingBottomPanel.d.ts +36 -0
- package/dist/dts/widget/trading/panel/TradingLogTab.d.ts +8 -0
- package/dist/dts/widget/trading/panel/TradingPanelHeader.d.ts +17 -0
- package/dist/dts/widget/trading/panel/csvExport.d.ts +18 -0
- package/dist/dts/widget/trading/ticket/ConnectedTradingDockPanel.d.ts +5 -0
- package/dist/dts/widget/trading/ticket/OrderTicketForm.d.ts +31 -0
- package/dist/dts/widget/trading/ticket/OrderTicketModal.d.ts +29 -0
- package/dist/dts/widget/trading/ticket/RegistryTradingDockPanel.d.ts +9 -0
- package/dist/dts/widget/trading/ticket/RiskCalculatorView.d.ts +9 -0
- package/dist/dts/widget/trading/ticket/TradingDockPanel.d.ts +36 -0
- package/dist/dts/widget/trading/ticket/orderTicketModel.d.ts +49 -0
- package/dist/dts/widget/trading/visibility/paperVisibility.d.ts +38 -0
- package/dist/dts/widget/types/dataProvider.d.ts +8 -0
- package/dist/dts/widget/types/fullChartHandle.d.ts +25 -0
- package/dist/dts/widget/types/saas.d.ts +83 -0
- package/dist/dts/widget/types/symbolSearch.d.ts +9 -0
- package/dist/dts/widget/types/watchlist.d.ts +26 -0
- package/dist/dts/widget/utils/axisHit.d.ts +16 -0
- package/dist/dts/widget/utils/chartRange.d.ts +12 -0
- package/dist/dts/widget/utils/chartTypeOptions.d.ts +38 -0
- package/dist/dts/widget/utils/clickOutside.d.ts +1 -0
- package/dist/dts/widget/utils/coordinateBridge.d.ts +31 -0
- package/dist/dts/widget/utils/crosshairSync.d.ts +50 -0
- package/dist/dts/widget/utils/drawingSync.d.ts +198 -0
- package/dist/dts/widget/utils/enrichedHash.d.ts +15 -0
- package/dist/dts/widget/utils/headerSync.d.ts +12 -0
- package/dist/dts/widget/utils/numberFormat.d.ts +13 -0
- package/dist/dts/widget/utils/paperTradeAdapters.d.ts +11 -0
- package/dist/dts/widget/utils/pineSeriesData.d.ts +71 -0
- package/dist/dts/widget/utils/rangeSync.d.ts +29 -0
- package/dist/dts/widget/utils/telemetry.d.ts +19 -0
- package/dist/dts/widget/utils/widgetEquality.d.ts +57 -0
- package/dist/dts/widget/utils/widgetErrors.d.ts +29 -0
- package/dist/dts/widget/utils/widgetHelpers.d.ts +395 -0
- package/dist/dts/widget/utils/xAxisTickFormatter.d.ts +33 -0
- package/dist/dts/widget/visibleRangeBridge.d.ts +28 -0
- package/dist/dts/widget/visibleRangeDiagnostics.d.ts +10 -0
- package/dist/dts/widget/visibleRangePolicies.d.ts +6 -0
- package/dist/dts/widget/workspace/WorkspaceManager.d.ts +23 -0
- package/dist/dts/widget/workspace/WorkspaceStore.d.ts +85 -0
- package/dist/dts/widget/workspace/types.d.ts +21 -0
- package/dist/externalBarsNormalization.worker.js +108 -0
- package/dist/iframe/index.html +63 -0
- package/dist/iframe/injected.css +6456 -0
- package/dist/iframe/vninvestchart.iframe.css +2 -0
- package/dist/iframe/vninvestchart.iframe.js +945 -0
- package/dist/iframe-host/host-entry.cjs +687 -0
- package/dist/iframe-host/host-entry.d.mts +818 -0
- package/dist/iframe-host/host-entry.d.ts +818 -0
- package/dist/iframe-host/host-entry.js +680 -0
- package/dist/index.cjs +7253 -0
- package/dist/index.css +3390 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +6461 -0
- package/dist/injected.css +6456 -0
- package/dist/rollAlgorithms-2P2ZKKHO.js +2 -0
- package/dist/types/runtime.cjs +8 -0
- package/dist/types/runtime.d.mts +92 -0
- package/dist/types/runtime.d.ts +92 -0
- package/dist/types/runtime.js +5 -0
- package/dist/types/runtime.umd.js +14 -0
- package/dist/vninvestchart.iife.css +2 -0
- package/dist/vninvestchart.iife.js +945 -0
- package/package.json +225 -5
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
export declare function numericExtent(values: readonly number[]): [number, number];
|
|
2
|
+
export declare function collectNumbers(value: unknown, collected?: number[]): number[];
|
|
3
|
+
export declare function emaSeries(values: readonly number[], period: number): number[];
|
|
4
|
+
export declare function smaSeries(values: readonly number[], period: number): number[];
|
|
5
|
+
export interface PriceBar {
|
|
6
|
+
open?: number;
|
|
7
|
+
close: number;
|
|
8
|
+
high: number;
|
|
9
|
+
low: number;
|
|
10
|
+
volume: number;
|
|
11
|
+
date?: Date;
|
|
12
|
+
}
|
|
13
|
+
export interface KdjSeriesResult {
|
|
14
|
+
k: number[];
|
|
15
|
+
d: number[];
|
|
16
|
+
j: number[];
|
|
17
|
+
}
|
|
18
|
+
export interface DmiSeriesResult {
|
|
19
|
+
plusDI: number[];
|
|
20
|
+
minusDI: number[];
|
|
21
|
+
adx: number[];
|
|
22
|
+
}
|
|
23
|
+
export interface BrarSeriesResult {
|
|
24
|
+
ar: number[];
|
|
25
|
+
br: number[];
|
|
26
|
+
}
|
|
27
|
+
export interface MtmSeriesResult {
|
|
28
|
+
mtm: number[];
|
|
29
|
+
signal: number[];
|
|
30
|
+
}
|
|
31
|
+
export interface EmvSeriesResult {
|
|
32
|
+
emv: number[];
|
|
33
|
+
signal: number[];
|
|
34
|
+
}
|
|
35
|
+
export interface TrixSeriesResult {
|
|
36
|
+
trix: number[];
|
|
37
|
+
signal: number[];
|
|
38
|
+
}
|
|
39
|
+
export interface DmaSeriesResult {
|
|
40
|
+
ddd: number[];
|
|
41
|
+
ama: number[];
|
|
42
|
+
}
|
|
43
|
+
export interface PsySeriesResult {
|
|
44
|
+
psy: number[];
|
|
45
|
+
signal: number[];
|
|
46
|
+
}
|
|
47
|
+
export interface CrSeriesResult {
|
|
48
|
+
cr: number[];
|
|
49
|
+
ma1: number[];
|
|
50
|
+
ma2: number[];
|
|
51
|
+
ma3: number[];
|
|
52
|
+
ma4: number[];
|
|
53
|
+
}
|
|
54
|
+
export declare function bbiSeries(bars: readonly PriceBar[]): number[];
|
|
55
|
+
export declare function sarSeries(bars: readonly PriceBar[], afStep?: number, afMax?: number): number[];
|
|
56
|
+
export declare function obvSeries(bars: readonly PriceBar[]): number[];
|
|
57
|
+
export declare function wrSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
58
|
+
export declare function vrSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
59
|
+
export declare function emaSeriesSkipNaN(values: readonly number[], period: number): number[];
|
|
60
|
+
export declare function smaSeriesSkipNaN(values: readonly number[], period: number): number[];
|
|
61
|
+
export declare function wilderSeries(values: readonly number[], period: number): number[];
|
|
62
|
+
export declare function wilderSeriesSkipNaN(values: readonly number[], period: number): number[];
|
|
63
|
+
export declare function aoColorSeries(values: readonly number[]): Array<string | undefined>;
|
|
64
|
+
export declare function kdjSeries(bars: readonly PriceBar[], period?: number, m1?: number, m2?: number): KdjSeriesResult;
|
|
65
|
+
export declare function cciSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
66
|
+
export declare function dmiSeries(bars: readonly PriceBar[], period?: number): DmiSeriesResult;
|
|
67
|
+
export declare function biasSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
68
|
+
export declare function brarSeries(bars: readonly PriceBar[], period?: number): BrarSeriesResult;
|
|
69
|
+
export declare function mtmSeries(bars: readonly PriceBar[], period?: number, signalPeriod?: number): MtmSeriesResult;
|
|
70
|
+
export declare function emvSeries(bars: readonly PriceBar[], period?: number): EmvSeriesResult;
|
|
71
|
+
export declare function aoSeries(bars: readonly PriceBar[]): number[];
|
|
72
|
+
export declare function rocSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
73
|
+
export declare function trixSeries(bars: readonly PriceBar[], period?: number, signalPeriod?: number): TrixSeriesResult;
|
|
74
|
+
export declare function dmaSeries(bars: readonly PriceBar[], fastPeriod?: number, slowPeriod?: number, signalPeriod?: number): DmaSeriesResult;
|
|
75
|
+
export declare function pvtSeries(bars: readonly PriceBar[]): number[];
|
|
76
|
+
export declare function psySeries(bars: readonly PriceBar[], period?: number, signalPeriod?: number): PsySeriesResult;
|
|
77
|
+
export declare function crSeries(bars: readonly PriceBar[], period?: number, m1?: number, m2?: number, m3?: number, m4?: number): CrSeriesResult;
|
|
78
|
+
export declare function rsiSeries(values: readonly number[], period: number): number[];
|
|
79
|
+
export interface MacdSeriesResult {
|
|
80
|
+
macd: number[];
|
|
81
|
+
signal: number[];
|
|
82
|
+
histogram: number[];
|
|
83
|
+
}
|
|
84
|
+
export declare function macdSeries(values: readonly number[], fastPeriod: number, slowPeriod: number, signalPeriod: number): MacdSeriesResult;
|
|
85
|
+
export interface BollingerSeriesResult {
|
|
86
|
+
upper: number[];
|
|
87
|
+
middle: number[];
|
|
88
|
+
lower: number[];
|
|
89
|
+
}
|
|
90
|
+
export declare function bollingerSeries(values: readonly number[], period: number, multiplier: number): BollingerSeriesResult;
|
|
91
|
+
export declare function trueRangeSeries(bars: readonly PriceBar[]): number[];
|
|
92
|
+
export declare function atrSeries(bars: readonly PriceBar[], period: number): number[];
|
|
93
|
+
export declare function wmaSeries(values: readonly number[], period: number): number[];
|
|
94
|
+
export declare function vwmaSeries(bars: readonly PriceBar[], period: number): number[];
|
|
95
|
+
export declare function hmaSeries(values: readonly number[], period: number): number[];
|
|
96
|
+
export declare function demaSeries(values: readonly number[], period: number): number[];
|
|
97
|
+
export declare function temaSeries(values: readonly number[], period: number): number[];
|
|
98
|
+
export interface MARibbonSeriesResult {
|
|
99
|
+
[key: string]: number[];
|
|
100
|
+
}
|
|
101
|
+
export declare function maRibbonSeries(values: readonly number[], type?: "SMA" | "EMA", periods?: readonly number[]): MARibbonSeriesResult;
|
|
102
|
+
export interface IchimokuSeriesResult {
|
|
103
|
+
tenkan: number[];
|
|
104
|
+
kijun: number[];
|
|
105
|
+
senkouA: number[];
|
|
106
|
+
senkouB: number[];
|
|
107
|
+
chikou: number[];
|
|
108
|
+
}
|
|
109
|
+
export declare function ichimokuSeries(bars: readonly PriceBar[], tenkanPeriod?: number, kijunPeriod?: number, senkouBPeriod?: number, displacement?: number): IchimokuSeriesResult;
|
|
110
|
+
export interface SupertrendSeriesResult {
|
|
111
|
+
supertrend: number[];
|
|
112
|
+
direction: number[];
|
|
113
|
+
upperBand: number[];
|
|
114
|
+
lowerBand: number[];
|
|
115
|
+
}
|
|
116
|
+
export declare function supertrendSeries(bars: readonly PriceBar[], period?: number, multiplier?: number): SupertrendSeriesResult;
|
|
117
|
+
export interface KeltnerSeriesResult {
|
|
118
|
+
upper: number[];
|
|
119
|
+
middle: number[];
|
|
120
|
+
lower: number[];
|
|
121
|
+
}
|
|
122
|
+
export declare function keltnerSeries(bars: readonly PriceBar[], period?: number, atrPeriod?: number, multiplier?: number): KeltnerSeriesResult;
|
|
123
|
+
export interface DonchianSeriesResult {
|
|
124
|
+
upper: number[];
|
|
125
|
+
middle: number[];
|
|
126
|
+
lower: number[];
|
|
127
|
+
}
|
|
128
|
+
export declare function donchianSeries(bars: readonly PriceBar[], period?: number): DonchianSeriesResult;
|
|
129
|
+
export declare function chaikinVolSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
130
|
+
export declare function stdDevSeries(values: readonly number[], period?: number): number[];
|
|
131
|
+
export declare function historicalVolSeries(values: readonly number[], period?: number, annualize?: boolean): number[];
|
|
132
|
+
export declare function choppinessIndexSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
133
|
+
export declare function cmfSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
134
|
+
export declare function mfiSeries(bars: readonly PriceBar[], period?: number): number[];
|
|
135
|
+
export declare function volOscSeries(bars: readonly PriceBar[], shortPeriod?: number, longPeriod?: number): number[];
|
|
136
|
+
export interface VwapSeriesResult {
|
|
137
|
+
vwap: number[];
|
|
138
|
+
upper1: number[];
|
|
139
|
+
lower1: number[];
|
|
140
|
+
upper2: number[];
|
|
141
|
+
lower2: number[];
|
|
142
|
+
upper3: number[];
|
|
143
|
+
lower3: number[];
|
|
144
|
+
}
|
|
145
|
+
export declare function vwapSeries(bars: readonly PriceBar[], anchor?: "session" | "week" | "month", showBands?: boolean, multiplier?: number): VwapSeriesResult;
|
|
146
|
+
export declare function anchoredVwapSeries(bars: readonly PriceBar[], anchorTime: number, showBands?: boolean, multiplier?: number): VwapSeriesResult;
|
|
147
|
+
export interface AlligatorSeriesResult {
|
|
148
|
+
jaw: number[];
|
|
149
|
+
teeth: number[];
|
|
150
|
+
lips: number[];
|
|
151
|
+
}
|
|
152
|
+
export declare function alligatorSeries(bars: readonly PriceBar[], jawPeriod?: number, jawShift?: number, teethPeriod?: number, teethShift?: number, lipsPeriod?: number, lipsShift?: number): AlligatorSeriesResult;
|
|
153
|
+
export interface FractalsSeriesResult {
|
|
154
|
+
bearish: number[];
|
|
155
|
+
bullish: number[];
|
|
156
|
+
}
|
|
157
|
+
export declare function fractalsSeries(bars: readonly PriceBar[]): FractalsSeriesResult;
|
|
158
|
+
export interface GatorSeriesResult {
|
|
159
|
+
upper: number[];
|
|
160
|
+
lower: number[];
|
|
161
|
+
}
|
|
162
|
+
export declare function gatorSeries(bars: readonly PriceBar[], jawPeriod?: number, jawShift?: number, teethPeriod?: number, teethShift?: number, lipsPeriod?: number, lipsShift?: number): GatorSeriesResult;
|
|
163
|
+
export declare function acSeries(bars: readonly PriceBar[]): number[];
|
|
164
|
+
export interface PivotSeriesResult {
|
|
165
|
+
pp: number[];
|
|
166
|
+
r1: number[];
|
|
167
|
+
s1: number[];
|
|
168
|
+
r2: number[];
|
|
169
|
+
s2: number[];
|
|
170
|
+
r3: number[];
|
|
171
|
+
s3: number[];
|
|
172
|
+
}
|
|
173
|
+
export declare function pivotStandardSeries(bars: readonly PriceBar[], type?: "standard" | "fibonacci" | "camarilla" | "woodie" | "demark"): PivotSeriesResult;
|
|
174
|
+
export declare function pivotHighLowSeries(bars: readonly PriceBar[], lookback?: number, type?: "standard" | "fibonacci"): PivotSeriesResult;
|
|
175
|
+
export declare function synthesizeTicksFromBar(bar: PriceBar, tickSize: number): Array<{
|
|
176
|
+
symbol: string;
|
|
177
|
+
timestamp: number;
|
|
178
|
+
price: number;
|
|
179
|
+
size: number;
|
|
180
|
+
side: "buy" | "sell";
|
|
181
|
+
}>;
|
|
182
|
+
export interface TPOBlock {
|
|
183
|
+
price: number;
|
|
184
|
+
letter: string;
|
|
185
|
+
volume: number;
|
|
186
|
+
timeStart: number;
|
|
187
|
+
timeEnd: number;
|
|
188
|
+
}
|
|
189
|
+
export interface MarketProfileData {
|
|
190
|
+
tpoBlocks: TPOBlock[];
|
|
191
|
+
poc: number;
|
|
192
|
+
valueAreaHigh: number;
|
|
193
|
+
valueAreaLow: number;
|
|
194
|
+
initialBalanceHigh: number;
|
|
195
|
+
initialBalanceLow: number;
|
|
196
|
+
profileHigh: number;
|
|
197
|
+
profileLow: number;
|
|
198
|
+
}
|
|
199
|
+
export declare function computeMarketProfile(ticks: Array<{
|
|
200
|
+
timestamp: number;
|
|
201
|
+
price: number;
|
|
202
|
+
size: number;
|
|
203
|
+
side: "buy" | "sell";
|
|
204
|
+
}>, sessionStart: number, sessionEnd: number, tickSize: number, tpoPeriodMinutes?: number): MarketProfileData;
|
|
205
|
+
export interface VolumeProfileLevel {
|
|
206
|
+
price: number;
|
|
207
|
+
volume: number;
|
|
208
|
+
buyVolume: number;
|
|
209
|
+
sellVolume: number;
|
|
210
|
+
}
|
|
211
|
+
export interface VolumeProfileData {
|
|
212
|
+
priceLevels: VolumeProfileLevel[];
|
|
213
|
+
poc: number;
|
|
214
|
+
valueAreaHigh: number;
|
|
215
|
+
valueAreaLow: number;
|
|
216
|
+
highVolumeNodes: number[];
|
|
217
|
+
lowVolumeNodes: number[];
|
|
218
|
+
}
|
|
219
|
+
export declare function computeVolumeProfile(data: Array<{
|
|
220
|
+
timestamp: number;
|
|
221
|
+
price: number;
|
|
222
|
+
size: number;
|
|
223
|
+
side: "buy" | "sell";
|
|
224
|
+
}> | PriceBar[], priceTickSize: number, range?: {
|
|
225
|
+
from: number;
|
|
226
|
+
to: number;
|
|
227
|
+
}): VolumeProfileData;
|
|
228
|
+
export interface FootprintLevel {
|
|
229
|
+
price: number;
|
|
230
|
+
bidVolume: number;
|
|
231
|
+
askVolume: number;
|
|
232
|
+
delta: number;
|
|
233
|
+
deltaPercent: number;
|
|
234
|
+
totalVolume: number;
|
|
235
|
+
}
|
|
236
|
+
export interface FootprintBar {
|
|
237
|
+
timestamp: number;
|
|
238
|
+
open: number;
|
|
239
|
+
high: number;
|
|
240
|
+
low: number;
|
|
241
|
+
close: number;
|
|
242
|
+
priceLevels: FootprintLevel[];
|
|
243
|
+
}
|
|
244
|
+
export declare function computeFootprintBars(data: Array<{
|
|
245
|
+
timestamp: number;
|
|
246
|
+
price: number;
|
|
247
|
+
size: number;
|
|
248
|
+
side: "buy" | "sell";
|
|
249
|
+
}> | PriceBar[], barIntervalMs: number, priceTickSize: number): FootprintBar[];
|
|
250
|
+
export interface DeltaProfileData {
|
|
251
|
+
cumulativeDelta: number[];
|
|
252
|
+
barDelta: number[];
|
|
253
|
+
deltaSMA: number[];
|
|
254
|
+
divergenceSignals: {
|
|
255
|
+
index: number;
|
|
256
|
+
type: "bullish" | "bearish";
|
|
257
|
+
}[];
|
|
258
|
+
}
|
|
259
|
+
export declare function computeDeltaProfile(footprintBars: FootprintBar[], smaPeriod?: number): DeltaProfileData;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ASTNode } from "./ast";
|
|
2
|
+
export interface IndicatorPlugin {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
version: string;
|
|
6
|
+
compute: (input: {
|
|
7
|
+
bars: any[];
|
|
8
|
+
}, params: any) => Record<string, number[]>;
|
|
9
|
+
outputSchema: any;
|
|
10
|
+
defaultParams: any;
|
|
11
|
+
paramSchema: any;
|
|
12
|
+
dependencies?: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare const pinePlugins: Map<string, IndicatorPlugin>;
|
|
15
|
+
export declare function registerPinePlugin(plugin: IndicatorPlugin): void;
|
|
16
|
+
export declare function getPinePlugin(id: string): IndicatorPlugin | undefined;
|
|
17
|
+
export declare function evaluatePineAST(nodes: ASTNode[], bars: {
|
|
18
|
+
open: number[];
|
|
19
|
+
high: number[];
|
|
20
|
+
low: number[];
|
|
21
|
+
close: number[];
|
|
22
|
+
volume: number[];
|
|
23
|
+
}): {
|
|
24
|
+
studyInfo: {
|
|
25
|
+
name: string;
|
|
26
|
+
overlay: boolean;
|
|
27
|
+
};
|
|
28
|
+
plots: {
|
|
29
|
+
name: string;
|
|
30
|
+
values: number[];
|
|
31
|
+
color: string;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
export declare function compilePineToPlugin(scriptText: string): IndicatorPlugin;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type ASTNode = {
|
|
2
|
+
type: "StudyDeclaration";
|
|
3
|
+
name: string;
|
|
4
|
+
overlay: boolean;
|
|
5
|
+
} | {
|
|
6
|
+
type: "Assignment";
|
|
7
|
+
variable: string;
|
|
8
|
+
expression: ExpressionNode;
|
|
9
|
+
} | {
|
|
10
|
+
type: "Plot";
|
|
11
|
+
expression: ExpressionNode;
|
|
12
|
+
title?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
} | {
|
|
15
|
+
type: "PlotShape";
|
|
16
|
+
expression: ExpressionNode;
|
|
17
|
+
title: string;
|
|
18
|
+
style: string;
|
|
19
|
+
location: string;
|
|
20
|
+
color: string;
|
|
21
|
+
size: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "HLine";
|
|
24
|
+
price: number;
|
|
25
|
+
title: string;
|
|
26
|
+
color: string;
|
|
27
|
+
} | {
|
|
28
|
+
type: "InputDecl";
|
|
29
|
+
variable: string;
|
|
30
|
+
defaultValue: number | string;
|
|
31
|
+
title: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: "IfStatement";
|
|
34
|
+
condition: ExpressionNode;
|
|
35
|
+
thenBlock: ASTNode[];
|
|
36
|
+
elseBlock: ASTNode[];
|
|
37
|
+
} | {
|
|
38
|
+
type: "ForStatement";
|
|
39
|
+
variable: string;
|
|
40
|
+
start: ExpressionNode;
|
|
41
|
+
end: ExpressionNode;
|
|
42
|
+
body: ASTNode[];
|
|
43
|
+
};
|
|
44
|
+
export type ExpressionNode = {
|
|
45
|
+
type: "Literal";
|
|
46
|
+
value: number | string | boolean;
|
|
47
|
+
} | {
|
|
48
|
+
type: "Identifier";
|
|
49
|
+
name: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "BinaryExpression";
|
|
52
|
+
operator: string;
|
|
53
|
+
left: ExpressionNode;
|
|
54
|
+
right: ExpressionNode;
|
|
55
|
+
} | {
|
|
56
|
+
type: "UnaryExpression";
|
|
57
|
+
operator: string;
|
|
58
|
+
argument: ExpressionNode;
|
|
59
|
+
} | {
|
|
60
|
+
type: "FunctionCall";
|
|
61
|
+
name: string;
|
|
62
|
+
arguments: ExpressionNode[];
|
|
63
|
+
};
|
|
64
|
+
export interface SourceLocation {
|
|
65
|
+
line: number;
|
|
66
|
+
column: number;
|
|
67
|
+
offset: number;
|
|
68
|
+
}
|
|
69
|
+
export interface SourceNode {
|
|
70
|
+
location: SourceLocation;
|
|
71
|
+
start: SourceLocation;
|
|
72
|
+
end: SourceLocation;
|
|
73
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { parseScript, type CompileError } from './pineParse';
|
|
2
|
+
import { createSeriesEnv, type PineBars, type SeriesEnv } from './pineEnv';
|
|
3
|
+
export { parseScript, createSeriesEnv, type CompileError, type PineBars };
|
|
4
|
+
/**
|
|
5
|
+
* Một `alertcondition()` đã đánh giá. `condition` là series 0/1 thật — không
|
|
6
|
+
* phải stub: đây chính là điều kiện mà script tuyên bố.
|
|
7
|
+
*/
|
|
8
|
+
export interface AlertSpec {
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
condition: number[];
|
|
12
|
+
}
|
|
13
|
+
export interface CompileResult {
|
|
14
|
+
output: Record<string, number[]>;
|
|
15
|
+
errors: CompileError[];
|
|
16
|
+
alerts: AlertSpec[];
|
|
17
|
+
/**
|
|
18
|
+
* `overlay=` from the `study`/`indicator`/`strategy` declaration, already parsed by the
|
|
19
|
+
* grammar (`grammar.ts:46`). The widget needs it to decide whether the output series joins
|
|
20
|
+
* the price pane or gets its own pane; until this existed, the host hardcoded `"price"` and
|
|
21
|
+
* a non-overlay script was drawn in the wrong place. Defaults to `false` (Pine's own default)
|
|
22
|
+
* when the declaration omits the keyword.
|
|
23
|
+
*/
|
|
24
|
+
overlay?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export { callFunction, MAX_FOR_ITERATIONS, MAX_WHILE_ITERATIONS, MAX_CALL_DEPTH } from './pineBuiltins';
|
|
27
|
+
/**
|
|
28
|
+
* Thực thi AST đã parse với một `env` cho sẵn.
|
|
29
|
+
*
|
|
30
|
+
* F1: `pine.worker.ts` từng GIỮ MỘT BẢN SAO của toàn bộ evaluator này. Hai
|
|
31
|
+
* bản lệch nhau ngay từ A9: bản trong worker không hiểu `boolLiteral`
|
|
32
|
+
* (`parseFloat(true)` = NaN -> 0) nên `ta.tr(true)` cho kết quả khác hẳn giữa
|
|
33
|
+
* editor và chart, và nó cũng không hiểu kênh chuỗi nên `str.*` sẽ chết âm thầm
|
|
34
|
+
* trong editor. Gộp về một hàm là cách chặn họ tái phát: giờ không còn bản sao
|
|
35
|
+
* nào để lệch.
|
|
36
|
+
*
|
|
37
|
+
* Ném exception ra ngoài (kể cả timeout) — cả `compile` lẫn worker đều tự bắt.
|
|
38
|
+
*/
|
|
39
|
+
export declare function runProgram(ast: any[], env: SeriesEnv, length: number, outputs: Record<string, number[]>, alerts?: AlertSpec[]): void;
|
|
40
|
+
export declare function compile(source: string, bars?: PineBars): CompileResult;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NGUỒN THẬT DUY NHẤT của grammar VnScript.
|
|
3
|
+
*
|
|
4
|
+
* `compile.ts` và `pine.worker.ts` đều gọi `peggy.generate(GRAMMAR_SOURCE)` — tức
|
|
5
|
+
* grammar được **biên dịch lúc chạy**, không có bước generate file.
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ W1.2: `grammar.pegjs` từng tồn tại cạnh file này nhưng **không module nào
|
|
8
|
+
* import** (grep toàn repo: 0 kết quả ngoài chính nó). Nó là bản sao chết đã khiến
|
|
9
|
+
* việc tìm lỗi parse rất dễ đi nhầm — sửa file đó không có tác dụng gì. Đã xoá.
|
|
10
|
+
* Nếu muốn đổi grammar, sửa **file này**.
|
|
11
|
+
*/
|
|
12
|
+
export declare const GRAMMAR_SOURCE = "{\n // VnScript Grammar \u2014 PEG.js\n // Phase A subset: study/indicator/strategy, plot, plotshape, hline, if/else, for, input(), 10+ ta.* functions\n // Error recovery via expected() + structured location() on all nodes\n //\n // W-01 (PINE Stage 3): grammar tra ve DONG PHANG, khong long khoa.\n //\n // Do do la chu dich, khong phai tai nang:\n // * `ifBlock = Statement+` nuot TAT CA statement con lai cua script vao khoi,\n // vi `Statement` khong biet \"het khoi o dau\". Do o @ 216a8cd: script\n // `if c` + `x = 1` + `else` + `x = -1` + `plot(x)` cho `output = {}`\n // va `errors = []` \u2014 ve ra KHONG co gi va KHONG bao loi.\n // * Muon long trong grammar thi can truyen \"do thu le cua khoi cha\" cho moi\n // rule, ma peggy 5 KHONG co rule co tham so (`Block$(ind)` khong hop le \u2014\n // xem `node_modules/peggy/lib/parser.js:2083`), va action trong PEG luon\n // chay SAU khi match nen khong gan bien truoc khi parse khoi duoc.\n // * Bang chung chay lai duoc: `scripts/probe-grammar-caps.mjs`.\n //\n // Vay grammar o day chi tach DONG: moi rule ket thuc bang `_EOL` de KHONG an\n // newline, nho do `indent` cua dong con nguyen cho `buildBlocks`.\n // (`pineBlocks.ts` la tang long khoi.)\n //\n // \u26A0\uFE0F `Script` phai la rule DINH NGHIA DAU TIEN (sau initializer). peggy chay\n // `parse()` tu rule dau tien, va `startRule` KHONG c\u1EE9u \u0111\u01B0\u1EE3c rule sau \u2014 thu\n // cho ra `Can't start parsing from rule \"X\"`. Do la ly do `_EOL` (va moi\n // rule phu tro khac) deu nam SAU `Script`.\n}\n\n// `Script` phai la rule DAU TIEN. `_EOL` dinh nghia sau no.\nScript\n = s:SourceLine* {\n return s\n }\n\n// Het dong: xoa khoang trang cuoi dong roi newline (hoac EOF). KHONG gom\n// `[ \\t]*` phia truoc newline vao `indent` cua dong sau \u2014 do la thu le\n// cua dong sau, thuoc ve `SourceLine` tiep theo.\n_EOL\n = [ \\t]* ( \"\\r\"? \"\\n\" / !. )\n\n// `SourceLine` GIU `indent`. Moi alternative cua `Statement` DA ket thuc bang\n// `_EOL`, nen `SourceLine` khong them `_EOL` lan nua \u2014 neu them, no se doi\n// newline thu hai ngay dau dong sau (do la loi da gap).\n//\n// Nh\u00E1nh 3 (d\u00F2ng tr\u1ED1ng) fix 2026-10-11 \u2014 xem pineDefaultTemplate.test.ts.\n// Ph\u1EA3i \u0103n newline: _EOL kh\u1EDBp zero-width \u1EDF EOF n\u00EAn peggy t\u1EEB ch\u1ED1i grammar l\u00FAc generate.\nSourceLine\n = ws:$([ \\t]*) node:(CommentLine / Statement) {\n return { indent: ws.length, node: node }\n }\n / ws:$([ \\t]*) CommentLineRest {\n return { indent: ws.length, node: null }\n }\n / ws:$([ \\t]*) \"\\r\"? \"\\n\" {\n return { indent: ws.length, node: null }\n }\n\n// Dong comment: ca noi dung bo qua, node = null nen `buildBlocks` bo qua.\nCommentLine\n = \"//\" [^\\n]* !. { return null }\n\nCommentLineRest\n = \"//\" [^\\n]* ( \"\\r\"? \"\\n\" / !. )\n\nStatement\n = s:studyDecl _EOL { return s }\n / s:inputCall _EOL { return s }\n / s:funcDeclBlock { return s }\n / s:funcDecl _EOL { return s }\n / s:varDecl _EOL { return s }\n / s:plotCall _EOL { return s }\n / s:plotshapeCall _EOL { return s }\n / s:hlineCall _EOL { return s }\n / s:alertconditionCall _EOL { return s }\n / s:assignment _EOL { return s }\n / s:tupleAssignment _EOL { return s }\n / s:ifStatement _EOL { return s }\n / s:forStatement _EOL { return s }\n / s:whileStatement _EOL { return s }\n / s:elseBlock _EOL { return s }\n\ncomment\n = \"//\" [^\\n]* \"\\n\"? { return null }\n\n\n// W1.2: Pine v5 doi tu \"study\" thanh \"indicator\" va them \"strategy\".\n// Nguoi dung quen TradingView se viet indicator(...) \u2014 neu grammar chi nhan\n// \"study\" thi script hop le bi tu choi. Ca ba tu khoa nhan chung mot shape.\nstudyDecl\n = kw:(\"indicator\" / \"strategy\" / \"study\") _ \"(\" _ title:stringLiteral _ rest:( _ \",\" _ \"overlay\" _ \"=\" _ overlayVal:boolLiteral { return overlayVal } )? _ \")\" {\n return { type: \"StudyDeclaration\", kind: kw, name: title, overlay: rest ?? false, loc: location() }\n }\n\n// W1.2: Pine v5 co \"var\"/\"const\" truoc khai bao bien. To khoa \"while\" va \"not\"\n// VAN chua ho tro \u2014 da bo khoi Monaco de tranh to mau mot tu khoa parser se tu choi.\n//\n// \u26A0 PINE-01 (2026-10-12): `var` nay **tu choi san** thay vi \"parse xong roi im lang\n// tinh sai\". Do evaluator chay vector tren TOAN bo series (xem `compile.ts`\n// `executeNodes`), nen `x := x + close` tinh `close` o moi bar cung mot luc \u2014 KHONG\n// doc gia tri `x` o bar truoc. Do la het `var x = 0` + `x := x + close` cho\n// [10,20,30,40,50,60] trong khi Pine that cho [10,30,60,100,150,210], va\n// `errors = []`. Do la dung lop \"sai ma im lang\" ma repo nay da 3 lan patch\n// (S4-B01/S4-B05/S4-B09) \u2014 nen `var` phai fail-closed cho den khi co\n// evaluator chay TUAN TU (noi lon cua Stage 3), khong phai \"them guard chong guard\".\n//\n// Loi nam O DAY chu khong phai trong `compile.ts`: ca `compile()` LAN worker\n// (`pine.worker.ts:47`) deu goi `p.parse`, nen mot loi nem tu action nay se co\n// `location()` va ca hai duong deu bao dung dong \u2014 truoc day mot guard chi o\n// `compile()` se bi worker bo qua (dung lop A9/F1 da gap 3 lan).\nvarDecl\n = declKind:(\"var\" / \"const\")? _ name:identifier _ op:assignOp _ expr:expression {\n if (declKind === \"var\") {\n const e = new Error(\"var is not supported yet: Pine's var keeps its value across bars, but this engine evaluates every statement across the whole series at once. Drop the var keyword, or wait for sequential evaluation.\")\n e.location = location()\n throw e\n }\n return { type: \"Assignment\", declKind: declKind ?? null, kind: op, variable: name, expression: expr, loc: location() }\n }\n\n// W-01: `=` khai bao, `:=` gan lai. `:=` truoc day bi tu choi trong khi\n// moi gan lai ma khong bao gi \u2014 mot script viet theo thoi quen Viet Nam\n// (TradingView) chi can mot dau hai cham la chay.\nassignOp\n = \":=\" { return \"reassign\" }\n / \"=\" { return \"assign\" }\n\nassignment\n = name:identifier _ op:assignOp _ expr:expression {\n return { type: \"Assignment\", kind: op, variable: name, expression: expr, loc: location() }\n }\n\n// W-05: khoi tach gia tri. KHONG phai array literal; day la phep gan nhieu bien\n// tu MOT bieu thuc tra ve nhieu gia tri.\n//\n// Vi sao can: Pine tra `ta.bb` ra 3 dai (middle/upper/lower) va `ta.macd` ra 3\n// gia tri (macd/signal/hist). Do khong co `[]` o tang Statement, cau hinh\n// `[m, u, l] = ta.bb(close, 20, 2)` that bang parse error (do: probe\n// `probe-pine-stage4.mjs` case S4-01) - ngh\u0129a la nguoi dung Viet Nam viet theo\n// thoi quen TradingView khong chay duoc.\n//\n// KHONG phai `close[1]`: `historyOffset` nam trong `primary` (tang bieu thuc,\n// duoi day ~200 dong), con rule nay nam trong `Statement`. Hai tang PEG roi nhau\n// nen khong va cham. R-01 cua plan Stage 3 bao \"va cham dau mo ngoac vuong la rui\n// ro so 1\" - do la CHAN DOAN SAI; rui ro that la quen them alternative vao\n// `Statement`.\ntupleAssignment\n = \"[\" _ names:tupleNameList _ \"]\" _ op:assignOp _ expr:expression {\n return { type: \"TupleAssignment\", kind: op, variables: names, expression: expr, loc: location() }\n }\n\n// Danh sach ten ben trong ngoac vuong. `&\"]\"` dam bao danh sach rong khong khop:\n// `[] = f()` phai la LOI (khong phai im lang giu 0 bien) - xem AC-1.3.\ntupleNameList\n = &\"]\" \"\" { return [] }\n / head:identifier tail:( _ \",\" _ p:identifier { return p })* { return [head, ...tail] }\n\n// W-01: UDF `f(x) => expr`. PHAI GAN CUOI danh sach Statement: `funcDecl`\n// mo bang `identifier` nen no an het moi rule bat dau bang identifier khac\n// (`study`, `plot`, ...) neu thu truoc no.\nfuncDecl\n = name:identifier _ \"(\" _ params:paramList _ \")\" _ \"=>\" _ body:expression {\n return { type: \"FuncDecl\", name: name, params: params, body: body, loc: location() }\n }\n\n// W-08: than KHOI. `f(x) =>` roi xuong dong, cac dong thut le sau la than.\n//\n// CANH BAO THAT, DA DO (AC-4.13b / R-01 cua plan Stage 4):\n// `f(x) =>` + newline + ` x * 2` (bieu thuc o DONG KE TIEP) DA CHAY DUOC tu\n// truoc W-08, vi `_` la whitespace va no AN newline ngay sau `=>`. Neu khoi thi\n// rule nay that, no se AN dang bieu thuc do va pha script dang chay.\n//\n// Dap ung la lookahead `&StatementBodyFirstLine`: rule khoi chi duoc dung khi\n// dong dau tien cua than that su la mot Statement HOP LE. `x*2` khong phai\n// Statement (khong co dau bang hay `:=` sau `x`) nen lookahead that, PEG\n// fallback ve dang bieu thuc. Rule khoi DONG TRUOC, va dong dau tien phai parse\n// duoc truoc khi rule khoi duoc chap nhan.\n//\n// V\u00EC sao `\"=>\" _EOL` ch\u1EE9 kh\u00F4ng ph\u1EA3i `\"=>\" _ _EOL`: `_` l\u00E0 whitespace v\u00E0 n\u00F3\n// \u0102N newline, n\u00EAn `_EOL` s\u1EBD kh\u00F4ng bao gi\u1EDD kh\u1EDBp. \u0110\u00E2y l\u00E0 l\u00FD do r\u1EA5t nh\u1ECF nh\u01B0ng l\u1EA1i\n// l\u00E0 th\u1EE9 gian nh\u1EA5t \u0111\u1EC3 l\u00E0m rule n\u00E0y ch\u1EBFt im l\u1EB7ng.\n//\n// \u26A0 B\u1EAAY C\u1EE6A TEMPLATE LITERAL, \u0111\u00E3 tr\u00FAng tr\u1EF1c ti\u1EBFp m\u1ED9t l\u1EA7n trong ch\u00EDnh W-08 n\u00E0y:\n// `GRAMMAR_SOURCE` l\u00E0 template literal, n\u00EAn m\u1ED9t chu\u1ED7i BACKSLASH + T/R/N trong\n// COMMENT l\u00E0 ESCAPE TH\u1EACT v\u00E0 s\u1EBD c\u1EAFt ngang d\u00F2ng. Comment vi\u1EBFt sai khi\u1EBFn PEGGY b\u00E1o\n// l\u1ED7i t\u1EA1i m\u1ED9t D\u00D2NG C\u1EE6A CH\u00CDNH GRAMMAR, v\u00E0 **m\u1ECDi** l\u1EC7nh \u0111\u1EC1u \u0111\u1ECF \u2014 k\u1EC3 c\u1EA3 l\u1EC7nh r\u1ED7ng.\n// \u0110\u00FAng \u0111\u1EBFn m\u1EE9c ng\u01B0\u1EDDi \u0111\u1ECDc comment th\u1EA5y ho\u00E0n to\u00E0n \u0111\u00FAng, ch\u1EC9 c\u00F3 compiler m\u1EDBi sai.\n// V\u00EC v\u1EADy trong file n\u00E0y: comment d\u00F9ng `\\``` \u0111\u1EC3 hi\u1EC7n backtick (quy \u01B0\u1EDBc s\u1EB5n c\u00F3\n// c\u1EE7a file), v\u00E0 KH\u00D4NG vi\u1EBFt escape backslash trong comment.\n// V\u00EC sao alternative n\u00E0y KH\u00D4NG c\u00F3 `_EOL` \u1EDF cu\u1ED1i (kh\u00E1c m\u1ECDi rule kh\u00E1c):\n// `funcDeclBlock` \u0111\u00E3 T\u1EF0 \u0102N newline ngay sau `=>` b\u00EAn trong n\u00F3. N\u1EBFu th\u00EAm `_EOL` \u1EDF\n// \u0111\u00E2y th\u00EC parser ph\u1EA3i \u0111\u00F2i m\u1ED9t newline TH\u1EE8 HAI ngay tr\u01B0\u1EDBc d\u00F2ng \u0111\u1EA7u c\u1EE7a th\u00E2n, m\u00E0\n// d\u00F2ng \u0111\u00F3 l\u00E0 ` plot(x)` \u2014 kh\u00F4ng c\u00F3 newline \u21D2 rule ch\u1EBFt, v\u00E0 m\u1ECDi UDF th\u00E2n kh\u1ED1i \u0111\u1EC1u\n// r\u01A1i v\u1EC1 d\u1EA1ng bi\u1EC3u th\u1EE9c r\u1ED3i b\u00E1o parse error. \u0110\u00E3 tr\u00FAng l\u1ED7i n\u00E0y m\u1ED9t l\u1EA7n.\n// \u26A0 `&` phai BO C\u1EA2 C\u00C1P TRONG NGO\u1EB6C: `&A B` trong PEGGY l\u00E0 `(&A) B` \u2014 predicate\n// ch\u1EC9 ph\u1EE7 `A`, c\u00F2n `B` l\u00E0 ph\u1EA7n t\u1EED B\u1EAET BU\u1ED8C ph\u1EA3i kh\u1EDBp t\u1EA1i v\u1ECB tr\u00ED CH\u01AFA consume.\n// V\u1EDBi `&[ \t]+ StatementStart` th\u00EC `StatementStart` ph\u1EA3i kh\u1EDBp ngay tr\u01B0\u1EDBc kho\u1EA3ng\n// tr\u1EAFng \u21D2 lu\u00F4n h\u1ECFng, m\u1ECDi th\u00E2n kh\u1ED1i r\u01A1i v\u1EC1 d\u1EA1ng bi\u1EC3u th\u1EE9c. \u0110o l\u1EA1i b\u1EB1ng grammar\n// peggy t\u1ED1i gi\u1EA3n tr\u01B0\u1EDBc khi tin.\nfuncDeclBlock\n = name:identifier _ \"(\" _ params:paramList _ \")\" _ \"=>\" _EOL &([ \\t]+ StatementStart) {\n return { type: \"FuncDeclBlock\", name: name, params: params, body: [], loc: location() }\n }\n\n// Token mo dau mot STATEMENT \u2014 dung lam lookahead cho `funcDeclBlock`.\n//\n// V\u00EC sao KH\u00D4NG d\u00F9ng `&` v\u1EDBi ch\u00EDnh rule `Statement`: `expression` trong grammar\n// nay \u0102N newline (do `_` l\u00E0 whitespace), n\u00EAn `Statement` th\u1EED parse `if a > 1`\n// r\u1ED3i nu\u1ED1t lu\u00F4n `\\n ` tr\u01B0\u1EDBc khi va `plot(a)` v\u00E0 H\u1ECENG \u2014 lookahead fail d\u00F9\n// d\u00F2ng \u0111\u00F3 l\u00E0 statement h\u1EE3p l\u1EC7. \u0110o \u0111\u01B0\u1EE3c: `StatementBodyFirstLine` kh\u1EDBp\n// ` plot(x)` nh\u01B0ng KH\u00D4NG kh\u1EDBp ` if a > 1\\n plot(a)`.\n//\n// N\u00EAn ta li\u1EC7t k\u00EA \u0111\u00FAng c\u00E1c token m\u1EDF \u0111\u1EA7u statement thay v\u00EC parse statement:\n// * t\u1EEB kho\u00E1 / l\u1EC7nh: if, for, while, plot, plotshape, hline, alertcondition,\n// input, var, const\n// * `[` \u2014 m\u1EDF \u0111\u1EA7u tuple destructuring (W-05)\n// * `identifier` theo sau `=` ho\u1EB7c `:=` \u2014 \u0111\u00E2y l\u00E0 ph\u00E9p g\u00E1n, KH\u00D4NG ph\u1EA3i\n// bi\u1EC3u th\u1EE9c. Ch\u00EDnh \u0111i\u1EC1u n\u00E0y ph\u00E2n ` x = 1` (statement, v\u00E0o kho\u00E1) v\u1EDBi\n// ` x * 2` (bi\u1EC3u th\u1EE9c, ph\u1EA3i r\u01A1i v\u1EC1 d\u1EA1ng bi\u1EC3u th\u1EE9c \u2014 AC-4.13b).\nStatementStart\n = (\"if\" / \"for\" / \"while\" / \"plot\" / \"plotshape\" / \"hline\" / \"alertcondition\" / \"input\" / \"var\" / \"const\" / \"[\")\n / identifier _ \":\" \"=\"\n / identifier _ \"=\"\n / identifier _ \"(\" _ \")\" _ \"=>\"\n\n// `f()` (khong tham so) va `f(a)` / `f(a, b)`.\n//\n// `\"\"` phai co TIA-NHIN `\")\"` o truoc. Khong co no thi `\"\"` luon khop rong\n// o ngay sau `(`, roi `\")\"` that tai `f(a)`. Do la thu tu PEG bat buoc:\n// khong co lookahead thi khong phan bi duoc \"khong co tham so\" voi \"co tham so\".\nparamList\n = &\")\" \"\" { return [] }\n / head:identifier tail:( _ \",\" _ p:identifier { return p })* { return [head, ...tail] }\n\nplotCall\n = \"plot\" _ \"(\" _ expr:expression _ args:plotArgs? _ \")\" {\n return { type: \"Plot\", expression: expr, title: args?.title ?? \"Plot\", color: args?.color ?? \"#2196F3\", loc: location() }\n }\n\nplotArgs\n = rest:( \",\" _ arg:plotArg { return arg })* {\n const r = {}\n for (const a of rest ?? []) Object.assign(r, a)\n return r\n }\n\nplotArg\n = \"title\" _ \"=\" _ val:stringLiteral { return { title: val } }\n / \"color\" _ \"=\" _ val:colorLiteral { return { color: val } }\n // W1.2: chuoi mau la MOT dang hop le (color=\"#ff9800\"). Thieu nhanh nay thi\n // template mac dinh cua PineEditorPanel FAIL parse tai plot() \u2014 da probe thuc te.\n / \"color\" _ \"=\" _ val:stringLiteral { return { color: val } }\n / \"color\" _ \"=\" _ val:identifier { return { color: val } }\n\nplotshapeCall\n = \"plotshape\" _ \"(\" _ expr:expression _ rest:plotshapeArgs? _ \")\" {\n return {\n type: \"PlotShape\", expression: expr,\n title: rest?.title ?? \"Shape\", style: rest?.style ?? \"shape.labelup\",\n location: rest?.location ?? \"location.bottom\", color: rest?.color ?? \"#4CAF50\",\n size: rest?.size ?? \"size.small\", loc: location()\n }\n }\n\nplotshapeArgs\n = rest:( \",\" _ arg:plotshapeArg { return arg })* {\n const r = {}\n for (const a of rest ?? []) Object.assign(r, a)\n return r\n }\n\nplotshapeArg\n = \"title\" _ \"=\" _ val:stringLiteral { return { title: val } }\n / \"style\" _ \"=\" _ val:identifier { return { style: val } }\n / \"location\" _ \"=\" _ val:identifier { return { location: val } }\n / \"color\" _ \"=\" _ val:colorLiteral { return { color: val } }\n // W1.2: chuoi mau, cung hop le nhu colorLiteral \u2014 dong nhat voi plotArg.\n / \"color\" _ \"=\" _ val:stringLiteral { return { color: val } }\n / \"color\" _ \"=\" _ val:identifier { return { color: val } }\n / \"size\" _ \"=\" _ val:identifier { return { size: val } }\n\nhlineCall\n = \"hline\" _ \"(\" _ price:numberLiteral _ rest:hlineArgs? _ \")\" {\n return { type: \"HLine\", price, title: rest?.title ?? \"Line\", color: rest?.color ?? \"#FF9800\", loc: location() }\n }\n\nhlineArgs\n = rest:( \",\" _ arg:hlineArg { return arg })* {\n const r = {}\n for (const a of rest ?? []) Object.assign(r, a)\n return r\n }\n\nhlineArg\n = \"title\" _ \"=\" _ val:stringLiteral { return { title: val } }\n / \"color\" _ \"=\" _ val:colorLiteral { return { color: val } }\n / \"color\" _ \"=\" _ val:stringLiteral { return { color: val } }\n / \"color\" _ \"=\" _ val:identifier { return { color: val } }\n\ninputCall\n = name:identifier _ \"=\" _ \"input\" _ \"(\" _ defVal:expression _ rest:inputArgs? _ \")\" {\n return { type: \"InputDecl\", variable: name, defaultValue: defVal, title: rest?.title ?? name, loc: location() }\n }\n\n// A9: alertcondition l\u00E0 STATEMENT c\u1EE7a Pine, kh\u00F4ng ph\u1EA3i h\u00E0m \u2014 n\u00F3 kh\u00F4ng tr\u1EA3 v\u1EC1\n// series \u0111\u1EC3 plot, n\u00F3 tuy\u00EAn b\u1ED1 m\u1ED9t \u0111i\u1EC1u ki\u1EC7n. \u0110i\u1EC1u ki\u1EC7n \u0111\u01B0\u1EE3c \u0111\u00E1nh gi\u00E1 th\u1EADt trong\n// executeNodes (compile.ts) v\u00E0 tr\u1EA3 v\u1EC1 trong CompileResult.alerts.\nalertconditionCall\n = \"alertcondition\" _ \"(\" _ cond:expression _ rest:alertconditionArgs? _ \")\" {\n return { type: \"AlertCondition\", condition: cond, title: rest?.title ?? \"Alert\", message: rest?.message ?? \"\", loc: location() }\n }\n\nalertconditionArgs\n = rest:( \",\" _ arg:alertconditionArg { return arg })* {\n const r = {}\n for (const a of rest ?? []) Object.assign(r, a)\n return r\n }\n\nalertconditionArg\n = \"title\" _ \"=\" _ val:stringLiteral { return { title: val } }\n / \"message\" _ \"=\" _ val:stringLiteral { return { message: val } }\n\ninputArgs\n = rest:( \",\" _ arg:inputArg { return arg })* {\n const r = {}\n for (const a of rest ?? []) Object.assign(r, a)\n return r\n }\n\ninputArg\n = \"title\" _ \"=\" _ val:stringLiteral { return { title: val } }\n\n// W-01: `if` / `for` / `while` / `else` KHONG con mang khoi. `buildBlocks`\n// (`pineBlocks.ts`) long khoi theo thu le. `thenBlock`/`body` se duoc gan khi\n// builder gap dong sau co thu le sau hon.\nifStatement\n = \"if\" _ cond:expression {\n return { type: \"IfStatement\", condition: cond, thenBlock: [], elseBlock: [], loc: location() }\n }\n\nforStatement\n = \"for\" _ name:identifier _ \"=\" _ start:expression _ \"to\" _ end:expression {\n return { type: \"ForStatement\", variable: name, start: start, end: end, body: [], loc: location() }\n }\n\n// W-01: `while`. `vnscript-grammar.ts` truoc day BIEN `while` khoi danh sach\n// keyword de tranh to mau mot tu khoa parser se tu choi. Bay parser chap nhan.\nwhileStatement\n = \"while\" _ cond:expression {\n return { type: \"WhileStatement\", condition: cond, body: [], loc: location() }\n }\n\n// `else` la DONG RIENG (khong phai con cua `if` trong grammar) \u2014 `buildBlocks`\n// gop no vao `elseBlock` cua khoi `if` ngay tren, cung cap thu le.\nelseBlock\n = \"else\" {\n return { type: \"ElseBlock\", body: [], loc: location() }\n }\n\nexpression\n = ternary\n\n// W-01: toan tu 3 nhanh. Phai thu TRUOC `logicalOr` \u2014 `comparison` khong chap\n// nhan `?` nen neu thu sau, toan bieu thuc se that tai day.\nternary\n = cond:logicalOr _ \"?\" _ whenTrue:expression _ \":\" _ whenFalse:expression {\n return { type: \"Conditional\", condition: cond, whenTrue: whenTrue, whenFalse: whenFalse, loc: location() }\n }\n / logicalOr\n\nlogicalOr\n = head:logicalAnd tail:( _ \"or\" _ expr:logicalAnd { return expr })* {\n return tail.reduce((acc, expr) => ({ type: \"BinaryExpression\", operator: \"or\", left: acc, right: expr, loc: location() }), head)\n }\n\nlogicalAnd\n = head:comparison tail:( _ \"and\" _ expr:comparison { return expr })* {\n return tail.reduce((acc, expr) => ({ type: \"BinaryExpression\", operator: \"and\", left: acc, right: expr, loc: location() }), head)\n }\n\ncomparison\n = head:addition tail:( _ op:compOp _ expr:addition { return { op, expr } })? {\n if (!tail) return head\n return { type: \"BinaryExpression\", operator: tail.op, left: head, right: tail.expr, loc: location() }\n }\n\ncompOp\n = \">=\" / \"<=\" / \"!=\" / \"==\" / \">\" / \"<\"\n\naddition\n = head:multiplication tail:( _ op:addOp _ expr:multiplication { return { op, expr } })* {\n return tail.reduce((acc, el) => ({ type: \"BinaryExpression\", operator: el.op, left: acc, right: el.expr, loc: location() }), head)\n }\n\naddOp\n = \"+\" / \"-\"\n\nmultiplication\n = head:unary tail:( _ op:mulOp _ expr:unary { return { op, expr } })* {\n return tail.reduce((acc, el) => ({ type: \"BinaryExpression\", operator: el.op, left: acc, right: el.expr, loc: location() }), head)\n }\n\nmulOp\n = \"*\" / \"/\"\n\n// W-01: `not` la TOAN TU, phai thu truoc `primary` \u2014 `identifier` se an `not`\n// roi goi no nhu ham, evaluator bao \"Unknown function: not\".\nunary\n = \"not\" _ expr:unary { return { type: \"UnaryExpression\", operator: \"not\", argument: expr, loc: location() } }\n / \"-\" _ expr:unary { return { type: \"UnaryExpression\", operator: \"-\", argument: expr, loc: location() } }\n / primary\n\nprimary\n = functionCall\n / id:identifier off:historyOffset {\n if (!off) return { type: \"Identifier\", name: id }\n return { type: \"HistoryOffset\", offset: off.offset, source: { type: \"Identifier\", name: id }, loc: location() }\n }\n / \"(\" _ expr:expression _ \")\" { return expr }\n // A9: boolLiteral ph\u1EA3i TH\u1EEC TR\u01AF\u1EDAC identifier. identifier kh\u1EDBm \"true\"/\"false\"\n // n\u00EAn nh\u00E1nh boolLiteral \u1EDF d\u01B0\u1EDBi b\u1ECB ch\u1EBFt v\u0129nh vi\u1EC5n: ta.tr(false) b\u00E1o\n // \"Undefined variable: false\" cho d\u00F9 boolLiteral c\u00F3 trong grammar.\n / bool:boolLiteral { return { type: \"Literal\", value: bool } }\n // W-01: `na` la LITERAL, phai thu TRUOC identifier \u2014 `identifier` an `na`\n // nen `plot(na)` bao \"Undefined variable: na\". `!identifierChar` chan\n // `nanny` bi cat thanh `na` + \"nny\".\n / \"na\" !identifierChar { return { type: \"Literal\", value: NaN } }\n / id:identifier { return { type: \"Identifier\", name: id } }\n / num:numberLiteral { return { type: \"Literal\", value: num } }\n // F1: KH\u00D4NG c\u1EA7n d\u1EDDi stringLiteral l\u00EAn tr\u01B0\u1EDBc identifier nh\u01B0 boolLiteral. \u0110\u00E3\n // probe th\u1EADt (kh\u00F4ng suy \u0111o\u00E1n): plot('hello') v\u00E0 plot(\"hello\") \u0111\u1EC1u parse ra\n // node Literal value \"hello\". L\u00FD do: identifier b\u1EAFt bu\u1ED9c m\u1EDF \u0111\u1EA7u b\u1EB1ng ch\u1EEF c\u00E1i\n // ho\u1EB7c g\u1EA1ch d\u01B0\u1EDBi, c\u00F2n stringLiteral m\u1EDF \u0111\u1EA7u b\u1EB1ng d\u1EA5u nh\u00E1y \u0111\u01A1n ho\u1EB7c nh\u00E1y k\u00E9p.\n // Hai t\u1EADp k\u00FD t\u1EF1 \u0111\u1EA7u r\u1EDDi nhau n\u00EAn kh\u00F4ng th\u1EC3 nu\u1ED1t nhau. Nh\u00E1nh chu\u1ED7i \u0111\u00E3 lu\u00F4n s\u1ED1ng;\n // n\u00F3 ch\u1EBFt \u1EDF T\u1EA6NG \u0110\u00C1NH GI\u00C1 (evalExpr g\u1ECDi parseFloat), kh\u00F4ng ph\u1EA3i \u1EDF grammar.\n / str:stringLiteral { return { type: \"Literal\", value: str } }\n\n// W-01: `close[1]`, `ta.sma(close,14)[2]` \u2014 lich su mot gia tri truoc.\nidentifierChar\n = [a-zA-Z0-9_.]\n\nfunctionCall\n = name:identifier _ \"(\" _ args:argumentList? _ \")\" off:historyOffset? {\n const call = { type: \"FunctionCall\", name: name, arguments: args ?? [], loc: location() }\n if (!off) return call\n return { type: \"HistoryOffset\", offset: off.offset, source: call, loc: location() }\n }\n\n// W-01: lich su. `numberLiteral` la `[0-9]+(\".\"[0-9]+)?` nen `[1.5]` la\n// offset 1.5 (Pine cung vay) chu khong phai `[1]` roi `.5`.\nhistoryOffset\n = \"[\" _ n:numberLiteral _ \"]\" {\n return { offset: n }\n }\n\nargumentList\n = head:expression tail:( _ \",\" _ expr:expression { return expr })* {\n return [head, ...tail]\n }\n\nidentifier\n = name:$([a-zA-Z_][a-zA-Z0-9_.]*) { return name }\n\nliteral\n = numberLiteral\n / stringLiteral\n / boolLiteral\n\nnumberLiteral\n = value:$([0-9]+(\".\"[0-9]+)?) { return parseFloat(value) }\n\n// GR1: escape sequences inside a literal string.\n// Pine v6 reference, Concepts > Strings > Escape sequences:\n// - the backslash is the escape character. Characters that are special in a\n// string definition (a quote, a backslash) become LITERAL when prefixed by\n// a backslash, so an escaped backslash yields a single backslash.\n// - \\n is U+000A and \\t is U+0009; unprefixed n and t stay literal.\n// - \"If a backslash applied to a character does not form a supported escape\n// sequence, the character's meaning does not change.\" The page's own\n// example title begins with a backslash followed by T, and its note says\n// the value also includes the backslash before T while T still appears\n// literally in the displayed text.\n// => an unsupported escape keeps BOTH the backslash and the character.\n// This is also the conservative choice: nothing is silently deleted, and a\n// Windows path or a regex-ish string round-trips intact.\n//\n// PINE_ESCAPES_BEYOND_DOCS: the page names only n and t plus the two characters\n// that were already special. Carriage return and \\uXXXX are NOT documented;\n// they are implemented because the task requires them, and both are additive --\n// a backslash was inert before GR1, so nothing that parsed before changes\n// except by deliberately using one of these two. A script that relies on\n // \\u being LITERAL will diverge from real Pine. Flagged, not assumed away.\n//\n// The one intentional change to previously-parsing input: a lone trailing\n// backslash immediately before the closing quote is now a parse error, because\n// in Pine that backslash escapes the delimiter and the literal never closes.\nstringLiteral\n = \"'\" chars:sqParts \"'\" { return chars }\n / '\"' chars:dqParts '\"' { return chars }\n\nsqParts\n = parts:sqChar* { return parts.join(\"\") }\n\ndqParts\n = parts:dqChar* { return parts.join(\"\") }\n\n// The delimiter is excluded from the plain-char class. PEG repetition does not\n// backtrack, so a class that also matched the closing quote would be eaten by\n// the star and the rule could never terminate. The old rule spelled the same\n// exclusion out as a negated class; this keeps that property explicitly.\nsqChar\n = \"\\\\\" seq:escape { return seq }\n / ch:[^\\\\'] { return ch }\n\ndqChar\n = \"\\\\\" seq:escape { return seq }\n / ch:[^\\\\\"] { return ch }\n\n// Ordered choice: a \\u NOT followed by four hex digits fails this whole\n// alternative and falls through to the final catch-all, so it stays literal\n// instead of half-decoding.\nescape\n = \"n\" { return \"\\n\" }\n / \"t\" { return \"\\t\" }\n / \"r\" { return \"\\r\" }\n / \"\\\\\" { return \"\\\\\" }\n / \"'\" { return \"'\" }\n / '\"' { return '\"' }\n / \"u\" hex:$([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) { return String.fromCharCode(parseInt(hex, 16)) }\n / ch:. { return \"\\\\\" + ch }\n\nboolLiteral\n = \"true\" { return true }\n / \"false\" { return false }\n\ncolorLiteral\n = \"#\" chars:$([0-9a-fA-F]+) { return \"#\" + chars }\n\n_ \"whitespace\"\n = [ \\t\\r\\n]*\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pineBlocks — W-01 (PINE Stage 3): LONG KHOI CAU LENH THEO THU LE.
|
|
3
|
+
*
|
|
4
|
+
* VÌ SAO FILE NÀY TỒN TẠI (và vì sao grammar KHÔNG tự lồng khoá):
|
|
5
|
+
*
|
|
6
|
+
* `grammar.ts` trước đây để `ifBlock = Statement+`. Vì `Statement` không biết
|
|
7
|
+
* "hết khoá ở đâu", **mọi** statement còn lại của script bị nuốt vào khoá. Đo
|
|
8
|
+
* thật ở `216a8cd` (`docs/upgrade-standard/plans/PLAN_PINE_STAGE3_2026-10-09.md`
|
|
9
|
+
* §2.2): script `if c` / ` x = 1` / `else` / ` x = -1` / `plot(x)` cho
|
|
10
|
+
* `output = {}` và `errors = []` — tức **vẽ ra không có gì và không báo lỗi**.
|
|
11
|
+
*
|
|
12
|
+
* Ba ràng buộc về công cụ đo được, không đoán
|
|
13
|
+
* (`scripts/probe-grammar-caps.mjs` chạy lại được):
|
|
14
|
+
* 1. peggy 5 **không có rule có tham số** (`Block$(ind)` không hợp lệ — xem
|
|
15
|
+
* `node_modules/peggy/lib/parser.js:2083`).
|
|
16
|
+
* 2. `startRule` **phải là rule định nghĩa đầu tiên**.
|
|
17
|
+
* 3. Action trong PEG **luôn chạy sau** khi match, nên không gán được biến
|
|
18
|
+
* "độ thụt lẽ của khoá cha" *trước* khi khoá được parse.
|
|
19
|
+
*
|
|
20
|
+
* ⇒ Tách hai tầng: **grammar chỉ tách DÒNG** (indent + statement),
|
|
21
|
+
* **tầng này lồng khoá**. Tầng builder là code thuần, test được bằng vitest, và
|
|
22
|
+
* không phải tranh đấu với cơ chế backtracking của PEG — nơi một predicate sai
|
|
23
|
+
* sẽ hỏng âm thầm toàn bộ khoá.
|
|
24
|
+
*
|
|
25
|
+
* Hợp đồng đầu vào: `lines: SourceLine[]` — mỗi phần tử là
|
|
26
|
+
* `{ indent: number, node: object | null }`. `node === null` là dòng comment.
|
|
27
|
+
*/
|
|
28
|
+
import type { CompileError } from './pineParse';
|
|
29
|
+
/** Một dòng nguồn: độ thụt lẽ (số space/tab) + node đã parse. */
|
|
30
|
+
export interface SourceLine {
|
|
31
|
+
indent: number;
|
|
32
|
+
node: Record<string, unknown> | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Ghép các dòng phẳng thành cây, kết thúc khoá khi thụt lẽ **không còn lớn
|
|
36
|
+
* hơn** khoá cha.
|
|
37
|
+
*
|
|
38
|
+
* Vì sao `<=` chứ không phải `<`: hai khoá ngang cấp phải là hai khoá anh em,
|
|
39
|
+
* và một dòng quay lại đúng cấp `if` là **thoát** khoá đó. Đây cũng là chỗ
|
|
40
|
+
* `else` (cùng cấp với `if`) được xử lý: `buildBlocks` gom nó thành
|
|
41
|
+
* `elseBlock` của khoá `if` ngay trước, chứ không nhét vào `thenBlock`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildBlocks(lines: SourceLine[]): Record<string, unknown>[];
|
|
44
|
+
/**
|
|
45
|
+
* Lỗi cấu trúc khoá. Tách riêng để `parseScript` đổi thành `CompileError` có
|
|
46
|
+
* `line`/`column` — evaluator chỉ bắt `Error`, nên nếu để lọt thì thông điệp
|
|
47
|
+
* "else without if" sẽ mất vị trí và người dùng phải tự dò script.
|
|
48
|
+
*/
|
|
49
|
+
export declare class PineBlockError extends Error {
|
|
50
|
+
readonly line?: number;
|
|
51
|
+
readonly column?: number;
|
|
52
|
+
constructor(message: string, line?: number, column?: number);
|
|
53
|
+
toCompileError(): CompileError;
|
|
54
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type SeriesEnv } from './pineEnv';
|
|
2
|
+
export declare const MAX_FOR_ITERATIONS = 1000;
|
|
3
|
+
/**
|
|
4
|
+
* W-03: trần vòng lặp của `while`.
|
|
5
|
+
*
|
|
6
|
+
* `TIMEOUT_MS = 1000` **không** đủ làm trần: một vòng `while` rẻ (chỉ cộng hai
|
|
7
|
+
* số) có thể chạy hàng triệu lần mà vẫn không hết 1s trên máy nhanh — tức
|
|
8
|
+
* timeout **không bảo đảm** chống treo. Một hằng đếm được thì có.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_WHILE_ITERATIONS = 10000;
|
|
11
|
+
/**
|
|
12
|
+
* W-03: trần độ sâu đệ quy của UDF.
|
|
13
|
+
*
|
|
14
|
+
* Đo được: `f(x) => f(x)` trước khi có hằng này cho **"Maximum call stack
|
|
15
|
+
* size exceeded"** — tức `RangeError`, không phải `CompileError`, nên editor hiện
|
|
16
|
+
* một thông báo không liên quan tới script. `checkTimeout()` không cứu được vì cả
|
|
17
|
+
* vòng đệ quy nằm trong MỘT lần gọi `evalExpr` — timer không có cơ hội chạy.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MAX_CALL_DEPTH = 100;
|
|
20
|
+
export declare function evalBinaryExpr(left: number[], op: string, right: number[], length: number): number[];
|
|
21
|
+
/**
|
|
22
|
+
* Dispatcher duy nhất của Pine. `pine.worker.ts` import hàm này thay vì giữ
|
|
23
|
+
* một bản sao — trước đây hai bản sao lệch nhau theo thời gian và editor báo
|
|
24
|
+
* lỗi cho script chạy được.
|
|
25
|
+
*/
|
|
26
|
+
export declare function callFunction(name: string, args: number[][], length: number, env: SeriesEnv): number[];
|
|
27
|
+
/**
|
|
28
|
+
* W-05: những builtin mà Pine trả **nhiều** giá trị, nên script phải destructure.
|
|
29
|
+
*
|
|
30
|
+
* Danh sách này là hợp đồng với `evalTupleExpr` (`compile.ts`). Thêm tên vào đây
|
|
31
|
+
* mà quên implement trong `callTupleFunction` ⇒ nhãn nằm, không có hành vi.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MULTI_VALUE_BUILTINS: Set<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Đánh giá builtin theo hình **tuple**: luôn trả `number[][]`.
|
|
36
|
+
*
|
|
37
|
+
* Vì sao KHÔNG đổi `callFunction` cho ra `number[][]`: `callFunction` là hợp
|
|
38
|
+
* đồng công khai với `pine.worker.ts` và có **12 call site thật** trong
|
|
39
|
+
* `pineFailClosed.test.ts` (đo: `git grep -c callFunction`). Đổi chữ ký nghĩa
|
|
40
|
+
* là sửa 13+ chỗ để rồi mỗi chỗ lại là một chỗ có thể sai. Thay vào đó hàm này
|
|
41
|
+
* là lớp **thêm**, còn `callFunction` giữ nguyên và gọi xuống đây cho phần
|
|
42
|
+
* một-giá-trị.
|
|
43
|
+
*
|
|
44
|
+
* Mọi builtin chưa biết trả về `[callFunction(...)]` — mảng **một** phần tử —
|
|
45
|
+
* để phía gán bắt được lệch số và báo lỗi thay vì âm thầm lấy `[0]`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function callTupleFunction(name: string, args: number[][], length: number, env: SeriesEnv): number[][];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pineEnv — nhóm ENV tách từ `compile.ts` (W-05, PINE Stage 2).
|
|
3
|
+
*
|
|
4
|
+
* Lá trong DAG: không import `compile`, `pineParse`, `pineMath` hay worker.
|
|
5
|
+
* `SeriesEnv` được export vì `compile.ts` cần nó trong chữ ký `callFunction` /
|
|
6
|
+
* `runProgram` (back-import, không phải shim `export-from` trần).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Series đang có trong môi trường lúc đánh giá. Pine cho phép builtin tự đọc
|
|
10
|
+
* series chuẩn (`ta.atr(14)` = ATR của high/low/close) nên dispatcher cần `env`,
|
|
11
|
+
* không chỉ các tham số vị trí.
|
|
12
|
+
*/
|
|
13
|
+
export type SeriesEnv = Map<string, number[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Builtin không có series ở tham số đầu: tham số đầu là số (period / cờ), hoặc
|
|
16
|
+
* builtin tự đọc series ngầm định. Nếu không, lỗi "requires at least 1
|
|
17
|
+
* argument" của `ta.sma` sẽ chặn nhầm `ta.atr(14)`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const NO_SOURCE_ARG: Set<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Series chuẩn theo tên. Không có series (lượt validate của editor) → mảng
|
|
22
|
+
* NaN, KHÔNG phải mảng 0: 0 là giá thật và sẽ vẽ ra đường bằng 0 (Rule 15).
|
|
23
|
+
*/
|
|
24
|
+
export declare function series(env: SeriesEnv, name: string, length: number): number[];
|
|
25
|
+
export interface PineBars {
|
|
26
|
+
open: number[];
|
|
27
|
+
high: number[];
|
|
28
|
+
low: number[];
|
|
29
|
+
close: number[];
|
|
30
|
+
volume: number[];
|
|
31
|
+
time?: number[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Dựng môi trường series chuẩn. Dùng bởi `compile` VÀ `pine.worker` — nếu hai bên
|
|
35
|
+
* khai báo khác nhau, editor báo "Undefined variable: hlc3" cho script mà chart vẫn
|
|
36
|
+
* chạy được.
|
|
37
|
+
*
|
|
38
|
+
* W1.2: tên biến series chuẩn của Pine. Khi KHÔNG có `bars` (lượt validate của
|
|
39
|
+
* editor gọi `compile(source)` — PineEditorPanel.tsx:137) các tên này phải vẫn
|
|
40
|
+
* "đã định nghĩa", nếu không mọi script dùng dữ liệu giá đều báo
|
|
41
|
+
* "Undefined variable: close" — kể cả template mặc định.
|
|
42
|
+
* Mảng RỖNG, không phải số 0: đây là lượt kiểm tra cú pháp/ký hiệu, không có dữ
|
|
43
|
+
* liệu thì không được bịa giá trị (AGENTS.md Rule 15). NaN ở đâu đó tương
|
|
44
|
+
* đương "chưa có giá trị" — mảng rỗng nói đúng hơn.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createSeriesEnv(bars?: PineBars): SeriesEnv;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pineMath — nhóm MATH tách từ `compile.ts` (W-05, PINE Stage 2).
|
|
3
|
+
*
|
|
4
|
+
* Lá trong DAG: thuần tính toán, không import `compile`, `pineParse`,
|
|
5
|
+
* `pineEnv` hay worker.
|
|
6
|
+
*/
|
|
7
|
+
/** RMA (Wilder). Cùng công thức với `wilderSeries` — `src/lib/indicators/utils.ts:328`. */
|
|
8
|
+
export declare function rma(src: number[], period: number, length: number): number[];
|
|
9
|
+
/**
|
|
10
|
+
* Parabolic SAR (Wilder). Cùng thuật toán với `sarSeries` ở
|
|
11
|
+
* `src/lib/indicators/utils.ts:153`; test khoá lại bằng cách so hai kết quả.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parabolicSar(high: number[], low: number[], close: number[], start: number, inc: number, max: number, length: number): number[];
|