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,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a `CALL_LIB` needs, and what the machine has to hand it.
|
|
3
|
+
*
|
|
4
|
+
* The interfaces the library asks its caller for are declared here rather than
|
|
5
|
+
* imported from the engine, so the dependency points one way: the engine knows
|
|
6
|
+
* about the library and the library knows only about the shape of the facts it
|
|
7
|
+
* is given. That is what lets the same table be driven by a chart engine, a
|
|
8
|
+
* backtest and a test that supplies four bars by hand.
|
|
9
|
+
*
|
|
10
|
+
* **An entry carries the same four facts the program carries.** `lib.functions`
|
|
11
|
+
* in a compiled program holds a name, an arity, whether the function holds
|
|
12
|
+
* state and what effect it has, and 2.5 says plainly why: they are there to be
|
|
13
|
+
* disagreed with. At load the engine compares each entry against this table and
|
|
14
|
+
* refuses a mismatch with OS6004, which catches a program compiled against a
|
|
15
|
+
* newer library before it computes a single wrong number.
|
|
16
|
+
*/
|
|
17
|
+
import type { Span } from '../../span/index.js';
|
|
18
|
+
import type { ColourValue, Heap, Reference, Value } from '../values/index.js';
|
|
19
|
+
import { isColour, isNumber, isRef, isString, reference } from '../values/index.js';
|
|
20
|
+
import type { StateRecord } from '../../stdlib/index.js';
|
|
21
|
+
|
|
22
|
+
/** What a call does to the world outside the machine, 5.4. */
|
|
23
|
+
export type Effect = 'none' | 'signal' | 'order' | 'draw' | 'log';
|
|
24
|
+
|
|
25
|
+
/** The bar being executed, as a library call sees it. */
|
|
26
|
+
export interface BarView {
|
|
27
|
+
readonly index: number;
|
|
28
|
+
readonly open: number | null;
|
|
29
|
+
readonly high: number | null;
|
|
30
|
+
readonly low: number | null;
|
|
31
|
+
readonly close: number | null;
|
|
32
|
+
readonly volume: number | null;
|
|
33
|
+
readonly time: number | null;
|
|
34
|
+
/**
|
|
35
|
+
* The previous bar's close, or absent on bar 0.
|
|
36
|
+
*
|
|
37
|
+
* Here rather than in a state region because `trueRange()` needs it and the
|
|
38
|
+
* library surface declares that call stateless, and because the value is a
|
|
39
|
+
* fact about the dataset rather than about a call site: it is the same for
|
|
40
|
+
* every call on a bar and it does not move when a moving bar re-executes.
|
|
41
|
+
*/
|
|
42
|
+
readonly previousClose: number | null;
|
|
43
|
+
readonly isConfirmed: boolean;
|
|
44
|
+
readonly isRealtime: boolean;
|
|
45
|
+
readonly isNew: boolean;
|
|
46
|
+
readonly isLast: boolean;
|
|
47
|
+
readonly updates: number;
|
|
48
|
+
/**
|
|
49
|
+
* Whether this bar opens the instrument's trading session, or closes it.
|
|
50
|
+
*
|
|
51
|
+
* Derived by the engine from the session hours in the instrument record,
|
|
52
|
+
* never asked of the host. Absent where the record cannot say, which is why
|
|
53
|
+
* the type carries absence: a session study on a host that states no session
|
|
54
|
+
* draws nothing rather than anchoring itself to a minute nobody chose.
|
|
55
|
+
*/
|
|
56
|
+
readonly isSessionFirst: boolean | null;
|
|
57
|
+
readonly isSessionLast: boolean | null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The facts an engine reads from the host and never from anywhere else, 5.2. */
|
|
61
|
+
export interface HostFacts {
|
|
62
|
+
symbol(): Value;
|
|
63
|
+
exchange(): Value;
|
|
64
|
+
interval(): Value;
|
|
65
|
+
/**
|
|
66
|
+
* The instrument's own timezone, an IANA name.
|
|
67
|
+
*
|
|
68
|
+
* Read rather than derived, and never a fixed offset: an offset is silently
|
|
69
|
+
* wrong for half the year anywhere that observes a seasonal clock change
|
|
70
|
+
* (`host-interface.md` 4.1).
|
|
71
|
+
*/
|
|
72
|
+
timezone(): Value;
|
|
73
|
+
tickSize(): Value;
|
|
74
|
+
lotSize(): Value;
|
|
75
|
+
pointValue(): Value;
|
|
76
|
+
currency(): Value;
|
|
77
|
+
instrumentType(): Value;
|
|
78
|
+
/**
|
|
79
|
+
* Whether the instrument has volume at all.
|
|
80
|
+
*
|
|
81
|
+
* The one instrument fact a host must state, because it is the one no
|
|
82
|
+
* derivation can recover: an instrument that never reports volume and one
|
|
83
|
+
* whose figures are late produce the same empty column.
|
|
84
|
+
*/
|
|
85
|
+
hasVolume(): Value;
|
|
86
|
+
hasOpenInterest(): Value;
|
|
87
|
+
/** The chart clock, which the host supplies, 8.4. */
|
|
88
|
+
now(): Value;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the host has answered the request with this id, `stdlib.md` 15.1.
|
|
91
|
+
*
|
|
92
|
+
* The compiler resolves `req.isReady(read)` to the request's id rather than
|
|
93
|
+
* to the read's value, because a value on a bar cannot say which request
|
|
94
|
+
* produced it. An engine that has been given no answers has answered none, so
|
|
95
|
+
* this is false rather than absent: "not yet" is a true statement about a
|
|
96
|
+
* read still in flight, and a script draws a loading state from it.
|
|
97
|
+
*/
|
|
98
|
+
requestReady(id: Value): Value;
|
|
99
|
+
/** Why a request failed, or the empty string when none has, 15.1. */
|
|
100
|
+
requestError(id: Value): Value;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* What the strategy holds, folded from its own settled fills, `stdlib.md` 17.1.
|
|
105
|
+
*
|
|
106
|
+
* Not a host fact, which is why it is not on `HostFacts` beside the instrument
|
|
107
|
+
* record. An account position is held per contract and is shared with every
|
|
108
|
+
* other strategy and every manual trade in it, so a strategy that read one
|
|
109
|
+
* would be sizing against somebody else's trade. What these two report is the
|
|
110
|
+
* run's own ledger (`stdlib.md` 17.7), and an engine with no ledger has no
|
|
111
|
+
* business answering them at all.
|
|
112
|
+
*/
|
|
113
|
+
export interface PositionFacts {
|
|
114
|
+
/** Net position in units, `0` while flat rather than absent. */
|
|
115
|
+
size(): Value;
|
|
116
|
+
/** Average price of the open position, absent while flat. */
|
|
117
|
+
avgPrice(): Value;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Everything one call can reach. */
|
|
121
|
+
export interface CallContext {
|
|
122
|
+
readonly heap: Heap;
|
|
123
|
+
readonly span: Span;
|
|
124
|
+
readonly bar: BarView;
|
|
125
|
+
readonly host: HostFacts;
|
|
126
|
+
/** The strategy's own position, which is the ledger's and not the host's. */
|
|
127
|
+
readonly position: PositionFacts;
|
|
128
|
+
/** This call site's region, empty on the first bar that reaches the call. */
|
|
129
|
+
readonly state: StateRecord;
|
|
130
|
+
/** The ceilings, so a library call that grows something can be stopped. */
|
|
131
|
+
readonly guard: Guard;
|
|
132
|
+
/** The name this value goes by in the program, for a diagnostic. */
|
|
133
|
+
nameOf(value: Value): string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The memory ceilings a library call has to respect.
|
|
138
|
+
*
|
|
139
|
+
* Three ceilings, because three are what the catalogue can state truthfully: an
|
|
140
|
+
* array holds at most so many elements (OS5002), a string at most so many code
|
|
141
|
+
* points (OS5008), and a script at most so many drawing objects at once
|
|
142
|
+
* (OS5010). There is still no code for a ceiling on the whole heap, and
|
|
143
|
+
* inventing one would mean a message that named an array for a limit the array
|
|
144
|
+
* did not reach, so the engine enforces the three it can name and reclaims what
|
|
145
|
+
* nothing can reach instead.
|
|
146
|
+
*
|
|
147
|
+
* The drawing ceiling is the one of the three that cannot be reclaimed around.
|
|
148
|
+
* An object lives until the script deletes it and an undeleted one is a root of
|
|
149
|
+
* its own, so a script that creates one per bar has a heap that grows for as
|
|
150
|
+
* long as the chart is open and a sweep that can free none of it.
|
|
151
|
+
*/
|
|
152
|
+
export interface Guard {
|
|
153
|
+
array(span: Span, name: string, size: number): void;
|
|
154
|
+
string(span: Span, text: string): string;
|
|
155
|
+
/** The same ceiling against a length, for a string not yet built. */
|
|
156
|
+
chars(span: Span, length: number): void;
|
|
157
|
+
/** The drawing object ceiling, charged with what the script holds now. */
|
|
158
|
+
drawing(span: Span, held: number): void;
|
|
159
|
+
/** Raise a run-time diagnostic that names an argument of this call. */
|
|
160
|
+
badArgument(span: Span, name: string, argument: string, found: string): never;
|
|
161
|
+
/** Raise a run-time diagnostic against an index outside an array. */
|
|
162
|
+
badIndex(span: Span, name: string, index: string, size: number): never;
|
|
163
|
+
/** Raise a run-time diagnostic against an object a script already deleted. */
|
|
164
|
+
deleted(span: Span, kind: string, bar: number): never;
|
|
165
|
+
/** Raise a run-time diagnostic against a zone name the host does not know. */
|
|
166
|
+
badZone(span: Span, value: string): never;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type LibraryCall = (ctx: CallContext, args: readonly Value[]) => Value;
|
|
170
|
+
|
|
171
|
+
export interface ManifestEntry {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly arity: number;
|
|
174
|
+
readonly state: boolean;
|
|
175
|
+
readonly effect: Effect;
|
|
176
|
+
/** Parameter names, in order, so a diagnostic can say which one was wrong. */
|
|
177
|
+
readonly params: readonly string[];
|
|
178
|
+
/** Positions that must hold a whole number of one or more. */
|
|
179
|
+
readonly whole: readonly number[];
|
|
180
|
+
readonly call: LibraryCall;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface EntryOptions {
|
|
184
|
+
readonly state?: true;
|
|
185
|
+
readonly effect?: Effect;
|
|
186
|
+
readonly whole?: readonly number[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Declares one entry.
|
|
191
|
+
*
|
|
192
|
+
* The parameter names are written as one space separated string, because that
|
|
193
|
+
* is how `stdlib.md`'s tables show a signature and the two can then be compared
|
|
194
|
+
* by eye without translating one of them first.
|
|
195
|
+
*/
|
|
196
|
+
export function entry(
|
|
197
|
+
name: string,
|
|
198
|
+
params: string,
|
|
199
|
+
call: LibraryCall,
|
|
200
|
+
options: EntryOptions = {},
|
|
201
|
+
): ManifestEntry {
|
|
202
|
+
const list = params === '' ? [] : params.split(' ');
|
|
203
|
+
return {
|
|
204
|
+
name,
|
|
205
|
+
arity: list.length,
|
|
206
|
+
state: options.state === true,
|
|
207
|
+
effect: options.effect ?? 'none',
|
|
208
|
+
params: list,
|
|
209
|
+
whole: options.whole ?? [],
|
|
210
|
+
call,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* An entry whose work happens at step 9, so the call itself produces absence.
|
|
216
|
+
*
|
|
217
|
+
* **An order call takes one argument more than the language surface shows**,
|
|
218
|
+
* and it is appended here rather than written into each of the nine signatures,
|
|
219
|
+
* so that the count the program records and the count this table expects cannot
|
|
220
|
+
* be given different answers. It is the names of the arguments the script wrote,
|
|
221
|
+
* in parameter order, and `compiled-program.md` 4.10 says why an order call
|
|
222
|
+
* needs it: two of its defaults are absence itself, so an argument left out and
|
|
223
|
+
* an argument written that came out absent arrive as the same value, and
|
|
224
|
+
* `language.md` 6.8 gives those opposite meanings.
|
|
225
|
+
*/
|
|
226
|
+
export function deferred(name: string, params: string, effect: Effect): ManifestEntry {
|
|
227
|
+
const all = effect === 'order' ? `${params} written`.trim() : params;
|
|
228
|
+
return entry(name, all, () => null, { effect });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The several numbers a multi-value call returns, as the array `stdlib.md`
|
|
233
|
+
* sections 2.3, 5 and 6 say it hands back.
|
|
234
|
+
*
|
|
235
|
+
* A fresh reference on every bar, because the language's own way of returning a
|
|
236
|
+
* trio is an array and an array is a heap object. The array never changes
|
|
237
|
+
* length and is never absent: each element carries its own warmup and is absent
|
|
238
|
+
* until it is reached, so an index is never out of range at the left edge of a
|
|
239
|
+
* chart and in range everywhere else.
|
|
240
|
+
*/
|
|
241
|
+
export function multi(ctx: CallContext, items: readonly (number | null)[]): Value {
|
|
242
|
+
return reference(ctx.heap.allocate({ kind: 'array', items: [...items] }));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function numberAt(args: readonly Value[], index: number): number | null {
|
|
246
|
+
const value = args[index];
|
|
247
|
+
return value !== undefined && isNumber(value) ? value : null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function stringAt(args: readonly Value[], index: number): string | null {
|
|
251
|
+
const value = args[index];
|
|
252
|
+
return value !== undefined && isString(value) ? value : null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export function boolAt(args: readonly Value[], index: number): boolean | null {
|
|
256
|
+
const value = args[index];
|
|
257
|
+
return typeof value === 'boolean' ? value : null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function colourAt(args: readonly Value[], index: number): ColourValue | null {
|
|
261
|
+
const value = args[index];
|
|
262
|
+
return value !== undefined && isColour(value) ? value : null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export function refAt(args: readonly Value[], index: number): Reference | null {
|
|
266
|
+
const value = args[index];
|
|
267
|
+
return value !== undefined && isRef(value) ? value : null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function valueAt(args: readonly Value[], index: number): Value {
|
|
271
|
+
return args[index] ?? null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* A length argument, checked against its contract.
|
|
276
|
+
*
|
|
277
|
+
* A length that is present and is not a whole number of one or more is a bug in
|
|
278
|
+
* the script and is OS4003, named against the parameter that took it. A length
|
|
279
|
+
* that is absent is left to the function, which returns absence: the argument
|
|
280
|
+
* arrived during another value's warmup, and stopping the study would turn a
|
|
281
|
+
* gap into an error.
|
|
282
|
+
*/
|
|
283
|
+
export function lengthAt(
|
|
284
|
+
ctx: CallContext,
|
|
285
|
+
name: string,
|
|
286
|
+
param: string,
|
|
287
|
+
args: readonly Value[],
|
|
288
|
+
index: number,
|
|
289
|
+
): number | null {
|
|
290
|
+
return checkedWhole(ctx, name, param, args[index], 1);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** A whole number of zero or more, for a digit count or an index. */
|
|
294
|
+
export function wholeAt(
|
|
295
|
+
ctx: CallContext,
|
|
296
|
+
name: string,
|
|
297
|
+
param: string,
|
|
298
|
+
args: readonly Value[],
|
|
299
|
+
index: number,
|
|
300
|
+
): number | null {
|
|
301
|
+
return checkedWhole(ctx, name, param, args[index], 0);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function checkedWhole(
|
|
305
|
+
ctx: CallContext,
|
|
306
|
+
name: string,
|
|
307
|
+
param: string,
|
|
308
|
+
value: Value | undefined,
|
|
309
|
+
least: number,
|
|
310
|
+
): number | null {
|
|
311
|
+
if (value === undefined || value === null) return null;
|
|
312
|
+
if (!isNumber(value) || !Number.isInteger(value) || value < least) {
|
|
313
|
+
ctx.guard.badArgument(ctx.span, name, param, describe(value));
|
|
314
|
+
}
|
|
315
|
+
return value;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** A value as a diagnostic has to print it. */
|
|
319
|
+
export function describe(value: Value): string {
|
|
320
|
+
if (value === null) return 'none';
|
|
321
|
+
if (typeof value === 'string') return JSON.stringify(value);
|
|
322
|
+
if (typeof value === 'number' || typeof value === 'boolean') return String(value);
|
|
323
|
+
if (value.tag === 'color') return `a colour`;
|
|
324
|
+
return 'an object';
|
|
325
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The calls that read something other than the bars: the instrument, the
|
|
3
|
+
* session, the position, and the order functions.
|
|
4
|
+
*
|
|
5
|
+
* `compiled-program.md` 5.2 lists what an engine reads from the host and from
|
|
6
|
+
* nowhere else, and every `chart` entry here is one row of that list. Two of
|
|
7
|
+
* them are deliberately not: `chart.intervalMinutes` and `chart.isIntraday` are
|
|
8
|
+
* derived from the interval string rather than read, which keeps them from
|
|
9
|
+
* disagreeing with the interval they describe.
|
|
10
|
+
*
|
|
11
|
+
* **The five `pos` entries are not host facts at all.** They read the run's own
|
|
12
|
+
* ledger (`stdlib.md` 17.7), folded from the orders this strategy sent and the
|
|
13
|
+
* fills the destination reported for them. An account position is held per
|
|
14
|
+
* contract and shared with every other strategy trading it, so a script that
|
|
15
|
+
* read one would be deciding against somebody else's trade (`stdlib.md` 17.1).
|
|
16
|
+
*
|
|
17
|
+
* **An order call performs nothing.** It appends a record to the pending effect
|
|
18
|
+
* list and pushes absent, and the list is applied at step 9 only when the bar is
|
|
19
|
+
* confirmed. The consequence is the one `language.md` 7.5 promises: a condition
|
|
20
|
+
* that was true halfway through a bar and false when it closed never places an
|
|
21
|
+
* order at all, because the execution that produced the pending record was
|
|
22
|
+
* thrown away. That is why every entry below with an effect is `deferred` and
|
|
23
|
+
* has no body: the machine never calls it.
|
|
24
|
+
*/
|
|
25
|
+
import type { Value } from '../values/index.js';
|
|
26
|
+
import { deferred, entry } from './binding.js';
|
|
27
|
+
import type { ManifestEntry } from './binding.js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Minutes in an interval code, or absent for a code that is not intraday.
|
|
31
|
+
*
|
|
32
|
+
* The grammar is the smallest thing that covers the codes a host serves: a
|
|
33
|
+
* count of minutes written bare, or a count with a unit letter. It is derived
|
|
34
|
+
* rather than read so that a study cannot see a `chart.interval` of one value
|
|
35
|
+
* and a `chart.intervalMinutes` of another.
|
|
36
|
+
*/
|
|
37
|
+
const INTERVAL = /^(\d+)([smhDWM]?)$/;
|
|
38
|
+
|
|
39
|
+
const MINUTES: Readonly<Record<string, number>> = {
|
|
40
|
+
s: 1 / 60,
|
|
41
|
+
'': 1,
|
|
42
|
+
m: 1,
|
|
43
|
+
h: 60,
|
|
44
|
+
D: 60 * 24,
|
|
45
|
+
W: 60 * 24 * 7,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function intervalMinutes(code: string | null): number | null {
|
|
49
|
+
if (code === null) return null;
|
|
50
|
+
const parsed = INTERVAL.exec(code);
|
|
51
|
+
if (parsed === null) return null;
|
|
52
|
+
const count = Number(parsed[1]);
|
|
53
|
+
const unit = parsed[2] ?? '';
|
|
54
|
+
// A month is not a fixed number of minutes, so it has no answer here rather
|
|
55
|
+
// than an average that would be wrong in every month.
|
|
56
|
+
if (unit === 'M') return null;
|
|
57
|
+
const scale = MINUTES[unit];
|
|
58
|
+
return scale === undefined ? null : count * scale;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const CHART_ENTRIES: readonly ManifestEntry[] = [
|
|
62
|
+
entry('chart.symbol', '', (ctx) => ctx.host.symbol()),
|
|
63
|
+
entry('chart.exchange', '', (ctx) => ctx.host.exchange()),
|
|
64
|
+
entry('chart.interval', '', (ctx) => ctx.host.interval()),
|
|
65
|
+
entry('chart.timezone', '', (ctx) => ctx.host.timezone()),
|
|
66
|
+
entry('chart.tickSize', '', (ctx) => ctx.host.tickSize()),
|
|
67
|
+
entry('chart.lotSize', '', (ctx) => ctx.host.lotSize()),
|
|
68
|
+
entry('chart.pointValue', '', (ctx) => ctx.host.pointValue()),
|
|
69
|
+
entry('chart.currency', '', (ctx) => ctx.host.currency()),
|
|
70
|
+
entry('chart.instrumentType', '', (ctx) => ctx.host.instrumentType()),
|
|
71
|
+
entry('chart.hasVolume', '', (ctx) => ctx.host.hasVolume()),
|
|
72
|
+
entry('chart.hasOpenInterest', '', (ctx) => ctx.host.hasOpenInterest()),
|
|
73
|
+
entry('chart.now', '', (ctx) => ctx.host.now()),
|
|
74
|
+
|
|
75
|
+
entry('chart.intervalMinutes', '', (ctx) => {
|
|
76
|
+
const code = ctx.host.interval();
|
|
77
|
+
return intervalMinutes(typeof code === 'string' ? code : null);
|
|
78
|
+
}),
|
|
79
|
+
|
|
80
|
+
entry('chart.isIntraday', '', (ctx) => {
|
|
81
|
+
const code = ctx.host.interval();
|
|
82
|
+
const minutes = intervalMinutes(typeof code === 'string' ? code : null);
|
|
83
|
+
return minutes === null ? null : minutes < 60 * 24;
|
|
84
|
+
}),
|
|
85
|
+
|
|
86
|
+
entry('req.isReady', 'read', (ctx, args) => ctx.host.requestReady(args[0] ?? null)),
|
|
87
|
+
entry('req.error', 'read', (ctx, args) => ctx.host.requestError(args[0] ?? null)),
|
|
88
|
+
|
|
89
|
+
entry('session.isFirstBar', '', (ctx) => ctx.bar.isSessionFirst),
|
|
90
|
+
entry('session.isLastBar', '', (ctx) => ctx.bar.isSessionLast),
|
|
91
|
+
|
|
92
|
+
entry('pos.size', '', (ctx) => ctx.position.size()),
|
|
93
|
+
entry('pos.avgPrice', '', (ctx) => ctx.position.avgPrice()),
|
|
94
|
+
entry('pos.isLong', '', (ctx) => sideOf(ctx.position.size(), 1)),
|
|
95
|
+
entry('pos.isShort', '', (ctx) => sideOf(ctx.position.size(), -1)),
|
|
96
|
+
entry('pos.isFlat', '', (ctx) => sideOf(ctx.position.size(), 0)),
|
|
97
|
+
|
|
98
|
+
deferred('print', 'value', 'log'),
|
|
99
|
+
deferred('buy', 'qty limit stop tag leg', 'order'),
|
|
100
|
+
deferred('sell', 'qty limit stop tag leg', 'order'),
|
|
101
|
+
deferred('close', 'tag qty leg', 'order'),
|
|
102
|
+
deferred('exit', 'tag qty limit stop profit loss leg', 'order'),
|
|
103
|
+
deferred('cancel', 'tag', 'order'),
|
|
104
|
+
deferred('cancelAll', '', 'order'),
|
|
105
|
+
deferred('order.place', 'side qty type price trigger tag leg', 'order'),
|
|
106
|
+
deferred('order.reverse', 'qty tag leg', 'order'),
|
|
107
|
+
deferred('order.bracket', 'tag profit loss leg', 'order'),
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
/** Which side a position is on, absent where the size is not a number. */
|
|
111
|
+
function sideOf(size: Value, want: number): boolean | null {
|
|
112
|
+
if (typeof size !== 'number') return null;
|
|
113
|
+
const side = size > 0 ? 1 : size < 0 ? -1 : 0;
|
|
114
|
+
return side === want;
|
|
115
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Colour: the nineteen names and the calls that compute one.
|
|
3
|
+
*
|
|
4
|
+
* **The channel table is standing in for something that does not exist yet.**
|
|
5
|
+
* `stdlib.md` 11.1 fixes the exact channel values of the named colours in the
|
|
6
|
+
* library manifest and makes them part of the conformance suite; there is no
|
|
7
|
+
* manifest in this repository, so the compiler carries a copy for the colours
|
|
8
|
+
* it has to write into a declaration field before bar 0, and the engine carries
|
|
9
|
+
* one for the colours a script computes on a bar. Two copies of one fact is
|
|
10
|
+
* exactly what should not happen, and `tests/engine/colours.test.ts` asserts
|
|
11
|
+
* they agree, so the day the manifest exists both are deleted rather than
|
|
12
|
+
* reconciled.
|
|
13
|
+
*
|
|
14
|
+
* Every call that computes a colour rounds red, green and blue to a whole
|
|
15
|
+
* number before it returns, halves away from zero, which `colour()` in the
|
|
16
|
+
* value module does. Alpha is not rounded: it stays a binary64 number from 0 to
|
|
17
|
+
* 1 and becomes a byte only at the contract boundary, where the conversion is
|
|
18
|
+
* one way and is not a round trip (3.1).
|
|
19
|
+
*/
|
|
20
|
+
import type { Value } from '../values/index.js';
|
|
21
|
+
import { colour } from '../values/index.js';
|
|
22
|
+
import { colourAt, entry, numberAt } from './binding.js';
|
|
23
|
+
import type { ManifestEntry } from './binding.js';
|
|
24
|
+
|
|
25
|
+
const CHANNELS: Readonly<Record<string, readonly [number, number, number]>> = {
|
|
26
|
+
aqua: [0, 255, 255],
|
|
27
|
+
black: [0, 0, 0],
|
|
28
|
+
blue: [0, 0, 255],
|
|
29
|
+
brown: [165, 42, 42],
|
|
30
|
+
fuchsia: [255, 0, 255],
|
|
31
|
+
gray: [128, 128, 128],
|
|
32
|
+
green: [0, 128, 0],
|
|
33
|
+
lime: [0, 255, 0],
|
|
34
|
+
maroon: [128, 0, 0],
|
|
35
|
+
navy: [0, 0, 128],
|
|
36
|
+
olive: [128, 128, 0],
|
|
37
|
+
orange: [255, 165, 0],
|
|
38
|
+
pink: [255, 192, 203],
|
|
39
|
+
purple: [128, 0, 128],
|
|
40
|
+
red: [255, 0, 0],
|
|
41
|
+
silver: [192, 192, 192],
|
|
42
|
+
teal: [0, 128, 128],
|
|
43
|
+
white: [255, 255, 255],
|
|
44
|
+
yellow: [255, 255, 0],
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** The nineteen names, for a test that has to compare two tables. */
|
|
48
|
+
export const COLOUR_NAMES: readonly string[] = Object.keys(CHANNELS);
|
|
49
|
+
|
|
50
|
+
export function namedColour(name: string): Value {
|
|
51
|
+
const channels = CHANNELS[name];
|
|
52
|
+
return channels === undefined ? null : colour(channels[0], channels[1], channels[2], 1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const COLOUR_ENTRIES: readonly ManifestEntry[] = [
|
|
56
|
+
...COLOUR_NAMES.map((name) => entry(name, '', () => namedColour(name))),
|
|
57
|
+
|
|
58
|
+
entry('rgb', 'r g b', (_ctx, args) => {
|
|
59
|
+
const r = numberAt(args, 0);
|
|
60
|
+
const g = numberAt(args, 1);
|
|
61
|
+
const b = numberAt(args, 2);
|
|
62
|
+
if (r === null || g === null || b === null) return null;
|
|
63
|
+
return colour(r, g, b, 1);
|
|
64
|
+
}),
|
|
65
|
+
|
|
66
|
+
entry('rgba', 'r g b a', (_ctx, args) => {
|
|
67
|
+
const r = numberAt(args, 0);
|
|
68
|
+
const g = numberAt(args, 1);
|
|
69
|
+
const b = numberAt(args, 2);
|
|
70
|
+
const a = numberAt(args, 3);
|
|
71
|
+
if (r === null || g === null || b === null || a === null) return null;
|
|
72
|
+
return colour(r, g, b, a);
|
|
73
|
+
}),
|
|
74
|
+
|
|
75
|
+
// `fade` takes transparency, not opacity, and the argument is a percentage:
|
|
76
|
+
// 100 is invisible. Both spellings follow the way a chart's own style controls
|
|
77
|
+
// are labelled, and the two conventions are opposites, so the arithmetic is
|
|
78
|
+
// written out rather than left to a reader to infer from the name.
|
|
79
|
+
entry('fade', 'color percent', (_ctx, args) => {
|
|
80
|
+
const base = colourAt(args, 0);
|
|
81
|
+
const percent = numberAt(args, 1);
|
|
82
|
+
if (base === null || percent === null) return null;
|
|
83
|
+
return colour(base.r, base.g, base.b, base.a * (1 - percent / 100));
|
|
84
|
+
}),
|
|
85
|
+
|
|
86
|
+
entry('mix', 'a b weight', (_ctx, args) => {
|
|
87
|
+
const a = colourAt(args, 0);
|
|
88
|
+
const b = colourAt(args, 1);
|
|
89
|
+
const weight = numberAt(args, 2);
|
|
90
|
+
if (a === null || b === null || weight === null) return null;
|
|
91
|
+
const blend = (from: number, to: number): number => from + (to - from) * weight;
|
|
92
|
+
return colour(
|
|
93
|
+
blend(a.r, b.r),
|
|
94
|
+
blend(a.g, b.g),
|
|
95
|
+
blend(a.b, b.b),
|
|
96
|
+
blend(a.a, b.a),
|
|
97
|
+
);
|
|
98
|
+
}),
|
|
99
|
+
|
|
100
|
+
entry('alpha', 'color', (_ctx, args) => {
|
|
101
|
+
const base = colourAt(args, 0);
|
|
102
|
+
return base === null ? null : base.a;
|
|
103
|
+
}),
|
|
104
|
+
|
|
105
|
+
entry('withAlpha', 'color a', (_ctx, args) => {
|
|
106
|
+
const base = colourAt(args, 0);
|
|
107
|
+
const a = numberAt(args, 1);
|
|
108
|
+
if (base === null || a === null) return null;
|
|
109
|
+
return colour(base.r, base.g, base.b, a);
|
|
110
|
+
}),
|
|
111
|
+
];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The calendar, `stdlib.md` section 12.2, and the session range test of 12.5.
|
|
3
|
+
*
|
|
4
|
+
* **Every number here is the numeric library's**, for the reason `series.ts`
|
|
5
|
+
* sets out beside the same wiring. The zone arithmetic is under
|
|
6
|
+
* `src/core/stdlib/calendar`, which raises nothing; this file is the call sites
|
|
7
|
+
* and the one refusal the calendar cannot make for itself.
|
|
8
|
+
*
|
|
9
|
+
* **The zone defaults to the chart's, not to UTC.** Section 12.1 gives the
|
|
10
|
+
* reason: a session study that disagreed with the labels on the chart's own
|
|
11
|
+
* axis would be wrong in the way that is hardest to see. So an absent `zone`
|
|
12
|
+
* argument falls back to `chart.timezone`, which is a host fact, and a host
|
|
13
|
+
* that states no timezone leaves every call here absent rather than answered in
|
|
14
|
+
* a zone nobody chose.
|
|
15
|
+
*
|
|
16
|
+
* **A zone the runtime does not know is OS6005 and never a guess.** An
|
|
17
|
+
* abbreviation is not a zone name: several of them mean two different offsets
|
|
18
|
+
* in different parts of the world, and a session test cannot carry that.
|
|
19
|
+
*/
|
|
20
|
+
import {
|
|
21
|
+
civilAt,
|
|
22
|
+
dateField,
|
|
23
|
+
instantFrom,
|
|
24
|
+
isKnownZone,
|
|
25
|
+
renderPattern,
|
|
26
|
+
sameDay,
|
|
27
|
+
startOf,
|
|
28
|
+
} from '../../stdlib/index.js';
|
|
29
|
+
import type { Boundary, DateField } from '../../stdlib/index.js';
|
|
30
|
+
import { entry, numberAt, stringAt } from './binding.js';
|
|
31
|
+
import type { CallContext, ManifestEntry } from './binding.js';
|
|
32
|
+
import type { Value } from '../values/index.js';
|
|
33
|
+
import { sessionHolds } from '../session/index.js';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The zone a call reads in: the one it was given, or the chart's.
|
|
37
|
+
*
|
|
38
|
+
* A name the runtime's zone table does not hold stops the bar with OS6005,
|
|
39
|
+
* because the alternatives are both worse: an invented offset is silently wrong
|
|
40
|
+
* for half the year, and an absent answer would look exactly like a host that
|
|
41
|
+
* stated no timezone at all.
|
|
42
|
+
*/
|
|
43
|
+
function zoneAt(ctx: CallContext, args: readonly Value[], index: number): string | null {
|
|
44
|
+
const given = stringAt(args, index);
|
|
45
|
+
if (given !== null) {
|
|
46
|
+
if (!isKnownZone(given)) ctx.guard.badZone(ctx.span, given);
|
|
47
|
+
return given;
|
|
48
|
+
}
|
|
49
|
+
const chart = ctx.host.timezone();
|
|
50
|
+
if (typeof chart !== 'string') return null;
|
|
51
|
+
if (!isKnownZone(chart)) ctx.guard.badZone(ctx.span, chart);
|
|
52
|
+
return chart;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** One calendar field read at `t`, which is every entry of the table in 12.2. */
|
|
56
|
+
function field(name: string, which: DateField): ManifestEntry {
|
|
57
|
+
return entry(`date.${name}`, 't zone', (ctx, args) =>
|
|
58
|
+
dateField(numberAt(args, 0), zoneAt(ctx, args, 1), which),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** One of the three boundaries a timestamp rounds back to. */
|
|
63
|
+
function boundary(name: string, which: Boundary): ManifestEntry {
|
|
64
|
+
return entry(`date.${name}`, 't zone', (ctx, args) =>
|
|
65
|
+
startOf(numberAt(args, 0), zoneAt(ctx, args, 1), which),
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const DATE_ENTRIES: readonly ManifestEntry[] = [
|
|
70
|
+
field('year', 'year'),
|
|
71
|
+
field('month', 'month'),
|
|
72
|
+
field('day', 'day'),
|
|
73
|
+
field('dayOfWeek', 'dayOfWeek'),
|
|
74
|
+
field('dayOfYear', 'dayOfYear'),
|
|
75
|
+
field('hour', 'hour'),
|
|
76
|
+
field('minute', 'minute'),
|
|
77
|
+
field('second', 'second'),
|
|
78
|
+
field('weekOfYear', 'weekOfYear'),
|
|
79
|
+
|
|
80
|
+
boundary('startOfDay', 'day'),
|
|
81
|
+
boundary('startOfWeek', 'week'),
|
|
82
|
+
boundary('startOfMonth', 'month'),
|
|
83
|
+
|
|
84
|
+
entry('date.from', 'year month day hour minute second zone', (ctx, args) =>
|
|
85
|
+
instantFrom(
|
|
86
|
+
numberAt(args, 0),
|
|
87
|
+
numberAt(args, 1),
|
|
88
|
+
numberAt(args, 2),
|
|
89
|
+
numberAt(args, 3),
|
|
90
|
+
numberAt(args, 4),
|
|
91
|
+
numberAt(args, 5),
|
|
92
|
+
zoneAt(ctx, args, 6),
|
|
93
|
+
),
|
|
94
|
+
),
|
|
95
|
+
|
|
96
|
+
entry('date.isSameDay', 'a b zone', (ctx, args) =>
|
|
97
|
+
sameDay(numberAt(args, 0), numberAt(args, 1), zoneAt(ctx, args, 2)),
|
|
98
|
+
),
|
|
99
|
+
|
|
100
|
+
entry('date.format', 't pattern zone', (ctx, args) => {
|
|
101
|
+
const zone = zoneAt(ctx, args, 2);
|
|
102
|
+
const rendered = renderPattern(stringAt(args, 1), civilAt(numberAt(args, 0), zone));
|
|
103
|
+
return rendered === null ? null : ctx.guard.string(ctx.span, rendered);
|
|
104
|
+
}),
|
|
105
|
+
|
|
106
|
+
entry('session.isIn', 'spec zone', (ctx, args) =>
|
|
107
|
+
sessionHolds(stringAt(args, 0), civilAt(ctx.bar.time, zoneAt(ctx, args, 1))),
|
|
108
|
+
),
|
|
109
|
+
];
|