openalgo-script 0.1.0-alpha.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1200 -0
- package/README.md +49 -28
- 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 +204 -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 +84 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +98 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +17 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +25 -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 +30 -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-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 +38 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +100 -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 +45 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +116 -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 +29 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +23 -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 +45 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +60 -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 +61 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +48 -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/package.json +38 -14
- package/spec/errors.json +382 -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 +238 -0
- package/src/adapters/charts/tables.ts +155 -0
- package/src/core/catalogue/catalogue.generated.ts +17 -9
- package/src/core/catalogue/values.generated.ts +8 -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 +67 -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-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 +115 -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 +150 -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 +74 -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 +104 -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 +128 -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
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A request expression, executed over the requested bars,
|
|
3
|
+
* `compiled-program.md` 2.16.1.
|
|
4
|
+
*
|
|
5
|
+
* **The body is a program the machine already knows how to run.** It holds the
|
|
6
|
+
* tables a program holds for the machine of section 3 and none of the tables
|
|
7
|
+
* that describe a chart, so the whole of this file is: build a program-shaped
|
|
8
|
+
* view whose code, frame, registers, cells, states, functions and loops are the
|
|
9
|
+
* body's own, keep the constant pool and the library manifest the program's,
|
|
10
|
+
* and drive the same interpreter over it once per requested bar. Nothing new is
|
|
11
|
+
* asked of the instruction loop, which is why the body ends in `RET` rather
|
|
12
|
+
* than in an opcode of its own.
|
|
13
|
+
*
|
|
14
|
+
* **Every table is counted from zero and none of them is the program's.** The
|
|
15
|
+
* registers are the requested instrument's bars and the cells and state regions
|
|
16
|
+
* step once per requested bar, so an engine that reached into the program's
|
|
17
|
+
* tables would put this chart's history behind another chart's name. The two
|
|
18
|
+
* that are shared, `consts` and `lib.functions`, hold nothing that depends on a
|
|
19
|
+
* bar.
|
|
20
|
+
*
|
|
21
|
+
* **A requested bar moves exactly as the chart's newest bar does.** `settle` is
|
|
22
|
+
* a bar that has closed and `peek` is the one still forming, and `peek` rolls
|
|
23
|
+
* the state back before it runs so that peeking the same bucket on ten chart
|
|
24
|
+
* bars gives the same answer as peeking it once. That is the mechanism of
|
|
25
|
+
* section 6 applied one level down, and it is what makes a `"developing"` read
|
|
26
|
+
* mean the bucket so far rather than the bucket in full.
|
|
27
|
+
*/
|
|
28
|
+
import type { Span } from '../span/index.js';
|
|
29
|
+
import { barField, factsFor } from './bars.js';
|
|
30
|
+
import type { HostBar } from './bars.js';
|
|
31
|
+
import { Budget, stepBound } from './budget.js';
|
|
32
|
+
import type { Clock, EngineLimits } from './budget.js';
|
|
33
|
+
import { Channels } from './channels.js';
|
|
34
|
+
import { guardFor } from './guard.js';
|
|
35
|
+
import { Machine } from './machine.js';
|
|
36
|
+
import { NO_SESSION } from './session/index.js';
|
|
37
|
+
import { Memory } from './memory.js';
|
|
38
|
+
import { Registers } from './registers.js';
|
|
39
|
+
import type { BarView, HostFacts, ManifestEntry, PositionFacts } from './library/index.js';
|
|
40
|
+
import type { CompiledProgram, Position, Request } from './types.js';
|
|
41
|
+
import { ABSENT, Heap, isRef, reference } from './values/index.js';
|
|
42
|
+
import type { Value } from './values/index.js';
|
|
43
|
+
|
|
44
|
+
/** One setting the body reads, resolved once at load like every other input. */
|
|
45
|
+
export interface BodyInput {
|
|
46
|
+
readonly series: number;
|
|
47
|
+
readonly value: Value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The reads written inside this one, as the body drives them.
|
|
52
|
+
*
|
|
53
|
+
* Declared here rather than imported, so the dependency points one way: the
|
|
54
|
+
* fold knows about a body and a body knows only the shape of what it has to
|
|
55
|
+
* step. A nested read folds the bars this body is running on, which are handed
|
|
56
|
+
* over one requested bar at a time, so a nested `"lookahead"` read sees no
|
|
57
|
+
* further than the requested bar being executed. That is the same thing the
|
|
58
|
+
* mode does on a live chart's newest bucket, one level down.
|
|
59
|
+
*/
|
|
60
|
+
export interface NestedRequests {
|
|
61
|
+
readonly empty: boolean;
|
|
62
|
+
fill(
|
|
63
|
+
registers: Registers,
|
|
64
|
+
bars: readonly HostBar[],
|
|
65
|
+
index: number,
|
|
66
|
+
fresh: boolean,
|
|
67
|
+
): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface BodyParts {
|
|
71
|
+
/** The program-shaped view of the body, built by `bodyProgram`. */
|
|
72
|
+
readonly program: CompiledProgram;
|
|
73
|
+
readonly limits: EngineLimits;
|
|
74
|
+
readonly clock: Clock | undefined;
|
|
75
|
+
readonly host: HostFacts;
|
|
76
|
+
readonly position: PositionFacts;
|
|
77
|
+
readonly library: readonly ManifestEntry[];
|
|
78
|
+
readonly inputs: readonly BodyInput[];
|
|
79
|
+
readonly nested: NestedRequests | undefined;
|
|
80
|
+
spanAt(line: number, column: number): Span;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The body's tables wearing a program's shape.
|
|
85
|
+
*
|
|
86
|
+
* A copy of the parent with nine fields replaced, rather than a second
|
|
87
|
+
* declaration, so that the one thing the two share by design, the constant pool
|
|
88
|
+
* and the manifest, is shared by construction and cannot drift.
|
|
89
|
+
*/
|
|
90
|
+
export function bodyProgram(parent: CompiledProgram, request: Request): CompiledProgram {
|
|
91
|
+
const body = request.body;
|
|
92
|
+
return {
|
|
93
|
+
...parent,
|
|
94
|
+
frame: body.frame,
|
|
95
|
+
series: body.series,
|
|
96
|
+
cells: body.cells,
|
|
97
|
+
states: body.states,
|
|
98
|
+
functions: body.functions,
|
|
99
|
+
callSites: body.callSites,
|
|
100
|
+
loops: body.loops,
|
|
101
|
+
code: body.code,
|
|
102
|
+
requests: body.requests,
|
|
103
|
+
debug: { ...parent.debug, pos: body.pos, fnPos: body.fnPos },
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export class RequestBody {
|
|
108
|
+
private readonly parts: BodyParts;
|
|
109
|
+
private readonly registers: Registers;
|
|
110
|
+
private readonly memory: Memory;
|
|
111
|
+
private readonly heap = new Heap();
|
|
112
|
+
private readonly budget: Budget;
|
|
113
|
+
private readonly machine: Machine;
|
|
114
|
+
|
|
115
|
+
/** Requested bars that have closed, which is the index the next one takes. */
|
|
116
|
+
private settled = 0;
|
|
117
|
+
/** Executions of the requested bar currently forming, for `bar.updates`. */
|
|
118
|
+
private touches = 0;
|
|
119
|
+
/** The previous requested bar's close, which `trueRange` inside a body needs. */
|
|
120
|
+
private lastClose: number | null = null;
|
|
121
|
+
/** The requested bars themselves, kept only when a read inside folds them. */
|
|
122
|
+
private readonly history: HostBar[] = [];
|
|
123
|
+
/**
|
|
124
|
+
* The value the last closed requested bar handed back.
|
|
125
|
+
*
|
|
126
|
+
* Held so that the sweep does not reclaim it. A confirmed read takes the last
|
|
127
|
+
* closed bucket's value on every chart bar of the next bucket, so the value
|
|
128
|
+
* outlives the execution that produced it, and if it is an object the object
|
|
129
|
+
* has to outlive it too.
|
|
130
|
+
*/
|
|
131
|
+
private handed: Value = ABSENT;
|
|
132
|
+
|
|
133
|
+
constructor(parts: BodyParts) {
|
|
134
|
+
this.parts = parts;
|
|
135
|
+
const { program } = parts;
|
|
136
|
+
this.registers = new Registers(program.series.length);
|
|
137
|
+
this.memory = new Memory(program.cells, program.states);
|
|
138
|
+
this.budget = new Budget(
|
|
139
|
+
parts.limits,
|
|
140
|
+
parts.limits.steps ?? stepBound(program),
|
|
141
|
+
program.limits.loops,
|
|
142
|
+
parts.clock,
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const fnPositions: (readonly Position[])[] = program.functions.map(() => []);
|
|
146
|
+
for (const [fn, positions] of program.debug.fnPos) fnPositions[fn] = positions;
|
|
147
|
+
|
|
148
|
+
this.machine = new Machine(
|
|
149
|
+
{
|
|
150
|
+
program,
|
|
151
|
+
registers: this.registers,
|
|
152
|
+
memory: this.memory,
|
|
153
|
+
// A read carries no channel, no plot and no declaration: those are the
|
|
154
|
+
// calls the language refuses inside a request expression, so nothing in
|
|
155
|
+
// a body can write a column and verification refuses an `EMIT` against
|
|
156
|
+
// an empty table.
|
|
157
|
+
channels: new Channels([]),
|
|
158
|
+
heap: this.heap,
|
|
159
|
+
budget: this.budget,
|
|
160
|
+
guard: guardFor(this.budget),
|
|
161
|
+
host: parts.host,
|
|
162
|
+
position: parts.position,
|
|
163
|
+
library: parts.library,
|
|
164
|
+
fnPositions,
|
|
165
|
+
spanAt: parts.spanAt,
|
|
166
|
+
},
|
|
167
|
+
this.viewOf({ open: null, high: null, low: null, close: null, time: null }, 0, false),
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** How many requested bars have closed, which a warmup is counted against. */
|
|
172
|
+
get closed(): number {
|
|
173
|
+
return this.settled;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** The body's own heap, which a read written inside it lands its value in. */
|
|
177
|
+
get objects(): Heap {
|
|
178
|
+
return this.heap;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* The requested bar still forming.
|
|
183
|
+
*
|
|
184
|
+
* Rolls back to the last closed bar first, so a bucket peeked on every chart
|
|
185
|
+
* bar inside it costs one execution each and leaves no trace of the previous
|
|
186
|
+
* one. Nothing is committed: the bucket is still moving.
|
|
187
|
+
*/
|
|
188
|
+
peek(bar: HostBar): Value {
|
|
189
|
+
const value = this.execute(bar, false);
|
|
190
|
+
this.touches += 1;
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The requested bar has closed.
|
|
196
|
+
*
|
|
197
|
+
* The last execution of that bar is the one that counts, and the state it
|
|
198
|
+
* leaves becomes the checkpoint the next bar starts from. `settle` is
|
|
199
|
+
* idempotent only in the sense every checkpoint is: it is called once per
|
|
200
|
+
* requested bar, by the one place that knows a bucket has ended.
|
|
201
|
+
*/
|
|
202
|
+
settle(bar: HostBar): Value {
|
|
203
|
+
const value = this.execute(bar, true);
|
|
204
|
+
this.handed = value;
|
|
205
|
+
this.memory.commit();
|
|
206
|
+
this.heap.commit();
|
|
207
|
+
this.heap.sweep((visit) => {
|
|
208
|
+
this.memory.walk(visit);
|
|
209
|
+
this.registers.walk(visit);
|
|
210
|
+
visit(this.handed);
|
|
211
|
+
});
|
|
212
|
+
this.registers.trim(this.settled, this.parts.program.limits.history);
|
|
213
|
+
this.lastClose = bar.close ?? null;
|
|
214
|
+
this.settled += 1;
|
|
215
|
+
this.touches = 0;
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
private execute(bar: HostBar, closed: boolean): Value {
|
|
220
|
+
const index = this.settled;
|
|
221
|
+
// Steps 1 and 2 of the bar cycle, one level down: the checkpoint from the
|
|
222
|
+
// end of the previous requested bar, and the history entry this bar may
|
|
223
|
+
// already have written.
|
|
224
|
+
this.memory.rollback();
|
|
225
|
+
this.heap.rollback();
|
|
226
|
+
this.registers.truncate(index);
|
|
227
|
+
this.registers.clearCurrent();
|
|
228
|
+
this.budget.begin(index);
|
|
229
|
+
|
|
230
|
+
const view = this.viewOf(bar, index, closed);
|
|
231
|
+
this.machine.begin(view, index);
|
|
232
|
+
|
|
233
|
+
const facts = factsFor(
|
|
234
|
+
index,
|
|
235
|
+
// A bar that has closed is not the last one: something later is what
|
|
236
|
+
// closed it. The one still forming is.
|
|
237
|
+
index + (closed ? 2 : 1),
|
|
238
|
+
{ isConfirmed: closed },
|
|
239
|
+
this.touches === 0,
|
|
240
|
+
this.touches + 1,
|
|
241
|
+
NO_SESSION,
|
|
242
|
+
);
|
|
243
|
+
for (const register of this.parts.program.series) {
|
|
244
|
+
if (register.kind !== 'bar' || register.field === null) continue;
|
|
245
|
+
this.registers.set(register.id, barField(register.field, bar, facts));
|
|
246
|
+
}
|
|
247
|
+
// A body is one expression with no statement to write a slot from, so a
|
|
248
|
+
// setting it reads arrives as a register rather than as a slot (2.16.1).
|
|
249
|
+
for (const input of this.parts.inputs) this.registers.set(input.series, input.value);
|
|
250
|
+
|
|
251
|
+
const nested = this.parts.nested;
|
|
252
|
+
if (nested !== undefined && !nested.empty) {
|
|
253
|
+
this.history[index] = bar;
|
|
254
|
+
nested.fill(this.registers, this.history, index, this.touches === 0);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
this.machine.run();
|
|
258
|
+
this.registers.close(index);
|
|
259
|
+
return this.machine.result();
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* A value the body produced, as a value of the machine that asked for it.
|
|
264
|
+
*
|
|
265
|
+
* A number, a string, a colour or absence is the same value in both, and
|
|
266
|
+
* nothing is copied. An object is not: a reference is an index into one heap,
|
|
267
|
+
* and the body's heap is its own, so handing the index over would name
|
|
268
|
+
* whatever the other heap happens to hold at that index. So the object is
|
|
269
|
+
* copied, and copied again on every bar that reads it, because the copy lives
|
|
270
|
+
* in a heap whose rollback undoes the bar it was made on.
|
|
271
|
+
*
|
|
272
|
+
* Only an array can arrive here. A read that declared a grid or drew an object
|
|
273
|
+
* is refused at the call (OS3006), so those two kinds cannot exist in a body.
|
|
274
|
+
*/
|
|
275
|
+
carry(value: Value, into: Heap): Value {
|
|
276
|
+
return copyInto(value, this.heap, into, new Map<number, number>());
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
private viewOf(bar: HostBar, index: number, closed: boolean): BarView {
|
|
280
|
+
return {
|
|
281
|
+
index,
|
|
282
|
+
open: bar.open ?? null,
|
|
283
|
+
high: bar.high ?? null,
|
|
284
|
+
low: bar.low ?? null,
|
|
285
|
+
close: bar.close ?? null,
|
|
286
|
+
volume: bar.volume ?? null,
|
|
287
|
+
time: bar.time ?? null,
|
|
288
|
+
previousClose: this.lastClose,
|
|
289
|
+
isConfirmed: closed,
|
|
290
|
+
isRealtime: false,
|
|
291
|
+
isNew: this.touches === 0,
|
|
292
|
+
isLast: !closed,
|
|
293
|
+
updates: this.touches + 1,
|
|
294
|
+
// The instrument record describes the chart's instrument, not the one a
|
|
295
|
+
// read names, and a requested bar is not on the chart's own grid either.
|
|
296
|
+
// So a body has no session, and it is told absence rather than false: a
|
|
297
|
+
// false would say this bar closes no session, which is a claim about an
|
|
298
|
+
// instrument whose hours the engine was never given.
|
|
299
|
+
isSessionFirst: null,
|
|
300
|
+
isSessionLast: null,
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* One value copied from one heap into another, sharing what it shared.
|
|
307
|
+
*
|
|
308
|
+
* The map is what keeps two references to one array two references to one copy,
|
|
309
|
+
* and it is what stops a value that refers to itself from recursing forever.
|
|
310
|
+
*/
|
|
311
|
+
function copyInto(
|
|
312
|
+
value: Value,
|
|
313
|
+
from: Heap,
|
|
314
|
+
into: Heap,
|
|
315
|
+
copied: Map<number, number>,
|
|
316
|
+
): Value {
|
|
317
|
+
if (!isRef(value)) return value;
|
|
318
|
+
const already = copied.get(value.id);
|
|
319
|
+
if (already !== undefined) return reference(already);
|
|
320
|
+
const object = from.get(value.id);
|
|
321
|
+
if (object === undefined || object.kind !== 'array') return ABSENT;
|
|
322
|
+
const items: Value[] = [];
|
|
323
|
+
const id = into.allocate({ kind: 'array', items });
|
|
324
|
+
copied.set(value.id, id);
|
|
325
|
+
for (const item of object.items) items.push(copyInto(item, from, into, copied));
|
|
326
|
+
into.countElements(items.length);
|
|
327
|
+
return reference(id);
|
|
328
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What is settled about a read before bar 0, `compiled-program.md` 2.16.
|
|
3
|
+
*
|
|
4
|
+
* **A request's identity is fixed before bar 0.** That is what lets the whole
|
|
5
|
+
* set be known at load, what lets a host fetch in parallel and cache by
|
|
6
|
+
* instrument and timeframe, and what makes a request that changed afterwards
|
|
7
|
+
* OS6013. So the three identity fields are resolved here, once, from the value
|
|
8
|
+
* the script wrote, the setting it named or the chart fact it named, and
|
|
9
|
+
* nothing below bar 0 ever asks again.
|
|
10
|
+
*
|
|
11
|
+
* **Two refusals belong at load and four belong to the host.** A timeframe the
|
|
12
|
+
* language does not know (OS6001), one finer than the chart's (OS6002) and one
|
|
13
|
+
* that does not fold into the chart's (OS6015) are facts about the program and
|
|
14
|
+
* the chart, both known before a bar runs, so they stop the load and name what
|
|
15
|
+
* was refused. An unknown instrument (OS6007), a range with no bars (OS6008), a
|
|
16
|
+
* source that refused (OS6009) and an interval the feed does not carry (OS6014)
|
|
17
|
+
* are the host's answers: they leave the read absent, put the reason in
|
|
18
|
+
* `req.error(read)` and let the study keep drawing everything else, which is
|
|
19
|
+
* `stdlib.md` 15.5.
|
|
20
|
+
*/
|
|
21
|
+
import { diagnosticFor } from '../diagnostics/index.js';
|
|
22
|
+
import type { Diagnostic } from '../diagnostics/index.js';
|
|
23
|
+
import { NO_POSITION, failure } from './errors.js';
|
|
24
|
+
import type { EngineHost, RequestAnswer, RequestQuery, RequestRefusal } from './host.js';
|
|
25
|
+
import type { ResolvedInput } from './inputs.js';
|
|
26
|
+
import type { Request, RequestField } from './types.js';
|
|
27
|
+
import { foldRefusal, isIntraday, parseTimeframe } from './timeframe.js';
|
|
28
|
+
import type { Timeframe } from './timeframe.js';
|
|
29
|
+
|
|
30
|
+
/** What a read holds once its identity, its timeframe and its source are fixed. */
|
|
31
|
+
export interface RequestPlan {
|
|
32
|
+
readonly request: Request;
|
|
33
|
+
readonly query: RequestQuery;
|
|
34
|
+
readonly timeframe: Timeframe;
|
|
35
|
+
/** The zone a calendar bucket is dated in, or nothing when none was stated. */
|
|
36
|
+
readonly zone: string | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type PlanResult =
|
|
40
|
+
| { readonly ok: true; readonly plans: readonly RequestPlan[] }
|
|
41
|
+
| { readonly ok: false; readonly diagnostic: Diagnostic };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* One of the three identity fields, resolved.
|
|
45
|
+
*
|
|
46
|
+
* Three forms and no fourth: the string the script wrote, the value of the
|
|
47
|
+
* setting it named, and one of the three chart facts that identify a chart
|
|
48
|
+
* rather than describe it.
|
|
49
|
+
*/
|
|
50
|
+
export function identityOf(
|
|
51
|
+
field: RequestField,
|
|
52
|
+
inputs: readonly ResolvedInput[],
|
|
53
|
+
host: EngineHost,
|
|
54
|
+
): string | null {
|
|
55
|
+
if (typeof field === 'string') return field;
|
|
56
|
+
if (field === null || typeof field !== 'object' || Array.isArray(field)) return null;
|
|
57
|
+
|
|
58
|
+
const named = field as { readonly input?: string; readonly chart?: string };
|
|
59
|
+
if (typeof named.input === 'string') {
|
|
60
|
+
const found = inputs.find((one) => one.key === named.input);
|
|
61
|
+
return typeof found?.value === 'string' ? found.value : null;
|
|
62
|
+
}
|
|
63
|
+
if (named.chart === 'symbol') return host.instrument?.symbol ?? null;
|
|
64
|
+
if (named.chart === 'exchange') return host.instrument?.exchange ?? null;
|
|
65
|
+
if (named.chart === 'interval') return host.instrument?.interval ?? null;
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Every read the program makes, with its identity settled.
|
|
71
|
+
*
|
|
72
|
+
* Walks the nested reads as well, because a read written inside another is part
|
|
73
|
+
* of the program and a host handed a list with one missing would fetch less
|
|
74
|
+
* than the file asks for.
|
|
75
|
+
*/
|
|
76
|
+
export function planRequests(
|
|
77
|
+
requests: readonly Request[],
|
|
78
|
+
inputs: readonly ResolvedInput[],
|
|
79
|
+
host: EngineHost,
|
|
80
|
+
): PlanResult {
|
|
81
|
+
const chart = chartTimeframe(host);
|
|
82
|
+
const plans: RequestPlan[] = [];
|
|
83
|
+
const problem = collect(requests, inputs, host, chart, plans);
|
|
84
|
+
if (problem !== undefined) return { ok: false, diagnostic: problem };
|
|
85
|
+
return { ok: true, plans };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function collect(
|
|
89
|
+
requests: readonly Request[],
|
|
90
|
+
inputs: readonly ResolvedInput[],
|
|
91
|
+
host: EngineHost,
|
|
92
|
+
chart: Timeframe | undefined,
|
|
93
|
+
into: RequestPlan[],
|
|
94
|
+
): Diagnostic | undefined {
|
|
95
|
+
for (const request of requests) {
|
|
96
|
+
const written = identityOf(request.timeframe, inputs, host);
|
|
97
|
+
const timeframe = written === null ? undefined : parseTimeframe(written);
|
|
98
|
+
if (timeframe === undefined) {
|
|
99
|
+
return failure('OS6001', NO_POSITION, { value: written ?? 'nothing' });
|
|
100
|
+
}
|
|
101
|
+
// The chart's interval is a host fact and a host may state none. Without it
|
|
102
|
+
// there is nothing to compare a request against, so the two comparisons are
|
|
103
|
+
// skipped rather than answered from a value nobody supplied.
|
|
104
|
+
const refusal = chart === undefined ? undefined : foldRefusal(timeframe, chart);
|
|
105
|
+
if (refusal !== undefined && chart !== undefined) {
|
|
106
|
+
if (refusal.code === 'OS6002') {
|
|
107
|
+
return failure('OS6002', NO_POSITION, { chart: chart.text, requested: timeframe.text });
|
|
108
|
+
}
|
|
109
|
+
return failure('OS6015', NO_POSITION, {
|
|
110
|
+
requested: timeframe.text,
|
|
111
|
+
chart: chart.text,
|
|
112
|
+
suggestion: refusal.suggestion,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
into.push({
|
|
117
|
+
request,
|
|
118
|
+
timeframe,
|
|
119
|
+
zone: host.instrument?.timezone ?? null,
|
|
120
|
+
query: {
|
|
121
|
+
id: request.id,
|
|
122
|
+
read: request.read,
|
|
123
|
+
instrument: instrumentOf(request, inputs, host),
|
|
124
|
+
exchange: exchangeOf(request, inputs, host),
|
|
125
|
+
timeframe: timeframe.text,
|
|
126
|
+
mode: request.mode,
|
|
127
|
+
warmup: request.warmup,
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
const nested = collect(request.body.requests, inputs, host, timeframe, into);
|
|
131
|
+
if (nested !== undefined) return nested;
|
|
132
|
+
}
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The instrument a read asks about, with the format's own default applied.
|
|
138
|
+
*
|
|
139
|
+
* 2.16 spells a read of the chart's own instrument as a `null` `symbol`, so
|
|
140
|
+
* resolving it here is applying the format's rule rather than inventing one:
|
|
141
|
+
* the host is handed the identity it gave for the chart, which is what
|
|
142
|
+
* `host-interface.md` 5.2 says a request carries.
|
|
143
|
+
*
|
|
144
|
+
* **The default belongs to a `"timeframe"` read and to nothing else.** A
|
|
145
|
+
* `"symbol"` read whose identity did not resolve, because the setting behind it
|
|
146
|
+
* holds something that is not an instrument, stays absent. Falling back there
|
|
147
|
+
* would turn a read of another instrument into a second read of this one, and
|
|
148
|
+
* the study would draw a line nobody asked for with nothing to say it had
|
|
149
|
+
* substituted anything.
|
|
150
|
+
*/
|
|
151
|
+
function instrumentOf(
|
|
152
|
+
request: Request,
|
|
153
|
+
inputs: readonly ResolvedInput[],
|
|
154
|
+
host: EngineHost,
|
|
155
|
+
): string | null {
|
|
156
|
+
const named = identityOf(request.symbol, inputs, host);
|
|
157
|
+
if (named !== null) return named;
|
|
158
|
+
return request.read === 'timeframe' ? host.instrument?.symbol ?? null : null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Where a read's instrument trades, with `stdlib.md` 15.1's default applied.
|
|
163
|
+
*
|
|
164
|
+
* `req.symbol`'s signature defaults `exchange` to `chart.exchange`, and 2.16
|
|
165
|
+
* spells the omission as `null`, "means the chart's exchange". A host handed
|
|
166
|
+
* that `null` would have to apply the rule against the record it supplied, and
|
|
167
|
+
* a host that applied it differently, or not at all, would resolve an
|
|
168
|
+
* instrument on a venue the script never named. So it is applied once, here.
|
|
169
|
+
*/
|
|
170
|
+
function exchangeOf(
|
|
171
|
+
request: Request,
|
|
172
|
+
inputs: readonly ResolvedInput[],
|
|
173
|
+
host: EngineHost,
|
|
174
|
+
): string | null {
|
|
175
|
+
return identityOf(request.exchange, inputs, host) ?? host.instrument?.exchange ?? null;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The chart's own interval as a timeframe, when the host stated a usable one. */
|
|
179
|
+
function chartTimeframe(host: EngineHost): Timeframe | undefined {
|
|
180
|
+
const interval = host.instrument?.interval;
|
|
181
|
+
return interval === undefined ? undefined : parseTimeframe(interval);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* What the host says about one read.
|
|
186
|
+
*
|
|
187
|
+
* A host with no provider is not asked. A read of the chart's own instrument is
|
|
188
|
+
* then folded from the bars the engine already holds, and a read of another
|
|
189
|
+
* instrument cannot be: the engine holds none of that instrument's bars, so
|
|
190
|
+
* nothing to serve is the same answer as an instrument the host does not know.
|
|
191
|
+
*/
|
|
192
|
+
export function askHost(plan: RequestPlan, host: EngineHost): RequestAnswer | undefined {
|
|
193
|
+
const answer = host.requestBars?.(plan.query);
|
|
194
|
+
if (answer !== undefined) return answer;
|
|
195
|
+
if (plan.query.read === 'timeframe') return undefined;
|
|
196
|
+
return { refused: { code: 'OS6007' } };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Whether this read can date a bucket at all.
|
|
201
|
+
*
|
|
202
|
+
* A day, week or month request is folded by the calendar, and a calendar
|
|
203
|
+
* boundary is a civil date read in a zone (`timeframe.ts`). A host that stated
|
|
204
|
+
* no timezone leaves the fold with no key for any bar, so the read is absent on
|
|
205
|
+
* every bar of the run and will be on every future one: nothing that arrives
|
|
206
|
+
* later supplies a fact the instrument record does not hold.
|
|
207
|
+
*
|
|
208
|
+
* That is a dead read, and a dead read a study cannot explain is the worst of
|
|
209
|
+
* the three: the trader has already looked at the blank pane. So it is answered
|
|
210
|
+
* here rather than left as absence, and `req.isReady` and `req.error` say it.
|
|
211
|
+
*/
|
|
212
|
+
export function undatable(plan: RequestPlan): boolean {
|
|
213
|
+
return !isIntraday(plan.timeframe) && plan.zone === null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* What `req.error(read)` says about a read with no zone to date its buckets.
|
|
218
|
+
*
|
|
219
|
+
* OS6012's own message, because the zone is an instrument fact the host did not
|
|
220
|
+
* supply and that is exactly what this read needs and cannot default. Nothing
|
|
221
|
+
* is raised: a fact the host did not state leaves the read absent, and this is
|
|
222
|
+
* the sentence that explains the absence rather than a second answer to the
|
|
223
|
+
* question `host-interface.md` 4.5 leaves open.
|
|
224
|
+
*/
|
|
225
|
+
export function undatableReason(query: RequestQuery): string {
|
|
226
|
+
return diagnosticFor('OS6012', NO_POSITION, { fact: 'a timezone', symbol: named(query) }).message;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** The instrument a reason names: the one the read asked for, or the chart's. */
|
|
230
|
+
function named(query: RequestQuery): string {
|
|
231
|
+
return query.instrument ?? 'the chart\'s instrument';
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The reason a refusal reads as through `req.error(read)`.
|
|
236
|
+
*
|
|
237
|
+
* The catalogue's own message, filled with the identity the read asked for and
|
|
238
|
+
* with the host's own words where it gave them. The host's words are carried
|
|
239
|
+
* and not paraphrased, because "the account's data subscription does not cover
|
|
240
|
+
* this instrument" is actionable and "the request failed" is not.
|
|
241
|
+
*/
|
|
242
|
+
export function reasonFor(refusal: RequestRefusal, query: RequestQuery): string {
|
|
243
|
+
const symbol = named(query);
|
|
244
|
+
const exchange = query.exchange ?? 'the chart\'s exchange';
|
|
245
|
+
const reason = refusal.reason ?? 'the host gave no reason';
|
|
246
|
+
switch (refusal.code) {
|
|
247
|
+
case 'OS6007':
|
|
248
|
+
return diagnosticFor('OS6007', NO_POSITION, { symbol, exchange }).message;
|
|
249
|
+
case 'OS6008':
|
|
250
|
+
return diagnosticFor('OS6008', NO_POSITION, { symbol, timeframe: query.timeframe }).message;
|
|
251
|
+
case 'OS6014':
|
|
252
|
+
return diagnosticFor('OS6014', NO_POSITION, {
|
|
253
|
+
timeframe: query.timeframe,
|
|
254
|
+
symbol,
|
|
255
|
+
available: refusal.available ?? 'nothing it named',
|
|
256
|
+
}).message;
|
|
257
|
+
case 'OS6015':
|
|
258
|
+
return diagnosticFor('OS6015', NO_POSITION, {
|
|
259
|
+
requested: query.timeframe,
|
|
260
|
+
chart: 'the chart\'s interval',
|
|
261
|
+
suggestion: refusal.available ?? 'a whole multiple of it',
|
|
262
|
+
}).message;
|
|
263
|
+
default:
|
|
264
|
+
return diagnosticFor('OS6009', NO_POSITION, {
|
|
265
|
+
symbol,
|
|
266
|
+
timeframe: query.timeframe,
|
|
267
|
+
reason,
|
|
268
|
+
}).message;
|
|
269
|
+
}
|
|
270
|
+
}
|