openalgo-script 0.1.0-alpha.0 → 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 +1249 -0
- package/README.md +288 -255
- 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 +62 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +49 -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/index.d.ts +2 -0
- package/dist/core/version/index.d.ts.map +1 -0
- package/dist/core/version/index.js +2 -0
- package/dist/core/version/index.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +10 -0
- package/dist/core/version/version.generated.d.ts.map +1 -0
- package/dist/core/version/version.generated.js +14 -0
- package/dist/core/version/version.generated.js.map +1 -0
- package/package.json +88 -52
- package/spec/errors.json +3403 -3204
- 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 +129 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/functions.ts +109 -109
- package/src/core/parse/names.ts +29 -2
- package/src/core/parse/switches.ts +105 -105
- 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/index.ts +1 -0
- package/src/core/version/version.generated.ts +15 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `variance` and `stdev`.
|
|
3
|
+
*
|
|
4
|
+
* **Population by default, the `len` divisor.** `stdlib.md` section 6 fixes it
|
|
5
|
+
* and gives the reason: that is what the band studies a chart has to reproduce
|
|
6
|
+
* use. `sample = true` switches to the `len - 1` divisor, so neither camp has
|
|
7
|
+
* to write the correction by hand and neither has to guess which one a chart
|
|
8
|
+
* drew.
|
|
9
|
+
*
|
|
10
|
+
* Two passes: the mean of the lookback first, then the deviations from it. The
|
|
11
|
+
* one pass arrangement that subtracts the square of the mean from the mean of
|
|
12
|
+
* the squares loses most of its significant digits on a price series, where the
|
|
13
|
+
* values are large and their spread is small, and can even produce a negative
|
|
14
|
+
* variance that then has to be floored at zero. A study whose implementation
|
|
15
|
+
* needs a floor to stay real is a study computing the wrong quantity.
|
|
16
|
+
*/
|
|
17
|
+
import type { Series, StateRecord, Tail, Value } from '../values/index.js';
|
|
18
|
+
import { NONE, fold, isPresent, result, ring, tailOf } from '../values/index.js';
|
|
19
|
+
|
|
20
|
+
/** `variance(src, len, sample)`: the squared deviation over the lookback, from bar `len - 1`. */
|
|
21
|
+
export function varianceStep(
|
|
22
|
+
state: StateRecord,
|
|
23
|
+
key: string,
|
|
24
|
+
value: Value,
|
|
25
|
+
len: number | null,
|
|
26
|
+
sample: boolean,
|
|
27
|
+
): Value {
|
|
28
|
+
const lookback = ring(state, key, len);
|
|
29
|
+
lookback.push(value);
|
|
30
|
+
if (len === null) return NONE;
|
|
31
|
+
const divisor = sample ? len - 1 : len;
|
|
32
|
+
if (!lookback.complete() || divisor <= 0) return NONE;
|
|
33
|
+
const mean = lookback.mean();
|
|
34
|
+
if (!isPresent(mean)) return NONE;
|
|
35
|
+
let squares = 0;
|
|
36
|
+
// Oldest bar first, the order of `lookback.ts`.
|
|
37
|
+
for (let back = len - 1; back >= 0; back -= 1) {
|
|
38
|
+
const deviation = (lookback.at(back) as number) - mean;
|
|
39
|
+
squares += deviation * deviation;
|
|
40
|
+
}
|
|
41
|
+
return result(squares / divisor);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** `variance(src, len, sample)` as a tail. */
|
|
45
|
+
export function varianceTail(len: number, sample = false): Tail<Value, Value> {
|
|
46
|
+
return tailOf((state, value: Value) => varianceStep(state, 'q', value, len, sample));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `variance(src, len, sample)` over a whole series. */
|
|
50
|
+
export function variance(src: Series, len: number, sample = false): Value[] {
|
|
51
|
+
return fold(varianceTail(len, sample), src);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `stdev(src, len, sample)`: the square root of the same, from bar `len - 1`. */
|
|
55
|
+
export function stdevStep(
|
|
56
|
+
state: StateRecord,
|
|
57
|
+
key: string,
|
|
58
|
+
value: Value,
|
|
59
|
+
len: number | null,
|
|
60
|
+
sample: boolean,
|
|
61
|
+
): Value {
|
|
62
|
+
const squared = varianceStep(state, key, value, len, sample);
|
|
63
|
+
if (!isPresent(squared) || squared < 0) return NONE;
|
|
64
|
+
return result(Math.sqrt(squared));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** `stdev(src, len, sample)` as a tail. */
|
|
68
|
+
export function stdevTail(len: number, sample = false): Tail<Value, Value> {
|
|
69
|
+
return tailOf((state, value: Value) => stdevStep(state, 'q', value, len, sample));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** `stdev(src, len, sample)` over a whole series. */
|
|
73
|
+
export function stdev(src: Series, len: number, sample = false): Value[] {
|
|
74
|
+
return fold(stdevTail(len, sample), src);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The mean absolute deviation from the lookback's mean.
|
|
79
|
+
*
|
|
80
|
+
* Not a call of its own in `stdlib.md`, and here because `cci` is defined
|
|
81
|
+
* against it rather than against `stdev`: the 0.015 constant in that study is
|
|
82
|
+
* calibrated for this quantity, and substituting a standard deviation changes
|
|
83
|
+
* every reading.
|
|
84
|
+
*/
|
|
85
|
+
export function meanDeviationStep(
|
|
86
|
+
state: StateRecord,
|
|
87
|
+
key: string,
|
|
88
|
+
value: Value,
|
|
89
|
+
len: number | null,
|
|
90
|
+
): Value {
|
|
91
|
+
const lookback = ring(state, key, len);
|
|
92
|
+
lookback.push(value);
|
|
93
|
+
if (len === null || !lookback.complete()) return NONE;
|
|
94
|
+
const mean = lookback.mean();
|
|
95
|
+
if (!isPresent(mean)) return NONE;
|
|
96
|
+
let total = 0;
|
|
97
|
+
for (let back = len - 1; back >= 0; back -= 1) {
|
|
98
|
+
total += Math.abs((lookback.at(back) as number) - mean);
|
|
99
|
+
}
|
|
100
|
+
return result(total / len);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The mean absolute deviation as a tail. */
|
|
104
|
+
export function meanDeviationTail(len: number): Tail<Value, Value> {
|
|
105
|
+
return tailOf((state, value: Value) => meanDeviationStep(state, 'q', value, len));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The mean absolute deviation over a whole series. */
|
|
109
|
+
export function meanDeviation(src: Series, len: number): Value[] {
|
|
110
|
+
return fold(meanDeviationTail(len), src);
|
|
111
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type { Gap } from './range.js';
|
|
2
|
+
export {
|
|
3
|
+
atr,
|
|
4
|
+
atrStep,
|
|
5
|
+
atrTail,
|
|
6
|
+
gapOf,
|
|
7
|
+
gapTrueRange,
|
|
8
|
+
gapTrueRangeStep,
|
|
9
|
+
gapTrueRangeTail,
|
|
10
|
+
natr,
|
|
11
|
+
natrStep,
|
|
12
|
+
natrTail,
|
|
13
|
+
trueRange,
|
|
14
|
+
trueRangeOf,
|
|
15
|
+
trueRangeTail,
|
|
16
|
+
} from './range.js';
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
meanDeviation,
|
|
20
|
+
meanDeviationStep,
|
|
21
|
+
meanDeviationTail,
|
|
22
|
+
stdev,
|
|
23
|
+
stdevStep,
|
|
24
|
+
stdevTail,
|
|
25
|
+
variance,
|
|
26
|
+
varianceStep,
|
|
27
|
+
varianceTail,
|
|
28
|
+
} from './deviation.js';
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
bbPercent,
|
|
32
|
+
bbPercentStep,
|
|
33
|
+
bbPercentTail,
|
|
34
|
+
bbWidth,
|
|
35
|
+
bbWidthStep,
|
|
36
|
+
bbWidthTail,
|
|
37
|
+
bollinger,
|
|
38
|
+
bollingerStep,
|
|
39
|
+
bollingerTail,
|
|
40
|
+
donchian,
|
|
41
|
+
donchianStep,
|
|
42
|
+
donchianTail,
|
|
43
|
+
keltner,
|
|
44
|
+
keltnerStep,
|
|
45
|
+
keltnerTail,
|
|
46
|
+
} from './bands.js';
|
|
47
|
+
|
|
48
|
+
export { chop, chopStep, chopTail, hv, hvStep, hvTail } from './measures.js';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chop` and `hv`, the two readings that say how the lookback behaved rather than
|
|
3
|
+
* how wide it was.
|
|
4
|
+
*
|
|
5
|
+
* Both are written as a step over a state region and both tails are that step
|
|
6
|
+
* over a region of their own, so a live chart and a fold over a run of bars
|
|
7
|
+
* cannot disagree.
|
|
8
|
+
*/
|
|
9
|
+
import type { Bar, Series, StateRecord, Tail, Value } from '../values/index.js';
|
|
10
|
+
import { NONE, fold, isPresent, result, tailOf } from '../values/index.js';
|
|
11
|
+
import { extremeStep, historyStep, sumStep } from '../series/index.js';
|
|
12
|
+
|
|
13
|
+
import type { Gap } from './range.js';
|
|
14
|
+
import { gapOf, trueRangeOf } from './range.js';
|
|
15
|
+
import { stdevStep } from './deviation.js';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `chop(len)`: a 0 to 100 reading of whether the lookback trended or chopped,
|
|
19
|
+
* from bar `len`.
|
|
20
|
+
*
|
|
21
|
+
* The distance price actually travelled over the lookback, against the outright
|
|
22
|
+
* range it covered. A market that went straight there travels its range and
|
|
23
|
+
* reads low; one that went back and forth travels several times its range and
|
|
24
|
+
* reads high.
|
|
25
|
+
*
|
|
26
|
+
* The travel is a sum of `len` true ranges, and a true range needs the bar
|
|
27
|
+
* before it, which is why the first reading is at bar `len` and not at bar
|
|
28
|
+
* `len - 1`: the gap-aware form of true range is the one used here, per the
|
|
29
|
+
* note in `range.ts`. The previous close arrives with the gap rather than being
|
|
30
|
+
* remembered here, for the reason the same note gives.
|
|
31
|
+
*/
|
|
32
|
+
export function chopStep(
|
|
33
|
+
state: StateRecord,
|
|
34
|
+
key: string,
|
|
35
|
+
gap: Gap,
|
|
36
|
+
len: number | null,
|
|
37
|
+
): Value {
|
|
38
|
+
const distance = sumStep(state, `${key}s`, trueRangeOf(gap, false), len);
|
|
39
|
+
const upper = extremeStep(state, `${key}h`, gap.high, len, true, false);
|
|
40
|
+
const lower = extremeStep(state, `${key}l`, gap.low, len, false, false);
|
|
41
|
+
if (len === null) return NONE;
|
|
42
|
+
if (!isPresent(distance) || !isPresent(upper) || !isPresent(lower)) return NONE;
|
|
43
|
+
const span = upper - lower;
|
|
44
|
+
const scale = Math.log10(len);
|
|
45
|
+
if (!(span > 0) || !(distance > 0) || scale === 0) return NONE;
|
|
46
|
+
return result((100 * Math.log10(distance / span)) / scale);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** `chop(len)` as a tail. */
|
|
50
|
+
export function chopTail(len = 14): Tail<Bar, Value> {
|
|
51
|
+
return tailOf((state, bar: Bar) => chopStep(state, '', gapOf(state, 'g', bar), len));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `chop(len)` over a run of bars. */
|
|
55
|
+
export function chop(bars: readonly Bar[], len = 14): Value[] {
|
|
56
|
+
return fold(chopTail(len), bars);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* `hv(src, len, periodsPerYear)`: the annualised standard deviation of log
|
|
61
|
+
* returns, from bar `len`.
|
|
62
|
+
*
|
|
63
|
+
* A log return needs the previous bar, so the deviation's lookback starts at bar
|
|
64
|
+
* 1 and its first value is at bar `len`, one later than a lookback over levels.
|
|
65
|
+
*
|
|
66
|
+
* The result is a proportion, not a percentage: `stdlib.md` section 6 says
|
|
67
|
+
* "annualised standard deviation of log returns" and nothing about scaling it
|
|
68
|
+
* by a hundred, so nothing here does. A study that wants a percentage axis
|
|
69
|
+
* multiplies at the plot, where a reader can see it happen.
|
|
70
|
+
*/
|
|
71
|
+
export function hvStep(
|
|
72
|
+
state: StateRecord,
|
|
73
|
+
key: string,
|
|
74
|
+
value: Value,
|
|
75
|
+
len: number | null,
|
|
76
|
+
periodsPerYear: number | null,
|
|
77
|
+
): Value {
|
|
78
|
+
const previous = historyStep(state, `${key}h`, value, 1);
|
|
79
|
+
let logReturn: Value = NONE;
|
|
80
|
+
if (isPresent(value) && isPresent(previous) && value > 0 && previous > 0) {
|
|
81
|
+
logReturn = result(Math.log(value / previous));
|
|
82
|
+
}
|
|
83
|
+
const deviation = stdevStep(state, `${key}q`, logReturn, len, false);
|
|
84
|
+
if (!isPresent(deviation) || periodsPerYear === null || !(periodsPerYear > 0)) return NONE;
|
|
85
|
+
return result(deviation * Math.sqrt(periodsPerYear));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** `hv(src, len, periodsPerYear)` as a tail. */
|
|
89
|
+
export function hvTail(len = 20, periodsPerYear = 252): Tail<Value, Value> {
|
|
90
|
+
return tailOf((state, value: Value) => hvStep(state, '', value, len, periodsPerYear));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** `hv(src, len, periodsPerYear)` over a whole series. */
|
|
94
|
+
export function hv(src: Series, len = 20, periodsPerYear = 252): Value[] {
|
|
95
|
+
return fold(hvTail(len, periodsPerYear), src);
|
|
96
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True range, and the two averages of it.
|
|
3
|
+
*
|
|
4
|
+
* **Bar 0 is the one deliberate exception to absence propagation in this
|
|
5
|
+
* library**, and `stdlib.md` section 6 puts it there rather than leaving it to
|
|
6
|
+
* an engine. `trueRange()` on bar 0 is `high - low`: the other two terms need
|
|
7
|
+
* the previous close, which does not exist there, and propagating absence would
|
|
8
|
+
* start `atr` one bar later than every reference implementation while adding
|
|
9
|
+
* nothing, because the bar's own range is a true statement about that bar.
|
|
10
|
+
*
|
|
11
|
+
* The exception is granted to `trueRange` and therefore to `atr` and `natr`.
|
|
12
|
+
* It is not granted to every function that happens to use a range: where a
|
|
13
|
+
* function's declared warmup shows it counts changes rather than levels,
|
|
14
|
+
* `gapTrueRange` is the form it uses, and that one is absent on bar 0 like any
|
|
15
|
+
* other change. `chop` and `adx` are the two, and both of their warmups in
|
|
16
|
+
* `stdlib.md` are one bar later than the plain reading would give, which is how
|
|
17
|
+
* the specification says which form they take.
|
|
18
|
+
*
|
|
19
|
+
* **Where the previous close comes from is a host fact, not an arithmetic one.**
|
|
20
|
+
* A run of bars has it in the bar before; an engine is handed it with the bar,
|
|
21
|
+
* and that is the one it must use, because a call inside a branch does not see
|
|
22
|
+
* every bar and the close of the bar it last ran on is a different number. So
|
|
23
|
+
* the arithmetic below takes it as an argument and `gapOf` is the small piece
|
|
24
|
+
* that remembers it for a caller folding over a series.
|
|
25
|
+
*/
|
|
26
|
+
import type { Bar, StateRecord, Tail, Value } from '../values/index.js';
|
|
27
|
+
import { NONE, fold, isPresent, result, tailOf } from '../values/index.js';
|
|
28
|
+
import { rmaStep } from '../averages/index.js';
|
|
29
|
+
|
|
30
|
+
/** A bar's two extremes and the close before it, which is what a range needs. */
|
|
31
|
+
export interface Gap {
|
|
32
|
+
readonly high: Value;
|
|
33
|
+
readonly low: Value;
|
|
34
|
+
/** The close of the bar before this one, absent on the first bar. */
|
|
35
|
+
readonly previousClose: Value;
|
|
36
|
+
/** Whether this is the first bar of the run. */
|
|
37
|
+
readonly isFirstBar: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** `trueRange()`: the bar's range including any gap from the previous close. */
|
|
41
|
+
export function trueRangeOf(gap: Gap, allowFirstBar: boolean): Value {
|
|
42
|
+
if (gap.isFirstBar) {
|
|
43
|
+
return allowFirstBar && isPresent(gap.high) && isPresent(gap.low)
|
|
44
|
+
? result(gap.high - gap.low)
|
|
45
|
+
: NONE;
|
|
46
|
+
}
|
|
47
|
+
if (!isPresent(gap.high) || !isPresent(gap.low) || !isPresent(gap.previousClose)) return NONE;
|
|
48
|
+
const within = gap.high - gap.low;
|
|
49
|
+
const upGap = Math.abs(gap.high - gap.previousClose);
|
|
50
|
+
const downGap = Math.abs(gap.low - gap.previousClose);
|
|
51
|
+
return result(Math.max(within, upGap, downGap));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The previous close remembered in a region, for a caller folding over a run of
|
|
56
|
+
* bars rather than being handed one at a time.
|
|
57
|
+
*/
|
|
58
|
+
export function gapOf(state: StateRecord, key: string, bar: Bar): Gap {
|
|
59
|
+
const closeKey = `${key}p`;
|
|
60
|
+
const seenKey = `${key}k`;
|
|
61
|
+
const held = state[closeKey];
|
|
62
|
+
const gap: Gap = {
|
|
63
|
+
high: bar.high,
|
|
64
|
+
low: bar.low,
|
|
65
|
+
previousClose: typeof held === 'number' ? held : NONE,
|
|
66
|
+
isFirstBar: state[seenKey] !== true,
|
|
67
|
+
};
|
|
68
|
+
state[seenKey] = true;
|
|
69
|
+
state[closeKey] = bar.close;
|
|
70
|
+
return gap;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** `trueRange()` as a tail. */
|
|
74
|
+
export function trueRangeTail(): Tail<Bar, Value> {
|
|
75
|
+
return tailOf((state, bar: Bar) => trueRangeOf(gapOf(state, 'g', bar), true));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* True range with no exception on bar 0, as a step: absent there, like any
|
|
80
|
+
* other quantity that needs the bar before it. Not a call a script can make;
|
|
81
|
+
* see this file's opening note for which functions use it and why.
|
|
82
|
+
*/
|
|
83
|
+
export function gapTrueRangeStep(state: StateRecord, key: string, bar: Bar): Value {
|
|
84
|
+
return trueRangeOf(gapOf(state, `${key}g`, bar), false);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** `trueRange()` over a run of bars. */
|
|
88
|
+
export function trueRange(bars: readonly Bar[]): Value[] {
|
|
89
|
+
return fold(trueRangeTail(), bars);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** The gap-aware true range as a tail. */
|
|
93
|
+
export function gapTrueRangeTail(): Tail<Bar, Value> {
|
|
94
|
+
return tailOf((state, bar: Bar) => gapTrueRangeStep(state, '', bar));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The gap-aware true range over a run of bars. */
|
|
98
|
+
export function gapTrueRange(bars: readonly Bar[]): Value[] {
|
|
99
|
+
return fold(gapTrueRangeTail(), bars);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** `atr(len)`: the smoothed mean of true range, from bar `len - 1`. */
|
|
103
|
+
export function atrStep(
|
|
104
|
+
state: StateRecord,
|
|
105
|
+
key: string,
|
|
106
|
+
gap: Gap,
|
|
107
|
+
len: number | null,
|
|
108
|
+
): Value {
|
|
109
|
+
return rmaStep(state, `${key}a`, trueRangeOf(gap, true), len);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** `atr(len)` as a tail. */
|
|
113
|
+
export function atrTail(len: number): Tail<Bar, Value> {
|
|
114
|
+
return tailOf((state, bar: Bar) => atrStep(state, '', gapOf(state, 'g', bar), len));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** `atr(len)` over a run of bars. */
|
|
118
|
+
export function atr(bars: readonly Bar[], len = 14): Value[] {
|
|
119
|
+
return fold(atrTail(len), bars);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** `natr(len)`: `atr` as a percentage of close, from bar `len - 1`. */
|
|
123
|
+
export function natrStep(
|
|
124
|
+
state: StateRecord,
|
|
125
|
+
key: string,
|
|
126
|
+
gap: Gap,
|
|
127
|
+
close: Value,
|
|
128
|
+
len: number | null,
|
|
129
|
+
): Value {
|
|
130
|
+
const average = atrStep(state, key, gap, len);
|
|
131
|
+
if (!isPresent(average) || !isPresent(close) || close === 0) return NONE;
|
|
132
|
+
return result((100 * average) / close);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** `natr(len)` as a tail. */
|
|
136
|
+
export function natrTail(len: number): Tail<Bar, Value> {
|
|
137
|
+
return tailOf((state, bar: Bar) => natrStep(state, '', gapOf(state, 'g', bar), bar.close, len));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** `natr(len)` over a run of bars. */
|
|
141
|
+
export function natr(bars: readonly Bar[], len = 14): Value[] {
|
|
142
|
+
return fold(natrTail(len), bars);
|
|
143
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The running totals: `obv`, `ad`, `adOsc` and `pvt`.
|
|
3
|
+
*
|
|
4
|
+
* Every function in this module returns absence on every bar when the host
|
|
5
|
+
* supplies no volume, because `volume` is absent rather than zero there
|
|
6
|
+
* (`stdlib.md` sections 3.1 and 7). A script tests `chart.hasVolume` to branch
|
|
7
|
+
* on that rather than inspecting the result, and nothing here substitutes a
|
|
8
|
+
* zero to keep a line drawing.
|
|
9
|
+
*
|
|
10
|
+
* A running total is the one thing a lookback cannot stand in for, so each of
|
|
11
|
+
* these carries its total in the state region rather than in a closure: that is
|
|
12
|
+
* what lets an engine roll one back with the rest of a moving bar's state.
|
|
13
|
+
*/
|
|
14
|
+
import type { Bar, StateRecord, Tail, Value } from '../values/index.js';
|
|
15
|
+
import { NONE, fold, held, isPresent, result, slot, tailOf } from '../values/index.js';
|
|
16
|
+
import { emaStep } from '../averages/index.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Where the close sat inside the bar, as -1 at the low to 1 at the high, times
|
|
20
|
+
* the volume behind it.
|
|
21
|
+
*
|
|
22
|
+
* A bar whose high and low are equal has no position inside it to report, and
|
|
23
|
+
* the settled treatment is that such a bar contributes nothing rather than
|
|
24
|
+
* ending the running total.
|
|
25
|
+
*/
|
|
26
|
+
export function moneyFlow(bar: Bar): Value {
|
|
27
|
+
if (!isPresent(bar.high) || !isPresent(bar.low)) return NONE;
|
|
28
|
+
if (!isPresent(bar.close) || !isPresent(bar.volume)) return NONE;
|
|
29
|
+
const span = bar.high - bar.low;
|
|
30
|
+
if (!(span > 0)) return 0;
|
|
31
|
+
return result((((bar.close - bar.low) - (bar.high - bar.close)) / span) * bar.volume);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** `obv()`: the running total of volume signed by the close's direction, from bar 0, seeded 0. */
|
|
35
|
+
export function obvStep(state: StateRecord, key: string, bar: Bar): Value {
|
|
36
|
+
const totalKey = `${key}t`;
|
|
37
|
+
const closeKey = `${key}p`;
|
|
38
|
+
const seenKey = `${key}k`;
|
|
39
|
+
const previousClose = held(state, closeKey);
|
|
40
|
+
const started = state[seenKey] === true;
|
|
41
|
+
|
|
42
|
+
if (!isPresent(bar.volume) || !isPresent(bar.close)) {
|
|
43
|
+
state[seenKey] = true;
|
|
44
|
+
state[closeKey] = bar.close;
|
|
45
|
+
return NONE;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let total = slot(state, totalKey, 0);
|
|
49
|
+
if (started && isPresent(previousClose)) {
|
|
50
|
+
if (bar.close > previousClose) total += bar.volume;
|
|
51
|
+
else if (bar.close < previousClose) total -= bar.volume;
|
|
52
|
+
}
|
|
53
|
+
state[seenKey] = true;
|
|
54
|
+
state[closeKey] = bar.close;
|
|
55
|
+
state[totalKey] = total;
|
|
56
|
+
return result(total);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** `obv()` as a tail. */
|
|
60
|
+
export function obvTail(): Tail<Bar, Value> {
|
|
61
|
+
return tailOf((state, bar: Bar) => obvStep(state, '', bar));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** `obv()` over a run of bars. */
|
|
65
|
+
export function obv(bars: readonly Bar[]): Value[] {
|
|
66
|
+
return fold(obvTail(), bars);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** `ad()`: the running total of volume weighted by where the close sat, from bar 0. */
|
|
70
|
+
export function adStep(state: StateRecord, key: string, bar: Bar): Value {
|
|
71
|
+
const flow = moneyFlow(bar);
|
|
72
|
+
if (!isPresent(flow)) return NONE;
|
|
73
|
+
const total = slot(state, `${key}t`, 0) + flow;
|
|
74
|
+
state[`${key}t`] = total;
|
|
75
|
+
return result(total);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** `ad()` as a tail. */
|
|
79
|
+
export function adTail(): Tail<Bar, Value> {
|
|
80
|
+
return tailOf((state, bar: Bar) => adStep(state, '', bar));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** `ad()` over a run of bars. */
|
|
84
|
+
export function ad(bars: readonly Bar[]): Value[] {
|
|
85
|
+
return fold(adTail(), bars);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* `adOsc(fast, slow)`: the difference of two means of `ad`, from bar `slow - 1`.
|
|
90
|
+
*
|
|
91
|
+
* The averages run over the running total, not over the per-bar term, so what
|
|
92
|
+
* this measures is acceleration in accumulation rather than the flow itself.
|
|
93
|
+
*/
|
|
94
|
+
export function adOscStep(
|
|
95
|
+
state: StateRecord,
|
|
96
|
+
key: string,
|
|
97
|
+
bar: Bar,
|
|
98
|
+
fast: number | null,
|
|
99
|
+
slow: number | null,
|
|
100
|
+
): Value {
|
|
101
|
+
const total = adStep(state, `${key}a`, bar);
|
|
102
|
+
const near = emaStep(state, `${key}f`, total, fast);
|
|
103
|
+
const far = emaStep(state, `${key}s`, total, slow);
|
|
104
|
+
if (!isPresent(near) || !isPresent(far)) return NONE;
|
|
105
|
+
return result(near - far);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** `adOsc(fast, slow)` as a tail. */
|
|
109
|
+
export function adOscTail(fast = 3, slow = 10): Tail<Bar, Value> {
|
|
110
|
+
return tailOf((state, bar: Bar) => adOscStep(state, '', bar, fast, slow));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** `adOsc(fast, slow)` over a run of bars. */
|
|
114
|
+
export function adOsc(bars: readonly Bar[], fast = 3, slow = 10): Value[] {
|
|
115
|
+
return fold(adOscTail(fast, slow), bars);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* `pvt()`: the running total of volume weighted by percentage change, from bar
|
|
120
|
+
* 1, seeded 0.
|
|
121
|
+
*
|
|
122
|
+
* The total starts at zero before the first change, and the first change is at
|
|
123
|
+
* bar 1, so bar 0 is absent and bar 1 already carries its own term. Reporting a
|
|
124
|
+
* zero at bar 0 would claim a reading on a bar where the quantity is not
|
|
125
|
+
* defined.
|
|
126
|
+
*/
|
|
127
|
+
export function pvtStep(state: StateRecord, key: string, bar: Bar): Value {
|
|
128
|
+
const totalKey = `${key}t`;
|
|
129
|
+
const closeKey = `${key}p`;
|
|
130
|
+
const seenKey = `${key}k`;
|
|
131
|
+
const before = held(state, closeKey);
|
|
132
|
+
const started = state[seenKey] === true;
|
|
133
|
+
state[seenKey] = true;
|
|
134
|
+
state[closeKey] = bar.close;
|
|
135
|
+
|
|
136
|
+
if (!started) return NONE;
|
|
137
|
+
if (!isPresent(before) || before === 0) return NONE;
|
|
138
|
+
if (!isPresent(bar.close) || !isPresent(bar.volume)) return NONE;
|
|
139
|
+
const total = slot(state, totalKey, 0) + ((bar.close - before) / before) * bar.volume;
|
|
140
|
+
state[totalKey] = total;
|
|
141
|
+
return result(total);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** `pvt()` as a tail. */
|
|
145
|
+
export function pvtTail(): Tail<Bar, Value> {
|
|
146
|
+
return tailOf((state, bar: Bar) => pvtStep(state, '', bar));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** `pvt()` over a run of bars. */
|
|
150
|
+
export function pvt(bars: readonly Bar[]): Value[] {
|
|
151
|
+
return fold(pvtTail(), bars);
|
|
152
|
+
}
|