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,374 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the standard library, as the checker needs to see it.
|
|
3
|
+
*
|
|
4
|
+
* `stdlib.md` is the specification of what each call does and what it costs in
|
|
5
|
+
* bars. What the checker needs from it is narrower: a name, the parameters it
|
|
6
|
+
* takes, the type it gives back, where it may be written and how many bars it
|
|
7
|
+
* delays its source by. That is what an entry here holds, and nothing here
|
|
8
|
+
* implements any of it: the numbers are computed under `src/core/stdlib/`.
|
|
9
|
+
*
|
|
10
|
+
* Entries are written as signature strings because a signature is what the
|
|
11
|
+
* specification's tables already show a reader, so the two can be compared by
|
|
12
|
+
* eye without translating one of them first. A string is parsed once, when this
|
|
13
|
+
* module loads, into the record below; there is no code built from text
|
|
14
|
+
* anywhere, and there cannot be, which is the rule the whole design rests on.
|
|
15
|
+
*/
|
|
16
|
+
import type { HandleKind, ObjectKind, Type } from './types.js';
|
|
17
|
+
import {
|
|
18
|
+
BOOL,
|
|
19
|
+
COLOR,
|
|
20
|
+
NONE,
|
|
21
|
+
NOTHING,
|
|
22
|
+
NUMBER,
|
|
23
|
+
STRING,
|
|
24
|
+
UNKNOWN,
|
|
25
|
+
arrayOf,
|
|
26
|
+
handleType,
|
|
27
|
+
objectType,
|
|
28
|
+
objectsType,
|
|
29
|
+
seriesOf,
|
|
30
|
+
} from './types.js';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* How a call's own warmup relates to the warmup of what it was given.
|
|
34
|
+
*
|
|
35
|
+
* `delay` and `params` both add bars to the source's own warmup, which is what
|
|
36
|
+
* makes warmups compose: `sma(ema(close, 10), 10)` is absent until bar 18.
|
|
37
|
+
* `params` reads the added bars off the call's own arguments, so it can only
|
|
38
|
+
* be exact when those arguments are literal numbers, and `exact` says whether
|
|
39
|
+
* the formula in `stdlib.md` is reproduced here or only bounded below.
|
|
40
|
+
*/
|
|
41
|
+
export type WarmupRule =
|
|
42
|
+
| { readonly kind: 'delay'; readonly bars: number }
|
|
43
|
+
| {
|
|
44
|
+
readonly kind: 'params';
|
|
45
|
+
readonly params: readonly string[];
|
|
46
|
+
readonly scale: number;
|
|
47
|
+
readonly add: number;
|
|
48
|
+
readonly exact: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** A value on bar 0 however late its arguments are: `isNone` is the example. */
|
|
51
|
+
| { readonly kind: 'total' }
|
|
52
|
+
/** The warmup of one named argument, and of nothing else. */
|
|
53
|
+
| { readonly kind: 'argument'; readonly param: string }
|
|
54
|
+
/** Present as soon as the earlier of these arguments is: `orElse`. */
|
|
55
|
+
| { readonly kind: 'either'; readonly params: readonly string[] }
|
|
56
|
+
/** Decided by the data rather than by a length, so a floor is all there is. */
|
|
57
|
+
| { readonly kind: 'data' };
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A whole number argument and the range it accepts, for OS3004.
|
|
61
|
+
*
|
|
62
|
+
* The bounds are numbers and the sentence is derived from them, so the message
|
|
63
|
+
* a reader sees and the test the checker runs cannot say different things. A
|
|
64
|
+
* fractional length is refused rather than truncated (`language.md` 5.1): a
|
|
65
|
+
* length of 14.5 is a bug in the script and rounding it hides the bug.
|
|
66
|
+
*/
|
|
67
|
+
export interface WholeRange {
|
|
68
|
+
readonly text: string;
|
|
69
|
+
readonly min: number | undefined;
|
|
70
|
+
readonly max: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function wholeRange(min?: number, max?: number): WholeRange {
|
|
74
|
+
const text =
|
|
75
|
+
min !== undefined && max !== undefined
|
|
76
|
+
? `${min} to ${max}`
|
|
77
|
+
: min !== undefined
|
|
78
|
+
? `${min} or more`
|
|
79
|
+
: max !== undefined
|
|
80
|
+
? `${max} or less`
|
|
81
|
+
: 'with no fractional part';
|
|
82
|
+
return { text, min, max };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface LibraryParameter {
|
|
86
|
+
readonly name: string;
|
|
87
|
+
readonly type: Type;
|
|
88
|
+
/** Whether the entry gives it a default. A missing required one is OS3012. */
|
|
89
|
+
readonly optional: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* The default, written as `stdlib.md`'s own tables write it, or nothing.
|
|
92
|
+
*
|
|
93
|
+
* An omitted argument is filled from this text, so the default is a
|
|
94
|
+
* compile-time fact and no engine carries a table of them
|
|
95
|
+
* (`compiled-program.md` 4.10). The text is a literal (`14`, `"ema"`,
|
|
96
|
+
* `false`, `none`) or a library name the compiler reads at the call
|
|
97
|
+
* (`hlc3`, `chart.timezone`); the emitter decides which, because a default
|
|
98
|
+
* is a value and values are the emitter's.
|
|
99
|
+
*
|
|
100
|
+
* **Nothing here is not "no default".** It means the specification states no
|
|
101
|
+
* value for this parameter: either it states words rather than a value, as
|
|
102
|
+
* `leg = the only leg` does, or it states nothing at all. Both are recorded
|
|
103
|
+
* with their reason in `spec/default-exceptions.json`, and
|
|
104
|
+
* `scripts/check-defaults.mjs` refuses any optional parameter that is in
|
|
105
|
+
* neither that file nor this field. The two together are what stop a default
|
|
106
|
+
* from being dropped again: an argument omitted from a call used to reach an
|
|
107
|
+
* engine as absence, every function built on it answered absence on every
|
|
108
|
+
* bar, and nothing anywhere reported it.
|
|
109
|
+
*/
|
|
110
|
+
readonly defaultText: string | undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface LibraryEntry {
|
|
114
|
+
/** `ema`, or `draw.line` with its namespace, exactly as a script writes it. */
|
|
115
|
+
readonly name: string;
|
|
116
|
+
/** A value such as `close` is read bare; a function is called. */
|
|
117
|
+
readonly callable: boolean;
|
|
118
|
+
readonly parameters: readonly LibraryParameter[];
|
|
119
|
+
readonly returns: Type;
|
|
120
|
+
readonly warmup: WarmupRule;
|
|
121
|
+
/**
|
|
122
|
+
* A rule per output, for an entry whose outputs warm up at different bars.
|
|
123
|
+
*
|
|
124
|
+
* `stdlib.md` 2.3 gives each element of a multi-output call its own warmup,
|
|
125
|
+
* and several of them differ: a signal line is later than the line it
|
|
126
|
+
* smooths. Empty where the specification states one bar for every element,
|
|
127
|
+
* because then `warmup` above is already that bar and a second copy of it
|
|
128
|
+
* would be a fact stated twice.
|
|
129
|
+
*/
|
|
130
|
+
readonly elements: readonly WarmupRule[];
|
|
131
|
+
/** Holds per-bar state, so a call inside a branch is OS8001. */
|
|
132
|
+
readonly stateful: boolean;
|
|
133
|
+
/** Top level only: OS3006, or OS3007 for `input`. */
|
|
134
|
+
readonly topLevel: boolean;
|
|
135
|
+
/** Available only in a `strategy()` file: OS7001. */
|
|
136
|
+
readonly strategyOnly: boolean;
|
|
137
|
+
/** Named so the surface is legible, and not in this release: OS2020. */
|
|
138
|
+
readonly planned: boolean;
|
|
139
|
+
/** Arguments with a closed set of accepted strings: OS3008. */
|
|
140
|
+
readonly values: Readonly<Record<string, readonly string[]>>;
|
|
141
|
+
/**
|
|
142
|
+
* Arguments that name something the file declares, where this release has no
|
|
143
|
+
* declaration that could fill the set: OS3023.
|
|
144
|
+
*
|
|
145
|
+
* Different from `values` and from `planned`, and the difference is what the
|
|
146
|
+
* reader is told. `values` holds an argument to a set the language fixes, and
|
|
147
|
+
* it can only judge a value written out as a literal. `planned` is about the
|
|
148
|
+
* whole name. This is about an argument whose accepted values are whatever
|
|
149
|
+
* the file declared, in a release where nothing can declare one: the value
|
|
150
|
+
* does not come into it, so a computed name is refused exactly as a written
|
|
151
|
+
* one is, and the message says the file declares none rather than listing an
|
|
152
|
+
* empty set.
|
|
153
|
+
*/
|
|
154
|
+
readonly undeclared: readonly string[];
|
|
155
|
+
/** Arguments that must be a whole number, with the range for OS3004. */
|
|
156
|
+
readonly whole: Readonly<Record<string, WholeRange>>;
|
|
157
|
+
/** Arguments read once before bar 0, so a bar-dependent one is OS3003. */
|
|
158
|
+
readonly constant: readonly string[];
|
|
159
|
+
/** Pairs that set the same thing two ways, so giving both is OS3010. */
|
|
160
|
+
readonly conflicts: readonly (readonly [string, string])[];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export interface EntryOptions {
|
|
164
|
+
readonly warmup?: WarmupRule;
|
|
165
|
+
readonly elements?: readonly WarmupRule[];
|
|
166
|
+
readonly stateful?: true;
|
|
167
|
+
readonly topLevel?: true;
|
|
168
|
+
readonly strategyOnly?: true;
|
|
169
|
+
readonly planned?: true;
|
|
170
|
+
readonly values?: Readonly<Record<string, readonly string[]>>;
|
|
171
|
+
readonly undeclared?: readonly string[];
|
|
172
|
+
readonly whole?: Readonly<Record<string, WholeRange>>;
|
|
173
|
+
readonly constant?: readonly string[];
|
|
174
|
+
readonly conflicts?: readonly (readonly [string, string])[];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const OBJECT_NAMES: readonly string[] = ['line', 'label', 'box', 'polyline', 'table'];
|
|
178
|
+
const HANDLE_NAMES: readonly string[] = ['plot', 'fill', 'level'];
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* A type as the signature strings spell it.
|
|
182
|
+
*
|
|
183
|
+
* `any` and the single letters are not types of the language. `any` is a
|
|
184
|
+
* parameter that takes whatever it is given, which is what `isNone` and `text`
|
|
185
|
+
* want. A single letter is a stand-in carried from one parameter to another, so
|
|
186
|
+
* that `push(arr, v)` can say that `v` is whatever `arr` holds and `orElse`
|
|
187
|
+
* can say it gives back what it was given. Both are resolved at the call site
|
|
188
|
+
* and neither ever reaches a name's type.
|
|
189
|
+
*
|
|
190
|
+
* `line | box` is not either of those and is not a general union: it is the set
|
|
191
|
+
* of object kinds one parameter accepts, which is what a `draw` setter takes,
|
|
192
|
+
* and it is checked like any other declared type. `any` used to stand there,
|
|
193
|
+
* and an `any` that means "one of these two" accepts a label and a number as
|
|
194
|
+
* readily, which is the defect it is written to end.
|
|
195
|
+
*/
|
|
196
|
+
export const ANY: Type = UNKNOWN;
|
|
197
|
+
|
|
198
|
+
const VARIABLE = /^[A-Z]$/;
|
|
199
|
+
|
|
200
|
+
function parseType(text: string): Type {
|
|
201
|
+
const trimmed = text.trim();
|
|
202
|
+
if (trimmed.startsWith('series ')) return seriesOf(parseType(trimmed.slice(7)));
|
|
203
|
+
if (trimmed.startsWith('array<') && trimmed.endsWith('>')) {
|
|
204
|
+
return arrayOf(parseType(trimmed.slice(6, -1)));
|
|
205
|
+
}
|
|
206
|
+
if (trimmed.includes('|')) return parseObjectSet(trimmed);
|
|
207
|
+
switch (trimmed) {
|
|
208
|
+
case 'number':
|
|
209
|
+
return NUMBER;
|
|
210
|
+
case 'string':
|
|
211
|
+
return STRING;
|
|
212
|
+
case 'bool':
|
|
213
|
+
return BOOL;
|
|
214
|
+
case 'color':
|
|
215
|
+
return COLOR;
|
|
216
|
+
case 'none':
|
|
217
|
+
return NONE;
|
|
218
|
+
case 'nothing':
|
|
219
|
+
return NOTHING;
|
|
220
|
+
case 'any':
|
|
221
|
+
return ANY;
|
|
222
|
+
default:
|
|
223
|
+
if (VARIABLE.test(trimmed)) return { kind: 'variable', name: trimmed };
|
|
224
|
+
if (OBJECT_NAMES.includes(trimmed)) return objectType(trimmed as ObjectKind);
|
|
225
|
+
if (HANDLE_NAMES.includes(trimmed)) return handleType(trimmed as HandleKind);
|
|
226
|
+
throw new Error(`library signature names no such type: ${trimmed}`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* `line | box`, as a set of object kinds.
|
|
232
|
+
*
|
|
233
|
+
* Every member has to be an object kind, there have to be two or more of them,
|
|
234
|
+
* and no kind may be written twice: each of those is a signature somebody wrote
|
|
235
|
+
* by hand, and a set that quietly accepted a misspelling would be a parameter
|
|
236
|
+
* that accepts less than the specification says while reading as though it
|
|
237
|
+
* accepts it.
|
|
238
|
+
*/
|
|
239
|
+
function parseObjectSet(text: string): Type {
|
|
240
|
+
const kinds = text.split('|').map((one) => one.trim());
|
|
241
|
+
const known = kinds.every((one) => OBJECT_NAMES.includes(one));
|
|
242
|
+
const distinct = new Set(kinds).size === kinds.length;
|
|
243
|
+
if (!known || !distinct || kinds.length < 2) {
|
|
244
|
+
throw new Error(`library signature names no such set of object types: ${text}`);
|
|
245
|
+
}
|
|
246
|
+
return objectsType(kinds as ObjectKind[]);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/** Split on commas that are not inside angle brackets. */
|
|
250
|
+
function splitParameters(text: string): readonly string[] {
|
|
251
|
+
const parts: string[] = [];
|
|
252
|
+
let depth = 0;
|
|
253
|
+
let start = 0;
|
|
254
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
255
|
+
const ch = text[i];
|
|
256
|
+
if (ch === '<') depth += 1;
|
|
257
|
+
else if (ch === '>') depth -= 1;
|
|
258
|
+
else if (ch === ',' && depth === 0) {
|
|
259
|
+
parts.push(text.slice(start, i));
|
|
260
|
+
start = i + 1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
parts.push(text.slice(start));
|
|
264
|
+
return parts.map((part) => part.trim()).filter((part) => part.length > 0);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* One entry, from `name(param: type, optional?: type) -> result`.
|
|
269
|
+
*
|
|
270
|
+
* A name with no bracket is a value a script reads bare, such as `close` or
|
|
271
|
+
* `bar.index`. A `?` after a parameter name means the library gives it a
|
|
272
|
+
* default, and `= value` after the type says what that default is, written the
|
|
273
|
+
* way `stdlib.md`'s tables write it so the two can still be compared by eye.
|
|
274
|
+
* The text is carried, never interpreted here: the emitter turns it into a
|
|
275
|
+
* value, because that is where a default belongs (4.10).
|
|
276
|
+
*/
|
|
277
|
+
export function entry(signature: string, options: EntryOptions = {}): LibraryEntry {
|
|
278
|
+
const arrow = signature.indexOf('->');
|
|
279
|
+
if (arrow < 0) throw new Error(`library signature has no result type: ${signature}`);
|
|
280
|
+
const head = signature.slice(0, arrow).trim();
|
|
281
|
+
const returns = parseType(signature.slice(arrow + 2));
|
|
282
|
+
|
|
283
|
+
const open = head.indexOf('(');
|
|
284
|
+
const callable = open >= 0;
|
|
285
|
+
const name = callable ? head.slice(0, open).trim() : head;
|
|
286
|
+
const parameters: LibraryParameter[] = [];
|
|
287
|
+
|
|
288
|
+
if (callable) {
|
|
289
|
+
if (!head.endsWith(')')) throw new Error(`library signature is not closed: ${signature}`);
|
|
290
|
+
for (const part of splitParameters(head.slice(open + 1, -1))) {
|
|
291
|
+
const colon = part.indexOf(':');
|
|
292
|
+
if (colon < 0) throw new Error(`library parameter has no type: ${part}`);
|
|
293
|
+
const written = part.slice(0, colon).trim();
|
|
294
|
+
const optional = written.endsWith('?');
|
|
295
|
+
const rest = part.slice(colon + 1);
|
|
296
|
+
const equals = rest.indexOf('=');
|
|
297
|
+
const defaultText = equals < 0 ? undefined : rest.slice(equals + 1).trim();
|
|
298
|
+
if (defaultText !== undefined && !optional) {
|
|
299
|
+
throw new Error(`library parameter has a default and no question mark: ${part}`);
|
|
300
|
+
}
|
|
301
|
+
// An empty default is a signature that was split somewhere unintended,
|
|
302
|
+
// and it would reach the emitter as a value nobody wrote.
|
|
303
|
+
if (defaultText !== undefined && defaultText.length === 0) {
|
|
304
|
+
throw new Error(`library parameter has an empty default: ${part}`);
|
|
305
|
+
}
|
|
306
|
+
parameters.push({
|
|
307
|
+
name: optional ? written.slice(0, -1) : written,
|
|
308
|
+
type: parseType(equals < 0 ? rest : rest.slice(0, equals)),
|
|
309
|
+
optional,
|
|
310
|
+
defaultText,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return {
|
|
316
|
+
name,
|
|
317
|
+
callable,
|
|
318
|
+
parameters,
|
|
319
|
+
returns,
|
|
320
|
+
warmup: options.warmup ?? { kind: 'delay', bars: 0 },
|
|
321
|
+
elements: options.elements ?? [],
|
|
322
|
+
stateful: options.stateful === true,
|
|
323
|
+
topLevel: options.topLevel === true,
|
|
324
|
+
strategyOnly: options.strategyOnly === true,
|
|
325
|
+
planned: options.planned === true,
|
|
326
|
+
values: options.values ?? {},
|
|
327
|
+
undeclared: options.undeclared ?? [],
|
|
328
|
+
whole: options.whole ?? {},
|
|
329
|
+
constant: options.constant ?? [],
|
|
330
|
+
conflicts: options.conflicts ?? [],
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** `bar `len - 1`` and its relatives, the commonest warmup shape in the library. */
|
|
335
|
+
export function fromLength(param: string, add: number, scale = 1): WarmupRule {
|
|
336
|
+
return { kind: 'params', params: [param], scale, add, exact: true };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** A sum of lengths, as `bar `len + smoothK - 2`` and its relatives state it. */
|
|
340
|
+
export function fromLengths(params: readonly string[], add: number): WarmupRule {
|
|
341
|
+
return { kind: 'params', params, scale: 1, add, exact: true };
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** A warmup this module bounds below rather than reproducing the formula for. */
|
|
345
|
+
export function atLeastLength(params: readonly string[], add = 0): WarmupRule {
|
|
346
|
+
return { kind: 'params', params, scale: 1, add, exact: false };
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export const DELAY_ZERO: WarmupRule = { kind: 'delay', bars: 0 };
|
|
350
|
+
export const TOTAL: WarmupRule = { kind: 'total' };
|
|
351
|
+
export const DATA_DRIVEN: WarmupRule = { kind: 'data' };
|
|
352
|
+
|
|
353
|
+
export function delayBars(bars: number): WarmupRule {
|
|
354
|
+
return { kind: 'delay', bars };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Every entry of a name, in the order they were declared.
|
|
359
|
+
*
|
|
360
|
+
* A bare name may carry more than one signature (stdlib.md 2.2), so a lookup
|
|
361
|
+
* answers with a list and the call site picks by arity and by argument type.
|
|
362
|
+
* There is no run-time dispatch anywhere: the choice is made here, once.
|
|
363
|
+
*/
|
|
364
|
+
export type LibraryIndex = ReadonlyMap<string, readonly LibraryEntry[]>;
|
|
365
|
+
|
|
366
|
+
export function indexOf(entries: readonly LibraryEntry[]): LibraryIndex {
|
|
367
|
+
const index = new Map<string, LibraryEntry[]>();
|
|
368
|
+
for (const one of entries) {
|
|
369
|
+
const existing = index.get(one.name);
|
|
370
|
+
if (existing === undefined) index.set(one.name, [one]);
|
|
371
|
+
else existing.push(one);
|
|
372
|
+
}
|
|
373
|
+
return index;
|
|
374
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The value behind an expression that was written out.
|
|
3
|
+
*
|
|
4
|
+
* Several rules only apply to a value the source states rather than computes: a
|
|
5
|
+
* length has to be a whole number when it is written as one, a `style` has to
|
|
6
|
+
* be one of a closed set when it is written as a string, and a warmup is exact
|
|
7
|
+
* only when every length on the path was a number in the file. Each of those
|
|
8
|
+
* asks the same two questions, and asking them in one place is what keeps the
|
|
9
|
+
* answers the same.
|
|
10
|
+
*
|
|
11
|
+
* A written negative is a unary minus over a literal rather than a literal, so
|
|
12
|
+
* it is read through here as well. Without that, `step = -1` would look like
|
|
13
|
+
* something computed and a loop that counts downwards would lose the one check
|
|
14
|
+
* that says it terminates.
|
|
15
|
+
*/
|
|
16
|
+
import type { Expression } from '../ast/index.js';
|
|
17
|
+
import { withoutGrouping } from '../ast/index.js';
|
|
18
|
+
|
|
19
|
+
export function literalNumber(expression: Expression | undefined): number | undefined {
|
|
20
|
+
if (expression === undefined) return undefined;
|
|
21
|
+
const inner = withoutGrouping(expression);
|
|
22
|
+
if (inner.kind === 'numberLiteral') return inner.value;
|
|
23
|
+
if (inner.kind === 'unary' && (inner.operator === '-' || inner.operator === '+')) {
|
|
24
|
+
const operand = literalNumber(inner.operand);
|
|
25
|
+
if (operand === undefined) return undefined;
|
|
26
|
+
return inner.operator === '-' ? -operand : operand;
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function literalString(expression: Expression | undefined): string | undefined {
|
|
32
|
+
if (expression === undefined) return undefined;
|
|
33
|
+
const inner = withoutGrouping(expression);
|
|
34
|
+
return inner.kind === 'stringLiteral' ? inner.value : undefined;
|
|
35
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file's fixed shape, recorded as the calls that declare it are met.
|
|
3
|
+
*
|
|
4
|
+
* `plot`, `plotCandles`, `fill`, `level` and `table` each reserve a field of
|
|
5
|
+
* the chart descriptor (`compiled-program.md` 2.8), and the order they are
|
|
6
|
+
* written in is the order that descriptor carries and a legend shows. So they
|
|
7
|
+
* are collected in source order and nothing sorts them afterwards: the script
|
|
8
|
+
* already decided, and a second decision here would be a second answer.
|
|
9
|
+
*
|
|
10
|
+
* The two warnings below belong to one particular call rather than to calls in
|
|
11
|
+
* general, which is why they are here and not in the argument checking.
|
|
12
|
+
*/
|
|
13
|
+
import type { Argument } from '../ast/index.js';
|
|
14
|
+
import type { Checker } from './checker.js';
|
|
15
|
+
import type { CheckedCall } from './checked.js';
|
|
16
|
+
import type { LibraryEntry } from './library.js';
|
|
17
|
+
import { literalString } from './literals.js';
|
|
18
|
+
|
|
19
|
+
const OUTPUT_FORMS = new Set(['plot', 'plotCandles', 'fill', 'level', 'table']);
|
|
20
|
+
|
|
21
|
+
export function recordOutput(
|
|
22
|
+
checker: Checker,
|
|
23
|
+
entry: LibraryEntry,
|
|
24
|
+
checked: CheckedCall,
|
|
25
|
+
): void {
|
|
26
|
+
if (!OUTPUT_FORMS.has(entry.name)) return;
|
|
27
|
+
const form = entry.name as 'plot' | 'plotCandles' | 'fill' | 'level' | 'table';
|
|
28
|
+
const title = literalString(argumentFor(entry, checked, 'title')?.value) ?? '';
|
|
29
|
+
const value = argumentFor(entry, checked, 'value') ?? argumentFor(entry, checked, 'price');
|
|
30
|
+
const warmup = value === undefined ? checked.warmup : checker.warmupOf(value.value);
|
|
31
|
+
|
|
32
|
+
checker.outputs.push({
|
|
33
|
+
id: checker.outputs.length,
|
|
34
|
+
form,
|
|
35
|
+
title,
|
|
36
|
+
call: checked.call,
|
|
37
|
+
warmup,
|
|
38
|
+
span: checked.call.span,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// A column whose value is absent on every bar draws nothing at all, and a
|
|
42
|
+
// reader deserves to know that before they run the study and wonder why.
|
|
43
|
+
if ((form === 'plot' || form === 'plotCandles') && warmup.kind === 'never') {
|
|
44
|
+
checker.report('OS8009', checked.call.span, { title: quoted(title) });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function reportCallWarnings(
|
|
49
|
+
checker: Checker,
|
|
50
|
+
entry: LibraryEntry,
|
|
51
|
+
checked: CheckedCall,
|
|
52
|
+
): void {
|
|
53
|
+
if (entry.name === 'alert') {
|
|
54
|
+
reportAlertWarnings(checker, entry, checked);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// precision and format on a plot set the formatting of the price scale the
|
|
59
|
+
// plot maps to, so setting them over the price pane reformats the
|
|
60
|
+
// instrument's own axis, which is almost never what was wanted.
|
|
61
|
+
if (entry.name !== 'plot' || checker.declaration?.overlay !== true) return;
|
|
62
|
+
const title = quoted(literalString(argumentFor(entry, checked, 'title')?.value) ?? '');
|
|
63
|
+
for (const option of ['precision', 'format']) {
|
|
64
|
+
if (argumentFor(entry, checked, option) === undefined) continue;
|
|
65
|
+
checker.report('OS8007', checked.call.span, { title, option });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The name one watched condition is known by, `stdlib.md` 16.1.
|
|
71
|
+
*
|
|
72
|
+
* It is the `id` the script wrote, and where there is none to write down, one
|
|
73
|
+
* derived from the line the call sits on. The derivation is here, once, because
|
|
74
|
+
* the checker reports two alerts that would land under one name and the emitter
|
|
75
|
+
* writes the name into `outputs.alerts[].key`, and two spellings of it would be
|
|
76
|
+
* two different answers to "which subscription is this".
|
|
77
|
+
*
|
|
78
|
+
* An id is written down only when it is a literal. One taken from an `input()`
|
|
79
|
+
* is a name that changes when a setting changes, and a subscription keyed on it
|
|
80
|
+
* would stop matching the moment a user touched the dialog, so it is derived
|
|
81
|
+
* like an absent one and OS8008 says so.
|
|
82
|
+
*/
|
|
83
|
+
export function alertKey(id: string | undefined, line: number): string {
|
|
84
|
+
return id === undefined || id === '' ? `alert@${line}` : id;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The `id` a call wrote down, or nothing where it wrote none it can keep. */
|
|
88
|
+
function writtenAlertId(entry: LibraryEntry, checked: CheckedCall): string | undefined {
|
|
89
|
+
const written = literalString(argumentFor(entry, checked, 'id')?.value);
|
|
90
|
+
return written === '' ? undefined : written;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* OS3017 over the watched conditions: two alerts that would share one name.
|
|
95
|
+
*
|
|
96
|
+
* A subscription is keyed by the name, so two entries under one name leave the
|
|
97
|
+
* host with two conditions and one row: whichever it keeps, the other fires
|
|
98
|
+
* nothing and nothing says which of the two the user subscribed to. The check
|
|
99
|
+
* runs over the derived name as well as the written one, because an id somebody
|
|
100
|
+
* writes by hand can collide with a derived one.
|
|
101
|
+
*/
|
|
102
|
+
export function reportRepeatedAlertIds(checker: Checker): void {
|
|
103
|
+
const seen = new Map<string, number>();
|
|
104
|
+
for (const checked of checker.calls) {
|
|
105
|
+
if (checked.name !== 'alert' || checked.entry === undefined) continue;
|
|
106
|
+
const line = checked.call.span.line;
|
|
107
|
+
const key = alertKey(writtenAlertId(checked.entry, checked), line);
|
|
108
|
+
const first = seen.get(key);
|
|
109
|
+
if (first === undefined) {
|
|
110
|
+
seen.set(key, line);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
checker.report('OS3017', checked.call.span, { kind: 'alert', name: `"${key}"`, line: first });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function reportAlertWarnings(
|
|
118
|
+
checker: Checker,
|
|
119
|
+
entry: LibraryEntry,
|
|
120
|
+
checked: CheckedCall,
|
|
121
|
+
): void {
|
|
122
|
+
// With no id of its own the compiler derives one from the call's position,
|
|
123
|
+
// which changes the moment a line is inserted above it and breaks a
|
|
124
|
+
// subscription with it.
|
|
125
|
+
if (writtenAlertId(entry, checked) === undefined) {
|
|
126
|
+
checker.report('OS8008', checked.call.span, { line: checked.call.span.line });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// An alert on every execution of the bar can only fire in a file that acts on
|
|
130
|
+
// a bar that is still moving (stdlib.md 16.2).
|
|
131
|
+
const frequency = argumentFor(entry, checked, 'frequency');
|
|
132
|
+
const written = literalString(frequency?.value);
|
|
133
|
+
if (written !== 'everyUpdate' || checker.declaration?.onUnconfirmed === true) return;
|
|
134
|
+
checker.report('OS3009', frequency?.span ?? checked.call.span, {
|
|
135
|
+
option: 'frequency',
|
|
136
|
+
value: written,
|
|
137
|
+
required: 'onUnconfirmed = true',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function argumentFor(
|
|
142
|
+
entry: LibraryEntry,
|
|
143
|
+
checked: CheckedCall,
|
|
144
|
+
name: string,
|
|
145
|
+
): Argument | undefined {
|
|
146
|
+
const index = entry.parameters.findIndex((one) => one.name === name);
|
|
147
|
+
return index < 0 ? undefined : checked.arguments[index];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function quoted(text: string): string {
|
|
151
|
+
return `"${text}"`;
|
|
152
|
+
}
|