openalgo-script 0.1.0-alpha.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1469 -0
- package/README.md +85 -30
- package/dist/adapters/charts/alerts.d.ts +70 -0
- package/dist/adapters/charts/alerts.d.ts.map +1 -0
- package/dist/adapters/charts/alerts.js +52 -0
- package/dist/adapters/charts/alerts.js.map +1 -0
- package/dist/adapters/charts/bars.d.ts +39 -0
- package/dist/adapters/charts/bars.d.ts.map +1 -0
- package/dist/adapters/charts/bars.js +32 -0
- package/dist/adapters/charts/bars.js.map +1 -0
- package/dist/adapters/charts/candles.d.ts +40 -0
- package/dist/adapters/charts/candles.d.ts.map +1 -0
- package/dist/adapters/charts/candles.js +85 -0
- package/dist/adapters/charts/candles.js.map +1 -0
- package/dist/adapters/charts/colours.d.ts +47 -0
- package/dist/adapters/charts/colours.d.ts.map +1 -0
- package/dist/adapters/charts/colours.js +80 -0
- package/dist/adapters/charts/colours.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +37 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -0
- package/dist/adapters/charts/columns.js +56 -0
- package/dist/adapters/charts/columns.js.map +1 -0
- package/dist/adapters/charts/contract.d.ts +278 -0
- package/dist/adapters/charts/contract.d.ts.map +1 -0
- package/dist/adapters/charts/contract.js +2 -0
- package/dist/adapters/charts/contract.js.map +1 -0
- package/dist/adapters/charts/descriptor.d.ts +48 -0
- package/dist/adapters/charts/descriptor.d.ts.map +1 -0
- package/dist/adapters/charts/descriptor.js +111 -0
- package/dist/adapters/charts/descriptor.js.map +1 -0
- package/dist/adapters/charts/drawings.d.ts +43 -0
- package/dist/adapters/charts/drawings.d.ts.map +1 -0
- package/dist/adapters/charts/drawings.js +172 -0
- package/dist/adapters/charts/drawings.js.map +1 -0
- package/dist/adapters/charts/errors.d.ts +28 -0
- package/dist/adapters/charts/errors.d.ts.map +1 -0
- package/dist/adapters/charts/errors.js +21 -0
- package/dist/adapters/charts/errors.js.map +1 -0
- package/dist/adapters/charts/fields.d.ts +33 -0
- package/dist/adapters/charts/fields.d.ts.map +1 -0
- package/dist/adapters/charts/fields.js +51 -0
- package/dist/adapters/charts/fields.js.map +1 -0
- package/dist/adapters/charts/fills.d.ts +23 -0
- package/dist/adapters/charts/fills.d.ts.map +1 -0
- package/dist/adapters/charts/fills.js +48 -0
- package/dist/adapters/charts/fills.js.map +1 -0
- package/dist/adapters/charts/index.d.ts +37 -0
- package/dist/adapters/charts/index.d.ts.map +1 -0
- package/dist/adapters/charts/index.js +33 -0
- package/dist/adapters/charts/index.js.map +1 -0
- package/dist/adapters/charts/levels.d.ts +39 -0
- package/dist/adapters/charts/levels.d.ts.map +1 -0
- package/dist/adapters/charts/levels.js +61 -0
- package/dist/adapters/charts/levels.js.map +1 -0
- package/dist/adapters/charts/markers.d.ts +41 -0
- package/dist/adapters/charts/markers.d.ts.map +1 -0
- package/dist/adapters/charts/markers.js +75 -0
- package/dist/adapters/charts/markers.js.map +1 -0
- package/dist/adapters/charts/paint.d.ts +61 -0
- package/dist/adapters/charts/paint.d.ts.map +1 -0
- package/dist/adapters/charts/paint.js +47 -0
- package/dist/adapters/charts/paint.js.map +1 -0
- package/dist/adapters/charts/plots.d.ts +39 -0
- package/dist/adapters/charts/plots.d.ts.map +1 -0
- package/dist/adapters/charts/plots.js +117 -0
- package/dist/adapters/charts/plots.js.map +1 -0
- package/dist/adapters/charts/produced.d.ts +57 -0
- package/dist/adapters/charts/produced.d.ts.map +1 -0
- package/dist/adapters/charts/produced.js +11 -0
- package/dist/adapters/charts/produced.js.map +1 -0
- package/dist/adapters/charts/requests.d.ts +114 -0
- package/dist/adapters/charts/requests.d.ts.map +1 -0
- package/dist/adapters/charts/requests.js +277 -0
- package/dist/adapters/charts/requests.js.map +1 -0
- package/dist/adapters/charts/run.d.ts +147 -0
- package/dist/adapters/charts/run.d.ts.map +1 -0
- package/dist/adapters/charts/run.js +148 -0
- package/dist/adapters/charts/run.js.map +1 -0
- package/dist/adapters/charts/settings.d.ts +78 -0
- package/dist/adapters/charts/settings.d.ts.map +1 -0
- package/dist/adapters/charts/settings.js +225 -0
- package/dist/adapters/charts/settings.js.map +1 -0
- package/dist/adapters/charts/surfaces.d.ts +221 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -0
- package/dist/adapters/charts/surfaces.js +2 -0
- package/dist/adapters/charts/surfaces.js.map +1 -0
- package/dist/adapters/charts/tables.d.ts +65 -0
- package/dist/adapters/charts/tables.d.ts.map +1 -0
- package/dist/adapters/charts/tables.js +166 -0
- package/dist/adapters/charts/tables.js.map +1 -0
- package/dist/adapters/codemirror/commands.d.ts +14 -0
- package/dist/adapters/codemirror/commands.d.ts.map +1 -0
- package/dist/adapters/codemirror/commands.js +52 -0
- package/dist/adapters/codemirror/commands.js.map +1 -0
- package/dist/adapters/codemirror/completion.d.ts +15 -0
- package/dist/adapters/codemirror/completion.d.ts.map +1 -0
- package/dist/adapters/codemirror/completion.js +64 -0
- package/dist/adapters/codemirror/completion.js.map +1 -0
- package/dist/adapters/codemirror/contract.d.ts +156 -0
- package/dist/adapters/codemirror/contract.d.ts.map +1 -0
- package/dist/adapters/codemirror/contract.js +42 -0
- package/dist/adapters/codemirror/contract.js.map +1 -0
- package/dist/adapters/codemirror/index.d.ts +43 -0
- package/dist/adapters/codemirror/index.d.ts.map +1 -0
- package/dist/adapters/codemirror/index.js +8 -0
- package/dist/adapters/codemirror/index.js.map +1 -0
- package/dist/adapters/codemirror/lint.d.ts +17 -0
- package/dist/adapters/codemirror/lint.d.ts.map +1 -0
- package/dist/adapters/codemirror/lint.js +62 -0
- package/dist/adapters/codemirror/lint.js.map +1 -0
- package/dist/adapters/codemirror/positions.d.ts +16 -0
- package/dist/adapters/codemirror/positions.d.ts.map +1 -0
- package/dist/adapters/codemirror/positions.js +65 -0
- package/dist/adapters/codemirror/positions.js.map +1 -0
- package/dist/adapters/codemirror/stream.d.ts +23 -0
- package/dist/adapters/codemirror/stream.d.ts.map +1 -0
- package/dist/adapters/codemirror/stream.js +70 -0
- package/dist/adapters/codemirror/stream.js.map +1 -0
- package/dist/adapters/codemirror/tokens.d.ts +44 -0
- package/dist/adapters/codemirror/tokens.d.ts.map +1 -0
- package/dist/adapters/codemirror/tokens.js +34 -0
- package/dist/adapters/codemirror/tokens.js.map +1 -0
- package/dist/adapters/codemirror/tooltips.d.ts +35 -0
- package/dist/adapters/codemirror/tooltips.d.ts.map +1 -0
- package/dist/adapters/codemirror/tooltips.js +108 -0
- package/dist/adapters/codemirror/tooltips.js.map +1 -0
- package/dist/core/accounting/charges.d.ts +136 -0
- package/dist/core/accounting/charges.d.ts.map +1 -0
- package/dist/core/accounting/charges.js +362 -0
- package/dist/core/accounting/charges.js.map +1 -0
- package/dist/core/accounting/equity.d.ts +158 -0
- package/dist/core/accounting/equity.d.ts.map +1 -0
- package/dist/core/accounting/equity.js +155 -0
- package/dist/core/accounting/equity.js.map +1 -0
- package/dist/core/accounting/index.d.ts +44 -0
- package/dist/core/accounting/index.d.ts.map +1 -0
- package/dist/core/accounting/index.js +36 -0
- package/dist/core/accounting/index.js.map +1 -0
- package/dist/core/accounting/markers.d.ts +43 -0
- package/dist/core/accounting/markers.d.ts.map +1 -0
- package/dist/core/accounting/markers.js +64 -0
- package/dist/core/accounting/markers.js.map +1 -0
- package/dist/core/accounting/monthly.d.ts +52 -0
- package/dist/core/accounting/monthly.d.ts.map +1 -0
- package/dist/core/accounting/monthly.js +99 -0
- package/dist/core/accounting/monthly.js.map +1 -0
- package/dist/core/accounting/report.d.ts +38 -0
- package/dist/core/accounting/report.d.ts.map +1 -0
- package/dist/core/accounting/report.js +63 -0
- package/dist/core/accounting/report.js.map +1 -0
- package/dist/core/accounting/shapes.d.ts +70 -0
- package/dist/core/accounting/shapes.d.ts.map +1 -0
- package/dist/core/accounting/shapes.js +21 -0
- package/dist/core/accounting/shapes.js.map +1 -0
- package/dist/core/accounting/statistics.d.ts +75 -0
- package/dist/core/accounting/statistics.d.ts.map +1 -0
- package/dist/core/accounting/statistics.js +246 -0
- package/dist/core/accounting/statistics.js.map +1 -0
- package/dist/core/accounting/trades.d.ts +118 -0
- package/dist/core/accounting/trades.d.ts.map +1 -0
- package/dist/core/accounting/trades.js +186 -0
- package/dist/core/accounting/trades.js.map +1 -0
- package/dist/core/backtest/compare.d.ts +38 -0
- package/dist/core/backtest/compare.d.ts.map +1 -0
- package/dist/core/backtest/compare.js +189 -0
- package/dist/core/backtest/compare.js.map +1 -0
- package/dist/core/backtest/declaration.d.ts +52 -0
- package/dist/core/backtest/declaration.d.ts.map +1 -0
- package/dist/core/backtest/declaration.js +48 -0
- package/dist/core/backtest/declaration.js.map +1 -0
- package/dist/core/backtest/drive.d.ts +29 -0
- package/dist/core/backtest/drive.d.ts.map +1 -0
- package/dist/core/backtest/drive.js +262 -0
- package/dist/core/backtest/drive.js.map +1 -0
- package/dist/core/backtest/index.d.ts +46 -0
- package/dist/core/backtest/index.d.ts.map +1 -0
- package/dist/core/backtest/index.js +36 -0
- package/dist/core/backtest/index.js.map +1 -0
- package/dist/core/backtest/range.d.ts +84 -0
- package/dist/core/backtest/range.d.ts.map +1 -0
- package/dist/core/backtest/range.js +90 -0
- package/dist/core/backtest/range.js.map +1 -0
- package/dist/core/backtest/record.d.ts +238 -0
- package/dist/core/backtest/record.d.ts.map +1 -0
- package/dist/core/backtest/record.js +176 -0
- package/dist/core/backtest/record.js.map +1 -0
- package/dist/core/backtest/replay.d.ts +48 -0
- package/dist/core/backtest/replay.d.ts.map +1 -0
- package/dist/core/backtest/replay.js +127 -0
- package/dist/core/backtest/replay.js.map +1 -0
- package/dist/core/backtest/resting.d.ts +62 -0
- package/dist/core/backtest/resting.d.ts.map +1 -0
- package/dist/core/backtest/resting.js +59 -0
- package/dist/core/backtest/resting.js.map +1 -0
- package/dist/core/backtest/settings.d.ts +117 -0
- package/dist/core/backtest/settings.d.ts.map +1 -0
- package/dist/core/backtest/settings.js +207 -0
- package/dist/core/backtest/settings.js.map +1 -0
- package/dist/core/backtest/simulate.d.ts +146 -0
- package/dist/core/backtest/simulate.d.ts.map +1 -0
- package/dist/core/backtest/simulate.js +217 -0
- package/dist/core/backtest/simulate.js.map +1 -0
- package/dist/core/catalogue/catalogue.generated.d.ts +164 -10
- package/dist/core/catalogue/catalogue.generated.d.ts.map +1 -1
- package/dist/core/catalogue/catalogue.generated.js +23 -9
- package/dist/core/catalogue/catalogue.generated.js.map +1 -1
- package/dist/core/catalogue/values.generated.d.ts +49 -0
- package/dist/core/catalogue/values.generated.d.ts.map +1 -1
- package/dist/core/check/arguments.d.ts +41 -0
- package/dist/core/check/arguments.d.ts.map +1 -0
- package/dist/core/check/arguments.js +84 -0
- package/dist/core/check/arguments.js.map +1 -0
- package/dist/core/check/call-sites.d.ts +22 -0
- package/dist/core/check/call-sites.d.ts.map +1 -0
- package/dist/core/check/call-sites.js +329 -0
- package/dist/core/check/call-sites.js.map +1 -0
- package/dist/core/check/call-warmup.d.ts +37 -0
- package/dist/core/check/call-warmup.d.ts.map +1 -0
- package/dist/core/check/call-warmup.js +97 -0
- package/dist/core/check/call-warmup.js.map +1 -0
- package/dist/core/check/calls.d.ts +33 -0
- package/dist/core/check/calls.d.ts.map +1 -0
- package/dist/core/check/calls.js +348 -0
- package/dist/core/check/calls.js.map +1 -0
- package/dist/core/check/check.d.ts +23 -0
- package/dist/core/check/check.d.ts.map +1 -0
- package/dist/core/check/check.js +163 -0
- package/dist/core/check/check.js.map +1 -0
- package/dist/core/check/checked.d.ts +198 -0
- package/dist/core/check/checked.d.ts.map +1 -0
- package/dist/core/check/checked.js +19 -0
- package/dist/core/check/checked.js.map +1 -0
- package/dist/core/check/checker.d.ts +182 -0
- package/dist/core/check/checker.d.ts.map +1 -0
- package/dist/core/check/checker.js +280 -0
- package/dist/core/check/checker.js.map +1 -0
- package/dist/core/check/conditional.d.ts +35 -0
- package/dist/core/check/conditional.d.ts.map +1 -0
- package/dist/core/check/conditional.js +100 -0
- package/dist/core/check/conditional.js.map +1 -0
- package/dist/core/check/constant.d.ts +47 -0
- package/dist/core/check/constant.d.ts.map +1 -0
- package/dist/core/check/constant.js +101 -0
- package/dist/core/check/constant.js.map +1 -0
- package/dist/core/check/declaration.d.ts +33 -0
- package/dist/core/check/declaration.d.ts.map +1 -0
- package/dist/core/check/declaration.js +181 -0
- package/dist/core/check/declaration.js.map +1 -0
- package/dist/core/check/expressions.d.ts +36 -0
- package/dist/core/check/expressions.d.ts.map +1 -0
- package/dist/core/check/expressions.js +398 -0
- package/dist/core/check/expressions.js.map +1 -0
- package/dist/core/check/functions.d.ts +31 -0
- package/dist/core/check/functions.d.ts.map +1 -0
- package/dist/core/check/functions.js +238 -0
- package/dist/core/check/functions.js.map +1 -0
- package/dist/core/check/handles.d.ts +48 -0
- package/dist/core/check/handles.d.ts.map +1 -0
- package/dist/core/check/handles.js +43 -0
- package/dist/core/check/handles.js.map +1 -0
- package/dist/core/check/index.d.ts +31 -0
- package/dist/core/check/index.d.ts.map +1 -0
- package/dist/core/check/index.js +26 -0
- package/dist/core/check/index.js.map +1 -0
- package/dist/core/check/library-bars.d.ts +7 -0
- package/dist/core/check/library-bars.d.ts.map +1 -0
- package/dist/core/check/library-bars.js +181 -0
- package/dist/core/check/library-bars.js.map +1 -0
- package/dist/core/check/library-orders.d.ts +5 -0
- package/dist/core/check/library-orders.d.ts.map +1 -0
- package/dist/core/check/library-orders.js +250 -0
- package/dist/core/check/library-orders.js.map +1 -0
- package/dist/core/check/library-output.d.ts +7 -0
- package/dist/core/check/library-output.d.ts.map +1 -0
- package/dist/core/check/library-output.js +195 -0
- package/dist/core/check/library-output.js.map +1 -0
- package/dist/core/check/library-prose.generated.d.ts +16 -0
- package/dist/core/check/library-prose.generated.d.ts.map +1 -0
- package/dist/core/check/library-prose.generated.js +353 -0
- package/dist/core/check/library-prose.generated.js.map +1 -0
- package/dist/core/check/library-series.d.ts +3 -0
- package/dist/core/check/library-series.d.ts.map +1 -0
- package/dist/core/check/library-series.js +415 -0
- package/dist/core/check/library-series.js.map +1 -0
- package/dist/core/check/library.d.ts +204 -0
- package/dist/core/check/library.d.ts.map +1 -0
- package/dist/core/check/library.js +198 -0
- package/dist/core/check/library.js.map +1 -0
- package/dist/core/check/literals.d.ts +19 -0
- package/dist/core/check/literals.d.ts.map +1 -0
- package/dist/core/check/literals.js +22 -0
- package/dist/core/check/literals.js.map +1 -0
- package/dist/core/check/outputs.d.ts +31 -0
- package/dist/core/check/outputs.d.ts.map +1 -0
- package/dist/core/check/outputs.js +113 -0
- package/dist/core/check/outputs.js.map +1 -0
- package/dist/core/check/statements.d.ts +25 -0
- package/dist/core/check/statements.d.ts.map +1 -0
- package/dist/core/check/statements.js +377 -0
- package/dist/core/check/statements.js.map +1 -0
- package/dist/core/check/suggest.d.ts +25 -0
- package/dist/core/check/suggest.d.ts.map +1 -0
- package/dist/core/check/suggest.js +61 -0
- package/dist/core/check/suggest.js.map +1 -0
- package/dist/core/check/surface.d.ts +62 -0
- package/dist/core/check/surface.d.ts.map +1 -0
- package/dist/core/check/surface.js +129 -0
- package/dist/core/check/surface.js.map +1 -0
- package/dist/core/check/tags.d.ts +4 -0
- package/dist/core/check/tags.d.ts.map +1 -0
- package/dist/core/check/tags.js +54 -0
- package/dist/core/check/tags.js.map +1 -0
- package/dist/core/check/types.d.ts +153 -0
- package/dist/core/check/types.d.ts.map +1 -0
- package/dist/core/check/types.js +221 -0
- package/dist/core/check/types.js.map +1 -0
- package/dist/core/check/warmup.d.ts +73 -0
- package/dist/core/check/warmup.d.ts.map +1 -0
- package/dist/core/check/warmup.js +62 -0
- package/dist/core/check/warmup.js.map +1 -0
- package/dist/core/diagnostics/collector.d.ts +12 -0
- package/dist/core/diagnostics/collector.d.ts.map +1 -1
- package/dist/core/diagnostics/collector.js +27 -1
- package/dist/core/diagnostics/collector.js.map +1 -1
- package/dist/core/emit/calls.d.ts +38 -0
- package/dist/core/emit/calls.d.ts.map +1 -0
- package/dist/core/emit/calls.js +347 -0
- package/dist/core/emit/calls.js.map +1 -0
- package/dist/core/emit/canonical.d.ts +39 -0
- package/dist/core/emit/canonical.d.ts.map +1 -0
- package/dist/core/emit/canonical.js +71 -0
- package/dist/core/emit/canonical.js.map +1 -0
- package/dist/core/emit/channels.d.ts +28 -0
- package/dist/core/emit/channels.d.ts.map +1 -0
- package/dist/core/emit/channels.js +110 -0
- package/dist/core/emit/channels.js.map +1 -0
- package/dist/core/emit/code.d.ts +75 -0
- package/dist/core/emit/code.d.ts.map +1 -0
- package/dist/core/emit/code.js +104 -0
- package/dist/core/emit/code.js.map +1 -0
- package/dist/core/emit/colours.d.ts +35 -0
- package/dist/core/emit/colours.d.ts.map +1 -0
- package/dist/core/emit/colours.js +50 -0
- package/dist/core/emit/colours.js.map +1 -0
- package/dist/core/emit/context.d.ts +271 -0
- package/dist/core/emit/context.d.ts.map +1 -0
- package/dist/core/emit/context.js +358 -0
- package/dist/core/emit/context.js.map +1 -0
- package/dist/core/emit/defaults.d.ts +64 -0
- package/dist/core/emit/defaults.d.ts.map +1 -0
- package/dist/core/emit/defaults.js +182 -0
- package/dist/core/emit/defaults.js.map +1 -0
- package/dist/core/emit/emit.d.ts +13 -0
- package/dist/core/emit/emit.d.ts.map +1 -0
- package/dist/core/emit/emit.js +281 -0
- package/dist/core/emit/emit.js.map +1 -0
- package/dist/core/emit/events.d.ts +21 -0
- package/dist/core/emit/events.d.ts.map +1 -0
- package/dist/core/emit/events.js +112 -0
- package/dist/core/emit/events.js.map +1 -0
- package/dist/core/emit/expressions.d.ts +23 -0
- package/dist/core/emit/expressions.d.ts.map +1 -0
- package/dist/core/emit/expressions.js +253 -0
- package/dist/core/emit/expressions.js.map +1 -0
- package/dist/core/emit/functions.d.ts +30 -0
- package/dist/core/emit/functions.d.ts.map +1 -0
- package/dist/core/emit/functions.js +171 -0
- package/dist/core/emit/functions.js.map +1 -0
- package/dist/core/emit/gaps.d.ts +34 -0
- package/dist/core/emit/gaps.d.ts.map +1 -0
- package/dist/core/emit/gaps.js +16 -0
- package/dist/core/emit/gaps.js.map +1 -0
- package/dist/core/emit/index.d.ts +31 -0
- package/dist/core/emit/index.d.ts.map +1 -0
- package/dist/core/emit/index.js +25 -0
- package/dist/core/emit/index.js.map +1 -0
- package/dist/core/emit/inputs.d.ts +47 -0
- package/dist/core/emit/inputs.d.ts.map +1 -0
- package/dist/core/emit/inputs.js +150 -0
- package/dist/core/emit/inputs.js.map +1 -0
- package/dist/core/emit/layout.d.ts +73 -0
- package/dist/core/emit/layout.d.ts.map +1 -0
- package/dist/core/emit/layout.js +126 -0
- package/dist/core/emit/layout.js.map +1 -0
- package/dist/core/emit/meta.d.ts +14 -0
- package/dist/core/emit/meta.d.ts.map +1 -0
- package/dist/core/emit/meta.js +68 -0
- package/dist/core/emit/meta.js.map +1 -0
- package/dist/core/emit/opcodes.d.ts +28 -0
- package/dist/core/emit/opcodes.d.ts.map +1 -0
- package/dist/core/emit/opcodes.js +137 -0
- package/dist/core/emit/opcodes.js.map +1 -0
- package/dist/core/emit/outputs.d.ts +67 -0
- package/dist/core/emit/outputs.d.ts.map +1 -0
- package/dist/core/emit/outputs.js +293 -0
- package/dist/core/emit/outputs.js.map +1 -0
- package/dist/core/emit/pool.d.ts +33 -0
- package/dist/core/emit/pool.d.ts.map +1 -0
- package/dist/core/emit/pool.js +79 -0
- package/dist/core/emit/pool.js.map +1 -0
- package/dist/core/emit/program.d.ts +333 -0
- package/dist/core/emit/program.d.ts.map +1 -0
- package/dist/core/emit/program.js +15 -0
- package/dist/core/emit/program.js.map +1 -0
- package/dist/core/emit/registers.d.ts +35 -0
- package/dist/core/emit/registers.d.ts.map +1 -0
- package/dist/core/emit/registers.js +170 -0
- package/dist/core/emit/registers.js.map +1 -0
- package/dist/core/emit/request-scope.d.ts +36 -0
- package/dist/core/emit/request-scope.d.ts.map +1 -0
- package/dist/core/emit/request-scope.js +41 -0
- package/dist/core/emit/request-scope.js.map +1 -0
- package/dist/core/emit/requests.d.ts +69 -0
- package/dist/core/emit/requests.d.ts.map +1 -0
- package/dist/core/emit/requests.js +230 -0
- package/dist/core/emit/requests.js.map +1 -0
- package/dist/core/emit/requires.d.ts +4 -0
- package/dist/core/emit/requires.d.ts.map +1 -0
- package/dist/core/emit/requires.js +71 -0
- package/dist/core/emit/requires.js.map +1 -0
- package/dist/core/emit/sha256.d.ts +24 -0
- package/dist/core/emit/sha256.d.ts.map +1 -0
- package/dist/core/emit/sha256.js +109 -0
- package/dist/core/emit/sha256.js.map +1 -0
- package/dist/core/emit/statements.d.ts +20 -0
- package/dist/core/emit/statements.d.ts.map +1 -0
- package/dist/core/emit/statements.js +393 -0
- package/dist/core/emit/statements.js.map +1 -0
- package/dist/core/emit/values.d.ts +80 -0
- package/dist/core/emit/values.d.ts.map +1 -0
- package/dist/core/emit/values.js +242 -0
- package/dist/core/emit/values.js.map +1 -0
- package/dist/core/engine/alerts.d.ts +66 -0
- package/dist/core/engine/alerts.d.ts.map +1 -0
- package/dist/core/engine/alerts.js +119 -0
- package/dist/core/engine/alerts.js.map +1 -0
- package/dist/core/engine/arithmetic.d.ts +82 -0
- package/dist/core/engine/arithmetic.d.ts.map +1 -0
- package/dist/core/engine/arithmetic.js +141 -0
- package/dist/core/engine/arithmetic.js.map +1 -0
- package/dist/core/engine/bars.d.ts +95 -0
- package/dist/core/engine/bars.d.ts.map +1 -0
- package/dist/core/engine/bars.js +133 -0
- package/dist/core/engine/bars.js.map +1 -0
- package/dist/core/engine/budget.d.ts +162 -0
- package/dist/core/engine/budget.d.ts.map +1 -0
- package/dist/core/engine/budget.js +188 -0
- package/dist/core/engine/budget.js.map +1 -0
- package/dist/core/engine/channels.d.ts +106 -0
- package/dist/core/engine/channels.d.ts.map +1 -0
- package/dist/core/engine/channels.js +99 -0
- package/dist/core/engine/channels.js.map +1 -0
- package/dist/core/engine/drawings.d.ts +64 -0
- package/dist/core/engine/drawings.d.ts.map +1 -0
- package/dist/core/engine/drawings.js +67 -0
- package/dist/core/engine/drawings.js.map +1 -0
- package/dist/core/engine/engine.d.ts +140 -0
- package/dist/core/engine/engine.d.ts.map +1 -0
- package/dist/core/engine/engine.js +405 -0
- package/dist/core/engine/engine.js.map +1 -0
- package/dist/core/engine/errors.d.ts +64 -0
- package/dist/core/engine/errors.d.ts.map +1 -0
- package/dist/core/engine/errors.js +63 -0
- package/dist/core/engine/errors.js.map +1 -0
- package/dist/core/engine/frames.d.ts +48 -0
- package/dist/core/engine/frames.d.ts.map +1 -0
- package/dist/core/engine/frames.js +41 -0
- package/dist/core/engine/frames.js.map +1 -0
- package/dist/core/engine/grids.d.ts +25 -0
- package/dist/core/engine/grids.d.ts.map +1 -0
- package/dist/core/engine/grids.js +77 -0
- package/dist/core/engine/grids.js.map +1 -0
- package/dist/core/engine/guard.d.ts +4 -0
- package/dist/core/engine/guard.d.ts.map +1 -0
- package/dist/core/engine/guard.js +46 -0
- package/dist/core/engine/guard.js.map +1 -0
- package/dist/core/engine/host.d.ts +219 -0
- package/dist/core/engine/host.d.ts.map +1 -0
- package/dist/core/engine/host.js +38 -0
- package/dist/core/engine/host.js.map +1 -0
- package/dist/core/engine/index.d.ts +49 -0
- package/dist/core/engine/index.d.ts.map +1 -0
- package/dist/core/engine/index.js +33 -0
- package/dist/core/engine/index.js.map +1 -0
- package/dist/core/engine/inputs.d.ts +77 -0
- package/dist/core/engine/inputs.d.ts.map +1 -0
- package/dist/core/engine/inputs.js +205 -0
- package/dist/core/engine/inputs.js.map +1 -0
- package/dist/core/engine/ledger/call.d.ts +63 -0
- package/dist/core/engine/ledger/call.d.ts.map +1 -0
- package/dist/core/engine/ledger/call.js +136 -0
- package/dist/core/engine/ledger/call.js.map +1 -0
- package/dist/core/engine/ledger/closable.d.ts +155 -0
- package/dist/core/engine/ledger/closable.d.ts.map +1 -0
- package/dist/core/engine/ledger/closable.js +173 -0
- package/dist/core/engine/ledger/closable.js.map +1 -0
- package/dist/core/engine/ledger/holdings.d.ts +194 -0
- package/dist/core/engine/ledger/holdings.d.ts.map +1 -0
- package/dist/core/engine/ledger/holdings.js +237 -0
- package/dist/core/engine/ledger/holdings.js.map +1 -0
- package/dist/core/engine/ledger/index.d.ts +19 -0
- package/dist/core/engine/ledger/index.d.ts.map +1 -0
- package/dist/core/engine/ledger/index.js +2 -0
- package/dist/core/engine/ledger/index.js.map +1 -0
- package/dist/core/engine/ledger/intent.d.ts +106 -0
- package/dist/core/engine/ledger/intent.d.ts.map +1 -0
- package/dist/core/engine/ledger/intent.js +21 -0
- package/dist/core/engine/ledger/intent.js.map +1 -0
- package/dist/core/engine/ledger/ledger.d.ts +143 -0
- package/dist/core/engine/ledger/ledger.d.ts.map +1 -0
- package/dist/core/engine/ledger/ledger.js +237 -0
- package/dist/core/engine/ledger/ledger.js.map +1 -0
- package/dist/core/engine/ledger/place.d.ts +75 -0
- package/dist/core/engine/ledger/place.d.ts.map +1 -0
- package/dist/core/engine/ledger/place.js +174 -0
- package/dist/core/engine/ledger/place.js.map +1 -0
- package/dist/core/engine/ledger/positions.d.ts +68 -0
- package/dist/core/engine/ledger/positions.d.ts.map +1 -0
- package/dist/core/engine/ledger/positions.js +114 -0
- package/dist/core/engine/ledger/positions.js.map +1 -0
- package/dist/core/engine/ledger/refuse.d.ts +43 -0
- package/dist/core/engine/ledger/refuse.d.ts.map +1 -0
- package/dist/core/engine/ledger/refuse.js +329 -0
- package/dist/core/engine/ledger/refuse.js.map +1 -0
- package/dist/core/engine/ledger/row.d.ts +176 -0
- package/dist/core/engine/ledger/row.d.ts.map +1 -0
- package/dist/core/engine/ledger/row.js +169 -0
- package/dist/core/engine/ledger/row.js.map +1 -0
- package/dist/core/engine/ledger/sizing.d.ts +142 -0
- package/dist/core/engine/ledger/sizing.d.ts.map +1 -0
- package/dist/core/engine/ledger/sizing.js +223 -0
- package/dist/core/engine/ledger/sizing.js.map +1 -0
- package/dist/core/engine/library/arrays.d.ts +14 -0
- package/dist/core/engine/library/arrays.d.ts.map +1 -0
- package/dist/core/engine/library/arrays.js +285 -0
- package/dist/core/engine/library/arrays.js.map +1 -0
- package/dist/core/engine/library/averages.d.ts +9 -0
- package/dist/core/engine/library/averages.d.ts.map +1 -0
- package/dist/core/engine/library/averages.js +41 -0
- package/dist/core/engine/library/averages.js.map +1 -0
- package/dist/core/engine/library/binding.d.ts +230 -0
- package/dist/core/engine/library/binding.d.ts.map +1 -0
- package/dist/core/engine/library/binding.js +109 -0
- package/dist/core/engine/library/binding.js.map +1 -0
- package/dist/core/engine/library/chart.d.ts +3 -0
- package/dist/core/engine/library/chart.d.ts.map +1 -0
- package/dist/core/engine/library/chart.js +83 -0
- package/dist/core/engine/library/chart.js.map +1 -0
- package/dist/core/engine/library/colours.d.ts +26 -0
- package/dist/core/engine/library/colours.d.ts.map +1 -0
- package/dist/core/engine/library/colours.js +81 -0
- package/dist/core/engine/library/colours.js.map +1 -0
- package/dist/core/engine/library/dates.d.ts +3 -0
- package/dist/core/engine/library/dates.d.ts.map +1 -0
- package/dist/core/engine/library/dates.js +75 -0
- package/dist/core/engine/library/dates.js.map +1 -0
- package/dist/core/engine/library/index.d.ts +13 -0
- package/dist/core/engine/library/index.d.ts.map +1 -0
- package/dist/core/engine/library/index.js +86 -0
- package/dist/core/engine/library/index.js.map +1 -0
- package/dist/core/engine/library/maths.d.ts +3 -0
- package/dist/core/engine/library/maths.d.ts.map +1 -0
- package/dist/core/engine/library/maths.js +89 -0
- package/dist/core/engine/library/maths.js.map +1 -0
- package/dist/core/engine/library/objects.d.ts +3 -0
- package/dist/core/engine/library/objects.d.ts.map +1 -0
- package/dist/core/engine/library/objects.js +199 -0
- package/dist/core/engine/library/objects.js.map +1 -0
- package/dist/core/engine/library/oscillators.d.ts +3 -0
- package/dist/core/engine/library/oscillators.d.ts.map +1 -0
- package/dist/core/engine/library/oscillators.js +29 -0
- package/dist/core/engine/library/oscillators.js.map +1 -0
- package/dist/core/engine/library/ranges.d.ts +3 -0
- package/dist/core/engine/library/ranges.d.ts.map +1 -0
- package/dist/core/engine/library/ranges.js +23 -0
- package/dist/core/engine/library/ranges.js.map +1 -0
- package/dist/core/engine/library/series.d.ts +3 -0
- package/dist/core/engine/library/series.d.ts.map +1 -0
- package/dist/core/engine/library/series.js +46 -0
- package/dist/core/engine/library/series.js.map +1 -0
- package/dist/core/engine/library/state.d.ts +35 -0
- package/dist/core/engine/library/state.d.ts.map +1 -0
- package/dist/core/engine/library/state.js +19 -0
- package/dist/core/engine/library/state.js.map +1 -0
- package/dist/core/engine/library/studies.d.ts +3 -0
- package/dist/core/engine/library/studies.d.ts.map +1 -0
- package/dist/core/engine/library/studies.js +35 -0
- package/dist/core/engine/library/studies.js.map +1 -0
- package/dist/core/engine/library/text.d.ts +6 -0
- package/dist/core/engine/library/text.d.ts.map +1 -0
- package/dist/core/engine/library/text.js +280 -0
- package/dist/core/engine/library/text.js.map +1 -0
- package/dist/core/engine/library/trend.d.ts +3 -0
- package/dist/core/engine/library/trend.d.ts.map +1 -0
- package/dist/core/engine/library/trend.js +29 -0
- package/dist/core/engine/library/trend.js.map +1 -0
- package/dist/core/engine/library/volume.d.ts +3 -0
- package/dist/core/engine/library/volume.d.ts.map +1 -0
- package/dist/core/engine/library/volume.js +51 -0
- package/dist/core/engine/library/volume.js.map +1 -0
- package/dist/core/engine/load.d.ts +59 -0
- package/dist/core/engine/load.d.ts.map +1 -0
- package/dist/core/engine/load.js +61 -0
- package/dist/core/engine/load.js.map +1 -0
- package/dist/core/engine/machine.d.ts +107 -0
- package/dist/core/engine/machine.d.ts.map +1 -0
- package/dist/core/engine/machine.js +337 -0
- package/dist/core/engine/machine.js.map +1 -0
- package/dist/core/engine/memory.d.ts +60 -0
- package/dist/core/engine/memory.d.ts.map +1 -0
- package/dist/core/engine/memory.js +92 -0
- package/dist/core/engine/memory.js.map +1 -0
- package/dist/core/engine/operations.d.ts +62 -0
- package/dist/core/engine/operations.d.ts.map +1 -0
- package/dist/core/engine/operations.js +149 -0
- package/dist/core/engine/operations.js.map +1 -0
- package/dist/core/engine/orders.d.ts +56 -0
- package/dist/core/engine/orders.d.ts.map +1 -0
- package/dist/core/engine/orders.js +83 -0
- package/dist/core/engine/orders.js.map +1 -0
- package/dist/core/engine/registers.d.ts +50 -0
- package/dist/core/engine/registers.d.ts.map +1 -0
- package/dist/core/engine/registers.js +85 -0
- package/dist/core/engine/registers.js.map +1 -0
- package/dist/core/engine/request-body.d.ts +138 -0
- package/dist/core/engine/request-body.d.ts.map +1 -0
- package/dist/core/engine/request-body.js +227 -0
- package/dist/core/engine/request-body.js.map +1 -0
- package/dist/core/engine/request-plan.d.ts +79 -0
- package/dist/core/engine/request-plan.d.ts.map +1 -0
- package/dist/core/engine/request-plan.js +228 -0
- package/dist/core/engine/request-plan.js.map +1 -0
- package/dist/core/engine/requests.d.ts +105 -0
- package/dist/core/engine/requests.d.ts.map +1 -0
- package/dist/core/engine/requests.js +260 -0
- package/dist/core/engine/requests.js.map +1 -0
- package/dist/core/engine/results.d.ts +40 -0
- package/dist/core/engine/results.d.ts.map +1 -0
- package/dist/core/engine/results.js +2 -0
- package/dist/core/engine/results.js.map +1 -0
- package/dist/core/engine/series.d.ts +61 -0
- package/dist/core/engine/series.d.ts.map +1 -0
- package/dist/core/engine/series.js +41 -0
- package/dist/core/engine/series.js.map +1 -0
- package/dist/core/engine/session/hours.d.ts +49 -0
- package/dist/core/engine/session/hours.d.ts.map +1 -0
- package/dist/core/engine/session/hours.js +31 -0
- package/dist/core/engine/session/hours.js.map +1 -0
- package/dist/core/engine/session/index.d.ts +17 -0
- package/dist/core/engine/session/index.d.ts.map +1 -0
- package/dist/core/engine/session/index.js +3 -0
- package/dist/core/engine/session/index.js.map +1 -0
- package/dist/core/engine/session/record.d.ts +56 -0
- package/dist/core/engine/session/record.d.ts.map +1 -0
- package/dist/core/engine/session/record.js +165 -0
- package/dist/core/engine/session/record.js.map +1 -0
- package/dist/core/engine/session/spec.d.ts +19 -0
- package/dist/core/engine/session/spec.d.ts.map +1 -0
- package/dist/core/engine/session/spec.js +31 -0
- package/dist/core/engine/session/spec.js.map +1 -0
- package/dist/core/engine/timeframe.d.ts +59 -0
- package/dist/core/engine/timeframe.d.ts.map +1 -0
- package/dist/core/engine/timeframe.js +140 -0
- package/dist/core/engine/timeframe.js.map +1 -0
- package/dist/core/engine/types.d.ts +15 -0
- package/dist/core/engine/types.d.ts.map +1 -0
- package/dist/core/engine/types.js +2 -0
- package/dist/core/engine/types.js.map +1 -0
- package/dist/core/engine/values/heap.d.ts +134 -0
- package/dist/core/engine/values/heap.d.ts.map +1 -0
- package/dist/core/engine/values/heap.js +230 -0
- package/dist/core/engine/values/heap.js.map +1 -0
- package/dist/core/engine/values/index.d.ts +13 -0
- package/dist/core/engine/values/index.d.ts.map +1 -0
- package/dist/core/engine/values/index.js +3 -0
- package/dist/core/engine/values/index.js.map +1 -0
- package/dist/core/engine/values/value.d.ts +82 -0
- package/dist/core/engine/values/value.d.ts.map +1 -0
- package/dist/core/engine/values/value.js +134 -0
- package/dist/core/engine/values/value.js.map +1 -0
- package/dist/core/engine/verify-budgets.d.ts +35 -0
- package/dist/core/engine/verify-budgets.d.ts.map +1 -0
- package/dist/core/engine/verify-budgets.js +172 -0
- package/dist/core/engine/verify-budgets.js.map +1 -0
- package/dist/core/engine/verify-code.d.ts +32 -0
- package/dist/core/engine/verify-code.d.ts.map +1 -0
- package/dist/core/engine/verify-code.js +278 -0
- package/dist/core/engine/verify-code.js.map +1 -0
- package/dist/core/engine/verify-requests.d.ts +44 -0
- package/dist/core/engine/verify-requests.d.ts.map +1 -0
- package/dist/core/engine/verify-requests.js +220 -0
- package/dist/core/engine/verify-requests.js.map +1 -0
- package/dist/core/engine/verify-shape.d.ts +46 -0
- package/dist/core/engine/verify-shape.d.ts.map +1 -0
- package/dist/core/engine/verify-shape.js +147 -0
- package/dist/core/engine/verify-shape.js.map +1 -0
- package/dist/core/engine/verify-tables.d.ts +19 -0
- package/dist/core/engine/verify-tables.d.ts.map +1 -0
- package/dist/core/engine/verify-tables.js +171 -0
- package/dist/core/engine/verify-tables.js.map +1 -0
- package/dist/core/engine/verify.d.ts +19 -0
- package/dist/core/engine/verify.d.ts.map +1 -0
- package/dist/core/engine/verify.js +309 -0
- package/dist/core/engine/verify.js.map +1 -0
- package/dist/core/index.d.ts +95 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +64 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/parse/expressions.js +1 -1
- package/dist/core/parse/expressions.js.map +1 -1
- package/dist/core/parse/names.d.ts +7 -1
- package/dist/core/parse/names.d.ts.map +1 -1
- package/dist/core/parse/names.js +28 -2
- package/dist/core/parse/names.js.map +1 -1
- package/dist/core/stdlib/averages/exponential.d.ts +51 -0
- package/dist/core/stdlib/averages/exponential.d.ts.map +1 -0
- package/dist/core/stdlib/averages/exponential.js +72 -0
- package/dist/core/stdlib/averages/exponential.js.map +1 -0
- package/dist/core/stdlib/averages/index.d.ts +7 -0
- package/dist/core/stdlib/averages/index.d.ts.map +1 -0
- package/dist/core/stdlib/averages/index.js +5 -0
- package/dist/core/stdlib/averages/index.js.map +1 -0
- package/dist/core/stdlib/averages/select.d.ts +35 -0
- package/dist/core/stdlib/averages/select.d.ts.map +1 -0
- package/dist/core/stdlib/averages/select.js +43 -0
- package/dist/core/stdlib/averages/select.js.map +1 -0
- package/dist/core/stdlib/averages/shaped.d.ts +61 -0
- package/dist/core/stdlib/averages/shaped.d.ts.map +1 -0
- package/dist/core/stdlib/averages/shaped.js +126 -0
- package/dist/core/stdlib/averages/shaped.js.map +1 -0
- package/dist/core/stdlib/averages/simple.d.ts +58 -0
- package/dist/core/stdlib/averages/simple.d.ts.map +1 -0
- package/dist/core/stdlib/averages/simple.js +92 -0
- package/dist/core/stdlib/averages/simple.js.map +1 -0
- package/dist/core/stdlib/calendar/civil.d.ts +56 -0
- package/dist/core/stdlib/calendar/civil.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/civil.js +70 -0
- package/dist/core/stdlib/calendar/civil.js.map +1 -0
- package/dist/core/stdlib/calendar/fields.d.ts +36 -0
- package/dist/core/stdlib/calendar/fields.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/fields.js +93 -0
- package/dist/core/stdlib/calendar/fields.js.map +1 -0
- package/dist/core/stdlib/calendar/format.d.ts +19 -0
- package/dist/core/stdlib/calendar/format.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/format.js +51 -0
- package/dist/core/stdlib/calendar/format.js.map +1 -0
- package/dist/core/stdlib/calendar/index.d.ts +7 -0
- package/dist/core/stdlib/calendar/index.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/index.js +5 -0
- package/dist/core/stdlib/calendar/index.js.map +1 -0
- package/dist/core/stdlib/calendar/zone.d.ts +53 -0
- package/dist/core/stdlib/calendar/zone.d.ts.map +1 -0
- package/dist/core/stdlib/calendar/zone.js +138 -0
- package/dist/core/stdlib/calendar/zone.js.map +1 -0
- package/dist/core/stdlib/index.d.ts +57 -0
- package/dist/core/stdlib/index.d.ts.map +1 -0
- package/dist/core/stdlib/index.js +51 -0
- package/dist/core/stdlib/index.js.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts +38 -0
- package/dist/core/stdlib/maths/arithmetic.d.ts.map +1 -0
- package/dist/core/stdlib/maths/arithmetic.js +66 -0
- package/dist/core/stdlib/maths/arithmetic.js.map +1 -0
- package/dist/core/stdlib/maths/elementary.d.ts +65 -0
- package/dist/core/stdlib/maths/elementary.d.ts.map +1 -0
- package/dist/core/stdlib/maths/elementary.js +93 -0
- package/dist/core/stdlib/maths/elementary.js.map +1 -0
- package/dist/core/stdlib/maths/index.d.ts +4 -0
- package/dist/core/stdlib/maths/index.d.ts.map +1 -0
- package/dist/core/stdlib/maths/index.js +4 -0
- package/dist/core/stdlib/maths/index.js.map +1 -0
- package/dist/core/stdlib/maths/rounding.d.ts +43 -0
- package/dist/core/stdlib/maths/rounding.d.ts.map +1 -0
- package/dist/core/stdlib/maths/rounding.js +62 -0
- package/dist/core/stdlib/maths/rounding.js.map +1 -0
- package/dist/core/stdlib/momentum/convergence.d.ts +36 -0
- package/dist/core/stdlib/momentum/convergence.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/convergence.js +48 -0
- package/dist/core/stdlib/momentum/convergence.js.map +1 -0
- package/dist/core/stdlib/momentum/index.d.ts +6 -0
- package/dist/core/stdlib/momentum/index.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/index.js +6 -0
- package/dist/core/stdlib/momentum/index.js.map +1 -0
- package/dist/core/stdlib/momentum/pressure.d.ts +43 -0
- package/dist/core/stdlib/momentum/pressure.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/pressure.js +103 -0
- package/dist/core/stdlib/momentum/pressure.js.map +1 -0
- package/dist/core/stdlib/momentum/rates.d.ts +74 -0
- package/dist/core/stdlib/momentum/rates.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rates.js +134 -0
- package/dist/core/stdlib/momentum/rates.js.map +1 -0
- package/dist/core/stdlib/momentum/rsi.d.ts +21 -0
- package/dist/core/stdlib/momentum/rsi.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/rsi.js +30 -0
- package/dist/core/stdlib/momentum/rsi.js.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts +44 -0
- package/dist/core/stdlib/momentum/stochastic.d.ts.map +1 -0
- package/dist/core/stdlib/momentum/stochastic.js +97 -0
- package/dist/core/stdlib/momentum/stochastic.js.map +1 -0
- package/dist/core/stdlib/series/changes.d.ts +59 -0
- package/dist/core/stdlib/series/changes.d.ts.map +1 -0
- package/dist/core/stdlib/series/changes.js +129 -0
- package/dist/core/stdlib/series/changes.js.map +1 -0
- package/dist/core/stdlib/series/conditions.d.ts +34 -0
- package/dist/core/stdlib/series/conditions.d.ts.map +1 -0
- package/dist/core/stdlib/series/conditions.js +52 -0
- package/dist/core/stdlib/series/conditions.js.map +1 -0
- package/dist/core/stdlib/series/extremes.d.ts +29 -0
- package/dist/core/stdlib/series/extremes.d.ts.map +1 -0
- package/dist/core/stdlib/series/extremes.js +62 -0
- package/dist/core/stdlib/series/extremes.js.map +1 -0
- package/dist/core/stdlib/series/index.d.ts +9 -0
- package/dist/core/stdlib/series/index.d.ts.map +1 -0
- package/dist/core/stdlib/series/index.js +7 -0
- package/dist/core/stdlib/series/index.js.map +1 -0
- package/dist/core/stdlib/series/pivots.d.ts +25 -0
- package/dist/core/stdlib/series/pivots.d.ts.map +1 -0
- package/dist/core/stdlib/series/pivots.js +42 -0
- package/dist/core/stdlib/series/pivots.js.map +1 -0
- package/dist/core/stdlib/series/statistics.d.ts +64 -0
- package/dist/core/stdlib/series/statistics.d.ts.map +1 -0
- package/dist/core/stdlib/series/statistics.js +148 -0
- package/dist/core/stdlib/series/statistics.js.map +1 -0
- package/dist/core/stdlib/series/totals.d.ts +68 -0
- package/dist/core/stdlib/series/totals.d.ts.map +1 -0
- package/dist/core/stdlib/series/totals.js +115 -0
- package/dist/core/stdlib/series/totals.js.map +1 -0
- package/dist/core/stdlib/trend/directional.d.ts +69 -0
- package/dist/core/stdlib/trend/directional.d.ts.map +1 -0
- package/dist/core/stdlib/trend/directional.js +151 -0
- package/dist/core/stdlib/trend/directional.js.map +1 -0
- package/dist/core/stdlib/trend/index.d.ts +4 -0
- package/dist/core/stdlib/trend/index.d.ts.map +1 -0
- package/dist/core/stdlib/trend/index.js +4 -0
- package/dist/core/stdlib/trend/index.js.map +1 -0
- package/dist/core/stdlib/trend/psar.d.ts +33 -0
- package/dist/core/stdlib/trend/psar.d.ts.map +1 -0
- package/dist/core/stdlib/trend/psar.js +86 -0
- package/dist/core/stdlib/trend/psar.js.map +1 -0
- package/dist/core/stdlib/trend/supertrend.d.ts +30 -0
- package/dist/core/stdlib/trend/supertrend.d.ts.map +1 -0
- package/dist/core/stdlib/trend/supertrend.js +65 -0
- package/dist/core/stdlib/trend/supertrend.js.map +1 -0
- package/dist/core/stdlib/values/bar.d.ts +39 -0
- package/dist/core/stdlib/values/bar.d.ts.map +1 -0
- package/dist/core/stdlib/values/bar.js +33 -0
- package/dist/core/stdlib/values/bar.js.map +1 -0
- package/dist/core/stdlib/values/index.d.ts +11 -0
- package/dist/core/stdlib/values/index.d.ts.map +1 -0
- package/dist/core/stdlib/values/index.js +6 -0
- package/dist/core/stdlib/values/index.js.map +1 -0
- package/dist/core/stdlib/values/lookback.d.ts +83 -0
- package/dist/core/stdlib/values/lookback.d.ts.map +1 -0
- package/dist/core/stdlib/values/lookback.js +134 -0
- package/dist/core/stdlib/values/lookback.js.map +1 -0
- package/dist/core/stdlib/values/region.d.ts +55 -0
- package/dist/core/stdlib/values/region.d.ts.map +1 -0
- package/dist/core/stdlib/values/region.js +73 -0
- package/dist/core/stdlib/values/region.js.map +1 -0
- package/dist/core/stdlib/values/tail.d.ts +44 -0
- package/dist/core/stdlib/values/tail.d.ts.map +1 -0
- package/dist/core/stdlib/values/tail.js +23 -0
- package/dist/core/stdlib/values/tail.js.map +1 -0
- package/dist/core/stdlib/values/value.d.ts +64 -0
- package/dist/core/stdlib/values/value.d.ts.map +1 -0
- package/dist/core/stdlib/values/value.js +61 -0
- package/dist/core/stdlib/values/value.js.map +1 -0
- package/dist/core/stdlib/volatility/bands.d.ts +50 -0
- package/dist/core/stdlib/volatility/bands.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/bands.js +101 -0
- package/dist/core/stdlib/volatility/bands.js.map +1 -0
- package/dist/core/stdlib/volatility/deviation.d.ts +43 -0
- package/dist/core/stdlib/volatility/deviation.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/deviation.js +75 -0
- package/dist/core/stdlib/volatility/deviation.js.map +1 -0
- package/dist/core/stdlib/volatility/index.d.ts +6 -0
- package/dist/core/stdlib/volatility/index.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/index.js +5 -0
- package/dist/core/stdlib/volatility/index.js.map +1 -0
- package/dist/core/stdlib/volatility/measures.d.ts +48 -0
- package/dist/core/stdlib/volatility/measures.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/measures.js +73 -0
- package/dist/core/stdlib/volatility/measures.js.map +1 -0
- package/dist/core/stdlib/volatility/range.d.ts +69 -0
- package/dist/core/stdlib/volatility/range.d.ts.map +1 -0
- package/dist/core/stdlib/volatility/range.js +86 -0
- package/dist/core/stdlib/volatility/range.js.map +1 -0
- package/dist/core/stdlib/volume/accumulation.d.ts +61 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -0
- package/dist/core/stdlib/volume/accumulation.js +127 -0
- package/dist/core/stdlib/volume/accumulation.js.map +1 -0
- package/dist/core/stdlib/volume/flow.d.ts +60 -0
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -0
- package/dist/core/stdlib/volume/flow.js +125 -0
- package/dist/core/stdlib/volume/flow.js.map +1 -0
- package/dist/core/stdlib/volume/index.d.ts +5 -0
- package/dist/core/stdlib/volume/index.d.ts.map +1 -0
- package/dist/core/stdlib/volume/index.js +4 -0
- package/dist/core/stdlib/volume/index.js.map +1 -0
- package/dist/core/stdlib/volume/weighted.d.ts +52 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -0
- package/dist/core/stdlib/volume/weighted.js +64 -0
- package/dist/core/stdlib/volume/weighted.js.map +1 -0
- package/dist/core/version/version.generated.d.ts +2 -2
- package/dist/core/version/version.generated.d.ts.map +1 -1
- package/dist/core/version/version.generated.js +2 -2
- package/dist/core/version/version.generated.js.map +1 -1
- package/dist/editor/complete.d.ts +40 -0
- package/dist/editor/complete.d.ts.map +1 -0
- package/dist/editor/complete.js +206 -0
- package/dist/editor/complete.js.map +1 -0
- package/dist/editor/diagnose.d.ts +18 -0
- package/dist/editor/diagnose.d.ts.map +1 -0
- package/dist/editor/diagnose.js +70 -0
- package/dist/editor/diagnose.js.map +1 -0
- package/dist/editor/format.d.ts +11 -0
- package/dist/editor/format.d.ts.map +1 -0
- package/dist/editor/format.js +50 -0
- package/dist/editor/format.js.map +1 -0
- package/dist/editor/highlight.d.ts +28 -0
- package/dist/editor/highlight.d.ts.map +1 -0
- package/dist/editor/highlight.js +65 -0
- package/dist/editor/highlight.js.map +1 -0
- package/dist/editor/hover.d.ts +40 -0
- package/dist/editor/hover.d.ts.map +1 -0
- package/dist/editor/hover.js +147 -0
- package/dist/editor/hover.js.map +1 -0
- package/dist/editor/index.d.ts +60 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +7 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/kinds.d.ts +27 -0
- package/dist/editor/kinds.d.ts.map +1 -0
- package/dist/editor/kinds.js +118 -0
- package/dist/editor/kinds.js.map +1 -0
- package/dist/editor/layout.d.ts +47 -0
- package/dist/editor/layout.d.ts.map +1 -0
- package/dist/editor/layout.js +135 -0
- package/dist/editor/layout.js.map +1 -0
- package/dist/editor/manifest.d.ts +47 -0
- package/dist/editor/manifest.d.ts.map +1 -0
- package/dist/editor/manifest.js +93 -0
- package/dist/editor/manifest.js.map +1 -0
- package/dist/editor/reading.d.ts +41 -0
- package/dist/editor/reading.d.ts.map +1 -0
- package/dist/editor/reading.js +51 -0
- package/dist/editor/reading.js.map +1 -0
- package/dist/editor/scan.d.ts +26 -0
- package/dist/editor/scan.d.ts.map +1 -0
- package/dist/editor/scan.js +139 -0
- package/dist/editor/scan.js.map +1 -0
- package/dist/editor/scope.d.ts +19 -0
- package/dist/editor/scope.d.ts.map +1 -0
- package/dist/editor/scope.js +99 -0
- package/dist/editor/scope.js.map +1 -0
- package/dist/editor/signature.d.ts +38 -0
- package/dist/editor/signature.d.ts.map +1 -0
- package/dist/editor/signature.js +112 -0
- package/dist/editor/signature.js.map +1 -0
- package/dist/editor/site.d.ts +46 -0
- package/dist/editor/site.d.ts.map +1 -0
- package/dist/editor/site.js +184 -0
- package/dist/editor/site.js.map +1 -0
- package/dist/editor/spacing.d.ts +29 -0
- package/dist/editor/spacing.d.ts.map +1 -0
- package/dist/editor/spacing.js +116 -0
- package/dist/editor/spacing.js.map +1 -0
- package/package.json +66 -15
- package/spec/errors.json +522 -183
- package/src/adapters/charts/alerts.ts +116 -0
- package/src/adapters/charts/bars.ts +63 -0
- package/src/adapters/charts/candles.ts +137 -0
- package/src/adapters/charts/colours.ts +113 -0
- package/src/adapters/charts/columns.ts +99 -0
- package/src/adapters/charts/contract.ts +320 -0
- package/src/adapters/charts/descriptor.ts +199 -0
- package/src/adapters/charts/drawings.ts +213 -0
- package/src/adapters/charts/errors.ts +45 -0
- package/src/adapters/charts/fields.ts +74 -0
- package/src/adapters/charts/fills.ts +71 -0
- package/src/adapters/charts/index.ts +78 -0
- package/src/adapters/charts/levels.ts +92 -0
- package/src/adapters/charts/markers.ts +119 -0
- package/src/adapters/charts/paint.ts +101 -0
- package/src/adapters/charts/plots.ts +185 -0
- package/src/adapters/charts/produced.ts +68 -0
- package/src/adapters/charts/requests.ts +357 -0
- package/src/adapters/charts/run.ts +327 -0
- package/src/adapters/charts/settings.ts +273 -0
- package/src/adapters/charts/surfaces.ts +255 -0
- package/src/adapters/charts/tables.ts +243 -0
- package/src/adapters/codemirror/commands.ts +53 -0
- package/src/adapters/codemirror/completion.ts +74 -0
- package/src/adapters/codemirror/contract.ts +156 -0
- package/src/adapters/codemirror/index.ts +66 -0
- package/src/adapters/codemirror/lint.ts +66 -0
- package/src/adapters/codemirror/positions.ts +79 -0
- package/src/adapters/codemirror/stream.ts +87 -0
- package/src/adapters/codemirror/tokens.ts +64 -0
- package/src/adapters/codemirror/tooltips.ts +113 -0
- package/src/core/accounting/charges.ts +452 -0
- package/src/core/accounting/equity.ts +276 -0
- package/src/core/accounting/index.ts +49 -0
- package/src/core/accounting/markers.ts +95 -0
- package/src/core/accounting/monthly.ts +137 -0
- package/src/core/accounting/report.ts +89 -0
- package/src/core/accounting/shapes.ts +73 -0
- package/src/core/accounting/statistics.ts +350 -0
- package/src/core/accounting/trades.ts +313 -0
- package/src/core/backtest/compare.ts +244 -0
- package/src/core/backtest/declaration.ts +97 -0
- package/src/core/backtest/drive.ts +364 -0
- package/src/core/backtest/index.ts +52 -0
- package/src/core/backtest/range.ts +137 -0
- package/src/core/backtest/record.ts +341 -0
- package/src/core/backtest/replay.ts +158 -0
- package/src/core/backtest/resting.ts +125 -0
- package/src/core/backtest/settings.ts +280 -0
- package/src/core/backtest/simulate.ts +304 -0
- package/src/core/catalogue/catalogue.generated.ts +23 -9
- package/src/core/catalogue/values.generated.ts +14 -0
- package/src/core/check/arguments.ts +126 -0
- package/src/core/check/call-sites.ts +385 -0
- package/src/core/check/call-warmup.ts +121 -0
- package/src/core/check/calls.ts +412 -0
- package/src/core/check/check.ts +183 -0
- package/src/core/check/checked.ts +228 -0
- package/src/core/check/checker.ts +393 -0
- package/src/core/check/conditional.ts +143 -0
- package/src/core/check/constant.ts +127 -0
- package/src/core/check/declaration.ts +230 -0
- package/src/core/check/expressions.ts +471 -0
- package/src/core/check/functions.ts +283 -0
- package/src/core/check/handles.ts +75 -0
- package/src/core/check/index.ts +70 -0
- package/src/core/check/library-bars.ts +194 -0
- package/src/core/check/library-orders.ts +290 -0
- package/src/core/check/library-output.ts +241 -0
- package/src/core/check/library-prose.generated.ts +367 -0
- package/src/core/check/library-series.ts +457 -0
- package/src/core/check/library.ts +374 -0
- package/src/core/check/literals.ts +35 -0
- package/src/core/check/outputs.ts +152 -0
- package/src/core/check/statements.ts +465 -0
- package/src/core/check/suggest.ts +63 -0
- package/src/core/check/surface.ts +149 -0
- package/src/core/check/tags.ts +94 -0
- package/src/core/check/types.ts +260 -0
- package/src/core/check/warmup.ts +100 -0
- package/src/core/diagnostics/collector.ts +27 -1
- package/src/core/emit/calls.ts +415 -0
- package/src/core/emit/canonical.ts +81 -0
- package/src/core/emit/channels.ts +144 -0
- package/src/core/emit/code.ts +155 -0
- package/src/core/emit/colours.ts +75 -0
- package/src/core/emit/context.ts +461 -0
- package/src/core/emit/defaults.ts +220 -0
- package/src/core/emit/emit.ts +313 -0
- package/src/core/emit/events.ts +141 -0
- package/src/core/emit/expressions.ts +292 -0
- package/src/core/emit/functions.ts +195 -0
- package/src/core/emit/gaps.ts +44 -0
- package/src/core/emit/index.ts +76 -0
- package/src/core/emit/inputs.ts +179 -0
- package/src/core/emit/layout.ts +165 -0
- package/src/core/emit/meta.ts +104 -0
- package/src/core/emit/opcodes.ts +160 -0
- package/src/core/emit/outputs.ts +357 -0
- package/src/core/emit/pool.ts +102 -0
- package/src/core/emit/program.ts +385 -0
- package/src/core/emit/registers.ts +179 -0
- package/src/core/emit/request-scope.ts +52 -0
- package/src/core/emit/requests.ts +258 -0
- package/src/core/emit/requires.ts +91 -0
- package/src/core/emit/sha256.ts +119 -0
- package/src/core/emit/statements.ts +438 -0
- package/src/core/emit/values.ts +284 -0
- package/src/core/engine/alerts.ts +152 -0
- package/src/core/engine/arithmetic.ts +165 -0
- package/src/core/engine/bars.ts +224 -0
- package/src/core/engine/budget.ts +284 -0
- package/src/core/engine/channels.ts +171 -0
- package/src/core/engine/drawings.ts +127 -0
- package/src/core/engine/engine.ts +498 -0
- package/src/core/engine/errors.ts +100 -0
- package/src/core/engine/frames.ts +85 -0
- package/src/core/engine/grids.ts +98 -0
- package/src/core/engine/guard.ts +71 -0
- package/src/core/engine/host.ts +251 -0
- package/src/core/engine/index.ts +93 -0
- package/src/core/engine/inputs.ts +263 -0
- package/src/core/engine/ledger/call.ts +218 -0
- package/src/core/engine/ledger/closable.ts +269 -0
- package/src/core/engine/ledger/holdings.ts +354 -0
- package/src/core/engine/ledger/index.ts +28 -0
- package/src/core/engine/ledger/intent.ts +112 -0
- package/src/core/engine/ledger/ledger.ts +314 -0
- package/src/core/engine/ledger/place.ts +277 -0
- package/src/core/engine/ledger/positions.ts +123 -0
- package/src/core/engine/ledger/refuse.ts +378 -0
- package/src/core/engine/ledger/row.ts +318 -0
- package/src/core/engine/ledger/sizing.ts +292 -0
- package/src/core/engine/library/arrays.ts +316 -0
- package/src/core/engine/library/averages.ts +97 -0
- package/src/core/engine/library/binding.ts +325 -0
- package/src/core/engine/library/chart.ts +115 -0
- package/src/core/engine/library/colours.ts +111 -0
- package/src/core/engine/library/dates.ts +109 -0
- package/src/core/engine/library/index.ts +103 -0
- package/src/core/engine/library/maths.ts +134 -0
- package/src/core/engine/library/objects.ts +265 -0
- package/src/core/engine/library/oscillators.ts +124 -0
- package/src/core/engine/library/ranges.ts +51 -0
- package/src/core/engine/library/series.ts +236 -0
- package/src/core/engine/library/state.ts +47 -0
- package/src/core/engine/library/studies.ts +150 -0
- package/src/core/engine/library/text.ts +303 -0
- package/src/core/engine/library/trend.ts +79 -0
- package/src/core/engine/library/volume.ts +101 -0
- package/src/core/engine/load.ts +118 -0
- package/src/core/engine/machine.ts +446 -0
- package/src/core/engine/memory.ts +129 -0
- package/src/core/engine/operations.ts +171 -0
- package/src/core/engine/orders.ts +121 -0
- package/src/core/engine/registers.ts +104 -0
- package/src/core/engine/request-body.ts +328 -0
- package/src/core/engine/request-plan.ts +270 -0
- package/src/core/engine/requests.ts +382 -0
- package/src/core/engine/results.ts +41 -0
- package/src/core/engine/series.ts +82 -0
- package/src/core/engine/session/hours.ts +86 -0
- package/src/core/engine/session/index.ts +17 -0
- package/src/core/engine/session/record.ts +191 -0
- package/src/core/engine/session/spec.ts +45 -0
- package/src/core/engine/timeframe.ts +161 -0
- package/src/core/engine/types.ts +47 -0
- package/src/core/engine/values/heap.ts +295 -0
- package/src/core/engine/values/index.ts +34 -0
- package/src/core/engine/values/value.ts +158 -0
- package/src/core/engine/verify-budgets.ts +202 -0
- package/src/core/engine/verify-code.ts +332 -0
- package/src/core/engine/verify-requests.ts +255 -0
- package/src/core/engine/verify-shape.ts +164 -0
- package/src/core/engine/verify-tables.ts +176 -0
- package/src/core/engine/verify.ts +341 -0
- package/src/core/index.ts +212 -6
- package/src/core/parse/expressions.ts +1 -1
- package/src/core/parse/names.ts +29 -2
- package/src/core/stdlib/averages/exponential.ts +119 -0
- package/src/core/stdlib/averages/index.ts +45 -0
- package/src/core/stdlib/averages/select.ts +71 -0
- package/src/core/stdlib/averages/shaped.ts +161 -0
- package/src/core/stdlib/averages/simple.ts +139 -0
- package/src/core/stdlib/calendar/civil.ts +89 -0
- package/src/core/stdlib/calendar/fields.ts +124 -0
- package/src/core/stdlib/calendar/format.ts +71 -0
- package/src/core/stdlib/calendar/index.ts +15 -0
- package/src/core/stdlib/calendar/zone.ts +161 -0
- package/src/core/stdlib/index.ts +400 -0
- package/src/core/stdlib/maths/arithmetic.ts +74 -0
- package/src/core/stdlib/maths/elementary.ts +124 -0
- package/src/core/stdlib/maths/index.ts +43 -0
- package/src/core/stdlib/maths/rounding.ts +78 -0
- package/src/core/stdlib/momentum/convergence.ts +82 -0
- package/src/core/stdlib/momentum/index.ts +47 -0
- package/src/core/stdlib/momentum/pressure.ts +141 -0
- package/src/core/stdlib/momentum/rates.ts +188 -0
- package/src/core/stdlib/momentum/rsi.ts +49 -0
- package/src/core/stdlib/momentum/stochastic.ts +147 -0
- package/src/core/stdlib/series/changes.ts +177 -0
- package/src/core/stdlib/series/conditions.ts +74 -0
- package/src/core/stdlib/series/extremes.ts +92 -0
- package/src/core/stdlib/series/index.ts +83 -0
- package/src/core/stdlib/series/pivots.ts +63 -0
- package/src/core/stdlib/series/statistics.ts +207 -0
- package/src/core/stdlib/series/totals.ts +164 -0
- package/src/core/stdlib/trend/directional.ts +196 -0
- package/src/core/stdlib/trend/index.ts +13 -0
- package/src/core/stdlib/trend/psar.ts +131 -0
- package/src/core/stdlib/trend/supertrend.ts +100 -0
- package/src/core/stdlib/values/bar.ts +54 -0
- package/src/core/stdlib/values/index.ts +14 -0
- package/src/core/stdlib/values/lookback.ts +198 -0
- package/src/core/stdlib/values/region.ts +86 -0
- package/src/core/stdlib/values/tail.ts +58 -0
- package/src/core/stdlib/values/value.ts +82 -0
- package/src/core/stdlib/volatility/bands.ts +178 -0
- package/src/core/stdlib/volatility/deviation.ts +111 -0
- package/src/core/stdlib/volatility/index.ts +48 -0
- package/src/core/stdlib/volatility/measures.ts +96 -0
- package/src/core/stdlib/volatility/range.ts +143 -0
- package/src/core/stdlib/volume/accumulation.ts +152 -0
- package/src/core/stdlib/volume/flow.ts +173 -0
- package/src/core/stdlib/volume/index.ts +43 -0
- package/src/core/stdlib/volume/weighted.ts +101 -0
- package/src/core/version/version.generated.ts +2 -2
- package/src/editor/complete.ts +266 -0
- package/src/editor/diagnose.ts +71 -0
- package/src/editor/format.ts +85 -0
- package/src/editor/highlight.ts +110 -0
- package/src/editor/hover.ts +199 -0
- package/src/editor/index.ts +65 -0
- package/src/editor/kinds.ts +157 -0
- package/src/editor/layout.ts +189 -0
- package/src/editor/manifest.ts +119 -0
- package/src/editor/reading.ts +69 -0
- package/src/editor/scan.ts +162 -0
- package/src/editor/scope.ts +122 -0
- package/src/editor/signature.ts +150 -0
- package/src/editor/site.ts +233 -0
- package/src/editor/spacing.ts +132 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The numeric library: the calculations of `stdlib.md` sections 4 to 9.
|
|
3
|
+
*
|
|
4
|
+
* **It depends on nothing else in this repository.** Not the lexer, not the
|
|
5
|
+
* checker, not the engine. A moving average is a moving average, and keeping
|
|
6
|
+
* this tier independently testable is what makes a gate on it worth anything:
|
|
7
|
+
* a number that matches a reference implementation here matches it because the
|
|
8
|
+
* arithmetic is right, not because the rest of the compiler agreed with itself.
|
|
9
|
+
*
|
|
10
|
+
* Three properties hold across everything below, and each has a file that
|
|
11
|
+
* explains it at the place it is implemented:
|
|
12
|
+
*
|
|
13
|
+
* - **Absence is not zero and never becomes zero** (`values/value.ts`). A
|
|
14
|
+
* warmup bar is absent, anything computed from an absent value is absent, and
|
|
15
|
+
* the three functions that deliberately ignore absent bars say so in their
|
|
16
|
+
* names.
|
|
17
|
+
* - **The accumulation order is part of the contract** (`values/lookback.ts`).
|
|
18
|
+
* Binary64 addition is not associative, so two engines that sum a lookback two
|
|
19
|
+
* ways disagree in the last bits. Lookbacks are summed fresh, oldest bar first,
|
|
20
|
+
* and where a formula could be arranged two ways the file that implements it
|
|
21
|
+
* says which way and why.
|
|
22
|
+
* - **Every function is written once, as a step over a state region**
|
|
23
|
+
* (`values/region.ts`): a flat record and a step that takes one bar. The tail
|
|
24
|
+
* form is that step over a region of its own and the whole-series form is the
|
|
25
|
+
* tail folded, so the live path and the history path cannot disagree, because
|
|
26
|
+
* there is only one of them. The record rather than a closure is what lets an
|
|
27
|
+
* engine drive the same step: `compiled-program.md` 2.11 requires a region to
|
|
28
|
+
* be copyable by something that does not know what is in it, and that is the
|
|
29
|
+
* reason there is no second copy of any of this arithmetic in the engine.
|
|
30
|
+
*
|
|
31
|
+
* **What this library does not do: raise.** A length outside its contract is
|
|
32
|
+
* OS3004 at compile time or OS4003 at run time, raised before a call reaches
|
|
33
|
+
* here. Nothing below throws, so nothing below can throw a diagnostic without a
|
|
34
|
+
* code.
|
|
35
|
+
*
|
|
36
|
+
* Two arguments appear here that no script writes, and neither is a numeric
|
|
37
|
+
* fact: the tick size `roundToTick` rounds to, which a host states, and the
|
|
38
|
+
* per-bar flag that says where a trading session begins for `vwap`, which an
|
|
39
|
+
* engine derives from the instrument's session hours. An engine supplies
|
|
40
|
+
* both.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
export type {
|
|
44
|
+
Bar,
|
|
45
|
+
Flag,
|
|
46
|
+
Flags,
|
|
47
|
+
Lookback,
|
|
48
|
+
Recurrence,
|
|
49
|
+
Series,
|
|
50
|
+
StateField,
|
|
51
|
+
StateRecord,
|
|
52
|
+
StateSlot,
|
|
53
|
+
Tail,
|
|
54
|
+
Value,
|
|
55
|
+
} from './values/index.js';
|
|
56
|
+
export {
|
|
57
|
+
NONE,
|
|
58
|
+
at,
|
|
59
|
+
copyState,
|
|
60
|
+
flag,
|
|
61
|
+
fold,
|
|
62
|
+
held,
|
|
63
|
+
hl2,
|
|
64
|
+
hlc3,
|
|
65
|
+
hlcc4,
|
|
66
|
+
isLength,
|
|
67
|
+
isPresent,
|
|
68
|
+
makeLookback,
|
|
69
|
+
newState,
|
|
70
|
+
ohlc4,
|
|
71
|
+
queue,
|
|
72
|
+
result,
|
|
73
|
+
ring,
|
|
74
|
+
slot,
|
|
75
|
+
smoothed,
|
|
76
|
+
tailOf,
|
|
77
|
+
} from './values/index.js';
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
E,
|
|
81
|
+
PI,
|
|
82
|
+
abs,
|
|
83
|
+
acos,
|
|
84
|
+
asin,
|
|
85
|
+
atan,
|
|
86
|
+
atan2,
|
|
87
|
+
boolOf,
|
|
88
|
+
ceil,
|
|
89
|
+
clamp,
|
|
90
|
+
cos,
|
|
91
|
+
exp,
|
|
92
|
+
floor,
|
|
93
|
+
hypot,
|
|
94
|
+
isNone,
|
|
95
|
+
log,
|
|
96
|
+
log2,
|
|
97
|
+
log10,
|
|
98
|
+
max,
|
|
99
|
+
min,
|
|
100
|
+
mod,
|
|
101
|
+
orElse,
|
|
102
|
+
pow,
|
|
103
|
+
round,
|
|
104
|
+
roundHalfAway,
|
|
105
|
+
roundTo,
|
|
106
|
+
roundToStep,
|
|
107
|
+
roundToTick,
|
|
108
|
+
sign,
|
|
109
|
+
sin,
|
|
110
|
+
sqrt,
|
|
111
|
+
tan,
|
|
112
|
+
toDegrees,
|
|
113
|
+
toRadians,
|
|
114
|
+
trunc,
|
|
115
|
+
} from './maths/index.js';
|
|
116
|
+
|
|
117
|
+
export type { Boundary, Civil, DateField } from './calendar/index.js';
|
|
118
|
+
export {
|
|
119
|
+
civilAt,
|
|
120
|
+
dateField,
|
|
121
|
+
dateOfDay,
|
|
122
|
+
dayNumber,
|
|
123
|
+
dayOfYearOf,
|
|
124
|
+
fieldsIn,
|
|
125
|
+
instantFrom,
|
|
126
|
+
instantOf,
|
|
127
|
+
isKnownZone,
|
|
128
|
+
offsetAt,
|
|
129
|
+
renderPattern,
|
|
130
|
+
sameDay,
|
|
131
|
+
startOf,
|
|
132
|
+
utcInstantOf,
|
|
133
|
+
weekOfYearOf,
|
|
134
|
+
weekdayOfDay,
|
|
135
|
+
} from './calendar/index.js';
|
|
136
|
+
|
|
137
|
+
export type { MaType, Weighted } from './averages/index.js';
|
|
138
|
+
export {
|
|
139
|
+
alma,
|
|
140
|
+
almaStep,
|
|
141
|
+
almaTail,
|
|
142
|
+
dema,
|
|
143
|
+
demaStep,
|
|
144
|
+
demaTail,
|
|
145
|
+
ema,
|
|
146
|
+
emaStep,
|
|
147
|
+
emaTail,
|
|
148
|
+
hma,
|
|
149
|
+
hmaStep,
|
|
150
|
+
hmaTail,
|
|
151
|
+
isMaType,
|
|
152
|
+
linreg,
|
|
153
|
+
linregStep,
|
|
154
|
+
linregTail,
|
|
155
|
+
ma,
|
|
156
|
+
maStep,
|
|
157
|
+
maTail,
|
|
158
|
+
rma,
|
|
159
|
+
rmaStep,
|
|
160
|
+
rmaTail,
|
|
161
|
+
sma,
|
|
162
|
+
smaStep,
|
|
163
|
+
smaTail,
|
|
164
|
+
swma,
|
|
165
|
+
swmaStep,
|
|
166
|
+
swmaTail,
|
|
167
|
+
tema,
|
|
168
|
+
temaStep,
|
|
169
|
+
temaTail,
|
|
170
|
+
vwma,
|
|
171
|
+
vwmaStep,
|
|
172
|
+
vwmaTail,
|
|
173
|
+
wma,
|
|
174
|
+
wmaStep,
|
|
175
|
+
wmaTail,
|
|
176
|
+
} from './averages/index.js';
|
|
177
|
+
|
|
178
|
+
export type { Direction, Occasion, Pair } from './series/index.js';
|
|
179
|
+
export {
|
|
180
|
+
avgSkip,
|
|
181
|
+
avgSkipStep,
|
|
182
|
+
avgSkipTail,
|
|
183
|
+
barsSince,
|
|
184
|
+
barsSinceStep,
|
|
185
|
+
barsSinceTail,
|
|
186
|
+
change,
|
|
187
|
+
changeStep,
|
|
188
|
+
changeTail,
|
|
189
|
+
correlation,
|
|
190
|
+
correlationStep,
|
|
191
|
+
correlationTail,
|
|
192
|
+
count,
|
|
193
|
+
countPresent,
|
|
194
|
+
countPresentStep,
|
|
195
|
+
countPresentTail,
|
|
196
|
+
countStep,
|
|
197
|
+
countTail,
|
|
198
|
+
covariance,
|
|
199
|
+
covarianceStep,
|
|
200
|
+
covarianceTail,
|
|
201
|
+
cross,
|
|
202
|
+
crossDown,
|
|
203
|
+
crossDownTail,
|
|
204
|
+
crossEitherTail,
|
|
205
|
+
crossStep,
|
|
206
|
+
crossUp,
|
|
207
|
+
crossUpTail,
|
|
208
|
+
cum,
|
|
209
|
+
cumStep,
|
|
210
|
+
cumTail,
|
|
211
|
+
extremeStep,
|
|
212
|
+
falling,
|
|
213
|
+
fallingTail,
|
|
214
|
+
highest,
|
|
215
|
+
highestBars,
|
|
216
|
+
highestBarsTail,
|
|
217
|
+
highestTail,
|
|
218
|
+
history,
|
|
219
|
+
historyStep,
|
|
220
|
+
historyTail,
|
|
221
|
+
lowest,
|
|
222
|
+
lowestBars,
|
|
223
|
+
lowestBarsTail,
|
|
224
|
+
lowestTail,
|
|
225
|
+
median,
|
|
226
|
+
medianTail,
|
|
227
|
+
percentRank,
|
|
228
|
+
percentRankStep,
|
|
229
|
+
percentRankTail,
|
|
230
|
+
percentile,
|
|
231
|
+
percentileStep,
|
|
232
|
+
percentileTail,
|
|
233
|
+
pivotHigh,
|
|
234
|
+
pivotHighTail,
|
|
235
|
+
pivotLow,
|
|
236
|
+
pivotLowTail,
|
|
237
|
+
pivotStep,
|
|
238
|
+
rising,
|
|
239
|
+
risingTail,
|
|
240
|
+
runStep,
|
|
241
|
+
sum,
|
|
242
|
+
sumSkip,
|
|
243
|
+
sumSkipStep,
|
|
244
|
+
sumSkipTail,
|
|
245
|
+
sumStep,
|
|
246
|
+
sumTail,
|
|
247
|
+
valueWhen,
|
|
248
|
+
valueWhenStep,
|
|
249
|
+
valueWhenTail,
|
|
250
|
+
} from './series/index.js';
|
|
251
|
+
|
|
252
|
+
export type { Gap } from './volatility/index.js';
|
|
253
|
+
export {
|
|
254
|
+
atr,
|
|
255
|
+
atrStep,
|
|
256
|
+
atrTail,
|
|
257
|
+
bbPercent,
|
|
258
|
+
bbPercentStep,
|
|
259
|
+
bbPercentTail,
|
|
260
|
+
bbWidth,
|
|
261
|
+
bbWidthStep,
|
|
262
|
+
bbWidthTail,
|
|
263
|
+
bollinger,
|
|
264
|
+
bollingerStep,
|
|
265
|
+
bollingerTail,
|
|
266
|
+
chop,
|
|
267
|
+
chopStep,
|
|
268
|
+
chopTail,
|
|
269
|
+
donchian,
|
|
270
|
+
donchianStep,
|
|
271
|
+
donchianTail,
|
|
272
|
+
gapOf,
|
|
273
|
+
gapTrueRange,
|
|
274
|
+
gapTrueRangeStep,
|
|
275
|
+
gapTrueRangeTail,
|
|
276
|
+
hv,
|
|
277
|
+
hvStep,
|
|
278
|
+
hvTail,
|
|
279
|
+
keltner,
|
|
280
|
+
keltnerStep,
|
|
281
|
+
keltnerTail,
|
|
282
|
+
meanDeviation,
|
|
283
|
+
meanDeviationStep,
|
|
284
|
+
meanDeviationTail,
|
|
285
|
+
natr,
|
|
286
|
+
natrStep,
|
|
287
|
+
natrTail,
|
|
288
|
+
stdev,
|
|
289
|
+
stdevStep,
|
|
290
|
+
stdevTail,
|
|
291
|
+
trueRange,
|
|
292
|
+
trueRangeOf,
|
|
293
|
+
trueRangeTail,
|
|
294
|
+
variance,
|
|
295
|
+
varianceStep,
|
|
296
|
+
varianceTail,
|
|
297
|
+
} from './volatility/index.js';
|
|
298
|
+
|
|
299
|
+
export {
|
|
300
|
+
awesomeOsc,
|
|
301
|
+
awesomeOscStep,
|
|
302
|
+
awesomeOscTail,
|
|
303
|
+
cci,
|
|
304
|
+
cciStep,
|
|
305
|
+
cciTail,
|
|
306
|
+
cmo,
|
|
307
|
+
cmoStep,
|
|
308
|
+
cmoTail,
|
|
309
|
+
dpo,
|
|
310
|
+
dpoStep,
|
|
311
|
+
dpoTail,
|
|
312
|
+
macd,
|
|
313
|
+
macdStep,
|
|
314
|
+
macdTail,
|
|
315
|
+
mom,
|
|
316
|
+
momTail,
|
|
317
|
+
ppo,
|
|
318
|
+
ppoStep,
|
|
319
|
+
ppoTail,
|
|
320
|
+
roc,
|
|
321
|
+
rocStep,
|
|
322
|
+
rocTail,
|
|
323
|
+
rsi,
|
|
324
|
+
rsiStep,
|
|
325
|
+
rsiTail,
|
|
326
|
+
stoch,
|
|
327
|
+
stochRsi,
|
|
328
|
+
stochRsiStep,
|
|
329
|
+
stochRsiTail,
|
|
330
|
+
stochStep,
|
|
331
|
+
stochTail,
|
|
332
|
+
trix,
|
|
333
|
+
trixStep,
|
|
334
|
+
trixTail,
|
|
335
|
+
tsi,
|
|
336
|
+
tsiStep,
|
|
337
|
+
tsiTail,
|
|
338
|
+
ultimateOsc,
|
|
339
|
+
ultimateOscStep,
|
|
340
|
+
ultimateOscTail,
|
|
341
|
+
williamsR,
|
|
342
|
+
williamsRStep,
|
|
343
|
+
williamsRTail,
|
|
344
|
+
} from './momentum/index.js';
|
|
345
|
+
|
|
346
|
+
export {
|
|
347
|
+
adx,
|
|
348
|
+
adxStep,
|
|
349
|
+
adxTail,
|
|
350
|
+
aroon,
|
|
351
|
+
aroonStep,
|
|
352
|
+
aroonTail,
|
|
353
|
+
ichimoku,
|
|
354
|
+
ichimokuStep,
|
|
355
|
+
ichimokuTail,
|
|
356
|
+
psar,
|
|
357
|
+
psarStep,
|
|
358
|
+
psarTail,
|
|
359
|
+
supertrend,
|
|
360
|
+
supertrendStep,
|
|
361
|
+
supertrendTail,
|
|
362
|
+
} from './trend/index.js';
|
|
363
|
+
|
|
364
|
+
export type { Anchored } from './volume/index.js';
|
|
365
|
+
export {
|
|
366
|
+
ad,
|
|
367
|
+
adOsc,
|
|
368
|
+
adOscStep,
|
|
369
|
+
adOscTail,
|
|
370
|
+
adStep,
|
|
371
|
+
adTail,
|
|
372
|
+
cmf,
|
|
373
|
+
cmfStep,
|
|
374
|
+
cmfTail,
|
|
375
|
+
eom,
|
|
376
|
+
eomStep,
|
|
377
|
+
eomTail,
|
|
378
|
+
forceIndex,
|
|
379
|
+
forceIndexStep,
|
|
380
|
+
forceIndexTail,
|
|
381
|
+
mfi,
|
|
382
|
+
mfiStep,
|
|
383
|
+
mfiTail,
|
|
384
|
+
moneyFlow,
|
|
385
|
+
obv,
|
|
386
|
+
obvStep,
|
|
387
|
+
obvTail,
|
|
388
|
+
pvt,
|
|
389
|
+
pvtStep,
|
|
390
|
+
pvtTail,
|
|
391
|
+
relativeVolume,
|
|
392
|
+
relativeVolumeStep,
|
|
393
|
+
relativeVolumeTail,
|
|
394
|
+
vwap,
|
|
395
|
+
vwapAnchor,
|
|
396
|
+
vwapAnchorStep,
|
|
397
|
+
vwapAnchorTail,
|
|
398
|
+
vwapStep,
|
|
399
|
+
vwapTail,
|
|
400
|
+
} from './volume/index.js';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bare arithmetic of `stdlib.md` section 8.1.
|
|
3
|
+
*
|
|
4
|
+
* None of these has a warmup: they read this bar's values only, so each
|
|
5
|
+
* produces a value on bar 0 whenever its arguments do. Every one is absent when
|
|
6
|
+
* any argument is absent, and every result goes through `result`, so a value
|
|
7
|
+
* with no finite real answer is absence rather than an infinity.
|
|
8
|
+
*/
|
|
9
|
+
import type { Value } from '../values/index.js';
|
|
10
|
+
import { NONE, isPresent, result } from '../values/index.js';
|
|
11
|
+
|
|
12
|
+
/** `abs(x)`: magnitude without sign. */
|
|
13
|
+
export function abs(x: Value): Value {
|
|
14
|
+
return isPresent(x) ? result(Math.abs(x)) : NONE;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** `sign(x)`: -1, 0 or 1. */
|
|
18
|
+
export function sign(x: Value): Value {
|
|
19
|
+
if (!isPresent(x)) return NONE;
|
|
20
|
+
if (x > 0) return 1;
|
|
21
|
+
if (x < 0) return -1;
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** `min(a, b)`: the smaller of two. */
|
|
26
|
+
export function min(a: Value, b: Value): Value {
|
|
27
|
+
if (!isPresent(a) || !isPresent(b)) return NONE;
|
|
28
|
+
return result(a < b ? a : b);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** `max(a, b)`: the larger of two. */
|
|
32
|
+
export function max(a: Value, b: Value): Value {
|
|
33
|
+
if (!isPresent(a) || !isPresent(b)) return NONE;
|
|
34
|
+
return result(a > b ? a : b);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** `clamp(x, lo, hi)`: `x` held inside a range. */
|
|
38
|
+
export function clamp(x: Value, lo: Value, hi: Value): Value {
|
|
39
|
+
if (!isPresent(x) || !isPresent(lo) || !isPresent(hi)) return NONE;
|
|
40
|
+
if (x < lo) return result(lo);
|
|
41
|
+
if (x > hi) return result(hi);
|
|
42
|
+
return result(x);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `mod(a, b)`: `a - b * floor(a / b)`, the floored remainder, whose sign
|
|
47
|
+
* follows `b`.
|
|
48
|
+
*
|
|
49
|
+
* Written out rather than described because "the modulo" names two different
|
|
50
|
+
* functions in common use. This is the floored one and the `%` operator is the
|
|
51
|
+
* truncated one: `mod(-7, 3)` is 2 where `-7 % 3` is -1. The two agree for
|
|
52
|
+
* every positive `b`, which is every use that wraps an index or a bar count.
|
|
53
|
+
* `mod(a, 0)` is absent, on the rule that a result with no finite real value is
|
|
54
|
+
* absent.
|
|
55
|
+
*/
|
|
56
|
+
export function mod(a: Value, b: Value): Value {
|
|
57
|
+
if (!isPresent(a) || !isPresent(b) || b === 0) return NONE;
|
|
58
|
+
return result(a - b * Math.floor(a / b));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** True when the value is absent. */
|
|
62
|
+
export function isNone(x: Value): boolean {
|
|
63
|
+
return !isPresent(x);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** `x` when present, `fallback` when absent. */
|
|
67
|
+
export function orElse(x: Value, fallback: Value): Value {
|
|
68
|
+
return isPresent(x) ? x : fallback;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** `toBool(x)`: absence to false, a bool to itself. Numbers are a type error. */
|
|
72
|
+
export function boolOf(x: boolean | null): boolean {
|
|
73
|
+
return x === null ? false : x;
|
|
74
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Square root, the logarithms, the powers and the trigonometry.
|
|
3
|
+
*
|
|
4
|
+
* **A gap, stated here rather than discovered later.**
|
|
5
|
+
* `compiled-program.md` section 8.3 requires that the transcendental functions
|
|
6
|
+
* not use the platform's own maths library, because a platform implementation
|
|
7
|
+
* is correct to within an ulp or so and differs between platforms in the last
|
|
8
|
+
* bit, which this project has declared a release blocker. It names the portable
|
|
9
|
+
* reference algorithm as living in the library manifest. **That manifest does
|
|
10
|
+
* not exist yet**, so there is nothing to implement against, and the functions
|
|
11
|
+
* below call the host until it does. Everything in this file except `sqrt` is
|
|
12
|
+
* therefore portable in value but not yet guaranteed in the last bit.
|
|
13
|
+
*
|
|
14
|
+
* `sqrt` is the exception and is not affected: IEEE-754 requires it to be
|
|
15
|
+
* correctly rounded, so every conforming platform returns the same bits.
|
|
16
|
+
*
|
|
17
|
+
* The consequence is worth stating plainly, because it decides what is safe to
|
|
18
|
+
* gate on today. Of the five gate studies, EMA, RSI, MACD, Bollinger Bands and
|
|
19
|
+
* Supertrend, four use only addition, subtraction, multiplication and division,
|
|
20
|
+
* and Bollinger Bands adds `sqrt`. None of them reaches this file's uncertain
|
|
21
|
+
* half. The functions that do are `alma` (exp), `hv` (log) and `chop` (log10).
|
|
22
|
+
*/
|
|
23
|
+
import type { Value } from '../values/index.js';
|
|
24
|
+
import { NONE, isPresent, result } from '../values/index.js';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `sqrt(x)`: square root, absent below zero.
|
|
28
|
+
*
|
|
29
|
+
* Correctly rounded on every conforming platform, so this one is bit-identical
|
|
30
|
+
* everywhere without a portable implementation of its own.
|
|
31
|
+
*/
|
|
32
|
+
export function sqrt(x: Value): Value {
|
|
33
|
+
if (!isPresent(x) || x < 0) return NONE;
|
|
34
|
+
return result(Math.sqrt(x));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** `pow(x, y)`: absent where the result is not a finite real. */
|
|
38
|
+
export function pow(x: Value, y: Value): Value {
|
|
39
|
+
if (!isPresent(x) || !isPresent(y)) return NONE;
|
|
40
|
+
return result(Math.pow(x, y));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** `exp(x)`: e to the power x. */
|
|
44
|
+
export function exp(x: Value): Value {
|
|
45
|
+
return isPresent(x) ? result(Math.exp(x)) : NONE;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** `log(x)`: natural logarithm, absent at or below zero. */
|
|
49
|
+
export function log(x: Value): Value {
|
|
50
|
+
if (!isPresent(x) || x <= 0) return NONE;
|
|
51
|
+
return result(Math.log(x));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** `log10(x)`: base ten logarithm, absent at or below zero. */
|
|
55
|
+
export function log10(x: Value): Value {
|
|
56
|
+
if (!isPresent(x) || x <= 0) return NONE;
|
|
57
|
+
return result(Math.log10(x));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** `math.log2(x)`: base two logarithm, absent at or below zero. */
|
|
61
|
+
export function log2(x: Value): Value {
|
|
62
|
+
if (!isPresent(x) || x <= 0) return NONE;
|
|
63
|
+
return result(Math.log2(x));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The circle constant. */
|
|
67
|
+
export const PI: number = Math.PI;
|
|
68
|
+
|
|
69
|
+
/** The base of the natural logarithm. */
|
|
70
|
+
export const E: number = Math.E;
|
|
71
|
+
|
|
72
|
+
/** `math.hypot(x, y)`: `sqrt(x * x + y * y)` without intermediate overflow. */
|
|
73
|
+
export function hypot(x: Value, y: Value): Value {
|
|
74
|
+
if (!isPresent(x) || !isPresent(y)) return NONE;
|
|
75
|
+
return result(Math.hypot(x, y));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** `math.toDegrees(x)`: radians to degrees. */
|
|
79
|
+
export function toDegrees(x: Value): Value {
|
|
80
|
+
return isPresent(x) ? result((x * 180) / Math.PI) : NONE;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** `math.toRadians(x)`: degrees to radians. */
|
|
84
|
+
export function toRadians(x: Value): Value {
|
|
85
|
+
return isPresent(x) ? result((x * Math.PI) / 180) : NONE;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** `math.sin(x)`: sine of an angle in radians. */
|
|
89
|
+
export function sin(x: Value): Value {
|
|
90
|
+
return isPresent(x) ? result(Math.sin(x)) : NONE;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** `math.cos(x)`: cosine. */
|
|
94
|
+
export function cos(x: Value): Value {
|
|
95
|
+
return isPresent(x) ? result(Math.cos(x)) : NONE;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** `math.tan(x)`: tangent. */
|
|
99
|
+
export function tan(x: Value): Value {
|
|
100
|
+
return isPresent(x) ? result(Math.tan(x)) : NONE;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** `math.asin(x)`: inverse sine, absent outside -1 to 1. */
|
|
104
|
+
export function asin(x: Value): Value {
|
|
105
|
+
if (!isPresent(x) || x < -1 || x > 1) return NONE;
|
|
106
|
+
return result(Math.asin(x));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** `math.acos(x)`: inverse cosine, absent outside -1 to 1. */
|
|
110
|
+
export function acos(x: Value): Value {
|
|
111
|
+
if (!isPresent(x) || x < -1 || x > 1) return NONE;
|
|
112
|
+
return result(Math.acos(x));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** `math.atan(x)`: inverse tangent. */
|
|
116
|
+
export function atan(x: Value): Value {
|
|
117
|
+
return isPresent(x) ? result(Math.atan(x)) : NONE;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** `math.atan2(y, x)`: angle of a vector, correct in all four quadrants. */
|
|
121
|
+
export function atan2(y: Value, x: Value): Value {
|
|
122
|
+
if (!isPresent(y) || !isPresent(x)) return NONE;
|
|
123
|
+
return result(Math.atan2(y, x));
|
|
124
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export {
|
|
2
|
+
abs,
|
|
3
|
+
boolOf,
|
|
4
|
+
clamp,
|
|
5
|
+
isNone,
|
|
6
|
+
max,
|
|
7
|
+
min,
|
|
8
|
+
mod,
|
|
9
|
+
orElse,
|
|
10
|
+
sign,
|
|
11
|
+
} from './arithmetic.js';
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
ceil,
|
|
15
|
+
floor,
|
|
16
|
+
round,
|
|
17
|
+
roundHalfAway,
|
|
18
|
+
roundTo,
|
|
19
|
+
roundToStep,
|
|
20
|
+
roundToTick,
|
|
21
|
+
trunc,
|
|
22
|
+
} from './rounding.js';
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
E,
|
|
26
|
+
PI,
|
|
27
|
+
acos,
|
|
28
|
+
asin,
|
|
29
|
+
atan,
|
|
30
|
+
atan2,
|
|
31
|
+
cos,
|
|
32
|
+
exp,
|
|
33
|
+
hypot,
|
|
34
|
+
log,
|
|
35
|
+
log2,
|
|
36
|
+
log10,
|
|
37
|
+
pow,
|
|
38
|
+
sin,
|
|
39
|
+
sqrt,
|
|
40
|
+
tan,
|
|
41
|
+
toDegrees,
|
|
42
|
+
toRadians,
|
|
43
|
+
} from './elementary.js';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rounding, and the one rule that decides every case.
|
|
3
|
+
*
|
|
4
|
+
* **Halves go away from zero, never to even.** `stdlib.md` section 8.1 fixes it
|
|
5
|
+
* there and the reason is legibility: a price rounded for display should agree
|
|
6
|
+
* with what a trader would write down, and round-half-to-even surprises people
|
|
7
|
+
* at exactly the values that matter. Fixing it also means two engines cannot
|
|
8
|
+
* differ by one tick.
|
|
9
|
+
*
|
|
10
|
+
* The implementation does not add a half and take the floor. That is the usual
|
|
11
|
+
* shortcut and it is wrong for the value just below a half, where adding 0.5
|
|
12
|
+
* rounds up to the next representable number before the floor ever runs. The
|
|
13
|
+
* fractional part is compared instead, which has no such case.
|
|
14
|
+
*/
|
|
15
|
+
import type { Value } from '../values/index.js';
|
|
16
|
+
import { NONE, isPresent, result } from '../values/index.js';
|
|
17
|
+
|
|
18
|
+
/** The nearest whole number, halves away from zero. */
|
|
19
|
+
export function roundHalfAway(x: number): number {
|
|
20
|
+
const below = Math.floor(x);
|
|
21
|
+
const fraction = x - below;
|
|
22
|
+
if (fraction > 0.5) return below + 1;
|
|
23
|
+
if (fraction < 0.5) return below;
|
|
24
|
+
// Exactly a half. Away from zero: upward above zero, and `below` already is
|
|
25
|
+
// the downward answer for a negative, since floor(-2.5) is -3.
|
|
26
|
+
return x > 0 ? below + 1 : below;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** `round(x)`: to the nearest whole number, halves away from zero. */
|
|
30
|
+
export function round(x: Value): Value {
|
|
31
|
+
return isPresent(x) ? result(roundHalfAway(x)) : NONE;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `round(x, decimals)`: to a fixed number of decimals, halves away from zero.
|
|
36
|
+
*
|
|
37
|
+
* A digit count is a whole number of zero or more; anything else is OS3004 or
|
|
38
|
+
* OS4003 before the call reaches here, and absence is the backstop.
|
|
39
|
+
*/
|
|
40
|
+
export function roundTo(x: Value, decimals: number): Value {
|
|
41
|
+
if (!isPresent(x)) return NONE;
|
|
42
|
+
if (!Number.isInteger(decimals) || decimals < 0) return NONE;
|
|
43
|
+
const scale = Math.pow(10, decimals);
|
|
44
|
+
return result(roundHalfAway(x * scale) / scale);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** `floor(x)`: toward negative infinity. */
|
|
48
|
+
export function floor(x: Value): Value {
|
|
49
|
+
return isPresent(x) ? result(Math.floor(x)) : NONE;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** `ceil(x)`: toward positive infinity. */
|
|
53
|
+
export function ceil(x: Value): Value {
|
|
54
|
+
return isPresent(x) ? result(Math.ceil(x)) : NONE;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** `trunc(x)`: toward zero. */
|
|
58
|
+
export function trunc(x: Value): Value {
|
|
59
|
+
return isPresent(x) ? result(Math.trunc(x)) : NONE;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** `roundToStep(x, step)`: to the nearest multiple of `step`. */
|
|
63
|
+
export function roundToStep(x: Value, step: Value): Value {
|
|
64
|
+
if (!isPresent(x) || !isPresent(step) || step <= 0) return NONE;
|
|
65
|
+
return result(roundHalfAway(x / step) * step);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* `roundToTick(price)`: to the instrument's tick.
|
|
70
|
+
*
|
|
71
|
+
* Absent when the host supplied no tick size, rather than the price unrounded.
|
|
72
|
+
* Returning the input would produce an order price that looks rounded and is
|
|
73
|
+
* not, which is a defect nothing downstream can see.
|
|
74
|
+
*/
|
|
75
|
+
export function roundToTick(price: Value, tickSize: Value): Value {
|
|
76
|
+
if (!isPresent(tickSize) || tickSize <= 0) return NONE;
|
|
77
|
+
return roundToStep(price, tickSize);
|
|
78
|
+
}
|