openalgo-script 0.1.0-alpha.1 → 0.4.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/CHANGELOG.md +1469 -0
- package/README.md +85 -30
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +221 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +166 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/adapters/codemirror/commands.d.ts +14 -0
- package/dist/adapters/codemirror/commands.d.ts.map +1 -0
- package/dist/adapters/codemirror/commands.js +52 -0
- package/dist/adapters/codemirror/commands.js.map +1 -0
- package/dist/adapters/codemirror/completion.d.ts +15 -0
- package/dist/adapters/codemirror/completion.d.ts.map +1 -0
- package/dist/adapters/codemirror/completion.js +64 -0
- package/dist/adapters/codemirror/completion.js.map +1 -0
- package/dist/adapters/codemirror/contract.d.ts +156 -0
- package/dist/adapters/codemirror/contract.d.ts.map +1 -0
- package/dist/adapters/codemirror/contract.js +42 -0
- package/dist/adapters/codemirror/contract.js.map +1 -0
- package/dist/adapters/codemirror/index.d.ts +43 -0
- package/dist/adapters/codemirror/index.d.ts.map +1 -0
- package/dist/adapters/codemirror/index.js +8 -0
- package/dist/adapters/codemirror/index.js.map +1 -0
- package/dist/adapters/codemirror/lint.d.ts +17 -0
- package/dist/adapters/codemirror/lint.d.ts.map +1 -0
- package/dist/adapters/codemirror/lint.js +62 -0
- package/dist/adapters/codemirror/lint.js.map +1 -0
- package/dist/adapters/codemirror/positions.d.ts +16 -0
- package/dist/adapters/codemirror/positions.d.ts.map +1 -0
- package/dist/adapters/codemirror/positions.js +65 -0
- package/dist/adapters/codemirror/positions.js.map +1 -0
- package/dist/adapters/codemirror/stream.d.ts +23 -0
- package/dist/adapters/codemirror/stream.d.ts.map +1 -0
- package/dist/adapters/codemirror/stream.js +70 -0
- package/dist/adapters/codemirror/stream.js.map +1 -0
- package/dist/adapters/codemirror/tokens.d.ts +44 -0
- package/dist/adapters/codemirror/tokens.d.ts.map +1 -0
- package/dist/adapters/codemirror/tokens.js +34 -0
- package/dist/adapters/codemirror/tokens.js.map +1 -0
- package/dist/adapters/codemirror/tooltips.d.ts +35 -0
- package/dist/adapters/codemirror/tooltips.d.ts.map +1 -0
- package/dist/adapters/codemirror/tooltips.js +108 -0
- package/dist/adapters/codemirror/tooltips.js.map +1 -0
- package/dist/core/accounting/charges.d.ts +136 -0
- package/dist/core/accounting/charges.d.ts.map +1 -0
- package/dist/core/accounting/charges.js +362 -0
- package/dist/core/accounting/charges.js.map +1 -0
- package/dist/core/accounting/equity.d.ts +158 -0
- package/dist/core/accounting/equity.d.ts.map +1 -0
- package/dist/core/accounting/equity.js +155 -0
- package/dist/core/accounting/equity.js.map +1 -0
- package/dist/core/accounting/index.d.ts +44 -0
- package/dist/core/accounting/index.d.ts.map +1 -0
- package/dist/core/accounting/index.js +36 -0
- package/dist/core/accounting/index.js.map +1 -0
- package/dist/core/accounting/markers.d.ts +43 -0
- package/dist/core/accounting/markers.d.ts.map +1 -0
- package/dist/core/accounting/markers.js +64 -0
- package/dist/core/accounting/markers.js.map +1 -0
- package/dist/core/accounting/monthly.d.ts +52 -0
- package/dist/core/accounting/monthly.d.ts.map +1 -0
- package/dist/core/accounting/monthly.js +99 -0
- package/dist/core/accounting/monthly.js.map +1 -0
- package/dist/core/accounting/report.d.ts +38 -0
- package/dist/core/accounting/report.d.ts.map +1 -0
- package/dist/core/accounting/report.js +63 -0
- package/dist/core/accounting/report.js.map +1 -0
- package/dist/core/accounting/shapes.d.ts +70 -0
- package/dist/core/accounting/shapes.d.ts.map +1 -0
- package/dist/core/accounting/shapes.js +21 -0
- package/dist/core/accounting/shapes.js.map +1 -0
- package/dist/core/accounting/statistics.d.ts +75 -0
- package/dist/core/accounting/statistics.d.ts.map +1 -0
- package/dist/core/accounting/statistics.js +246 -0
- package/dist/core/accounting/statistics.js.map +1 -0
- package/dist/core/accounting/trades.d.ts +118 -0
- package/dist/core/accounting/trades.d.ts.map +1 -0
- package/dist/core/accounting/trades.js +186 -0
- package/dist/core/accounting/trades.js.map +1 -0
- package/dist/core/backtest/compare.d.ts +38 -0
- package/dist/core/backtest/compare.d.ts.map +1 -0
- package/dist/core/backtest/compare.js +189 -0
- package/dist/core/backtest/compare.js.map +1 -0
- package/dist/core/backtest/declaration.d.ts +52 -0
- package/dist/core/backtest/declaration.d.ts.map +1 -0
- package/dist/core/backtest/declaration.js +48 -0
- package/dist/core/backtest/declaration.js.map +1 -0
- package/dist/core/backtest/drive.d.ts +29 -0
- package/dist/core/backtest/drive.d.ts.map +1 -0
- package/dist/core/backtest/drive.js +262 -0
- package/dist/core/backtest/drive.js.map +1 -0
- package/dist/core/backtest/index.d.ts +46 -0
- package/dist/core/backtest/index.d.ts.map +1 -0
- package/dist/core/backtest/index.js +36 -0
- package/dist/core/backtest/index.js.map +1 -0
- package/dist/core/backtest/range.d.ts +84 -0
- package/dist/core/backtest/range.d.ts.map +1 -0
- package/dist/core/backtest/range.js +90 -0
- package/dist/core/backtest/range.js.map +1 -0
- package/dist/core/backtest/record.d.ts +238 -0
- package/dist/core/backtest/record.d.ts.map +1 -0
- package/dist/core/backtest/record.js +176 -0
- package/dist/core/backtest/record.js.map +1 -0
- package/dist/core/backtest/replay.d.ts +48 -0
- package/dist/core/backtest/replay.d.ts.map +1 -0
- package/dist/core/backtest/replay.js +127 -0
- package/dist/core/backtest/replay.js.map +1 -0
- package/dist/core/backtest/resting.d.ts +62 -0
- package/dist/core/backtest/resting.d.ts.map +1 -0
- package/dist/core/backtest/resting.js +59 -0
- package/dist/core/backtest/resting.js.map +1 -0
- package/dist/core/backtest/settings.d.ts +117 -0
- package/dist/core/backtest/settings.d.ts.map +1 -0
- package/dist/core/backtest/settings.js +207 -0
- package/dist/core/backtest/settings.js.map +1 -0
- package/dist/core/backtest/simulate.d.ts +146 -0
- package/dist/core/backtest/simulate.d.ts.map +1 -0
- package/dist/core/backtest/simulate.js +217 -0
- package/dist/core/backtest/simulate.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +164 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +23 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +49 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +31 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-prose.generated.d.ts +16 -0
- package/dist/core/check/library-prose.generated.d.ts.map +1 -0
- package/dist/core/check/library-prose.generated.js +353 -0
- package/dist/core/check/library-prose.generated.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +62 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +129 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +64 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +182 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +31 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +25 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +59 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +61 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +95 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +64 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +2 -2
- package/dist/core/version/version.generated.d.ts.map +1 -1
- package/dist/core/version/version.generated.js +2 -2
- package/dist/core/version/version.generated.js.map +1 -1
- package/dist/editor/complete.d.ts +40 -0
- package/dist/editor/complete.d.ts.map +1 -0
- package/dist/editor/complete.js +206 -0
- package/dist/editor/complete.js.map +1 -0
- package/dist/editor/diagnose.d.ts +18 -0
- package/dist/editor/diagnose.d.ts.map +1 -0
- package/dist/editor/diagnose.js +70 -0
- package/dist/editor/diagnose.js.map +1 -0
- package/dist/editor/format.d.ts +11 -0
- package/dist/editor/format.d.ts.map +1 -0
- package/dist/editor/format.js +50 -0
- package/dist/editor/format.js.map +1 -0
- package/dist/editor/highlight.d.ts +28 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/highlight.js +65 -0
- package/dist/editor/highlight.js.map +1 -0
- package/dist/editor/hover.d.ts +40 -0
- package/dist/editor/hover.d.ts.map +1 -0
- package/dist/editor/hover.js +147 -0
- package/dist/editor/hover.js.map +1 -0
- package/dist/editor/index.d.ts +60 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +7 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/kinds.d.ts +27 -0
- package/dist/editor/kinds.d.ts.map +1 -0
- package/dist/editor/kinds.js +118 -0
- package/dist/editor/kinds.js.map +1 -0
- package/dist/editor/layout.d.ts +47 -0
- package/dist/editor/layout.d.ts.map +1 -0
- package/dist/editor/layout.js +135 -0
- package/dist/editor/layout.js.map +1 -0
- package/dist/editor/manifest.d.ts +47 -0
- package/dist/editor/manifest.d.ts.map +1 -0
- package/dist/editor/manifest.js +93 -0
- package/dist/editor/manifest.js.map +1 -0
- package/dist/editor/reading.d.ts +41 -0
- package/dist/editor/reading.d.ts.map +1 -0
- package/dist/editor/reading.js +51 -0
- package/dist/editor/reading.js.map +1 -0
- package/dist/editor/scan.d.ts +26 -0
- package/dist/editor/scan.d.ts.map +1 -0
- package/dist/editor/scan.js +139 -0
- package/dist/editor/scan.js.map +1 -0
- package/dist/editor/scope.d.ts +19 -0
- package/dist/editor/scope.d.ts.map +1 -0
- package/dist/editor/scope.js +99 -0
- package/dist/editor/scope.js.map +1 -0
- package/dist/editor/signature.d.ts +38 -0
- package/dist/editor/signature.d.ts.map +1 -0
- package/dist/editor/signature.js +112 -0
- package/dist/editor/signature.js.map +1 -0
- package/dist/editor/site.d.ts +46 -0
- package/dist/editor/site.d.ts.map +1 -0
- package/dist/editor/site.js +184 -0
- package/dist/editor/site.js.map +1 -0
- package/dist/editor/spacing.d.ts +29 -0
- package/dist/editor/spacing.d.ts.map +1 -0
- package/dist/editor/spacing.js +116 -0
- package/dist/editor/spacing.js.map +1 -0
- package/package.json +66 -15
- package/spec/errors.json +522 -183
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +255 -0
- package/src/adapters/charts/tables.ts +243 -0
- package/src/adapters/codemirror/commands.ts +53 -0
- package/src/adapters/codemirror/completion.ts +74 -0
- package/src/adapters/codemirror/contract.ts +156 -0
- package/src/adapters/codemirror/index.ts +66 -0
- package/src/adapters/codemirror/lint.ts +66 -0
- package/src/adapters/codemirror/positions.ts +79 -0
- package/src/adapters/codemirror/stream.ts +87 -0
- package/src/adapters/codemirror/tokens.ts +64 -0
- package/src/adapters/codemirror/tooltips.ts +113 -0
- package/src/core/accounting/charges.ts +452 -0
- package/src/core/accounting/equity.ts +276 -0
- package/src/core/accounting/index.ts +49 -0
- package/src/core/accounting/markers.ts +95 -0
- package/src/core/accounting/monthly.ts +137 -0
- package/src/core/accounting/report.ts +89 -0
- package/src/core/accounting/shapes.ts +73 -0
- package/src/core/accounting/statistics.ts +350 -0
- package/src/core/accounting/trades.ts +313 -0
- package/src/core/backtest/compare.ts +244 -0
- package/src/core/backtest/declaration.ts +97 -0
- package/src/core/backtest/drive.ts +364 -0
- package/src/core/backtest/index.ts +52 -0
- package/src/core/backtest/range.ts +137 -0
- package/src/core/backtest/record.ts +341 -0
- package/src/core/backtest/replay.ts +158 -0
- package/src/core/backtest/resting.ts +125 -0
- package/src/core/backtest/settings.ts +280 -0
- package/src/core/backtest/simulate.ts +304 -0
- package/src/core/catalogue/catalogue.generated.ts +23 -9
- package/src/core/catalogue/values.generated.ts +14 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +70 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-prose.generated.ts +367 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +149 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +220 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +76 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +118 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +212 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/names.ts +29 -2
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/version.generated.ts +2 -2
- package/src/editor/complete.ts +266 -0
- package/src/editor/diagnose.ts +71 -0
- package/src/editor/format.ts +85 -0
- package/src/editor/highlight.ts +110 -0
- package/src/editor/hover.ts +199 -0
- package/src/editor/index.ts +65 -0
- package/src/editor/kinds.ts +157 -0
- package/src/editor/layout.ts +189 -0
- package/src/editor/manifest.ts +119 -0
- package/src/editor/reading.ts +69 -0
- package/src/editor/scan.ts +162 -0
- package/src/editor/scope.ts +122 -0
- package/src/editor/signature.ts +150 -0
- package/src/editor/site.ts +233 -0
- package/src/editor/spacing.ts +132 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The drawing objects a host reads, as facts rather than as heap contents.
|
|
3
|
+
*
|
|
4
|
+
* The heap is the engine's own representation: a polyline's path is a
|
|
5
|
+
* reference into it, a handle is an integer, and neither means anything to
|
|
6
|
+
* whoever is drawing. This is the door between the two. A host is handed one
|
|
7
|
+
* record per live object, in creation order, with every value resolved, and it
|
|
8
|
+
* never dereferences anything.
|
|
9
|
+
*
|
|
10
|
+
* **An anchor is a time and a price.** That is the whole of where an object
|
|
11
|
+
* sits, and it is why an object survives what happens to the view: a zoom
|
|
12
|
+
* changes pixels and nothing here, loading more history renumbers every bar and
|
|
13
|
+
* nothing here, and an anchor past the newest bar is carried through as it was
|
|
14
|
+
* written so a projection reaches into the margin instead of being clamped to
|
|
15
|
+
* the last bar. Turning either number into a coordinate is the host's job and
|
|
16
|
+
* needs the host's scales, which is exactly why the engine does not attempt it.
|
|
17
|
+
*
|
|
18
|
+
* **Absence is a gap.** An anchor with no time or no price, and a style value a
|
|
19
|
+
* script left absent, are handed over absent. `language.md` 6.7 fixes what that
|
|
20
|
+
* means on a drawing surface: nothing is drawn there, and nothing is invented
|
|
21
|
+
* to fill it.
|
|
22
|
+
*
|
|
23
|
+
* **A host reads this after every execution, re-executions of a moving bar
|
|
24
|
+
* included.** The set is rebuilt from what the bar left behind, which the
|
|
25
|
+
* rollback has already restored, so a host that draws whatever it is given here
|
|
26
|
+
* needs no rule of its own for a chart that ticks.
|
|
27
|
+
*/
|
|
28
|
+
import type { DrawingObject, Heap, Value } from './values/index.js';
|
|
29
|
+
import { isNumber } from './values/index.js';
|
|
30
|
+
|
|
31
|
+
export type DrawingKind = DrawingObject['kind'];
|
|
32
|
+
|
|
33
|
+
/** Where one point of an object sits, in the two units a chart never loses. */
|
|
34
|
+
export interface Anchor {
|
|
35
|
+
readonly time: number | null;
|
|
36
|
+
readonly price: number | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** One live object, as the surface holding it needs to see it. */
|
|
40
|
+
export interface Drawing {
|
|
41
|
+
/** Stable while the object lives, so a host can hold its own view of it. */
|
|
42
|
+
readonly id: number;
|
|
43
|
+
readonly kind: DrawingKind;
|
|
44
|
+
/**
|
|
45
|
+
* The object's points, in order.
|
|
46
|
+
*
|
|
47
|
+
* A line and a box have two, a label has one, and a polyline has as many as
|
|
48
|
+
* its path. A host that knows the kind knows what the points mean, and one
|
|
49
|
+
* that does not can still draw the extent of it.
|
|
50
|
+
*/
|
|
51
|
+
readonly anchors: readonly Anchor[];
|
|
52
|
+
/**
|
|
53
|
+
* Everything that is not a point: colours, text, width, line style, the
|
|
54
|
+
* extend flags, the fill opacity and the tooltip, under the names
|
|
55
|
+
* `stdlib.md` 14.4 gives them.
|
|
56
|
+
*/
|
|
57
|
+
readonly style: Readonly<Record<string, Value>>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The property pairs each kind anchors itself with, in order. */
|
|
61
|
+
const ANCHORS: Readonly<Record<DrawingKind, readonly (readonly [string, string])[]>> = {
|
|
62
|
+
line: [
|
|
63
|
+
['t1', 'p1'],
|
|
64
|
+
['t2', 'p2'],
|
|
65
|
+
],
|
|
66
|
+
box: [
|
|
67
|
+
['t1', 'p1'],
|
|
68
|
+
['t2', 'p2'],
|
|
69
|
+
],
|
|
70
|
+
label: [['t', 'p']],
|
|
71
|
+
polyline: [],
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function numberOf(value: Value | undefined): number | null {
|
|
75
|
+
return value !== undefined && isNumber(value) ? value : null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** A polyline's path, from the two arrays the object copied at the call. */
|
|
79
|
+
function pathOf(heap: Heap, object: DrawingObject): readonly Anchor[] {
|
|
80
|
+
const times = heap.deref(object.props['times'] ?? null);
|
|
81
|
+
const prices = heap.deref(object.props['prices'] ?? null);
|
|
82
|
+
const timeItems = times !== undefined && times.kind === 'array' ? times.items : [];
|
|
83
|
+
const priceItems = prices !== undefined && prices.kind === 'array' ? prices.items : [];
|
|
84
|
+
const out: Anchor[] = [];
|
|
85
|
+
for (let i = 0; i < Math.max(timeItems.length, priceItems.length); i += 1) {
|
|
86
|
+
out.push({ time: numberOf(timeItems[i]), price: numberOf(priceItems[i]) });
|
|
87
|
+
}
|
|
88
|
+
return out;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function anchorsOf(heap: Heap, object: DrawingObject): readonly Anchor[] {
|
|
92
|
+
if (object.kind === 'polyline') return pathOf(heap, object);
|
|
93
|
+
return ANCHORS[object.kind].map(([time, price]) => ({
|
|
94
|
+
time: numberOf(object.props[time]),
|
|
95
|
+
price: numberOf(object.props[price]),
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function styleOf(object: DrawingObject): Readonly<Record<string, Value>> {
|
|
100
|
+
const anchored = new Set<string>(['times', 'prices']);
|
|
101
|
+
for (const [time, price] of ANCHORS[object.kind]) {
|
|
102
|
+
anchored.add(time);
|
|
103
|
+
anchored.add(price);
|
|
104
|
+
}
|
|
105
|
+
const out: Record<string, Value> = {};
|
|
106
|
+
for (const key of Object.keys(object.props)) {
|
|
107
|
+
if (!anchored.has(key)) out[key] = object.props[key] ?? null;
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Every object the script holds, oldest first.
|
|
114
|
+
*
|
|
115
|
+
* Creation order rather than any other, because it is the order the script
|
|
116
|
+
* wrote and therefore the order a reader expects one drawing to sit over
|
|
117
|
+
* another. Deleted objects are not here at all: an object lives until the
|
|
118
|
+
* script deletes it, and then it is gone rather than hidden.
|
|
119
|
+
*/
|
|
120
|
+
export function drawingsIn(heap: Heap): readonly Drawing[] {
|
|
121
|
+
return heap.drawings().map(({ id, object }) => ({
|
|
122
|
+
id,
|
|
123
|
+
kind: object.kind,
|
|
124
|
+
anchors: anchorsOf(heap, object),
|
|
125
|
+
style: styleOf(object),
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bar cycle, `compiled-program.md` 5.1, and the one door a host comes
|
|
3
|
+
* through.
|
|
4
|
+
*
|
|
5
|
+
* Eleven steps in one order, and everything else in the engine is a detail of
|
|
6
|
+
* one of them. Two pairs of steps carry the whole of what makes a live chart
|
|
7
|
+
* and a backtest of the same data agree:
|
|
8
|
+
*
|
|
9
|
+
* - **Steps 1 and 2 make a still-moving bar idempotent.** The newest bar
|
|
10
|
+
* re-executes on every update, so the state rolls back to the start of that
|
|
11
|
+
* bar and the register histories are truncated before anything runs again.
|
|
12
|
+
* - **Steps 8 and 9 separate what a script may do on a moving bar from what it
|
|
13
|
+
* may not.** The drawing is recomputed from scratch and published every time;
|
|
14
|
+
* a signal, an alert or an order waits for the bar to close.
|
|
15
|
+
*
|
|
16
|
+
* **Nothing here throws.** A host draws many studies in one render loop and a
|
|
17
|
+
* platform runs many customers' scripts in one process, so a failure becomes a
|
|
18
|
+
* diagnostic on this script and touches nothing else. The catch is deliberately
|
|
19
|
+
* broad: a diagnostic carries its code and position, and anything else becomes
|
|
20
|
+
* OS6018, because a verified program that still threw is not the program
|
|
21
|
+
* verification walked.
|
|
22
|
+
*/
|
|
23
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
24
|
+
import type { Span } from '../span/index.js';
|
|
25
|
+
import { barField, barViewOf, factsFor } from './bars.js';
|
|
26
|
+
import type { BarFacts, BarState, HostBar } from './bars.js';
|
|
27
|
+
import { alertsFor } from './alerts.js';
|
|
28
|
+
import type { Alerts } from './alerts.js';
|
|
29
|
+
import { Budget, stepBound } from './budget.js';
|
|
30
|
+
import type { EngineLimits } from './budget.js';
|
|
31
|
+
import { Channels } from './channels.js';
|
|
32
|
+
import { ScriptError, spanAt, unexpected } from './errors.js';
|
|
33
|
+
import { guardFor } from './guard.js';
|
|
34
|
+
import { hostFactsFor } from './host.js';
|
|
35
|
+
import { fieldValue } from './inputs.js';
|
|
36
|
+
import type { ResolvedInput } from './inputs.js';
|
|
37
|
+
import { manifestEntry } from './library/index.js';
|
|
38
|
+
import type { BarView, ManifestEntry } from './library/index.js';
|
|
39
|
+
import type { LoadOptions } from './load.js';
|
|
40
|
+
import { Machine } from './machine.js';
|
|
41
|
+
import { Memory } from './memory.js';
|
|
42
|
+
import { Registers } from './registers.js';
|
|
43
|
+
import { Grids } from './grids.js';
|
|
44
|
+
import type { Grid } from './grids.js';
|
|
45
|
+
import type { Ledger } from './ledger/index.js';
|
|
46
|
+
import type { LedgerRow, OrderFrame } from './ledger/index.js';
|
|
47
|
+
import { ledgerFor, routedEffects } from './orders.js';
|
|
48
|
+
import type { CompiledProgram, Position } from './types.js';
|
|
49
|
+
import type { RequestPlan } from './request-plan.js';
|
|
50
|
+
import { NO_SESSION, sessionReader } from './session/index.js';
|
|
51
|
+
import type { SessionReader } from './session/index.js';
|
|
52
|
+
import { noBars, outOfOrder } from './series.js';
|
|
53
|
+
import { barMinutesOf } from './timeframe.js';
|
|
54
|
+
import { RequestSet } from './requests.js';
|
|
55
|
+
import type { Value } from './values/index.js';
|
|
56
|
+
import { Heap } from './values/index.js';
|
|
57
|
+
import { drawingsIn } from './drawings.js';
|
|
58
|
+
import type { Drawing } from './drawings.js';
|
|
59
|
+
import type { BarResult, RunResult } from './results.js';
|
|
60
|
+
|
|
61
|
+
export class Engine {
|
|
62
|
+
private readonly registers: Registers;
|
|
63
|
+
private readonly memory: Memory;
|
|
64
|
+
private readonly channels: Channels;
|
|
65
|
+
private readonly heap = new Heap();
|
|
66
|
+
private readonly budget: Budget;
|
|
67
|
+
private readonly machine: Machine;
|
|
68
|
+
private readonly library: ManifestEntry[] = [];
|
|
69
|
+
private readonly grids: Grids;
|
|
70
|
+
private readonly onUnconfirmed: boolean;
|
|
71
|
+
private readonly alerting: Alerts;
|
|
72
|
+
private readonly requests: RequestSet;
|
|
73
|
+
/**
|
|
74
|
+
* What this strategy sent and what became of it, `stdlib.md` 17.7. Held by
|
|
75
|
+
* the run rather than asked of the host, because a host's position row is per
|
|
76
|
+
* contract and shared: reading it is reading somebody else's trade.
|
|
77
|
+
*/
|
|
78
|
+
private readonly ledger: Ledger;
|
|
79
|
+
/**
|
|
80
|
+
* The instrument's session, read once from the record it belongs to.
|
|
81
|
+
*
|
|
82
|
+
* Once because the record is read once, at load, and is constant for the
|
|
83
|
+
* whole run (`host-interface.md` 4.4). A session that changed between bar ten
|
|
84
|
+
* and bar eleven would anchor the first ten bars of a study to one schedule
|
|
85
|
+
* and the rest of the same chart to another.
|
|
86
|
+
*/
|
|
87
|
+
private readonly sessions: SessionReader;
|
|
88
|
+
/**
|
|
89
|
+
* The bars the engine has been given, which a read folds.
|
|
90
|
+
*
|
|
91
|
+
* A read of the chart's own instrument at a coarser interval is folded from
|
|
92
|
+
* these, so the fold needs the bars themselves and not only the registers
|
|
93
|
+
* derived from them. `run` seeds the whole dataset before bar 0 and `append`
|
|
94
|
+
* adds one at a time, which is the difference a `"lookahead"` read shows and
|
|
95
|
+
* the other two modes do not: lookahead reads to the end of the bucket the
|
|
96
|
+
* chart bar is inside, and on a live feed there is nothing there yet. That is
|
|
97
|
+
* the mode repainting on history, permanently and by design.
|
|
98
|
+
*/
|
|
99
|
+
private known: HostBar[] = [];
|
|
100
|
+
|
|
101
|
+
private supplied = 0;
|
|
102
|
+
private index = -1;
|
|
103
|
+
private updates = 0;
|
|
104
|
+
private started = false;
|
|
105
|
+
private previousClose: Value = null;
|
|
106
|
+
private lastClose: Value = null;
|
|
107
|
+
private facts: BarFacts;
|
|
108
|
+
private view: BarView;
|
|
109
|
+
private failure: Diagnostic | undefined;
|
|
110
|
+
|
|
111
|
+
readonly program: CompiledProgram;
|
|
112
|
+
private readonly inputs: readonly ResolvedInput[];
|
|
113
|
+
private readonly options: LoadOptions;
|
|
114
|
+
|
|
115
|
+
constructor(
|
|
116
|
+
program: CompiledProgram,
|
|
117
|
+
inputs: readonly ResolvedInput[],
|
|
118
|
+
options: LoadOptions,
|
|
119
|
+
limits: EngineLimits,
|
|
120
|
+
plans: readonly RequestPlan[] = [],
|
|
121
|
+
) {
|
|
122
|
+
this.program = program;
|
|
123
|
+
this.inputs = inputs;
|
|
124
|
+
this.options = options;
|
|
125
|
+
this.registers = new Registers(program.series.length);
|
|
126
|
+
this.memory = new Memory(program.cells, program.states);
|
|
127
|
+
this.channels = new Channels(program.channels);
|
|
128
|
+
this.budget = new Budget(
|
|
129
|
+
limits,
|
|
130
|
+
limits.steps ?? stepBound(program),
|
|
131
|
+
program.limits.loops,
|
|
132
|
+
options.clock,
|
|
133
|
+
);
|
|
134
|
+
this.onUnconfirmed = fieldValue(program.meta.onUnconfirmed, inputs) === true;
|
|
135
|
+
// A watched condition's title and frequency are declaration fields, which a
|
|
136
|
+
// script may write with an `input()`, and inputs are resolved at load. So
|
|
137
|
+
// they are read once here rather than per bar, as every other declaration
|
|
138
|
+
// the descriptor is built from is.
|
|
139
|
+
this.alerting = alertsFor(program, inputs);
|
|
140
|
+
|
|
141
|
+
for (const entry of program.lib.functions) {
|
|
142
|
+
// Verification refused a name this engine does not have, so the lookup
|
|
143
|
+
// cannot fail here and the table is resolved once rather than per call.
|
|
144
|
+
this.library.push(manifestEntry(entry.name, entry.arity) as ManifestEntry);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const instrument = options.host?.instrument;
|
|
148
|
+
this.sessions = sessionReader(
|
|
149
|
+
instrument?.session,
|
|
150
|
+
typeof instrument?.timezone === 'string' ? instrument.timezone : null,
|
|
151
|
+
barMinutesOf(instrument?.interval),
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
const facts = hostFactsFor(() => this.options.host ?? {}, {
|
|
155
|
+
answered: (id: Value) => this.requests.answered(id),
|
|
156
|
+
failure: (id: Value) => this.requests.failure(id),
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
this.ledger = ledgerFor(program, inputs, instrument);
|
|
160
|
+
const position = {
|
|
161
|
+
size: (): Value => this.ledger.size(),
|
|
162
|
+
avgPrice: (): Value => this.ledger.avgPrice(),
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
this.facts = factsFor(0, 1, {}, true, 1, NO_SESSION);
|
|
166
|
+
this.view = barViewOf({ open: null, high: null, low: null, close: null, time: null }, this.facts, null);
|
|
167
|
+
|
|
168
|
+
const fnPositions: (readonly Position[])[] = program.functions.map(() => []);
|
|
169
|
+
for (const [fn, positions] of program.debug.fnPos) fnPositions[fn] = positions;
|
|
170
|
+
|
|
171
|
+
this.machine = new Machine(
|
|
172
|
+
{
|
|
173
|
+
program,
|
|
174
|
+
registers: this.registers,
|
|
175
|
+
memory: this.memory,
|
|
176
|
+
channels: this.channels,
|
|
177
|
+
heap: this.heap,
|
|
178
|
+
budget: this.budget,
|
|
179
|
+
guard: guardFor(this.budget),
|
|
180
|
+
host: facts,
|
|
181
|
+
position,
|
|
182
|
+
library: this.library,
|
|
183
|
+
fnPositions,
|
|
184
|
+
spanAt: (line: number, column: number): Span => spanAt(options.source, line, column),
|
|
185
|
+
},
|
|
186
|
+
this.view,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
this.requests = new RequestSet(
|
|
190
|
+
{
|
|
191
|
+
program,
|
|
192
|
+
plans: new Map(plans.map((one) => [one.request.id, one])),
|
|
193
|
+
host: options.host ?? {},
|
|
194
|
+
limits,
|
|
195
|
+
clock: options.clock,
|
|
196
|
+
library: this.library,
|
|
197
|
+
inputs,
|
|
198
|
+
facts,
|
|
199
|
+
position,
|
|
200
|
+
heapOf: () => this.heap,
|
|
201
|
+
spanAt: (line: number, column: number): Span => spanAt(options.source, line, column),
|
|
202
|
+
},
|
|
203
|
+
program.requests,
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
this.grids = new Grids(program, inputs, this.heap);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** Whether a failure has stopped this script. A stopped script stays stopped. */
|
|
210
|
+
get failed(): boolean {
|
|
211
|
+
return this.failure !== undefined;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** How many bars the engine has been given. */
|
|
215
|
+
get barCount(): number {
|
|
216
|
+
return this.supplied;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* A new bar arrives.
|
|
221
|
+
*
|
|
222
|
+
* Step 11 of the previous bar happens here rather than at the end of it,
|
|
223
|
+
* because a checkpoint is taken only if the engine is moving on to the next
|
|
224
|
+
* bar, and until one arrives the previous bar may still be re-executed.
|
|
225
|
+
*/
|
|
226
|
+
append(bar: HostBar, state: BarState = {}, supplied = this.supplied + 1): BarResult {
|
|
227
|
+
// Before anything moves: a bar that does not follow the one before it is
|
|
228
|
+
// refused rather than executed, because every value the bar produces would
|
|
229
|
+
// be derived from a history that never happened (`series.ts`). A script
|
|
230
|
+
// that has already failed keeps the failure it has, which is the one that
|
|
231
|
+
// explains what went wrong first.
|
|
232
|
+
if (this.failure === undefined) {
|
|
233
|
+
const problem = outOfOrder(bar, this.known[this.index], this.index + 1);
|
|
234
|
+
if (problem !== undefined) return this.refuse(problem);
|
|
235
|
+
}
|
|
236
|
+
if (this.started) this.checkpoint();
|
|
237
|
+
this.index += 1;
|
|
238
|
+
this.supplied = Math.max(supplied, this.index + 1);
|
|
239
|
+
this.updates = 1;
|
|
240
|
+
this.started = true;
|
|
241
|
+
this.previousClose = this.lastClose;
|
|
242
|
+
if (this.known.length <= this.index) this.known[this.index] = bar;
|
|
243
|
+
return this.execute(bar, state, true);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The newest bar changed, so it runs again.
|
|
248
|
+
*
|
|
249
|
+
* Step 1: the checkpoint from the end of the previous bar is restored, except
|
|
250
|
+
* that `"live"` cells keep their current values, which is the whole of
|
|
251
|
+
* `live var`. Everything else rolls back, so executing a moving bar ten times
|
|
252
|
+
* gives the same answer as executing it once.
|
|
253
|
+
*/
|
|
254
|
+
update(bar: HostBar, state: BarState = {}): BarResult {
|
|
255
|
+
if (!this.started) return this.append(bar, state);
|
|
256
|
+
// A revision is the same bar again, so it is held to the same order: an
|
|
257
|
+
// update whose time has moved back onto the bar before it is a series the
|
|
258
|
+
// engine cannot run on, whatever it is called.
|
|
259
|
+
if (this.failure === undefined) {
|
|
260
|
+
const problem = outOfOrder(bar, this.known[this.index - 1], this.index);
|
|
261
|
+
if (problem !== undefined) return this.refuse(problem);
|
|
262
|
+
}
|
|
263
|
+
this.rollback();
|
|
264
|
+
this.updates += 1;
|
|
265
|
+
// A revision replaces the bar the fold already read, so the bucket it is
|
|
266
|
+
// inside is rebuilt from this reading rather than from the one it replaced.
|
|
267
|
+
this.known[this.index] = bar;
|
|
268
|
+
return this.execute(bar, state, false);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A whole dataset, appended in order. Stops at the first bar that fails.
|
|
273
|
+
*
|
|
274
|
+
* The whole set is handed to the fold before bar 0 rather than discovered one
|
|
275
|
+
* bar at a time. Nothing about a confirmed or a developing read changes: both
|
|
276
|
+
* stop at the bar being executed, so running a dataset and appending it bar by
|
|
277
|
+
* bar give the same numbers. A `"lookahead"` read is the one that differs, and
|
|
278
|
+
* that difference is the mode: it reads to the end of the bucket the chart bar
|
|
279
|
+
* is inside, which exists in a dataset and does not exist on a live feed.
|
|
280
|
+
*
|
|
281
|
+
* A dataset with nothing in it is OS6010 and not an empty result, because a
|
|
282
|
+
* pane with nothing drawn on it is what a study that computed nothing also
|
|
283
|
+
* produces and only the engine can tell the two apart.
|
|
284
|
+
*/
|
|
285
|
+
run(bars: readonly HostBar[], states: readonly BarState[] = []): RunResult {
|
|
286
|
+
const out: BarResult[] = [];
|
|
287
|
+
// A dataset with nothing in it is the one hand-over that has no bar to
|
|
288
|
+
// report against, so it is answered here rather than by the loop below,
|
|
289
|
+
// which would run no iterations and return a clean, empty, wordless result.
|
|
290
|
+
if (bars.length === 0 && !this.started) {
|
|
291
|
+
const diagnostic = this.failure ?? noBars(this.options.host?.instrument);
|
|
292
|
+
this.failure = diagnostic;
|
|
293
|
+
return { bars: [], diagnostic };
|
|
294
|
+
}
|
|
295
|
+
this.known = [...bars];
|
|
296
|
+
for (let i = 0; i < bars.length; i += 1) {
|
|
297
|
+
const bar = bars[i];
|
|
298
|
+
if (bar === undefined) continue;
|
|
299
|
+
const result = this.append(bar, states[i] ?? {}, bars.length);
|
|
300
|
+
out.push(result);
|
|
301
|
+
if (result.diagnostic !== undefined) return { bars: out, diagnostic: result.diagnostic };
|
|
302
|
+
}
|
|
303
|
+
return { bars: out, diagnostic: undefined };
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* A frame from the destination, `host-interface.md` 7.2. Held until the next
|
|
308
|
+
* bar begins rather than folded where it lands: nothing reaches a running
|
|
309
|
+
* execution, so every position fact is constant for the length of one and a
|
|
310
|
+
* moving bar sees what its first execution saw.
|
|
311
|
+
*/
|
|
312
|
+
deliver(frame: OrderFrame): void {
|
|
313
|
+
this.ledger.deliver(frame);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** The strategy's own ledger, `stdlib.md` 17.7, oldest row first. */
|
|
317
|
+
orders(): readonly LedgerRow[] {
|
|
318
|
+
return this.ledger.rows();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
private execute(bar: HostBar, state: BarState, isNew: boolean): BarResult {
|
|
322
|
+
if (this.failure !== undefined) {
|
|
323
|
+
return {
|
|
324
|
+
index: this.index,
|
|
325
|
+
columns: [],
|
|
326
|
+
applied: false,
|
|
327
|
+
effects: [],
|
|
328
|
+
frames: [],
|
|
329
|
+
alerts: [],
|
|
330
|
+
diagnostic: this.failure,
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
const index = this.index;
|
|
334
|
+
// The fold, at the boundary between two bars and before step 4. A
|
|
335
|
+
// re-execution folds nothing: the same frames reaching one bar twice would
|
|
336
|
+
// settle the same fill twice.
|
|
337
|
+
const frames = isNew ? this.ledger.settle() : [];
|
|
338
|
+
// The bar before this one, which is what says whether this bar opened a
|
|
339
|
+
// session or is inside the one that bar was already in. Read from the bars
|
|
340
|
+
// themselves rather than carried, so a re-executed bar compares against the
|
|
341
|
+
// same neighbour it compared against the first time.
|
|
342
|
+
const previous = this.known[index - 1]?.time ?? null;
|
|
343
|
+
this.facts = factsFor(
|
|
344
|
+
index,
|
|
345
|
+
this.supplied,
|
|
346
|
+
state,
|
|
347
|
+
isNew,
|
|
348
|
+
this.updates,
|
|
349
|
+
this.sessions.factsAt(bar.time ?? null, previous),
|
|
350
|
+
);
|
|
351
|
+
this.view = barViewOf(bar, this.facts, this.previousClose);
|
|
352
|
+
|
|
353
|
+
try {
|
|
354
|
+
// Step 2. Any entry a previous execution of this bar wrote is discarded.
|
|
355
|
+
this.registers.truncate(index);
|
|
356
|
+
|
|
357
|
+
// Step 3.
|
|
358
|
+
this.channels.clear();
|
|
359
|
+
this.registers.clearCurrent();
|
|
360
|
+
this.budget.begin(index);
|
|
361
|
+
this.grids.clear();
|
|
362
|
+
this.machine.begin(this.view, index);
|
|
363
|
+
|
|
364
|
+
// Step 4.
|
|
365
|
+
const slots = this.machine.slots();
|
|
366
|
+
for (const register of this.program.series) {
|
|
367
|
+
if (register.kind !== 'bar' || register.field === null) continue;
|
|
368
|
+
this.registers.set(register.id, barField(register.field, bar, this.facts));
|
|
369
|
+
}
|
|
370
|
+
// The same step fills each read's `"request"` register, absent where the
|
|
371
|
+
// answer has not arrived or the read's mode allows no value yet (2.16).
|
|
372
|
+
if (!this.requests.empty) this.requests.fill(this.registers, this.known, index, isNew);
|
|
373
|
+
|
|
374
|
+
// Step 5. An input's value and a grid's handle land in their slots here,
|
|
375
|
+
// and nothing is resolved: that happened once, at load.
|
|
376
|
+
for (const input of this.inputs) {
|
|
377
|
+
slots[input.slot] =
|
|
378
|
+
input.field === undefined ? input.value : barField(input.field, bar, this.facts);
|
|
379
|
+
}
|
|
380
|
+
this.grids.fill(slots);
|
|
381
|
+
|
|
382
|
+
// Step 6.
|
|
383
|
+
this.machine.run();
|
|
384
|
+
} catch (thrown) {
|
|
385
|
+
return this.stopped(thrown);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Step 7.
|
|
389
|
+
this.registers.close(index);
|
|
390
|
+
// Step 8: the columns, whatever the bar's state.
|
|
391
|
+
this.channels.publish(index);
|
|
392
|
+
// Step 9. The deferred channels and the pending effects, together: a
|
|
393
|
+
// marker, an alert and an order are one decision about one bar, and an
|
|
394
|
+
// order the language will not place stops the bar with nothing routed.
|
|
395
|
+
const applied = this.facts.isConfirmed || this.onUnconfirmed;
|
|
396
|
+
const pending = this.channels.decide(index, applied);
|
|
397
|
+
const sending = { index, time: bar.time ?? null };
|
|
398
|
+
const routed = routedEffects(this.ledger, pending, sending, this.options.host?.route);
|
|
399
|
+
if (routed.refusal !== undefined) return this.stopped(new ScriptError(routed.refusal));
|
|
400
|
+
const alerts = applied
|
|
401
|
+
? this.alerting.raise(
|
|
402
|
+
{ index, time: bar.time ?? null, isRealtime: this.facts.isRealtime },
|
|
403
|
+
(channel) => this.channels.at(channel, index),
|
|
404
|
+
)
|
|
405
|
+
: [];
|
|
406
|
+
// Step 10.
|
|
407
|
+
this.registers.trim(index, this.program.limits.history);
|
|
408
|
+
|
|
409
|
+
this.lastClose = bar.close ?? null;
|
|
410
|
+
return {
|
|
411
|
+
index,
|
|
412
|
+
columns: this.channels.row(index),
|
|
413
|
+
applied,
|
|
414
|
+
effects: routed.effects,
|
|
415
|
+
frames,
|
|
416
|
+
alerts,
|
|
417
|
+
diagnostic: undefined,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* A bar that failed.
|
|
423
|
+
*
|
|
424
|
+
* Steps 7 to 11 do not run, the bar's output columns keep whatever the
|
|
425
|
+
* previous execution published or stay absent, and the engine reports the
|
|
426
|
+
* error with its code and source position. It does not continue to the next
|
|
427
|
+
* bar with a half executed state, so the journal is rolled back and the
|
|
428
|
+
* script is marked stopped.
|
|
429
|
+
*/
|
|
430
|
+
/**
|
|
431
|
+
* A hand-over the engine refuses, before any of it has been executed.
|
|
432
|
+
*
|
|
433
|
+
* Nothing is rolled back because nothing has run: the bar was never begun,
|
|
434
|
+
* the previous bar's checkpoint still stands, and the columns already
|
|
435
|
+
* published stay as they are. The script is stopped for the same reason a
|
|
436
|
+
* failed bar stops it, which is that the next bar would be computed on a
|
|
437
|
+
* state nobody can account for.
|
|
438
|
+
*/
|
|
439
|
+
private refuse(diagnostic: Diagnostic): BarResult {
|
|
440
|
+
this.failure = diagnostic;
|
|
441
|
+
return {
|
|
442
|
+
index: this.index,
|
|
443
|
+
columns: [],
|
|
444
|
+
applied: false,
|
|
445
|
+
effects: [],
|
|
446
|
+
frames: [],
|
|
447
|
+
alerts: [],
|
|
448
|
+
diagnostic,
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
private stopped(thrown: unknown): BarResult {
|
|
453
|
+
const diagnostic =
|
|
454
|
+
thrown instanceof ScriptError ? thrown.diagnostic : unexpected('the bar', thrown);
|
|
455
|
+
this.rollback();
|
|
456
|
+
this.failure = diagnostic;
|
|
457
|
+
return {
|
|
458
|
+
index: this.index,
|
|
459
|
+
columns: [],
|
|
460
|
+
applied: false,
|
|
461
|
+
effects: [],
|
|
462
|
+
frames: [],
|
|
463
|
+
alerts: [],
|
|
464
|
+
diagnostic,
|
|
465
|
+
};
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** Step 11, and the sweep that pays for the objects the bar left behind. */
|
|
469
|
+
private checkpoint(): void {
|
|
470
|
+
this.memory.commit();
|
|
471
|
+
this.heap.commit();
|
|
472
|
+
this.heap.sweep((visit) => {
|
|
473
|
+
this.memory.walk(visit);
|
|
474
|
+
this.registers.walk(visit);
|
|
475
|
+
this.grids.walk(visit);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
private rollback(): void {
|
|
480
|
+
this.memory.rollback();
|
|
481
|
+
this.heap.rollback();
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/** One channel's column over every bar executed so far. */
|
|
485
|
+
column(channel: number): readonly Value[] {
|
|
486
|
+
return this.channels.column(channel, this.supplied);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** The drawing objects a host should render, in creation order. */
|
|
490
|
+
drawings(): readonly Drawing[] {
|
|
491
|
+
return drawingsIn(this.heap);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** The grids and the cells the last executed bar wrote into them. */
|
|
495
|
+
tables(): readonly Grid[] {
|
|
496
|
+
return this.grids.read();
|
|
497
|
+
}
|
|
498
|
+
}
|