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,341 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The run record: a whole run as a plain JSON document.
|
|
3
|
+
*
|
|
4
|
+
* **The record is the conformance case.** That is the one decision this module
|
|
5
|
+
* exists to hold, and everything in it follows from it: no object reference, no
|
|
6
|
+
* function, no dependence on this implementation's internals, and nothing that
|
|
7
|
+
* only this engine can read. A record carries the script revision, the compiled
|
|
8
|
+
* program, the bars, the settings the host chose, the frames the destination
|
|
9
|
+
* answered in delivery order, the fills the engine folded in fold order, the
|
|
10
|
+
* ledger the run ended with, the diagnostics and the report.
|
|
11
|
+
*
|
|
12
|
+
* **The bars are inline or referenced, and both carry the same hash.** Inline is
|
|
13
|
+
* the conformance form, because a case has to hold every byte of its own input.
|
|
14
|
+
* Referenced is the operational form, because the smallest deployment has a one
|
|
15
|
+
* megabyte request body and nothing that grows with history may travel in one.
|
|
16
|
+
* A replay whose bars do not hash to the record's hash is OS6022 rather than a
|
|
17
|
+
* silently different study.
|
|
18
|
+
*
|
|
19
|
+
* **The frames name an intent by ordinal and never by an engine's own id**,
|
|
20
|
+
* because a case cannot know what id another engine minted. The same reason the
|
|
21
|
+
* ledger rows here are flat words rather than this engine's own types.
|
|
22
|
+
*
|
|
23
|
+
* The record is written through the existing canonical encoding, so there is one
|
|
24
|
+
* canonical writer in the repository and key order and number form are fixed for
|
|
25
|
+
* everybody.
|
|
26
|
+
*/
|
|
27
|
+
import type { RecordedFill, Report } from '../accounting/index.js';
|
|
28
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
29
|
+
import { canonicalise, programHash, sha256 } from '../emit/index.js';
|
|
30
|
+
import type { CompiledProgram, SourceStamp } from '../emit/index.js';
|
|
31
|
+
import type { LedgerRow } from '../engine/index.js';
|
|
32
|
+
import { VERSION } from '../version/index.js';
|
|
33
|
+
import type { BacktestSettings } from './settings.js';
|
|
34
|
+
|
|
35
|
+
/** One bar as a record holds it. */
|
|
36
|
+
export interface RecordedBar {
|
|
37
|
+
readonly time: number | null;
|
|
38
|
+
readonly open: number | null;
|
|
39
|
+
readonly high: number | null;
|
|
40
|
+
readonly low: number | null;
|
|
41
|
+
readonly close: number | null;
|
|
42
|
+
readonly volume: number | null;
|
|
43
|
+
readonly oi: number | null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The bars, held or pointed at.
|
|
48
|
+
*
|
|
49
|
+
* Both forms carry the same hash, computed the same way over the canonical
|
|
50
|
+
* tuple of each bar, so a referenced record can be turned into an inline one by
|
|
51
|
+
* whoever holds the bars and the result is the same case.
|
|
52
|
+
*/
|
|
53
|
+
export type BarsInRecord =
|
|
54
|
+
| {
|
|
55
|
+
readonly form: 'inline';
|
|
56
|
+
readonly hash: string;
|
|
57
|
+
readonly count: number;
|
|
58
|
+
readonly rows: readonly RecordedBar[];
|
|
59
|
+
}
|
|
60
|
+
| {
|
|
61
|
+
readonly form: 'referenced';
|
|
62
|
+
readonly hash: string;
|
|
63
|
+
readonly count: number;
|
|
64
|
+
readonly firstTime: number | null;
|
|
65
|
+
readonly lastTime: number | null;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** The columns of `conformance.md`'s frames.csv, in its order and with its names. */
|
|
69
|
+
export interface RecordedFrame {
|
|
70
|
+
readonly afterBar: number;
|
|
71
|
+
/** An ordinal, 1-based, never an engine's own id. */
|
|
72
|
+
readonly intent: number;
|
|
73
|
+
readonly status: string;
|
|
74
|
+
readonly filledQty: number;
|
|
75
|
+
readonly avgFillPrice: number | null;
|
|
76
|
+
readonly orderRef: string | null;
|
|
77
|
+
readonly text: string | null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** A ledger row of `stdlib.md` 17.7, flattened: the `orders` channel of expected.json. */
|
|
81
|
+
export interface RecordedOrder {
|
|
82
|
+
readonly intent: number;
|
|
83
|
+
readonly orderRef: string;
|
|
84
|
+
readonly tag: string;
|
|
85
|
+
readonly leg: string;
|
|
86
|
+
readonly positionRef: number;
|
|
87
|
+
readonly symbol: string | null;
|
|
88
|
+
readonly exchange: string | null;
|
|
89
|
+
readonly product: string;
|
|
90
|
+
readonly side: string;
|
|
91
|
+
readonly qty: number | null;
|
|
92
|
+
readonly qtyType: string;
|
|
93
|
+
readonly type: string | null;
|
|
94
|
+
readonly price: number | null;
|
|
95
|
+
readonly trigger: number | null;
|
|
96
|
+
readonly status: string;
|
|
97
|
+
readonly filledQty: number;
|
|
98
|
+
readonly avgFillPrice: number | null;
|
|
99
|
+
readonly rejection: string | null;
|
|
100
|
+
readonly placedAt: number | null;
|
|
101
|
+
readonly updatedAt: number | null;
|
|
102
|
+
readonly units: number | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** A diagnostic as a record holds it: the code, the span and the bar. */
|
|
106
|
+
export interface RecordedDiagnostic {
|
|
107
|
+
readonly code: string;
|
|
108
|
+
readonly line: number;
|
|
109
|
+
readonly column: number;
|
|
110
|
+
readonly severity: string;
|
|
111
|
+
readonly barIndex: number | null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** One run, whole, and readable by an engine that is not this one. */
|
|
115
|
+
export interface RunRecord {
|
|
116
|
+
readonly recordVersion: number;
|
|
117
|
+
readonly engine: { readonly name: string; readonly version: string };
|
|
118
|
+
readonly languageVersion: string;
|
|
119
|
+
/** Already plain data. */
|
|
120
|
+
readonly program: CompiledProgram;
|
|
121
|
+
readonly programHash: string;
|
|
122
|
+
/** Hash, lines, file: the script revision. */
|
|
123
|
+
readonly source: SourceStamp;
|
|
124
|
+
readonly settings: BacktestSettings;
|
|
125
|
+
readonly bars: BarsInRecord;
|
|
126
|
+
/** What the destination answered, in delivery order. */
|
|
127
|
+
readonly frames: readonly RecordedFrame[];
|
|
128
|
+
/** What the engine folded, in fold order. */
|
|
129
|
+
readonly fills: readonly RecordedFill[];
|
|
130
|
+
/** The ledger at the end, oldest first. */
|
|
131
|
+
readonly orders: readonly RecordedOrder[];
|
|
132
|
+
readonly diagnostics: readonly RecordedDiagnostic[];
|
|
133
|
+
readonly report: Report;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The revision of this document's own shape.
|
|
138
|
+
*
|
|
139
|
+
* A reader is handed a record and has to know what it is looking at before it
|
|
140
|
+
* reads a field, so the number is first in the document and is written by this
|
|
141
|
+
* file alone. It moves when a channel is added or a meaning changes, never when
|
|
142
|
+
* a figure in a report does.
|
|
143
|
+
*/
|
|
144
|
+
export const RECORD_VERSION = 1;
|
|
145
|
+
|
|
146
|
+
/** What this engine calls itself in a record it wrote. */
|
|
147
|
+
const ENGINE_NAME = 'openscript';
|
|
148
|
+
|
|
149
|
+
/** The parts a run hands over, each already in the shape the record holds. */
|
|
150
|
+
export interface RecordParts {
|
|
151
|
+
readonly program: CompiledProgram;
|
|
152
|
+
readonly settings: BacktestSettings;
|
|
153
|
+
readonly bars: readonly RecordedBar[];
|
|
154
|
+
/**
|
|
155
|
+
* Whether the bars travel in the record or are pointed at.
|
|
156
|
+
*
|
|
157
|
+
* Inline is the conformance form, because a case holds every byte of its own
|
|
158
|
+
* input. Referenced is the operational form, because nothing that grows with
|
|
159
|
+
* history may travel in a request body. Both carry the same hash over the
|
|
160
|
+
* same canonical tuples, so one becomes the other without becoming a
|
|
161
|
+
* different case.
|
|
162
|
+
*/
|
|
163
|
+
readonly form: 'inline' | 'referenced';
|
|
164
|
+
readonly frames: readonly RecordedFrame[];
|
|
165
|
+
readonly fills: readonly RecordedFill[];
|
|
166
|
+
readonly orders: readonly RecordedOrder[];
|
|
167
|
+
readonly diagnostics: readonly RecordedDiagnostic[];
|
|
168
|
+
readonly report: Report;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* One run, as the document another engine is handed.
|
|
173
|
+
*
|
|
174
|
+
* Nothing is computed here. Every channel arrives folded, because what a record
|
|
175
|
+
* says has to be what the run did rather than what a second fold of the same
|
|
176
|
+
* inputs came to: a record that recomputed its own report would agree with
|
|
177
|
+
* itself whatever the engine had actually done.
|
|
178
|
+
*/
|
|
179
|
+
export function recordOf(parts: RecordParts): RunRecord {
|
|
180
|
+
return {
|
|
181
|
+
recordVersion: RECORD_VERSION,
|
|
182
|
+
engine: { name: ENGINE_NAME, version: VERSION },
|
|
183
|
+
languageVersion: String(parts.program.openscript.language),
|
|
184
|
+
program: parts.program,
|
|
185
|
+
programHash: programHash(parts.program),
|
|
186
|
+
source: parts.program.source,
|
|
187
|
+
settings: parts.settings,
|
|
188
|
+
bars: barsIn(parts.bars, parts.form),
|
|
189
|
+
frames: parts.frames,
|
|
190
|
+
fills: parts.fills,
|
|
191
|
+
orders: parts.orders,
|
|
192
|
+
diagnostics: parts.diagnostics,
|
|
193
|
+
report: parts.report,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The bars, held or pointed at, and the same hash either way.
|
|
199
|
+
*
|
|
200
|
+
* The referenced form keeps the first and last times so that a reader can say
|
|
201
|
+
* which bars are wanted without holding them, and the count so that a set of
|
|
202
|
+
* the wrong length is known to be wrong before it is hashed.
|
|
203
|
+
*/
|
|
204
|
+
export function barsIn(bars: readonly RecordedBar[], form: 'inline' | 'referenced'): BarsInRecord {
|
|
205
|
+
const hash = barsHash(bars);
|
|
206
|
+
if (form === 'inline') {
|
|
207
|
+
return { form: 'inline', hash, count: bars.length, rows: bars };
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
form: 'referenced',
|
|
211
|
+
hash,
|
|
212
|
+
count: bars.length,
|
|
213
|
+
firstTime: bars[0]?.time ?? null,
|
|
214
|
+
lastTime: bars[bars.length - 1]?.time ?? null,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The hash a record names its bars by.
|
|
220
|
+
*
|
|
221
|
+
* Over the canonical tuple of each bar, in the order they were supplied, and
|
|
222
|
+
* through the canonical encoding the compiled program is hashed with, so there
|
|
223
|
+
* is one canonical writer in the repository rather than two that agree until
|
|
224
|
+
* one of them is changed. A tuple rather than an object, because the field
|
|
225
|
+
* order is then the specification's and not a sort's.
|
|
226
|
+
*/
|
|
227
|
+
export function barsHash(bars: readonly RecordedBar[]): string {
|
|
228
|
+
const tuples = bars.map((bar) => [
|
|
229
|
+
bar.time,
|
|
230
|
+
bar.open,
|
|
231
|
+
bar.high,
|
|
232
|
+
bar.low,
|
|
233
|
+
bar.close,
|
|
234
|
+
bar.volume,
|
|
235
|
+
bar.oi,
|
|
236
|
+
]);
|
|
237
|
+
return 'sha256:' + sha256(canonicalise(tuples));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* The record as the bytes another engine reads.
|
|
242
|
+
*
|
|
243
|
+
* Through the canonical encoding, so key order is fixed, every number is in the
|
|
244
|
+
* shortest decimal form that reads back as itself, and two runs of the same
|
|
245
|
+
* record produce the same bytes on every machine. That is what makes the
|
|
246
|
+
* reproducibility test a byte comparison rather than a tour of the fields.
|
|
247
|
+
*/
|
|
248
|
+
export function recordToJson(record: RunRecord): string {
|
|
249
|
+
return canonicalise(record);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* The run, without who produced it.
|
|
254
|
+
*
|
|
255
|
+
* **`engine` is provenance, and provenance is not part of the run.** The claim
|
|
256
|
+
* a rerun makes is that the run is a function of the record, and that claim has
|
|
257
|
+
* to survive the engine it runs on being upgraded: a record stored under
|
|
258
|
+
* `0.3.0` and rerun under `0.4.0` produces the same trades, the same fills and
|
|
259
|
+
* the same money, and a document carrying the version stamp inside the bytes
|
|
260
|
+
* being compared says it does not.
|
|
261
|
+
*
|
|
262
|
+
* It was compared as whole bytes until the first version bump would have broken
|
|
263
|
+
* it, which is a test that passes for exactly as long as nothing changes and
|
|
264
|
+
* then fails for the one reason that is not a defect. So the stamp stays in the
|
|
265
|
+
* record, because knowing which engine wrote a run is worth keeping, and the
|
|
266
|
+
* comparison is made over everything else.
|
|
267
|
+
*/
|
|
268
|
+
export function runBytes(record: RunRecord): string {
|
|
269
|
+
const { engine: _engine, ...run } = record;
|
|
270
|
+
return canonicalise(run);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A record read back from those bytes.
|
|
275
|
+
*
|
|
276
|
+
* A parse and not a validation: what comes back is the document as it was
|
|
277
|
+
* written, and a document this engine did not write is the caller's to trust or
|
|
278
|
+
* not. The one thing asserted is the revision, because reading a later
|
|
279
|
+
* revision's fields under this one's rules is how a record silently becomes a
|
|
280
|
+
* different run.
|
|
281
|
+
*/
|
|
282
|
+
export function recordFromJson(text: string): RunRecord | null {
|
|
283
|
+
const parsed: unknown = JSON.parse(text);
|
|
284
|
+
if (parsed === null || typeof parsed !== 'object') return null;
|
|
285
|
+
const record = parsed as RunRecord;
|
|
286
|
+
return record.recordVersion === RECORD_VERSION ? record : null;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* One ledger row, flattened into the words a case file prints.
|
|
291
|
+
*
|
|
292
|
+
* The engine's own types do not cross: a second engine has its own, and a
|
|
293
|
+
* channel written in this one's would be a case only this one could read. The
|
|
294
|
+
* intent is an ordinal for the same reason, because no engine can know what id
|
|
295
|
+
* another minted.
|
|
296
|
+
*
|
|
297
|
+
* `qtyType` comes from the intent rather than from the row, because the unit a
|
|
298
|
+
* quantity is counted in is per order and not per leg: an order the engine
|
|
299
|
+
* sized itself is in units whatever the declaration counts in, and a row that
|
|
300
|
+
* printed the declaration's unit for it would state a quantity in a unit it was
|
|
301
|
+
* never measured in.
|
|
302
|
+
*/
|
|
303
|
+
export function orderIn(row: LedgerRow, intent: number, qtyType: string): RecordedOrder {
|
|
304
|
+
return {
|
|
305
|
+
intent,
|
|
306
|
+
orderRef: row.orderRef,
|
|
307
|
+
tag: row.tag,
|
|
308
|
+
leg: row.leg,
|
|
309
|
+
positionRef: row.positionRef,
|
|
310
|
+
symbol: row.instrument.symbol,
|
|
311
|
+
exchange: row.instrument.exchange,
|
|
312
|
+
product: row.product,
|
|
313
|
+
side: row.side,
|
|
314
|
+
qty: row.qty,
|
|
315
|
+
qtyType,
|
|
316
|
+
type: row.type,
|
|
317
|
+
price: row.price,
|
|
318
|
+
trigger: row.trigger,
|
|
319
|
+
status: row.status,
|
|
320
|
+
filledQty: row.filledQty,
|
|
321
|
+
avgFillPrice: row.avgFillPrice,
|
|
322
|
+
rejection: row.rejection === '' ? null : row.rejection,
|
|
323
|
+
placedAt: row.placedAt,
|
|
324
|
+
updatedAt: row.updatedAt,
|
|
325
|
+
units: row.units,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** One diagnostic, as a record holds it: the code, the span and the bar. */
|
|
330
|
+
export function diagnosticIn(
|
|
331
|
+
diagnostic: Diagnostic,
|
|
332
|
+
barIndex: number | null,
|
|
333
|
+
): RecordedDiagnostic {
|
|
334
|
+
return {
|
|
335
|
+
code: diagnostic.code,
|
|
336
|
+
line: diagnostic.span.line,
|
|
337
|
+
column: diagnostic.span.column,
|
|
338
|
+
severity: diagnostic.severity,
|
|
339
|
+
barIndex,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A stored run, reported again and run again.
|
|
3
|
+
*
|
|
4
|
+
* Two questions, and they are different questions, which is why they are two
|
|
5
|
+
* calls:
|
|
6
|
+
*
|
|
7
|
+
* - **`replay` asks whether the report is a function of the fills.** It folds
|
|
8
|
+
* the money again from the record's own fills and its own bar closes, with no
|
|
9
|
+
* bar executed and no order placed, and what comes back has to equal the
|
|
10
|
+
* report the record carries. If it does not, the report was reading something
|
|
11
|
+
* the engine happened to be holding rather than what the run settled, and
|
|
12
|
+
* nobody could reproduce it from the document.
|
|
13
|
+
* - **`rerun` asks whether the engine still does what it did.** It executes the
|
|
14
|
+
* record's program over the record's bars under the record's settings, and
|
|
15
|
+
* the two records are compared as bytes. A rerun of one record on this engine
|
|
16
|
+
* is bit-identical or it is a defect: the tolerance on the record is for a
|
|
17
|
+
* second implementation and is never this one's excuse.
|
|
18
|
+
*
|
|
19
|
+
* **The bars are proved before either is attempted.** A record names the bars it
|
|
20
|
+
* was made from by a hash, and bars are revised: a feed corrects a print, a
|
|
21
|
+
* session is extended, a split is applied to history. A replay over revised bars
|
|
22
|
+
* reporting the original figures is the most convincing wrong answer this system
|
|
23
|
+
* can produce, so a set that does not hash to the record's is OS6022.
|
|
24
|
+
*
|
|
25
|
+
* **One engine call is made, and nothing is executed by it.** A declaration
|
|
26
|
+
* field may be written by an `input()`, and what an input resolved to is the
|
|
27
|
+
* engine's rule; asking it here rather than resolving a second time is what
|
|
28
|
+
* keeps the replayed capital and commission the ones the run used. No bar is
|
|
29
|
+
* appended, so no value is computed and no order is placed: the load is a
|
|
30
|
+
* question about the program, not a run of it.
|
|
31
|
+
*/
|
|
32
|
+
import { reportOf, scheduleFromDeclaration } from '../accounting/index.js';
|
|
33
|
+
import type { ChargeSchedule, Report } from '../accounting/index.js';
|
|
34
|
+
import { diagnosticFor } from '../diagnostics/index.js';
|
|
35
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
36
|
+
import { load } from '../engine/index.js';
|
|
37
|
+
import { backtest } from './drive.js';
|
|
38
|
+
import type { BacktestResult } from './drive.js';
|
|
39
|
+
import { declarationOf } from './declaration.js';
|
|
40
|
+
import type { RunDeclaration } from './declaration.js';
|
|
41
|
+
import { marksFor, windowFor } from './range.js';
|
|
42
|
+
import { barsHash } from './record.js';
|
|
43
|
+
import type { RecordedBar, RunRecord } from './record.js';
|
|
44
|
+
|
|
45
|
+
/** The report a record folds to, or why it could not be folded. */
|
|
46
|
+
export type ReplayResult =
|
|
47
|
+
| { readonly ok: true; readonly report: Report }
|
|
48
|
+
| { readonly ok: false; readonly diagnostic: Diagnostic };
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The record's own report, computed again from its own fills.
|
|
52
|
+
*
|
|
53
|
+
* The bars are the record's where it carries them and the caller's where it
|
|
54
|
+
* points at them, and either way they are hashed against what the record names
|
|
55
|
+
* before a figure is computed from them.
|
|
56
|
+
*/
|
|
57
|
+
export function replay(record: RunRecord, bars: readonly RecordedBar[] | null = null): ReplayResult {
|
|
58
|
+
const held = barsOf(record, bars);
|
|
59
|
+
if (!held.ok) return { ok: false, diagnostic: held.diagnostic };
|
|
60
|
+
|
|
61
|
+
const framed = windowFor(held.bars, record.settings.range);
|
|
62
|
+
if (!framed.ok) return { ok: false, diagnostic: framed.diagnostic };
|
|
63
|
+
|
|
64
|
+
const declared = declarationIn(record);
|
|
65
|
+
if (!declared.ok) return { ok: false, diagnostic: declared.diagnostic };
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
ok: true,
|
|
69
|
+
report: reportOf(
|
|
70
|
+
record.fills,
|
|
71
|
+
marksFor(held.bars, framed.covered),
|
|
72
|
+
scheduleIn(record, declared.declaration),
|
|
73
|
+
record.settings.contract,
|
|
74
|
+
declared.declaration.capital,
|
|
75
|
+
),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The same run, executed again.
|
|
81
|
+
*
|
|
82
|
+
* Everything the run depended on is in the record: the program, the bars, the
|
|
83
|
+
* settings and the inputs. So a rerun takes no argument the record does not
|
|
84
|
+
* already hold, except the bars a referenced record points at rather than
|
|
85
|
+
* carries, and the record it produces is comparable with the original field for
|
|
86
|
+
* field and byte for byte.
|
|
87
|
+
*/
|
|
88
|
+
export function rerun(record: RunRecord, bars: readonly RecordedBar[] | null = null): BacktestResult {
|
|
89
|
+
const held = barsOf(record, bars);
|
|
90
|
+
if (!held.ok) return { ok: false, diagnostic: held.diagnostic };
|
|
91
|
+
return backtest(record.program, held.bars, record.settings, { form: record.bars.form });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type BarsResult =
|
|
95
|
+
| { readonly ok: true; readonly bars: readonly RecordedBar[] }
|
|
96
|
+
| { readonly ok: false; readonly diagnostic: Diagnostic };
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The bars a record was made from, proved to be those bars.
|
|
100
|
+
*
|
|
101
|
+
* A record carrying its own bars is still checked against any that are supplied
|
|
102
|
+
* beside them, because supplying a different set is exactly the mistake worth
|
|
103
|
+
* catching: the caller believes they are replaying this run and they are
|
|
104
|
+
* studying another one.
|
|
105
|
+
*/
|
|
106
|
+
export function barsOf(record: RunRecord, supplied: readonly RecordedBar[] | null): BarsResult {
|
|
107
|
+
if (supplied !== null) {
|
|
108
|
+
const hash = barsHash(supplied);
|
|
109
|
+
if (hash !== record.bars.hash) return { ok: false, diagnostic: mismatch(hash, record) };
|
|
110
|
+
return { ok: true, bars: supplied };
|
|
111
|
+
}
|
|
112
|
+
if (record.bars.form === 'inline') return { ok: true, bars: record.bars.rows };
|
|
113
|
+
// A referenced record points at bars it does not hold, so there is nothing to
|
|
114
|
+
// replay until whoever holds them supplies them. It is the same refusal as a
|
|
115
|
+
// wrong set, because the question it answers is the same one: are these the
|
|
116
|
+
// bars the record was made from.
|
|
117
|
+
return { ok: false, diagnostic: mismatch('no bars supplied', record) };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function mismatch(found: string, record: RunRecord): Diagnostic {
|
|
121
|
+
return diagnosticFor('OS6022', NO_POSITION, { found, expected: record.bars.hash });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
type DeclarationResult =
|
|
125
|
+
| { readonly ok: true; readonly declaration: RunDeclaration }
|
|
126
|
+
| { readonly ok: false; readonly diagnostic: Diagnostic };
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* What the record's own program declares, after the record's own inputs.
|
|
130
|
+
*
|
|
131
|
+
* The destination handed to the load is one that answers nothing, because
|
|
132
|
+
* nothing is placed: a strategy declares the orders capability and a host that
|
|
133
|
+
* did not offer it would be refused at load for a reason that has nothing to do
|
|
134
|
+
* with the record.
|
|
135
|
+
*/
|
|
136
|
+
function declarationIn(record: RunRecord): DeclarationResult {
|
|
137
|
+
const loaded = load(record.program, {
|
|
138
|
+
settings: record.settings.inputs,
|
|
139
|
+
host: { route: () => undefined },
|
|
140
|
+
});
|
|
141
|
+
if (!loaded.ok) return { ok: false, diagnostic: loaded.diagnostic };
|
|
142
|
+
return { ok: true, declaration: declarationOf(loaded.engine.program, loaded.inputs) };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** The cost model the record was carried out under, derived where it was derived. */
|
|
146
|
+
function scheduleIn(record: RunRecord, declared: RunDeclaration): ChargeSchedule {
|
|
147
|
+
if (record.settings.costs !== null) return record.settings.costs;
|
|
148
|
+
return scheduleFromDeclaration(
|
|
149
|
+
declared.commission,
|
|
150
|
+
declared.commissionType,
|
|
151
|
+
declared.slippage,
|
|
152
|
+
record.settings.contract.currency,
|
|
153
|
+
record.settings.contract.digits,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Where a refusal about a record points: nowhere in anybody's script. */
|
|
158
|
+
const NO_POSITION: Diagnostic['span'] = { offset: 0, length: 0, line: 0, column: 0 };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One resting order against one bar: did it trade, and at what price.
|
|
3
|
+
*
|
|
4
|
+
* **A bar is four prices and no path.** Whether the high came before the low is
|
|
5
|
+
* not in the data, so every rule here is one that does not need to know, and
|
|
6
|
+
* the places where knowing would matter are decided against the strategy rather
|
|
7
|
+
* than guessed in its favour. That is the whole discipline of this file: a
|
|
8
|
+
* backtest that is generous about fills is a backtest that reports money the
|
|
9
|
+
* market never offered.
|
|
10
|
+
*
|
|
11
|
+
* Three rules, each with the case it exists for:
|
|
12
|
+
*
|
|
13
|
+
* - **Touched is not traded through.** A limit resting exactly at the low of a
|
|
14
|
+
* bar may or may not have been filled: the print happened, somebody was
|
|
15
|
+
* filled at that price, and whether it was this order depends on a queue no
|
|
16
|
+
* bar records. The default is that it was not (`limitNeedsThrough`), and a
|
|
17
|
+
* host that has decided otherwise for its own market says so in the policy.
|
|
18
|
+
* - **A gap fills at the open, not at the level.** A stop triggered by a bar
|
|
19
|
+
* that opened beyond it was not filled at its trigger, and a backtest that
|
|
20
|
+
* says it was is reporting the one price that was never available. The open
|
|
21
|
+
* is the first price there was.
|
|
22
|
+
* - **A limit fills at its own price or better, and never worse.** Where the
|
|
23
|
+
* bar opened already through a limit, the open is the better price and the
|
|
24
|
+
* fill is there; a limit is never worsened by slippage, because a limit that
|
|
25
|
+
* is worsened is not a limit.
|
|
26
|
+
*
|
|
27
|
+
* A stop limit is both, in one bar and in that order: the trigger has to be
|
|
28
|
+
* reached and the limit has to be traded through, and where only the trigger is
|
|
29
|
+
* reached the order becomes a resting limit and waits.
|
|
30
|
+
*/
|
|
31
|
+
import type { OrderSide, OrderType } from '../engine/index.js';
|
|
32
|
+
import type { FillPolicy } from './settings.js';
|
|
33
|
+
import type { RecordedBar } from './record.js';
|
|
34
|
+
|
|
35
|
+
/** A resting order, as the venue holds one. */
|
|
36
|
+
export interface RestingOrder {
|
|
37
|
+
readonly side: OrderSide;
|
|
38
|
+
readonly type: OrderType;
|
|
39
|
+
/** The price a limit may not be worse than, absent on a plain stop. */
|
|
40
|
+
readonly limit: number | null;
|
|
41
|
+
/** The price a stop is triggered at, absent on a plain limit. */
|
|
42
|
+
readonly trigger: number | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** What one bar did to one resting order. */
|
|
46
|
+
export type RestOutcome =
|
|
47
|
+
| { readonly filled: false; readonly triggered: boolean }
|
|
48
|
+
| {
|
|
49
|
+
readonly filled: true;
|
|
50
|
+
readonly price: number;
|
|
51
|
+
/** Whether the price is the bar's open, which is a gap through the level. */
|
|
52
|
+
readonly atOpen: boolean;
|
|
53
|
+
/** Whether slippage applies, which a limit never takes. */
|
|
54
|
+
readonly slips: boolean;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const NOTHING: RestOutcome = { filled: false, triggered: false };
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* One order against one bar.
|
|
61
|
+
*
|
|
62
|
+
* A bar missing any of the four prices decides nothing: an incomplete bar is
|
|
63
|
+
* not evidence that a level was reached and it is not evidence that it was not.
|
|
64
|
+
*/
|
|
65
|
+
export function testResting(
|
|
66
|
+
order: RestingOrder,
|
|
67
|
+
bar: RecordedBar,
|
|
68
|
+
policy: FillPolicy,
|
|
69
|
+
): RestOutcome {
|
|
70
|
+
const open = bar.open;
|
|
71
|
+
const high = bar.high;
|
|
72
|
+
const low = bar.low;
|
|
73
|
+
if (open === null || high === null || low === null || bar.close === null) return NOTHING;
|
|
74
|
+
|
|
75
|
+
if (order.type === 'limit') return limitAgainst(order, open, high, low, policy);
|
|
76
|
+
|
|
77
|
+
const trigger = order.trigger;
|
|
78
|
+
if (trigger === null) return NOTHING;
|
|
79
|
+
const reached = order.side === 'buy' ? high >= trigger : low <= trigger;
|
|
80
|
+
if (!reached) return NOTHING;
|
|
81
|
+
|
|
82
|
+
if (order.type === 'stop') {
|
|
83
|
+
const gapped = order.side === 'buy' ? open >= trigger : open <= trigger;
|
|
84
|
+
const price = gapped && policy.stopFillsAtOpenOnGap ? open : trigger;
|
|
85
|
+
return { filled: true, price, atOpen: gapped && policy.stopFillsAtOpenOnGap, slips: true };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// A stop limit that triggered is a limit for the rest of this bar. Where the
|
|
89
|
+
// limit is not traded through it keeps resting, and the caller is told the
|
|
90
|
+
// trigger was reached so that the order rests as a limit from here on.
|
|
91
|
+
const asLimit = limitAgainst(order, open, high, low, policy);
|
|
92
|
+
return asLimit.filled ? asLimit : { filled: false, triggered: true };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A limit against one bar.
|
|
97
|
+
*
|
|
98
|
+
* `limitNeedsThrough` is the difference between a strict comparison and a loose
|
|
99
|
+
* one, and it is the only knob in this file that changes a fill into no fill
|
|
100
|
+
* rather than one price into another.
|
|
101
|
+
*/
|
|
102
|
+
function limitAgainst(
|
|
103
|
+
order: RestingOrder,
|
|
104
|
+
open: number,
|
|
105
|
+
high: number,
|
|
106
|
+
low: number,
|
|
107
|
+
policy: FillPolicy,
|
|
108
|
+
): RestOutcome {
|
|
109
|
+
const limit = order.limit;
|
|
110
|
+
if (limit === null) return NOTHING;
|
|
111
|
+
|
|
112
|
+
if (order.side === 'buy') {
|
|
113
|
+
const traded = policy.limitNeedsThrough ? low < limit : low <= limit;
|
|
114
|
+
if (!traded) return NOTHING;
|
|
115
|
+
// The open already below the limit is the better price, and it is the first
|
|
116
|
+
// price the bar had.
|
|
117
|
+
const gapped = open < limit;
|
|
118
|
+
return { filled: true, price: gapped ? open : limit, atOpen: gapped, slips: false };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const traded = policy.limitNeedsThrough ? high > limit : high >= limit;
|
|
122
|
+
if (!traded) return NOTHING;
|
|
123
|
+
const gapped = open > limit;
|
|
124
|
+
return { filled: true, price: gapped ? open : limit, atOpen: gapped, slips: false };
|
|
125
|
+
}
|