@insiderfinance/totalfinance 0.1.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/LICENSE +201 -0
- package/README.md +339 -0
- package/STABILITY.md +23 -0
- package/modules/backtest/dist/artifacts.d.ts +23 -0
- package/modules/backtest/dist/artifacts.d.ts.map +1 -0
- package/modules/backtest/dist/artifacts.js +22 -0
- package/modules/backtest/dist/artifacts.js.map +1 -0
- package/modules/backtest/dist/broker.d.ts +265 -0
- package/modules/backtest/dist/broker.d.ts.map +1 -0
- package/modules/backtest/dist/broker.js +1228 -0
- package/modules/backtest/dist/broker.js.map +1 -0
- package/modules/backtest/dist/costs.d.ts +67 -0
- package/modules/backtest/dist/costs.d.ts.map +1 -0
- package/modules/backtest/dist/costs.js +171 -0
- package/modules/backtest/dist/costs.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/engine.d.ts +21 -0
- package/modules/backtest/dist/cross-sectional/engine.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/engine.js +1399 -0
- package/modules/backtest/dist/cross-sectional/engine.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/folds.d.ts +134 -0
- package/modules/backtest/dist/cross-sectional/folds.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/folds.js +375 -0
- package/modules/backtest/dist/cross-sectional/folds.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/grid.d.ts +142 -0
- package/modules/backtest/dist/cross-sectional/grid.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/grid.js +394 -0
- package/modules/backtest/dist/cross-sectional/grid.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/index.d.ts +18 -0
- package/modules/backtest/dist/cross-sectional/index.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/index.js +15 -0
- package/modules/backtest/dist/cross-sectional/index.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/types.d.ts +331 -0
- package/modules/backtest/dist/cross-sectional/types.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/types.js +12 -0
- package/modules/backtest/dist/cross-sectional/types.js.map +1 -0
- package/modules/backtest/dist/cross-sectional/validate.d.ts +22 -0
- package/modules/backtest/dist/cross-sectional/validate.d.ts.map +1 -0
- package/modules/backtest/dist/cross-sectional/validate.js +489 -0
- package/modules/backtest/dist/cross-sectional/validate.js.map +1 -0
- package/modules/backtest/dist/diagnostics.d.ts +16 -0
- package/modules/backtest/dist/diagnostics.d.ts.map +1 -0
- package/modules/backtest/dist/diagnostics.js +63 -0
- package/modules/backtest/dist/diagnostics.js.map +1 -0
- package/modules/backtest/dist/environment/bench.d.ts +34 -0
- package/modules/backtest/dist/environment/bench.d.ts.map +1 -0
- package/modules/backtest/dist/environment/bench.js +724 -0
- package/modules/backtest/dist/environment/bench.js.map +1 -0
- package/modules/backtest/dist/environment/environment.d.ts +5 -0
- package/modules/backtest/dist/environment/environment.d.ts.map +1 -0
- package/modules/backtest/dist/environment/environment.js +618 -0
- package/modules/backtest/dist/environment/environment.js.map +1 -0
- package/modules/backtest/dist/environment/episode.d.ts +4 -0
- package/modules/backtest/dist/environment/episode.d.ts.map +1 -0
- package/modules/backtest/dist/environment/episode.js +121 -0
- package/modules/backtest/dist/environment/episode.js.map +1 -0
- package/modules/backtest/dist/environment/episodes.d.ts +14 -0
- package/modules/backtest/dist/environment/episodes.d.ts.map +1 -0
- package/modules/backtest/dist/environment/episodes.js +644 -0
- package/modules/backtest/dist/environment/episodes.js.map +1 -0
- package/modules/backtest/dist/environment/features.d.ts +31 -0
- package/modules/backtest/dist/environment/features.d.ts.map +1 -0
- package/modules/backtest/dist/environment/features.js +157 -0
- package/modules/backtest/dist/environment/features.js.map +1 -0
- package/modules/backtest/dist/environment/index.d.ts +14 -0
- package/modules/backtest/dist/environment/index.d.ts.map +1 -0
- package/modules/backtest/dist/environment/index.js +12 -0
- package/modules/backtest/dist/environment/index.js.map +1 -0
- package/modules/backtest/dist/environment/limits.d.ts +63 -0
- package/modules/backtest/dist/environment/limits.d.ts.map +1 -0
- package/modules/backtest/dist/environment/limits.js +253 -0
- package/modules/backtest/dist/environment/limits.js.map +1 -0
- package/modules/backtest/dist/environment/reward.d.ts +5 -0
- package/modules/backtest/dist/environment/reward.d.ts.map +1 -0
- package/modules/backtest/dist/environment/reward.js +80 -0
- package/modules/backtest/dist/environment/reward.js.map +1 -0
- package/modules/backtest/dist/environment/types.d.ts +540 -0
- package/modules/backtest/dist/environment/types.d.ts.map +1 -0
- package/modules/backtest/dist/environment/types.js +2 -0
- package/modules/backtest/dist/environment/types.js.map +1 -0
- package/modules/backtest/dist/environment/validate.d.ts +23 -0
- package/modules/backtest/dist/environment/validate.d.ts.map +1 -0
- package/modules/backtest/dist/environment/validate.js +264 -0
- package/modules/backtest/dist/environment/validate.js.map +1 -0
- package/modules/backtest/dist/event-driven.d.ts +111 -0
- package/modules/backtest/dist/event-driven.d.ts.map +1 -0
- package/modules/backtest/dist/event-driven.js +325 -0
- package/modules/backtest/dist/event-driven.js.map +1 -0
- package/modules/backtest/dist/execution/conformance.d.ts +33 -0
- package/modules/backtest/dist/execution/conformance.d.ts.map +1 -0
- package/modules/backtest/dist/execution/conformance.js +269 -0
- package/modules/backtest/dist/execution/conformance.js.map +1 -0
- package/modules/backtest/dist/execution/fill-models.d.ts +35 -0
- package/modules/backtest/dist/execution/fill-models.d.ts.map +1 -0
- package/modules/backtest/dist/execution/fill-models.js +375 -0
- package/modules/backtest/dist/execution/fill-models.js.map +1 -0
- package/modules/backtest/dist/execution/fill-order.d.ts +55 -0
- package/modules/backtest/dist/execution/fill-order.d.ts.map +1 -0
- package/modules/backtest/dist/execution/fill-order.js +156 -0
- package/modules/backtest/dist/execution/fill-order.js.map +1 -0
- package/modules/backtest/dist/execution/index.d.ts +33 -0
- package/modules/backtest/dist/execution/index.d.ts.map +1 -0
- package/modules/backtest/dist/execution/index.js +27 -0
- package/modules/backtest/dist/execution/index.js.map +1 -0
- package/modules/backtest/dist/execution/intrabar.d.ts +46 -0
- package/modules/backtest/dist/execution/intrabar.d.ts.map +1 -0
- package/modules/backtest/dist/execution/intrabar.js +130 -0
- package/modules/backtest/dist/execution/intrabar.js.map +1 -0
- package/modules/backtest/dist/execution/normalized.d.ts +56 -0
- package/modules/backtest/dist/execution/normalized.d.ts.map +1 -0
- package/modules/backtest/dist/execution/normalized.js +154 -0
- package/modules/backtest/dist/execution/normalized.js.map +1 -0
- package/modules/backtest/dist/execution/policy.d.ts +84 -0
- package/modules/backtest/dist/execution/policy.d.ts.map +1 -0
- package/modules/backtest/dist/execution/policy.js +341 -0
- package/modules/backtest/dist/execution/policy.js.map +1 -0
- package/modules/backtest/dist/execution/types.d.ts +217 -0
- package/modules/backtest/dist/execution/types.d.ts.map +1 -0
- package/modules/backtest/dist/execution/types.js +8 -0
- package/modules/backtest/dist/execution/types.js.map +1 -0
- package/modules/backtest/dist/execution/validate.d.ts +35 -0
- package/modules/backtest/dist/execution/validate.d.ts.map +1 -0
- package/modules/backtest/dist/execution/validate.js +666 -0
- package/modules/backtest/dist/execution/validate.js.map +1 -0
- package/modules/backtest/dist/generated/validation-specs.d.ts +12 -0
- package/modules/backtest/dist/generated/validation-specs.d.ts.map +1 -0
- package/modules/backtest/dist/generated/validation-specs.js +1129 -0
- package/modules/backtest/dist/generated/validation-specs.js.map +1 -0
- package/modules/backtest/dist/index.d.ts +33 -0
- package/modules/backtest/dist/index.d.ts.map +1 -0
- package/modules/backtest/dist/index.js +28 -0
- package/modules/backtest/dist/index.js.map +1 -0
- package/modules/backtest/dist/options/chain.d.ts +68 -0
- package/modules/backtest/dist/options/chain.d.ts.map +1 -0
- package/modules/backtest/dist/options/chain.js +303 -0
- package/modules/backtest/dist/options/chain.js.map +1 -0
- package/modules/backtest/dist/options/engine.d.ts +28 -0
- package/modules/backtest/dist/options/engine.d.ts.map +1 -0
- package/modules/backtest/dist/options/engine.js +1859 -0
- package/modules/backtest/dist/options/engine.js.map +1 -0
- package/modules/backtest/dist/options/index.d.ts +23 -0
- package/modules/backtest/dist/options/index.d.ts.map +1 -0
- package/modules/backtest/dist/options/index.js +21 -0
- package/modules/backtest/dist/options/index.js.map +1 -0
- package/modules/backtest/dist/options/tearsheet.d.ts +77 -0
- package/modules/backtest/dist/options/tearsheet.d.ts.map +1 -0
- package/modules/backtest/dist/options/tearsheet.js +205 -0
- package/modules/backtest/dist/options/tearsheet.js.map +1 -0
- package/modules/backtest/dist/options/types.d.ts +571 -0
- package/modules/backtest/dist/options/types.d.ts.map +1 -0
- package/modules/backtest/dist/options/types.js +19 -0
- package/modules/backtest/dist/options/types.js.map +1 -0
- package/modules/backtest/dist/paper/index.d.ts +13 -0
- package/modules/backtest/dist/paper/index.d.ts.map +1 -0
- package/modules/backtest/dist/paper/index.js +12 -0
- package/modules/backtest/dist/paper/index.js.map +1 -0
- package/modules/backtest/dist/paper/paper.d.ts +8 -0
- package/modules/backtest/dist/paper/paper.d.ts.map +1 -0
- package/modules/backtest/dist/paper/paper.js +950 -0
- package/modules/backtest/dist/paper/paper.js.map +1 -0
- package/modules/backtest/dist/paper/types.d.ts +190 -0
- package/modules/backtest/dist/paper/types.d.ts.map +1 -0
- package/modules/backtest/dist/paper/types.js +3 -0
- package/modules/backtest/dist/paper/types.js.map +1 -0
- package/modules/backtest/dist/paper/validate.d.ts +9 -0
- package/modules/backtest/dist/paper/validate.d.ts.map +1 -0
- package/modules/backtest/dist/paper/validate.js +112 -0
- package/modules/backtest/dist/paper/validate.js.map +1 -0
- package/modules/backtest/dist/portfolio/adapters.d.ts +37 -0
- package/modules/backtest/dist/portfolio/adapters.d.ts.map +1 -0
- package/modules/backtest/dist/portfolio/adapters.js +555 -0
- package/modules/backtest/dist/portfolio/adapters.js.map +1 -0
- package/modules/backtest/dist/portfolio/engine.d.ts +35 -0
- package/modules/backtest/dist/portfolio/engine.d.ts.map +1 -0
- package/modules/backtest/dist/portfolio/engine.js +1300 -0
- package/modules/backtest/dist/portfolio/engine.js.map +1 -0
- package/modules/backtest/dist/portfolio/index.d.ts +12 -0
- package/modules/backtest/dist/portfolio/index.d.ts.map +1 -0
- package/modules/backtest/dist/portfolio/index.js +11 -0
- package/modules/backtest/dist/portfolio/index.js.map +1 -0
- package/modules/backtest/dist/portfolio/types.d.ts +418 -0
- package/modules/backtest/dist/portfolio/types.d.ts.map +1 -0
- package/modules/backtest/dist/portfolio/types.js +8 -0
- package/modules/backtest/dist/portfolio/types.js.map +1 -0
- package/modules/backtest/dist/portfolio/validate.d.ts +26 -0
- package/modules/backtest/dist/portfolio/validate.d.ts.map +1 -0
- package/modules/backtest/dist/portfolio/validate.js +556 -0
- package/modules/backtest/dist/portfolio/validate.js.map +1 -0
- package/modules/backtest/dist/run-artifacts.d.ts +425 -0
- package/modules/backtest/dist/run-artifacts.d.ts.map +1 -0
- package/modules/backtest/dist/run-artifacts.js +1843 -0
- package/modules/backtest/dist/run-artifacts.js.map +1 -0
- package/modules/backtest/dist/signals.d.ts +110 -0
- package/modules/backtest/dist/signals.d.ts.map +1 -0
- package/modules/backtest/dist/signals.js +207 -0
- package/modules/backtest/dist/signals.js.map +1 -0
- package/modules/backtest/dist/tearsheet.d.ts +126 -0
- package/modules/backtest/dist/tearsheet.d.ts.map +1 -0
- package/modules/backtest/dist/tearsheet.js +266 -0
- package/modules/backtest/dist/tearsheet.js.map +1 -0
- package/modules/backtest/dist/types.d.ts +175 -0
- package/modules/backtest/dist/types.d.ts.map +1 -0
- package/modules/backtest/dist/types.js +29 -0
- package/modules/backtest/dist/types.js.map +1 -0
- package/modules/backtest/dist/validate.d.ts +13 -0
- package/modules/backtest/dist/validate.d.ts.map +1 -0
- package/modules/backtest/dist/validate.js +37 -0
- package/modules/backtest/dist/validate.js.map +1 -0
- package/modules/backtest/dist/vectorized.d.ts +53 -0
- package/modules/backtest/dist/vectorized.d.ts.map +1 -0
- package/modules/backtest/dist/vectorized.js +383 -0
- package/modules/backtest/dist/vectorized.js.map +1 -0
- package/modules/backtest/dist/walk-forward.d.ts +57 -0
- package/modules/backtest/dist/walk-forward.d.ts.map +1 -0
- package/modules/backtest/dist/walk-forward.js +125 -0
- package/modules/backtest/dist/walk-forward.js.map +1 -0
- package/modules/backtest/etc/backtest.api.md +139 -0
- package/modules/backtest/src/artifacts.ts +54 -0
- package/modules/backtest/src/broker.ts +1529 -0
- package/modules/backtest/src/costs.ts +225 -0
- package/modules/backtest/src/cross-sectional/engine.ts +1608 -0
- package/modules/backtest/src/cross-sectional/folds.ts +718 -0
- package/modules/backtest/src/cross-sectional/grid.ts +646 -0
- package/modules/backtest/src/cross-sectional/index.ts +76 -0
- package/modules/backtest/src/cross-sectional/types.ts +363 -0
- package/modules/backtest/src/cross-sectional/validate.ts +906 -0
- package/modules/backtest/src/diagnostics.ts +66 -0
- package/modules/backtest/src/environment/bench.ts +1022 -0
- package/modules/backtest/src/environment/environment.ts +766 -0
- package/modules/backtest/src/environment/episode.ts +146 -0
- package/modules/backtest/src/environment/episodes.ts +786 -0
- package/modules/backtest/src/environment/features.ts +184 -0
- package/modules/backtest/src/environment/index.ts +79 -0
- package/modules/backtest/src/environment/limits.ts +383 -0
- package/modules/backtest/src/environment/reward.ts +98 -0
- package/modules/backtest/src/environment/types.ts +595 -0
- package/modules/backtest/src/environment/validate.ts +415 -0
- package/modules/backtest/src/event-driven.ts +528 -0
- package/modules/backtest/src/execution/conformance.ts +346 -0
- package/modules/backtest/src/execution/fill-models.ts +410 -0
- package/modules/backtest/src/execution/fill-order.ts +261 -0
- package/modules/backtest/src/execution/index.ts +91 -0
- package/modules/backtest/src/execution/intrabar.ts +185 -0
- package/modules/backtest/src/execution/normalized.ts +216 -0
- package/modules/backtest/src/execution/policy.ts +447 -0
- package/modules/backtest/src/execution/types.ts +239 -0
- package/modules/backtest/src/execution/validate.ts +889 -0
- package/modules/backtest/src/generated/validation-specs.ts +1132 -0
- package/modules/backtest/src/index.ts +157 -0
- package/modules/backtest/src/options/chain.ts +410 -0
- package/modules/backtest/src/options/engine.ts +2240 -0
- package/modules/backtest/src/options/index.ts +68 -0
- package/modules/backtest/src/options/tearsheet.ts +327 -0
- package/modules/backtest/src/options/types.ts +573 -0
- package/modules/backtest/src/paper/index.ts +27 -0
- package/modules/backtest/src/paper/paper.ts +1288 -0
- package/modules/backtest/src/paper/types.ts +221 -0
- package/modules/backtest/src/paper/validate.ts +168 -0
- package/modules/backtest/src/portfolio/adapters.ts +651 -0
- package/modules/backtest/src/portfolio/engine.ts +1518 -0
- package/modules/backtest/src/portfolio/index.ts +64 -0
- package/modules/backtest/src/portfolio/types.ts +456 -0
- package/modules/backtest/src/portfolio/validate.ts +861 -0
- package/modules/backtest/src/run-artifacts.ts +2873 -0
- package/modules/backtest/src/signals.ts +267 -0
- package/modules/backtest/src/tearsheet.ts +425 -0
- package/modules/backtest/src/types.ts +200 -0
- package/modules/backtest/src/validate.ts +43 -0
- package/modules/backtest/src/vectorized.ts +541 -0
- package/modules/backtest/src/walk-forward.ts +215 -0
- package/modules/calendars/dist/cboe.d.ts +15 -0
- package/modules/calendars/dist/cboe.d.ts.map +1 -0
- package/modules/calendars/dist/cboe.js +16 -0
- package/modules/calendars/dist/cboe.js.map +1 -0
- package/modules/calendars/dist/crypto.d.ts +15 -0
- package/modules/calendars/dist/crypto.d.ts.map +1 -0
- package/modules/calendars/dist/crypto.js +16 -0
- package/modules/calendars/dist/crypto.js.map +1 -0
- package/modules/calendars/dist/expirations.d.ts +35 -0
- package/modules/calendars/dist/expirations.d.ts.map +1 -0
- package/modules/calendars/dist/expirations.js +158 -0
- package/modules/calendars/dist/expirations.js.map +1 -0
- package/modules/calendars/dist/index.d.ts +16 -0
- package/modules/calendars/dist/index.d.ts.map +1 -0
- package/modules/calendars/dist/index.js +13 -0
- package/modules/calendars/dist/index.js.map +1 -0
- package/modules/calendars/dist/nyse.d.ts +11 -0
- package/modules/calendars/dist/nyse.d.ts.map +1 -0
- package/modules/calendars/dist/nyse.js +12 -0
- package/modules/calendars/dist/nyse.js.map +1 -0
- package/modules/calendars/dist/trading-calendar.d.ts +32 -0
- package/modules/calendars/dist/trading-calendar.d.ts.map +1 -0
- package/modules/calendars/dist/trading-calendar.js +67 -0
- package/modules/calendars/dist/trading-calendar.js.map +1 -0
- package/modules/calendars/dist/us-market.d.ts +29 -0
- package/modules/calendars/dist/us-market.d.ts.map +1 -0
- package/modules/calendars/dist/us-market.js +72 -0
- package/modules/calendars/dist/us-market.js.map +1 -0
- package/modules/calendars/etc/calendars.api.md +22 -0
- package/modules/calendars/src/cboe.ts +17 -0
- package/modules/calendars/src/crypto.ts +17 -0
- package/modules/calendars/src/expirations.ts +200 -0
- package/modules/calendars/src/index.ts +23 -0
- package/modules/calendars/src/nyse.ts +13 -0
- package/modules/calendars/src/trading-calendar.ts +85 -0
- package/modules/calendars/src/us-market.ts +86 -0
- package/modules/cli/dist/bin.d.ts +9 -0
- package/modules/cli/dist/bin.d.ts.map +1 -0
- package/modules/cli/dist/bin.js +458 -0
- package/modules/cli/dist/bin.js.map +1 -0
- package/modules/cli/dist/commands.d.ts +7 -0
- package/modules/cli/dist/commands.d.ts.map +1 -0
- package/modules/cli/dist/commands.js +17 -0
- package/modules/cli/dist/commands.js.map +1 -0
- package/modules/cli/dist/exit-codes.d.ts +20 -0
- package/modules/cli/dist/exit-codes.d.ts.map +1 -0
- package/modules/cli/dist/exit-codes.js +19 -0
- package/modules/cli/dist/exit-codes.js.map +1 -0
- package/modules/cli/dist/index.d.ts +13 -0
- package/modules/cli/dist/index.d.ts.map +1 -0
- package/modules/cli/dist/index.js +10 -0
- package/modules/cli/dist/index.js.map +1 -0
- package/modules/cli/etc/cli.api.md +25 -0
- package/modules/cli/src/bin.ts +530 -0
- package/modules/cli/src/commands.ts +19 -0
- package/modules/cli/src/exit-codes.ts +21 -0
- package/modules/cli/src/index.ts +29 -0
- package/modules/commodities/dist/forwards.d.ts +274 -0
- package/modules/commodities/dist/forwards.d.ts.map +1 -0
- package/modules/commodities/dist/forwards.js +359 -0
- package/modules/commodities/dist/forwards.js.map +1 -0
- package/modules/commodities/dist/index.d.ts +10 -0
- package/modules/commodities/dist/index.d.ts.map +1 -0
- package/modules/commodities/dist/index.js +10 -0
- package/modules/commodities/dist/index.js.map +1 -0
- package/modules/commodities/dist/internal.d.ts +6 -0
- package/modules/commodities/dist/internal.d.ts.map +1 -0
- package/modules/commodities/dist/internal.js +6 -0
- package/modules/commodities/dist/internal.js.map +1 -0
- package/modules/commodities/dist/term-structure.d.ts +327 -0
- package/modules/commodities/dist/term-structure.d.ts.map +1 -0
- package/modules/commodities/dist/term-structure.js +416 -0
- package/modules/commodities/dist/term-structure.js.map +1 -0
- package/modules/commodities/etc/commodities.api.md +53 -0
- package/modules/commodities/src/forwards.ts +791 -0
- package/modules/commodities/src/index.ts +10 -0
- package/modules/commodities/src/internal.ts +6 -0
- package/modules/commodities/src/term-structure.ts +828 -0
- package/modules/core/dist/artifacts/analysis-artifact.d.ts +140 -0
- package/modules/core/dist/artifacts/analysis-artifact.d.ts.map +1 -0
- package/modules/core/dist/artifacts/analysis-artifact.js +356 -0
- package/modules/core/dist/artifacts/analysis-artifact.js.map +1 -0
- package/modules/core/dist/artifacts/calculation-comparison.d.ts +125 -0
- package/modules/core/dist/artifacts/calculation-comparison.d.ts.map +1 -0
- package/modules/core/dist/artifacts/calculation-comparison.js +444 -0
- package/modules/core/dist/artifacts/calculation-comparison.js.map +1 -0
- package/modules/core/dist/artifacts/canonical-scan.d.ts +58 -0
- package/modules/core/dist/artifacts/canonical-scan.d.ts.map +1 -0
- package/modules/core/dist/artifacts/canonical-scan.js +250 -0
- package/modules/core/dist/artifacts/canonical-scan.js.map +1 -0
- package/modules/core/dist/artifacts/comparison.d.ts +179 -0
- package/modules/core/dist/artifacts/comparison.d.ts.map +1 -0
- package/modules/core/dist/artifacts/comparison.js +383 -0
- package/modules/core/dist/artifacts/comparison.js.map +1 -0
- package/modules/core/dist/artifacts/content-hash.d.ts +38 -0
- package/modules/core/dist/artifacts/content-hash.d.ts.map +1 -0
- package/modules/core/dist/artifacts/content-hash.js +170 -0
- package/modules/core/dist/artifacts/content-hash.js.map +1 -0
- package/modules/core/dist/artifacts/deep-freeze.d.ts +8 -0
- package/modules/core/dist/artifacts/deep-freeze.d.ts.map +1 -0
- package/modules/core/dist/artifacts/deep-freeze.js +16 -0
- package/modules/core/dist/artifacts/deep-freeze.js.map +1 -0
- package/modules/core/dist/artifacts/fitted-model-kit.d.ts +123 -0
- package/modules/core/dist/artifacts/fitted-model-kit.d.ts.map +1 -0
- package/modules/core/dist/artifacts/fitted-model-kit.js +281 -0
- package/modules/core/dist/artifacts/fitted-model-kit.js.map +1 -0
- package/modules/core/dist/artifacts/fitted-model-summary.d.ts +73 -0
- package/modules/core/dist/artifacts/fitted-model-summary.d.ts.map +1 -0
- package/modules/core/dist/artifacts/fitted-model-summary.js +254 -0
- package/modules/core/dist/artifacts/fitted-model-summary.js.map +1 -0
- package/modules/core/dist/artifacts/index.d.ts +52 -0
- package/modules/core/dist/artifacts/index.d.ts.map +1 -0
- package/modules/core/dist/artifacts/index.js +47 -0
- package/modules/core/dist/artifacts/index.js.map +1 -0
- package/modules/core/dist/artifacts/market-snapshot.d.ts +189 -0
- package/modules/core/dist/artifacts/market-snapshot.d.ts.map +1 -0
- package/modules/core/dist/artifacts/market-snapshot.js +517 -0
- package/modules/core/dist/artifacts/market-snapshot.js.map +1 -0
- package/modules/core/dist/artifacts/migration.d.ts +60 -0
- package/modules/core/dist/artifacts/migration.d.ts.map +1 -0
- package/modules/core/dist/artifacts/migration.js +106 -0
- package/modules/core/dist/artifacts/migration.js.map +1 -0
- package/modules/core/dist/artifacts/numeric-comparison.d.ts +12 -0
- package/modules/core/dist/artifacts/numeric-comparison.d.ts.map +1 -0
- package/modules/core/dist/artifacts/numeric-comparison.js +53 -0
- package/modules/core/dist/artifacts/numeric-comparison.js.map +1 -0
- package/modules/core/dist/artifacts/scenario-set.d.ts +97 -0
- package/modules/core/dist/artifacts/scenario-set.d.ts.map +1 -0
- package/modules/core/dist/artifacts/scenario-set.js +249 -0
- package/modules/core/dist/artifacts/scenario-set.js.map +1 -0
- package/modules/core/dist/artifacts/table-handle.d.ts +96 -0
- package/modules/core/dist/artifacts/table-handle.d.ts.map +1 -0
- package/modules/core/dist/artifacts/table-handle.js +253 -0
- package/modules/core/dist/artifacts/table-handle.js.map +1 -0
- package/modules/core/dist/assumptions.d.ts +52 -0
- package/modules/core/dist/assumptions.d.ts.map +1 -0
- package/modules/core/dist/assumptions.js +13 -0
- package/modules/core/dist/assumptions.js.map +1 -0
- package/modules/core/dist/calendar.d.ts +98 -0
- package/modules/core/dist/calendar.d.ts.map +1 -0
- package/modules/core/dist/calendar.js +301 -0
- package/modules/core/dist/calendar.js.map +1 -0
- package/modules/core/dist/canonical-json.d.ts +63 -0
- package/modules/core/dist/canonical-json.d.ts.map +1 -0
- package/modules/core/dist/canonical-json.js +241 -0
- package/modules/core/dist/canonical-json.js.map +1 -0
- package/modules/core/dist/computed.d.ts +31 -0
- package/modules/core/dist/computed.d.ts.map +1 -0
- package/modules/core/dist/computed.js +40 -0
- package/modules/core/dist/computed.js.map +1 -0
- package/modules/core/dist/contracts.d.ts +59 -0
- package/modules/core/dist/contracts.d.ts.map +1 -0
- package/modules/core/dist/contracts.js +9 -0
- package/modules/core/dist/contracts.js.map +1 -0
- package/modules/core/dist/dates.d.ts +31 -0
- package/modules/core/dist/dates.d.ts.map +1 -0
- package/modules/core/dist/dates.js +126 -0
- package/modules/core/dist/dates.js.map +1 -0
- package/modules/core/dist/diagnostics.d.ts +278 -0
- package/modules/core/dist/diagnostics.d.ts.map +1 -0
- package/modules/core/dist/diagnostics.js +287 -0
- package/modules/core/dist/diagnostics.js.map +1 -0
- package/modules/core/dist/errors.d.ts +324 -0
- package/modules/core/dist/errors.d.ts.map +1 -0
- package/modules/core/dist/errors.js +363 -0
- package/modules/core/dist/errors.js.map +1 -0
- package/modules/core/dist/facade.d.ts +97 -0
- package/modules/core/dist/facade.d.ts.map +1 -0
- package/modules/core/dist/facade.js +354 -0
- package/modules/core/dist/facade.js.map +1 -0
- package/modules/core/dist/index.d.ts +45 -0
- package/modules/core/dist/index.d.ts.map +1 -0
- package/modules/core/dist/index.js +23 -0
- package/modules/core/dist/index.js.map +1 -0
- package/modules/core/dist/invariants.d.ts +112 -0
- package/modules/core/dist/invariants.d.ts.map +1 -0
- package/modules/core/dist/invariants.js +240 -0
- package/modules/core/dist/invariants.js.map +1 -0
- package/modules/core/dist/market-data.d.ts +219 -0
- package/modules/core/dist/market-data.d.ts.map +1 -0
- package/modules/core/dist/market-data.js +183 -0
- package/modules/core/dist/market-data.js.map +1 -0
- package/modules/core/dist/numeric.d.ts +46 -0
- package/modules/core/dist/numeric.d.ts.map +1 -0
- package/modules/core/dist/numeric.js +145 -0
- package/modules/core/dist/numeric.js.map +1 -0
- package/modules/core/dist/orders.d.ts +28 -0
- package/modules/core/dist/orders.d.ts.map +1 -0
- package/modules/core/dist/orders.js +49 -0
- package/modules/core/dist/orders.js.map +1 -0
- package/modules/core/dist/pricing.d.ts +418 -0
- package/modules/core/dist/pricing.d.ts.map +1 -0
- package/modules/core/dist/pricing.js +987 -0
- package/modules/core/dist/pricing.js.map +1 -0
- package/modules/core/dist/provenance.d.ts +25 -0
- package/modules/core/dist/provenance.d.ts.map +1 -0
- package/modules/core/dist/provenance.js +75 -0
- package/modules/core/dist/provenance.js.map +1 -0
- package/modules/core/dist/schema/index.d.ts +14 -0
- package/modules/core/dist/schema/index.d.ts.map +1 -0
- package/modules/core/dist/schema/index.js +12 -0
- package/modules/core/dist/schema/index.js.map +1 -0
- package/modules/core/dist/schema/json-schema-guard.d.ts +21 -0
- package/modules/core/dist/schema/json-schema-guard.d.ts.map +1 -0
- package/modules/core/dist/schema/json-schema-guard.js +114 -0
- package/modules/core/dist/schema/json-schema-guard.js.map +1 -0
- package/modules/core/dist/schema/json-schema.d.ts +33 -0
- package/modules/core/dist/schema/json-schema.d.ts.map +1 -0
- package/modules/core/dist/schema/json-schema.js +3 -0
- package/modules/core/dist/schema/json-schema.js.map +1 -0
- package/modules/core/dist/schema/payloads.d.ts +429 -0
- package/modules/core/dist/schema/payloads.d.ts.map +1 -0
- package/modules/core/dist/schema/payloads.js +323 -0
- package/modules/core/dist/schema/payloads.js.map +1 -0
- package/modules/core/dist/schema/schema.d.ts +282 -0
- package/modules/core/dist/schema/schema.d.ts.map +1 -0
- package/modules/core/dist/schema/schema.js +780 -0
- package/modules/core/dist/schema/schema.js.map +1 -0
- package/modules/core/dist/schema/standard.d.ts +32 -0
- package/modules/core/dist/schema/standard.d.ts.map +1 -0
- package/modules/core/dist/schema/standard.js +8 -0
- package/modules/core/dist/schema/standard.js.map +1 -0
- package/modules/core/dist/symbology.d.ts +30 -0
- package/modules/core/dist/symbology.d.ts.map +1 -0
- package/modules/core/dist/symbology.js +126 -0
- package/modules/core/dist/symbology.js.map +1 -0
- package/modules/core/dist/time.d.ts +122 -0
- package/modules/core/dist/time.d.ts.map +1 -0
- package/modules/core/dist/time.js +349 -0
- package/modules/core/dist/time.js.map +1 -0
- package/modules/core/dist/validation-codes.d.ts +24 -0
- package/modules/core/dist/validation-codes.d.ts.map +1 -0
- package/modules/core/dist/validation-codes.js +24 -0
- package/modules/core/dist/validation-codes.js.map +1 -0
- package/modules/core/dist/validation.d.ts +117 -0
- package/modules/core/dist/validation.d.ts.map +1 -0
- package/modules/core/dist/validation.js +415 -0
- package/modules/core/dist/validation.js.map +1 -0
- package/modules/core/etc/core.api.md +157 -0
- package/modules/core/src/artifacts/analysis-artifact.ts +515 -0
- package/modules/core/src/artifacts/calculation-comparison.ts +641 -0
- package/modules/core/src/artifacts/canonical-scan.ts +358 -0
- package/modules/core/src/artifacts/comparison.ts +586 -0
- package/modules/core/src/artifacts/content-hash.ts +183 -0
- package/modules/core/src/artifacts/deep-freeze.ts +15 -0
- package/modules/core/src/artifacts/fitted-model-kit.ts +402 -0
- package/modules/core/src/artifacts/fitted-model-summary.ts +478 -0
- package/modules/core/src/artifacts/index.ts +155 -0
- package/modules/core/src/artifacts/market-snapshot.ts +787 -0
- package/modules/core/src/artifacts/migration.ts +195 -0
- package/modules/core/src/artifacts/numeric-comparison.ts +71 -0
- package/modules/core/src/artifacts/scenario-set.ts +383 -0
- package/modules/core/src/artifacts/table-handle.ts +329 -0
- package/modules/core/src/assumptions.ts +62 -0
- package/modules/core/src/calendar.ts +407 -0
- package/modules/core/src/canonical-json.ts +289 -0
- package/modules/core/src/computed.ts +55 -0
- package/modules/core/src/contracts.ts +63 -0
- package/modules/core/src/dates.ts +163 -0
- package/modules/core/src/diagnostics.ts +397 -0
- package/modules/core/src/errors.ts +404 -0
- package/modules/core/src/facade.ts +436 -0
- package/modules/core/src/index.ts +185 -0
- package/modules/core/src/invariants.ts +339 -0
- package/modules/core/src/market-data.ts +481 -0
- package/modules/core/src/numeric.ts +205 -0
- package/modules/core/src/orders.ts +71 -0
- package/modules/core/src/pricing.ts +1647 -0
- package/modules/core/src/provenance.ts +121 -0
- package/modules/core/src/schema/index.ts +61 -0
- package/modules/core/src/schema/json-schema-guard.ts +172 -0
- package/modules/core/src/schema/json-schema.ts +52 -0
- package/modules/core/src/schema/payloads.ts +364 -0
- package/modules/core/src/schema/schema.ts +986 -0
- package/modules/core/src/schema/standard.ts +40 -0
- package/modules/core/src/symbology.ts +170 -0
- package/modules/core/src/time.ts +458 -0
- package/modules/core/src/validation-codes.ts +23 -0
- package/modules/core/src/validation.ts +607 -0
- package/modules/crypto/dist/carry.d.ts +176 -0
- package/modules/crypto/dist/carry.d.ts.map +1 -0
- package/modules/crypto/dist/carry.js +349 -0
- package/modules/crypto/dist/carry.js.map +1 -0
- package/modules/crypto/dist/curve.d.ts +69 -0
- package/modules/crypto/dist/curve.d.ts.map +1 -0
- package/modules/crypto/dist/curve.js +180 -0
- package/modules/crypto/dist/curve.js.map +1 -0
- package/modules/crypto/dist/index.d.ts +20 -0
- package/modules/crypto/dist/index.d.ts.map +1 -0
- package/modules/crypto/dist/index.js +16 -0
- package/modules/crypto/dist/index.js.map +1 -0
- package/modules/crypto/dist/inverse.d.ts +61 -0
- package/modules/crypto/dist/inverse.d.ts.map +1 -0
- package/modules/crypto/dist/inverse.js +89 -0
- package/modules/crypto/dist/inverse.js.map +1 -0
- package/modules/crypto/dist/liquidation.d.ts +67 -0
- package/modules/crypto/dist/liquidation.d.ts.map +1 -0
- package/modules/crypto/dist/liquidation.js +103 -0
- package/modules/crypto/dist/liquidation.js.map +1 -0
- package/modules/crypto/etc/crypto.api.md +45 -0
- package/modules/crypto/src/carry.ts +656 -0
- package/modules/crypto/src/curve.ts +273 -0
- package/modules/crypto/src/index.ts +62 -0
- package/modules/crypto/src/inverse.ts +172 -0
- package/modules/crypto/src/liquidation.ts +174 -0
- package/modules/fixed-income/dist/artifacts.d.ts +24 -0
- package/modules/fixed-income/dist/artifacts.d.ts.map +1 -0
- package/modules/fixed-income/dist/artifacts.js +21 -0
- package/modules/fixed-income/dist/artifacts.js.map +1 -0
- package/modules/fixed-income/dist/bonds.d.ts +298 -0
- package/modules/fixed-income/dist/bonds.d.ts.map +1 -0
- package/modules/fixed-income/dist/bonds.js +951 -0
- package/modules/fixed-income/dist/bonds.js.map +1 -0
- package/modules/fixed-income/dist/conventions.d.ts +77 -0
- package/modules/fixed-income/dist/conventions.d.ts.map +1 -0
- package/modules/fixed-income/dist/conventions.js +266 -0
- package/modules/fixed-income/dist/conventions.js.map +1 -0
- package/modules/fixed-income/dist/convertible.d.ts +76 -0
- package/modules/fixed-income/dist/convertible.d.ts.map +1 -0
- package/modules/fixed-income/dist/convertible.js +182 -0
- package/modules/fixed-income/dist/convertible.js.map +1 -0
- package/modules/fixed-income/dist/credit.d.ts +227 -0
- package/modules/fixed-income/dist/credit.d.ts.map +1 -0
- package/modules/fixed-income/dist/credit.js +653 -0
- package/modules/fixed-income/dist/credit.js.map +1 -0
- package/modules/fixed-income/dist/cross-currency.d.ts +82 -0
- package/modules/fixed-income/dist/cross-currency.d.ts.map +1 -0
- package/modules/fixed-income/dist/cross-currency.js +93 -0
- package/modules/fixed-income/dist/cross-currency.js.map +1 -0
- package/modules/fixed-income/dist/curve-data.d.ts +70 -0
- package/modules/fixed-income/dist/curve-data.d.ts.map +1 -0
- package/modules/fixed-income/dist/curve-data.js +254 -0
- package/modules/fixed-income/dist/curve-data.js.map +1 -0
- package/modules/fixed-income/dist/curve-mappers.d.ts +57 -0
- package/modules/fixed-income/dist/curve-mappers.d.ts.map +1 -0
- package/modules/fixed-income/dist/curve-mappers.js +131 -0
- package/modules/fixed-income/dist/curve-mappers.js.map +1 -0
- package/modules/fixed-income/dist/curve-state.d.ts +47 -0
- package/modules/fixed-income/dist/curve-state.d.ts.map +1 -0
- package/modules/fixed-income/dist/curve-state.js +33 -0
- package/modules/fixed-income/dist/curve-state.js.map +1 -0
- package/modules/fixed-income/dist/curves.d.ts +198 -0
- package/modules/fixed-income/dist/curves.d.ts.map +1 -0
- package/modules/fixed-income/dist/curves.js +803 -0
- package/modules/fixed-income/dist/curves.js.map +1 -0
- package/modules/fixed-income/dist/fitted-model-artifacts.d.ts +277 -0
- package/modules/fixed-income/dist/fitted-model-artifacts.d.ts.map +1 -0
- package/modules/fixed-income/dist/fitted-model-artifacts.js +839 -0
- package/modules/fixed-income/dist/fitted-model-artifacts.js.map +1 -0
- package/modules/fixed-income/dist/fitted-model-families.d.ts +170 -0
- package/modules/fixed-income/dist/fitted-model-families.d.ts.map +1 -0
- package/modules/fixed-income/dist/fitted-model-families.js +461 -0
- package/modules/fixed-income/dist/fitted-model-families.js.map +1 -0
- package/modules/fixed-income/dist/futures.d.ts +264 -0
- package/modules/fixed-income/dist/futures.d.ts.map +1 -0
- package/modules/fixed-income/dist/futures.js +630 -0
- package/modules/fixed-income/dist/futures.js.map +1 -0
- package/modules/fixed-income/dist/generated/validation-specs.d.ts +12 -0
- package/modules/fixed-income/dist/generated/validation-specs.d.ts.map +1 -0
- package/modules/fixed-income/dist/generated/validation-specs.js +556 -0
- package/modules/fixed-income/dist/generated/validation-specs.js.map +1 -0
- package/modules/fixed-income/dist/index.d.ts +36 -0
- package/modules/fixed-income/dist/index.d.ts.map +1 -0
- package/modules/fixed-income/dist/index.js +37 -0
- package/modules/fixed-income/dist/index.js.map +1 -0
- package/modules/fixed-income/dist/inflation.d.ts +174 -0
- package/modules/fixed-income/dist/inflation.d.ts.map +1 -0
- package/modules/fixed-income/dist/inflation.js +335 -0
- package/modules/fixed-income/dist/inflation.js.map +1 -0
- package/modules/fixed-income/dist/lattice.d.ts +156 -0
- package/modules/fixed-income/dist/lattice.d.ts.map +1 -0
- package/modules/fixed-income/dist/lattice.js +433 -0
- package/modules/fixed-income/dist/lattice.js.map +1 -0
- package/modules/fixed-income/dist/models.d.ts +187 -0
- package/modules/fixed-income/dist/models.d.ts.map +1 -0
- package/modules/fixed-income/dist/models.js +580 -0
- package/modules/fixed-income/dist/models.js.map +1 -0
- package/modules/fixed-income/dist/pricer.d.ts +48 -0
- package/modules/fixed-income/dist/pricer.d.ts.map +1 -0
- package/modules/fixed-income/dist/pricer.js +445 -0
- package/modules/fixed-income/dist/pricer.js.map +1 -0
- package/modules/fixed-income/dist/rates.d.ts +305 -0
- package/modules/fixed-income/dist/rates.d.ts.map +1 -0
- package/modules/fixed-income/dist/rates.js +686 -0
- package/modules/fixed-income/dist/rates.js.map +1 -0
- package/modules/fixed-income/dist/validate.d.ts +28 -0
- package/modules/fixed-income/dist/validate.d.ts.map +1 -0
- package/modules/fixed-income/dist/validate.js +123 -0
- package/modules/fixed-income/dist/validate.js.map +1 -0
- package/modules/fixed-income/dist/xva.d.ts +88 -0
- package/modules/fixed-income/dist/xva.d.ts.map +1 -0
- package/modules/fixed-income/dist/xva.js +316 -0
- package/modules/fixed-income/dist/xva.js.map +1 -0
- package/modules/fixed-income/etc/fixed-income.api.md +195 -0
- package/modules/fixed-income/src/artifacts.ts +60 -0
- package/modules/fixed-income/src/bonds.ts +1514 -0
- package/modules/fixed-income/src/conventions.ts +387 -0
- package/modules/fixed-income/src/convertible.ts +286 -0
- package/modules/fixed-income/src/credit.ts +1065 -0
- package/modules/fixed-income/src/cross-currency.ts +176 -0
- package/modules/fixed-income/src/curve-data.ts +381 -0
- package/modules/fixed-income/src/curve-mappers.ts +170 -0
- package/modules/fixed-income/src/curve-state.ts +70 -0
- package/modules/fixed-income/src/curves.ts +1169 -0
- package/modules/fixed-income/src/fitted-model-artifacts.ts +1414 -0
- package/modules/fixed-income/src/fitted-model-families.ts +834 -0
- package/modules/fixed-income/src/futures.ts +1018 -0
- package/modules/fixed-income/src/generated/validation-specs.ts +559 -0
- package/modules/fixed-income/src/index.ts +241 -0
- package/modules/fixed-income/src/inflation.ts +554 -0
- package/modules/fixed-income/src/lattice.ts +675 -0
- package/modules/fixed-income/src/models.ts +897 -0
- package/modules/fixed-income/src/pricer.ts +624 -0
- package/modules/fixed-income/src/rates.ts +1086 -0
- package/modules/fixed-income/src/validate.ts +169 -0
- package/modules/fixed-income/src/xva.ts +466 -0
- package/modules/foreign-exchange/dist/exposure.d.ts +140 -0
- package/modules/foreign-exchange/dist/exposure.d.ts.map +1 -0
- package/modules/foreign-exchange/dist/exposure.js +253 -0
- package/modules/foreign-exchange/dist/exposure.js.map +1 -0
- package/modules/foreign-exchange/dist/forwards.d.ts +159 -0
- package/modules/foreign-exchange/dist/forwards.d.ts.map +1 -0
- package/modules/foreign-exchange/dist/forwards.js +310 -0
- package/modules/foreign-exchange/dist/forwards.js.map +1 -0
- package/modules/foreign-exchange/dist/index.d.ts +11 -0
- package/modules/foreign-exchange/dist/index.d.ts.map +1 -0
- package/modules/foreign-exchange/dist/index.js +11 -0
- package/modules/foreign-exchange/dist/index.js.map +1 -0
- package/modules/foreign-exchange/dist/internal.d.ts +6 -0
- package/modules/foreign-exchange/dist/internal.d.ts.map +1 -0
- package/modules/foreign-exchange/dist/internal.js +6 -0
- package/modules/foreign-exchange/dist/internal.js.map +1 -0
- package/modules/foreign-exchange/dist/spot.d.ts +150 -0
- package/modules/foreign-exchange/dist/spot.d.ts.map +1 -0
- package/modules/foreign-exchange/dist/spot.js +289 -0
- package/modules/foreign-exchange/dist/spot.js.map +1 -0
- package/modules/foreign-exchange/etc/foreign-exchange.api.md +52 -0
- package/modules/foreign-exchange/src/exposure.ts +485 -0
- package/modules/foreign-exchange/src/forwards.ts +595 -0
- package/modules/foreign-exchange/src/index.ts +11 -0
- package/modules/foreign-exchange/src/internal.ts +6 -0
- package/modules/foreign-exchange/src/spot.ts +530 -0
- package/modules/fundamentals/dist/analyze.d.ts +90 -0
- package/modules/fundamentals/dist/analyze.d.ts.map +1 -0
- package/modules/fundamentals/dist/analyze.js +293 -0
- package/modules/fundamentals/dist/analyze.js.map +1 -0
- package/modules/fundamentals/dist/index.d.ts +17 -0
- package/modules/fundamentals/dist/index.d.ts.map +1 -0
- package/modules/fundamentals/dist/index.js +15 -0
- package/modules/fundamentals/dist/index.js.map +1 -0
- package/modules/fundamentals/dist/periods.d.ts +47 -0
- package/modules/fundamentals/dist/periods.d.ts.map +1 -0
- package/modules/fundamentals/dist/periods.js +106 -0
- package/modules/fundamentals/dist/periods.js.map +1 -0
- package/modules/fundamentals/dist/ratio-heads.d.ts +47 -0
- package/modules/fundamentals/dist/ratio-heads.d.ts.map +1 -0
- package/modules/fundamentals/dist/ratio-heads.js +766 -0
- package/modules/fundamentals/dist/ratio-heads.js.map +1 -0
- package/modules/fundamentals/dist/ratio-internals.d.ts +187 -0
- package/modules/fundamentals/dist/ratio-internals.d.ts.map +1 -0
- package/modules/fundamentals/dist/ratio-internals.js +299 -0
- package/modules/fundamentals/dist/ratio-internals.js.map +1 -0
- package/modules/fundamentals/dist/ratios.d.ts +9 -0
- package/modules/fundamentals/dist/ratios.d.ts.map +1 -0
- package/modules/fundamentals/dist/ratios.js +8 -0
- package/modules/fundamentals/dist/ratios.js.map +1 -0
- package/modules/fundamentals/dist/score-heads.d.ts +130 -0
- package/modules/fundamentals/dist/score-heads.d.ts.map +1 -0
- package/modules/fundamentals/dist/score-heads.js +364 -0
- package/modules/fundamentals/dist/score-heads.js.map +1 -0
- package/modules/fundamentals/dist/scores.d.ts +6 -0
- package/modules/fundamentals/dist/scores.d.ts.map +1 -0
- package/modules/fundamentals/dist/scores.js +6 -0
- package/modules/fundamentals/dist/scores.js.map +1 -0
- package/modules/fundamentals/dist/statement-contracts.d.ts +170 -0
- package/modules/fundamentals/dist/statement-contracts.d.ts.map +1 -0
- package/modules/fundamentals/dist/statement-contracts.js +207 -0
- package/modules/fundamentals/dist/statement-contracts.js.map +1 -0
- package/modules/fundamentals/dist/statement-utilities.d.ts +190 -0
- package/modules/fundamentals/dist/statement-utilities.d.ts.map +1 -0
- package/modules/fundamentals/dist/statement-utilities.js +501 -0
- package/modules/fundamentals/dist/statement-utilities.js.map +1 -0
- package/modules/fundamentals/dist/statements.d.ts +8 -0
- package/modules/fundamentals/dist/statements.d.ts.map +1 -0
- package/modules/fundamentals/dist/statements.js +7 -0
- package/modules/fundamentals/dist/statements.js.map +1 -0
- package/modules/fundamentals/etc/fundamentals.api.md +110 -0
- package/modules/fundamentals/src/analyze.ts +401 -0
- package/modules/fundamentals/src/index.ts +24 -0
- package/modules/fundamentals/src/periods.ts +197 -0
- package/modules/fundamentals/src/ratio-heads.ts +945 -0
- package/modules/fundamentals/src/ratio-internals.ts +562 -0
- package/modules/fundamentals/src/ratios.ts +23 -0
- package/modules/fundamentals/src/score-heads.ts +651 -0
- package/modules/fundamentals/src/scores.ts +6 -0
- package/modules/fundamentals/src/statement-contracts.ts +393 -0
- package/modules/fundamentals/src/statement-utilities.ts +833 -0
- package/modules/fundamentals/src/statements.ts +22 -0
- package/modules/http/dist/bin.d.ts +7 -0
- package/modules/http/dist/bin.d.ts.map +1 -0
- package/modules/http/dist/bin.js +167 -0
- package/modules/http/dist/bin.js.map +1 -0
- package/modules/http/dist/index.d.ts +10 -0
- package/modules/http/dist/index.d.ts.map +1 -0
- package/modules/http/dist/index.js +8 -0
- package/modules/http/dist/index.js.map +1 -0
- package/modules/http/dist/openapi.d.ts +38 -0
- package/modules/http/dist/openapi.d.ts.map +1 -0
- package/modules/http/dist/openapi.js +431 -0
- package/modules/http/dist/openapi.js.map +1 -0
- package/modules/http/dist/security.d.ts +21 -0
- package/modules/http/dist/security.d.ts.map +1 -0
- package/modules/http/dist/security.js +116 -0
- package/modules/http/dist/security.js.map +1 -0
- package/modules/http/dist/server.d.ts +63 -0
- package/modules/http/dist/server.d.ts.map +1 -0
- package/modules/http/dist/server.js +544 -0
- package/modules/http/dist/server.js.map +1 -0
- package/modules/http/etc/http.api.md +15 -0
- package/modules/http/etc/openapi.json +51958 -0
- package/modules/http/src/bin.ts +190 -0
- package/modules/http/src/index.ts +10 -0
- package/modules/http/src/openapi.ts +488 -0
- package/modules/http/src/security.ts +158 -0
- package/modules/http/src/server.ts +941 -0
- package/modules/math/dist/bivariate.d.ts +17 -0
- package/modules/math/dist/bivariate.d.ts.map +1 -0
- package/modules/math/dist/bivariate.js +123 -0
- package/modules/math/dist/bivariate.js.map +1 -0
- package/modules/math/dist/distributions.d.ts +66 -0
- package/modules/math/dist/distributions.d.ts.map +1 -0
- package/modules/math/dist/distributions.js +465 -0
- package/modules/math/dist/distributions.js.map +1 -0
- package/modules/math/dist/filters.d.ts +96 -0
- package/modules/math/dist/filters.d.ts.map +1 -0
- package/modules/math/dist/filters.js +347 -0
- package/modules/math/dist/filters.js.map +1 -0
- package/modules/math/dist/index.d.ts +34 -0
- package/modules/math/dist/index.d.ts.map +1 -0
- package/modules/math/dist/index.js +23 -0
- package/modules/math/dist/index.js.map +1 -0
- package/modules/math/dist/integration.d.ts +58 -0
- package/modules/math/dist/integration.d.ts.map +1 -0
- package/modules/math/dist/integration.js +176 -0
- package/modules/math/dist/integration.js.map +1 -0
- package/modules/math/dist/interpolation.d.ts +57 -0
- package/modules/math/dist/interpolation.d.ts.map +1 -0
- package/modules/math/dist/interpolation.js +464 -0
- package/modules/math/dist/interpolation.js.map +1 -0
- package/modules/math/dist/linalg.d.ts +251 -0
- package/modules/math/dist/linalg.d.ts.map +1 -0
- package/modules/math/dist/linalg.js +1503 -0
- package/modules/math/dist/linalg.js.map +1 -0
- package/modules/math/dist/lowdiscrepancy.d.ts +21 -0
- package/modules/math/dist/lowdiscrepancy.d.ts.map +1 -0
- package/modules/math/dist/lowdiscrepancy.js +200 -0
- package/modules/math/dist/lowdiscrepancy.js.map +1 -0
- package/modules/math/dist/montecarlo.d.ts +58 -0
- package/modules/math/dist/montecarlo.d.ts.map +1 -0
- package/modules/math/dist/montecarlo.js +248 -0
- package/modules/math/dist/montecarlo.js.map +1 -0
- package/modules/math/dist/normal.d.ts +40 -0
- package/modules/math/dist/normal.d.ts.map +1 -0
- package/modules/math/dist/normal.js +157 -0
- package/modules/math/dist/normal.js.map +1 -0
- package/modules/math/dist/optimize.d.ts +83 -0
- package/modules/math/dist/optimize.d.ts.map +1 -0
- package/modules/math/dist/optimize.js +784 -0
- package/modules/math/dist/optimize.js.map +1 -0
- package/modules/math/dist/random.d.ts +76 -0
- package/modules/math/dist/random.d.ts.map +1 -0
- package/modules/math/dist/random.js +261 -0
- package/modules/math/dist/random.js.map +1 -0
- package/modules/math/dist/regression.d.ts +58 -0
- package/modules/math/dist/regression.d.ts.map +1 -0
- package/modules/math/dist/regression.js +283 -0
- package/modules/math/dist/regression.js.map +1 -0
- package/modules/math/dist/resource-validation.d.ts +18 -0
- package/modules/math/dist/resource-validation.d.ts.map +1 -0
- package/modules/math/dist/resource-validation.js +60 -0
- package/modules/math/dist/resource-validation.js.map +1 -0
- package/modules/math/dist/sobol-data.d.ts +36 -0
- package/modules/math/dist/sobol-data.d.ts.map +1 -0
- package/modules/math/dist/sobol-data.js +172 -0
- package/modules/math/dist/sobol-data.js.map +1 -0
- package/modules/math/dist/solvers.d.ts +90 -0
- package/modules/math/dist/solvers.d.ts.map +1 -0
- package/modules/math/dist/solvers.js +663 -0
- package/modules/math/dist/solvers.js.map +1 -0
- package/modules/math/dist/statistics-internal.d.ts +73 -0
- package/modules/math/dist/statistics-internal.d.ts.map +1 -0
- package/modules/math/dist/statistics-internal.js +217 -0
- package/modules/math/dist/statistics-internal.js.map +1 -0
- package/modules/math/dist/statistics.d.ts +113 -0
- package/modules/math/dist/statistics.d.ts.map +1 -0
- package/modules/math/dist/statistics.js +545 -0
- package/modules/math/dist/statistics.js.map +1 -0
- package/modules/math/dist/timeseries.d.ts +131 -0
- package/modules/math/dist/timeseries.d.ts.map +1 -0
- package/modules/math/dist/timeseries.js +502 -0
- package/modules/math/dist/timeseries.js.map +1 -0
- package/modules/math/etc/math.api.md +178 -0
- package/modules/math/src/bivariate.ts +124 -0
- package/modules/math/src/distributions.ts +481 -0
- package/modules/math/src/filters.ts +452 -0
- package/modules/math/src/index.ts +223 -0
- package/modules/math/src/integration.ts +259 -0
- package/modules/math/src/interpolation.ts +588 -0
- package/modules/math/src/linalg.ts +1892 -0
- package/modules/math/src/lowdiscrepancy.ts +241 -0
- package/modules/math/src/montecarlo.ts +326 -0
- package/modules/math/src/normal.ts +161 -0
- package/modules/math/src/optimize.ts +943 -0
- package/modules/math/src/random.ts +372 -0
- package/modules/math/src/regression.ts +340 -0
- package/modules/math/src/resource-validation.ts +79 -0
- package/modules/math/src/sobol-data.ts +187 -0
- package/modules/math/src/solvers.ts +859 -0
- package/modules/math/src/statistics-internal.ts +256 -0
- package/modules/math/src/statistics.ts +636 -0
- package/modules/math/src/timeseries.ts +611 -0
- package/modules/options/dist/american-iv.d.ts +116 -0
- package/modules/options/dist/american-iv.d.ts.map +1 -0
- package/modules/options/dist/american-iv.js +385 -0
- package/modules/options/dist/american-iv.js.map +1 -0
- package/modules/options/dist/arbitrage.d.ts +42 -0
- package/modules/options/dist/arbitrage.d.ts.map +1 -0
- package/modules/options/dist/arbitrage.js +79 -0
- package/modules/options/dist/arbitrage.js.map +1 -0
- package/modules/options/dist/bachelier.d.ts +68 -0
- package/modules/options/dist/bachelier.d.ts.map +1 -0
- package/modules/options/dist/bachelier.js +348 -0
- package/modules/options/dist/bachelier.js.map +1 -0
- package/modules/options/dist/batch.d.ts +82 -0
- package/modules/options/dist/batch.d.ts.map +1 -0
- package/modules/options/dist/batch.js +346 -0
- package/modules/options/dist/batch.js.map +1 -0
- package/modules/options/dist/black-scholes.d.ts +42 -0
- package/modules/options/dist/black-scholes.d.ts.map +1 -0
- package/modules/options/dist/black-scholes.js +334 -0
- package/modules/options/dist/black-scholes.js.map +1 -0
- package/modules/options/dist/black76.d.ts +77 -0
- package/modules/options/dist/black76.d.ts.map +1 -0
- package/modules/options/dist/black76.js +400 -0
- package/modules/options/dist/black76.js.map +1 -0
- package/modules/options/dist/bsm.d.ts +120 -0
- package/modules/options/dist/bsm.d.ts.map +1 -0
- package/modules/options/dist/bsm.js +414 -0
- package/modules/options/dist/bsm.js.map +1 -0
- package/modules/options/dist/chain-greeks.d.ts +69 -0
- package/modules/options/dist/chain-greeks.d.ts.map +1 -0
- package/modules/options/dist/chain-greeks.js +154 -0
- package/modules/options/dist/chain-greeks.js.map +1 -0
- package/modules/options/dist/chain-health.d.ts +254 -0
- package/modules/options/dist/chain-health.d.ts.map +1 -0
- package/modules/options/dist/chain-health.js +746 -0
- package/modules/options/dist/chain-health.js.map +1 -0
- package/modules/options/dist/contract.d.ts +73 -0
- package/modules/options/dist/contract.d.ts.map +1 -0
- package/modules/options/dist/contract.js +226 -0
- package/modules/options/dist/contract.js.map +1 -0
- package/modules/options/dist/dividend-term-structure.d.ts +76 -0
- package/modules/options/dist/dividend-term-structure.d.ts.map +1 -0
- package/modules/options/dist/dividend-term-structure.js +180 -0
- package/modules/options/dist/dividend-term-structure.js.map +1 -0
- package/modules/options/dist/dividends.d.ts +34 -0
- package/modules/options/dist/dividends.d.ts.map +1 -0
- package/modules/options/dist/dividends.js +51 -0
- package/modules/options/dist/dividends.js.map +1 -0
- package/modules/options/dist/engine-bsm.d.ts +22 -0
- package/modules/options/dist/engine-bsm.d.ts.map +1 -0
- package/modules/options/dist/engine-bsm.js +236 -0
- package/modules/options/dist/engine-bsm.js.map +1 -0
- package/modules/options/dist/engines/american-approx.d.ts +29 -0
- package/modules/options/dist/engines/american-approx.d.ts.map +1 -0
- package/modules/options/dist/engines/american-approx.js +483 -0
- package/modules/options/dist/engines/american-approx.js.map +1 -0
- package/modules/options/dist/engines/bounds.d.ts +49 -0
- package/modules/options/dist/engines/bounds.d.ts.map +1 -0
- package/modules/options/dist/engines/bounds.js +58 -0
- package/modules/options/dist/engines/bounds.js.map +1 -0
- package/modules/options/dist/engines/engine-factory.d.ts +92 -0
- package/modules/options/dist/engines/engine-factory.d.ts.map +1 -0
- package/modules/options/dist/engines/engine-factory.js +372 -0
- package/modules/options/dist/engines/engine-factory.js.map +1 -0
- package/modules/options/dist/engines/fd-greeks.d.ts +84 -0
- package/modules/options/dist/engines/fd-greeks.d.ts.map +1 -0
- package/modules/options/dist/engines/fd-greeks.js +343 -0
- package/modules/options/dist/engines/fd-greeks.js.map +1 -0
- package/modules/options/dist/engines/fdm.d.ts +78 -0
- package/modules/options/dist/engines/fdm.d.ts.map +1 -0
- package/modules/options/dist/engines/fdm.js +218 -0
- package/modules/options/dist/engines/fdm.js.map +1 -0
- package/modules/options/dist/engines/scalar-pricing.d.ts +24 -0
- package/modules/options/dist/engines/scalar-pricing.d.ts.map +1 -0
- package/modules/options/dist/engines/scalar-pricing.js +2 -0
- package/modules/options/dist/engines/scalar-pricing.js.map +1 -0
- package/modules/options/dist/engines/tree.d.ts +78 -0
- package/modules/options/dist/engines/tree.d.ts.map +1 -0
- package/modules/options/dist/engines/tree.js +247 -0
- package/modules/options/dist/engines/tree.js.map +1 -0
- package/modules/options/dist/engines.d.ts +272 -0
- package/modules/options/dist/engines.d.ts.map +1 -0
- package/modules/options/dist/engines.js +1309 -0
- package/modules/options/dist/engines.js.map +1 -0
- package/modules/options/dist/equity-lattice.d.ts +58 -0
- package/modules/options/dist/equity-lattice.d.ts.map +1 -0
- package/modules/options/dist/equity-lattice.js +139 -0
- package/modules/options/dist/equity-lattice.js.map +1 -0
- package/modules/options/dist/exercise.d.ts +80 -0
- package/modules/options/dist/exercise.d.ts.map +1 -0
- package/modules/options/dist/exercise.js +266 -0
- package/modules/options/dist/exercise.js.map +1 -0
- package/modules/options/dist/exotics.d.ts +640 -0
- package/modules/options/dist/exotics.d.ts.map +1 -0
- package/modules/options/dist/exotics.js +2880 -0
- package/modules/options/dist/exotics.js.map +1 -0
- package/modules/options/dist/facade-util.d.ts +51 -0
- package/modules/options/dist/facade-util.d.ts.map +1 -0
- package/modules/options/dist/facade-util.js +93 -0
- package/modules/options/dist/facade-util.js.map +1 -0
- package/modules/options/dist/generated/validation-specs.d.ts +12 -0
- package/modules/options/dist/generated/validation-specs.d.ts.map +1 -0
- package/modules/options/dist/generated/validation-specs.js +2616 -0
- package/modules/options/dist/generated/validation-specs.js.map +1 -0
- package/modules/options/dist/heston.d.ts +160 -0
- package/modules/options/dist/heston.d.ts.map +1 -0
- package/modules/options/dist/heston.js +983 -0
- package/modules/options/dist/heston.js.map +1 -0
- package/modules/options/dist/index.d.ts +65 -0
- package/modules/options/dist/index.d.ts.map +1 -0
- package/modules/options/dist/index.js +58 -0
- package/modules/options/dist/index.js.map +1 -0
- package/modules/options/dist/iv.d.ts +85 -0
- package/modules/options/dist/iv.d.ts.map +1 -0
- package/modules/options/dist/iv.js +424 -0
- package/modules/options/dist/iv.js.map +1 -0
- package/modules/options/dist/lattice.d.ts +7 -0
- package/modules/options/dist/lattice.d.ts.map +1 -0
- package/modules/options/dist/lattice.js +7 -0
- package/modules/options/dist/lattice.js.map +1 -0
- package/modules/options/dist/local-volatility.d.ts +128 -0
- package/modules/options/dist/local-volatility.d.ts.map +1 -0
- package/modules/options/dist/local-volatility.js +333 -0
- package/modules/options/dist/local-volatility.js.map +1 -0
- package/modules/options/dist/market.d.ts +19 -0
- package/modules/options/dist/market.d.ts.map +1 -0
- package/modules/options/dist/market.js +58 -0
- package/modules/options/dist/market.js.map +1 -0
- package/modules/options/dist/mc/complex.d.ts +23 -0
- package/modules/options/dist/mc/complex.d.ts.map +1 -0
- package/modules/options/dist/mc/complex.js +42 -0
- package/modules/options/dist/mc/complex.js.map +1 -0
- package/modules/options/dist/mc/core.d.ts +151 -0
- package/modules/options/dist/mc/core.d.ts.map +1 -0
- package/modules/options/dist/mc/core.js +319 -0
- package/modules/options/dist/mc/core.js.map +1 -0
- package/modules/options/dist/monte-carlo.d.ts +66 -0
- package/modules/options/dist/monte-carlo.d.ts.map +1 -0
- package/modules/options/dist/monte-carlo.js +388 -0
- package/modules/options/dist/monte-carlo.js.map +1 -0
- package/modules/options/dist/parity.d.ts +191 -0
- package/modules/options/dist/parity.d.ts.map +1 -0
- package/modules/options/dist/parity.js +566 -0
- package/modules/options/dist/parity.js.map +1 -0
- package/modules/options/dist/payoff-kernel.d.ts +33 -0
- package/modules/options/dist/payoff-kernel.d.ts.map +1 -0
- package/modules/options/dist/payoff-kernel.js +27 -0
- package/modules/options/dist/payoff-kernel.js.map +1 -0
- package/modules/options/dist/payoff.d.ts +34 -0
- package/modules/options/dist/payoff.d.ts.map +1 -0
- package/modules/options/dist/payoff.js +60 -0
- package/modules/options/dist/payoff.js.map +1 -0
- package/modules/options/dist/pricer.d.ts +44 -0
- package/modules/options/dist/pricer.d.ts.map +1 -0
- package/modules/options/dist/pricer.js +179 -0
- package/modules/options/dist/pricer.js.map +1 -0
- package/modules/options/dist/pro.d.ts +82 -0
- package/modules/options/dist/pro.d.ts.map +1 -0
- package/modules/options/dist/pro.js +177 -0
- package/modules/options/dist/pro.js.map +1 -0
- package/modules/options/dist/quote.d.ts +18 -0
- package/modules/options/dist/quote.d.ts.map +1 -0
- package/modules/options/dist/quote.js +26 -0
- package/modules/options/dist/quote.js.map +1 -0
- package/modules/options/dist/resource-validation-internal.d.ts +8 -0
- package/modules/options/dist/resource-validation-internal.d.ts.map +1 -0
- package/modules/options/dist/resource-validation-internal.js +23 -0
- package/modules/options/dist/resource-validation-internal.js.map +1 -0
- package/modules/options/dist/sabr.d.ts +153 -0
- package/modules/options/dist/sabr.d.ts.map +1 -0
- package/modules/options/dist/sabr.js +515 -0
- package/modules/options/dist/sabr.js.map +1 -0
- package/modules/options/dist/schema.d.ts +120 -0
- package/modules/options/dist/schema.d.ts.map +1 -0
- package/modules/options/dist/schema.js +62 -0
- package/modules/options/dist/schema.js.map +1 -0
- package/modules/options/dist/time.d.ts +44 -0
- package/modules/options/dist/time.d.ts.map +1 -0
- package/modules/options/dist/time.js +76 -0
- package/modules/options/dist/time.js.map +1 -0
- package/modules/options/dist/types.d.ts +115 -0
- package/modules/options/dist/types.d.ts.map +1 -0
- package/modules/options/dist/types.js +3 -0
- package/modules/options/dist/types.js.map +1 -0
- package/modules/options/etc/options.api.md +230 -0
- package/modules/options/src/american-iv.ts +547 -0
- package/modules/options/src/arbitrage.ts +134 -0
- package/modules/options/src/bachelier.ts +515 -0
- package/modules/options/src/batch.ts +496 -0
- package/modules/options/src/black-scholes.ts +501 -0
- package/modules/options/src/black76.ts +573 -0
- package/modules/options/src/bsm.ts +575 -0
- package/modules/options/src/chain-greeks.ts +242 -0
- package/modules/options/src/chain-health.ts +1083 -0
- package/modules/options/src/contract.ts +329 -0
- package/modules/options/src/dividend-term-structure.ts +303 -0
- package/modules/options/src/dividends.ts +75 -0
- package/modules/options/src/engine-bsm.ts +306 -0
- package/modules/options/src/engines/american-approx.ts +669 -0
- package/modules/options/src/engines/bounds.ts +106 -0
- package/modules/options/src/engines/engine-factory.ts +502 -0
- package/modules/options/src/engines/fd-greeks.ts +426 -0
- package/modules/options/src/engines/fdm.ts +302 -0
- package/modules/options/src/engines/scalar-pricing.ts +27 -0
- package/modules/options/src/engines/tree.ts +350 -0
- package/modules/options/src/engines.ts +1845 -0
- package/modules/options/src/equity-lattice.ts +224 -0
- package/modules/options/src/exercise.ts +422 -0
- package/modules/options/src/exotics.ts +3966 -0
- package/modules/options/src/facade-util.ts +137 -0
- package/modules/options/src/generated/validation-specs.ts +2621 -0
- package/modules/options/src/heston.ts +1348 -0
- package/modules/options/src/index.ts +325 -0
- package/modules/options/src/iv.ts +591 -0
- package/modules/options/src/lattice.ts +6 -0
- package/modules/options/src/local-volatility.ts +493 -0
- package/modules/options/src/market.ts +74 -0
- package/modules/options/src/mc/complex.ts +55 -0
- package/modules/options/src/mc/core.ts +538 -0
- package/modules/options/src/monte-carlo.ts +567 -0
- package/modules/options/src/parity.ts +928 -0
- package/modules/options/src/payoff-kernel.ts +39 -0
- package/modules/options/src/payoff.ts +81 -0
- package/modules/options/src/pricer.ts +217 -0
- package/modules/options/src/pro.ts +272 -0
- package/modules/options/src/quote.ts +34 -0
- package/modules/options/src/resource-validation-internal.ts +31 -0
- package/modules/options/src/sabr.ts +716 -0
- package/modules/options/src/schema.ts +73 -0
- package/modules/options/src/time.ts +104 -0
- package/modules/options/src/types.ts +124 -0
- package/modules/performance/dist/activity.d.ts +24 -0
- package/modules/performance/dist/activity.d.ts.map +1 -0
- package/modules/performance/dist/activity.js +137 -0
- package/modules/performance/dist/activity.js.map +1 -0
- package/modules/performance/dist/analyze.d.ts +85 -0
- package/modules/performance/dist/analyze.d.ts.map +1 -0
- package/modules/performance/dist/analyze.js +203 -0
- package/modules/performance/dist/analyze.js.map +1 -0
- package/modules/performance/dist/annualization-internal.d.ts +21 -0
- package/modules/performance/dist/annualization-internal.d.ts.map +1 -0
- package/modules/performance/dist/annualization-internal.js +34 -0
- package/modules/performance/dist/annualization-internal.js.map +1 -0
- package/modules/performance/dist/drawdown.d.ts +34 -0
- package/modules/performance/dist/drawdown.d.ts.map +1 -0
- package/modules/performance/dist/drawdown.js +99 -0
- package/modules/performance/dist/drawdown.js.map +1 -0
- package/modules/performance/dist/flow-aware.d.ts +388 -0
- package/modules/performance/dist/flow-aware.d.ts.map +1 -0
- package/modules/performance/dist/flow-aware.js +888 -0
- package/modules/performance/dist/flow-aware.js.map +1 -0
- package/modules/performance/dist/index.d.ts +26 -0
- package/modules/performance/dist/index.d.ts.map +1 -0
- package/modules/performance/dist/index.js +25 -0
- package/modules/performance/dist/index.js.map +1 -0
- package/modules/performance/dist/metrics.d.ts +13 -0
- package/modules/performance/dist/metrics.d.ts.map +1 -0
- package/modules/performance/dist/metrics.js +87 -0
- package/modules/performance/dist/metrics.js.map +1 -0
- package/modules/performance/dist/ratios.d.ts +55 -0
- package/modules/performance/dist/ratios.d.ts.map +1 -0
- package/modules/performance/dist/ratios.js +168 -0
- package/modules/performance/dist/ratios.js.map +1 -0
- package/modules/performance/dist/relative.d.ts +33 -0
- package/modules/performance/dist/relative.d.ts.map +1 -0
- package/modules/performance/dist/relative.js +150 -0
- package/modules/performance/dist/relative.js.map +1 -0
- package/modules/performance/dist/returns.d.ts +18 -0
- package/modules/performance/dist/returns.d.ts.map +1 -0
- package/modules/performance/dist/returns.js +70 -0
- package/modules/performance/dist/returns.js.map +1 -0
- package/modules/performance/dist/rolling.d.ts +36 -0
- package/modules/performance/dist/rolling.d.ts.map +1 -0
- package/modules/performance/dist/rolling.js +102 -0
- package/modules/performance/dist/rolling.js.map +1 -0
- package/modules/performance/dist/sector-performance-internal.d.ts +61 -0
- package/modules/performance/dist/sector-performance-internal.d.ts.map +1 -0
- package/modules/performance/dist/sector-performance-internal.js +216 -0
- package/modules/performance/dist/sector-performance-internal.js.map +1 -0
- package/modules/performance/dist/sector-performance.d.ts +288 -0
- package/modules/performance/dist/sector-performance.d.ts.map +1 -0
- package/modules/performance/dist/sector-performance.js +690 -0
- package/modules/performance/dist/sector-performance.js.map +1 -0
- package/modules/performance/dist/sharpe.d.ts +74 -0
- package/modules/performance/dist/sharpe.d.ts.map +1 -0
- package/modules/performance/dist/sharpe.js +157 -0
- package/modules/performance/dist/sharpe.js.map +1 -0
- package/modules/performance/etc/performance.api.md +109 -0
- package/modules/performance/src/activity.ts +182 -0
- package/modules/performance/src/analyze.ts +305 -0
- package/modules/performance/src/annualization-internal.ts +43 -0
- package/modules/performance/src/drawdown.ts +132 -0
- package/modules/performance/src/flow-aware.ts +1518 -0
- package/modules/performance/src/index.ts +89 -0
- package/modules/performance/src/metrics.ts +150 -0
- package/modules/performance/src/ratios.ts +243 -0
- package/modules/performance/src/relative.ts +278 -0
- package/modules/performance/src/returns.ts +80 -0
- package/modules/performance/src/rolling.ts +155 -0
- package/modules/performance/src/sector-performance-internal.ts +293 -0
- package/modules/performance/src/sector-performance.ts +1263 -0
- package/modules/performance/src/sharpe.ts +256 -0
- package/modules/portfolio/dist/allocation.d.ts +227 -0
- package/modules/portfolio/dist/allocation.d.ts.map +1 -0
- package/modules/portfolio/dist/allocation.js +545 -0
- package/modules/portfolio/dist/allocation.js.map +1 -0
- package/modules/portfolio/dist/events.d.ts +502 -0
- package/modules/portfolio/dist/events.d.ts.map +1 -0
- package/modules/portfolio/dist/events.js +1061 -0
- package/modules/portfolio/dist/events.js.map +1 -0
- package/modules/portfolio/dist/index.d.ts +47 -0
- package/modules/portfolio/dist/index.d.ts.map +1 -0
- package/modules/portfolio/dist/index.js +34 -0
- package/modules/portfolio/dist/index.js.map +1 -0
- package/modules/portfolio/dist/internal.d.ts +101 -0
- package/modules/portfolio/dist/internal.d.ts.map +1 -0
- package/modules/portfolio/dist/internal.js +356 -0
- package/modules/portfolio/dist/internal.js.map +1 -0
- package/modules/portfolio/dist/ledger.d.ts +129 -0
- package/modules/portfolio/dist/ledger.d.ts.map +1 -0
- package/modules/portfolio/dist/ledger.js +271 -0
- package/modules/portfolio/dist/ledger.js.map +1 -0
- package/modules/portfolio/dist/lifecycle-corporate.d.ts +49 -0
- package/modules/portfolio/dist/lifecycle-corporate.d.ts.map +1 -0
- package/modules/portfolio/dist/lifecycle-corporate.js +462 -0
- package/modules/portfolio/dist/lifecycle-corporate.js.map +1 -0
- package/modules/portfolio/dist/lifecycle-derivatives.d.ts +59 -0
- package/modules/portfolio/dist/lifecycle-derivatives.d.ts.map +1 -0
- package/modules/portfolio/dist/lifecycle-derivatives.js +422 -0
- package/modules/portfolio/dist/lifecycle-derivatives.js.map +1 -0
- package/modules/portfolio/dist/marks.d.ts +44 -0
- package/modules/portfolio/dist/marks.d.ts.map +1 -0
- package/modules/portfolio/dist/marks.js +81 -0
- package/modules/portfolio/dist/marks.js.map +1 -0
- package/modules/portfolio/dist/monitor.d.ts +222 -0
- package/modules/portfolio/dist/monitor.d.ts.map +1 -0
- package/modules/portfolio/dist/monitor.js +1806 -0
- package/modules/portfolio/dist/monitor.js.map +1 -0
- package/modules/portfolio/dist/performance.d.ts +78 -0
- package/modules/portfolio/dist/performance.d.ts.map +1 -0
- package/modules/portfolio/dist/performance.js +146 -0
- package/modules/portfolio/dist/performance.js.map +1 -0
- package/modules/portfolio/dist/pnl.d.ts +154 -0
- package/modules/portfolio/dist/pnl.d.ts.map +1 -0
- package/modules/portfolio/dist/pnl.js +548 -0
- package/modules/portfolio/dist/pnl.js.map +1 -0
- package/modules/portfolio/dist/policy-grammar.d.ts +358 -0
- package/modules/portfolio/dist/policy-grammar.d.ts.map +1 -0
- package/modules/portfolio/dist/policy-grammar.js +1198 -0
- package/modules/portfolio/dist/policy-grammar.js.map +1 -0
- package/modules/portfolio/dist/policy.d.ts +24 -0
- package/modules/portfolio/dist/policy.d.ts.map +1 -0
- package/modules/portfolio/dist/policy.js +20 -0
- package/modules/portfolio/dist/policy.js.map +1 -0
- package/modules/portfolio/dist/rebalance.d.ts +281 -0
- package/modules/portfolio/dist/rebalance.d.ts.map +1 -0
- package/modules/portfolio/dist/rebalance.js +1236 -0
- package/modules/portfolio/dist/rebalance.js.map +1 -0
- package/modules/portfolio/dist/reconciliation.d.ts +150 -0
- package/modules/portfolio/dist/reconciliation.d.ts.map +1 -0
- package/modules/portfolio/dist/reconciliation.js +392 -0
- package/modules/portfolio/dist/reconciliation.js.map +1 -0
- package/modules/portfolio/dist/reducer-kernel.d.ts +92 -0
- package/modules/portfolio/dist/reducer-kernel.d.ts.map +1 -0
- package/modules/portfolio/dist/reducer-kernel.js +320 -0
- package/modules/portfolio/dist/reducer-kernel.js.map +1 -0
- package/modules/portfolio/dist/snapshot.d.ts +128 -0
- package/modules/portfolio/dist/snapshot.d.ts.map +1 -0
- package/modules/portfolio/dist/snapshot.js +205 -0
- package/modules/portfolio/dist/snapshot.js.map +1 -0
- package/modules/portfolio/dist/state.d.ts +196 -0
- package/modules/portfolio/dist/state.d.ts.map +1 -0
- package/modules/portfolio/dist/state.js +1093 -0
- package/modules/portfolio/dist/state.js.map +1 -0
- package/modules/portfolio/dist/timeline.d.ts +107 -0
- package/modules/portfolio/dist/timeline.d.ts.map +1 -0
- package/modules/portfolio/dist/timeline.js +220 -0
- package/modules/portfolio/dist/timeline.js.map +1 -0
- package/modules/portfolio/dist/trade/grant.d.ts +21 -0
- package/modules/portfolio/dist/trade/grant.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/grant.js +411 -0
- package/modules/portfolio/dist/trade/grant.js.map +1 -0
- package/modules/portfolio/dist/trade/index.d.ts +20 -0
- package/modules/portfolio/dist/trade/index.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/index.js +17 -0
- package/modules/portfolio/dist/trade/index.js.map +1 -0
- package/modules/portfolio/dist/trade/journal.d.ts +23 -0
- package/modules/portfolio/dist/trade/journal.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/journal.js +352 -0
- package/modules/portfolio/dist/trade/journal.js.map +1 -0
- package/modules/portfolio/dist/trade/plan.d.ts +25 -0
- package/modules/portfolio/dist/trade/plan.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/plan.js +285 -0
- package/modules/portfolio/dist/trade/plan.js.map +1 -0
- package/modules/portfolio/dist/trade/policy.d.ts +5 -0
- package/modules/portfolio/dist/trade/policy.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/policy.js +133 -0
- package/modules/portfolio/dist/trade/policy.js.map +1 -0
- package/modules/portfolio/dist/trade/preflight.d.ts +3 -0
- package/modules/portfolio/dist/trade/preflight.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/preflight.js +381 -0
- package/modules/portfolio/dist/trade/preflight.js.map +1 -0
- package/modules/portfolio/dist/trade/reconcile.d.ts +8 -0
- package/modules/portfolio/dist/trade/reconcile.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/reconcile.js +240 -0
- package/modules/portfolio/dist/trade/reconcile.js.map +1 -0
- package/modules/portfolio/dist/trade/types.d.ts +559 -0
- package/modules/portfolio/dist/trade/types.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/types.js +36 -0
- package/modules/portfolio/dist/trade/types.js.map +1 -0
- package/modules/portfolio/dist/trade/validate.d.ts +36 -0
- package/modules/portfolio/dist/trade/validate.d.ts.map +1 -0
- package/modules/portfolio/dist/trade/validate.js +776 -0
- package/modules/portfolio/dist/trade/validate.js.map +1 -0
- package/modules/portfolio/etc/portfolio.api.md +236 -0
- package/modules/portfolio/src/allocation.ts +844 -0
- package/modules/portfolio/src/events.ts +1968 -0
- package/modules/portfolio/src/index.ts +295 -0
- package/modules/portfolio/src/internal.ts +523 -0
- package/modules/portfolio/src/ledger.ts +420 -0
- package/modules/portfolio/src/lifecycle-corporate.ts +888 -0
- package/modules/portfolio/src/lifecycle-derivatives.ts +735 -0
- package/modules/portfolio/src/marks.ts +140 -0
- package/modules/portfolio/src/monitor.ts +2421 -0
- package/modules/portfolio/src/performance.ts +237 -0
- package/modules/portfolio/src/pnl.ts +840 -0
- package/modules/portfolio/src/policy-grammar.ts +1891 -0
- package/modules/portfolio/src/policy.ts +119 -0
- package/modules/portfolio/src/rebalance.ts +1742 -0
- package/modules/portfolio/src/reconciliation.ts +621 -0
- package/modules/portfolio/src/reducer-kernel.ts +512 -0
- package/modules/portfolio/src/snapshot.ts +372 -0
- package/modules/portfolio/src/state.ts +1776 -0
- package/modules/portfolio/src/timeline.ts +359 -0
- package/modules/portfolio/src/trade/grant.ts +514 -0
- package/modules/portfolio/src/trade/index.ts +96 -0
- package/modules/portfolio/src/trade/journal.ts +432 -0
- package/modules/portfolio/src/trade/plan.ts +424 -0
- package/modules/portfolio/src/trade/policy.ts +153 -0
- package/modules/portfolio/src/trade/preflight.ts +605 -0
- package/modules/portfolio/src/trade/reconcile.ts +276 -0
- package/modules/portfolio/src/trade/types.ts +637 -0
- package/modules/portfolio/src/trade/validate.ts +1213 -0
- package/modules/research/dist/artifacts.d.ts +25 -0
- package/modules/research/dist/artifacts.d.ts.map +1 -0
- package/modules/research/dist/artifacts.js +22 -0
- package/modules/research/dist/artifacts.js.map +1 -0
- package/modules/research/dist/events.d.ts +238 -0
- package/modules/research/dist/events.d.ts.map +1 -0
- package/modules/research/dist/events.js +844 -0
- package/modules/research/dist/events.js.map +1 -0
- package/modules/research/dist/factors.d.ts +330 -0
- package/modules/research/dist/factors.d.ts.map +1 -0
- package/modules/research/dist/factors.js +891 -0
- package/modules/research/dist/factors.js.map +1 -0
- package/modules/research/dist/index.d.ts +11 -0
- package/modules/research/dist/index.d.ts.map +1 -0
- package/modules/research/dist/index.js +13 -0
- package/modules/research/dist/index.js.map +1 -0
- package/modules/research/dist/observations.d.ts +77 -0
- package/modules/research/dist/observations.d.ts.map +1 -0
- package/modules/research/dist/observations.js +201 -0
- package/modules/research/dist/observations.js.map +1 -0
- package/modules/research/dist/point-in-time.d.ts +17 -0
- package/modules/research/dist/point-in-time.d.ts.map +1 -0
- package/modules/research/dist/point-in-time.js +34 -0
- package/modules/research/dist/point-in-time.js.map +1 -0
- package/modules/research/dist/research-hygiene.d.ts +126 -0
- package/modules/research/dist/research-hygiene.d.ts.map +1 -0
- package/modules/research/dist/research-hygiene.js +290 -0
- package/modules/research/dist/research-hygiene.js.map +1 -0
- package/modules/research/dist/research-run-artifacts.d.ts +315 -0
- package/modules/research/dist/research-run-artifacts.d.ts.map +1 -0
- package/modules/research/dist/research-run-artifacts.js +766 -0
- package/modules/research/dist/research-run-artifacts.js.map +1 -0
- package/modules/research/dist/research-run-kinds.d.ts +135 -0
- package/modules/research/dist/research-run-kinds.d.ts.map +1 -0
- package/modules/research/dist/research-run-kinds.js +470 -0
- package/modules/research/dist/research-run-kinds.js.map +1 -0
- package/modules/research/dist/screening.d.ts +215 -0
- package/modules/research/dist/screening.d.ts.map +1 -0
- package/modules/research/dist/screening.js +616 -0
- package/modules/research/dist/screening.js.map +1 -0
- package/modules/research/dist/universe.d.ts +131 -0
- package/modules/research/dist/universe.d.ts.map +1 -0
- package/modules/research/dist/universe.js +294 -0
- package/modules/research/dist/universe.js.map +1 -0
- package/modules/research/etc/research.api.md +109 -0
- package/modules/research/src/artifacts.ts +68 -0
- package/modules/research/src/events.ts +1358 -0
- package/modules/research/src/factors.ts +1322 -0
- package/modules/research/src/index.ts +28 -0
- package/modules/research/src/observations.ts +360 -0
- package/modules/research/src/point-in-time.ts +44 -0
- package/modules/research/src/research-hygiene.ts +544 -0
- package/modules/research/src/research-run-artifacts.ts +1464 -0
- package/modules/research/src/research-run-kinds.ts +723 -0
- package/modules/research/src/screening.ts +957 -0
- package/modules/research/src/universe.ts +494 -0
- package/modules/risk/dist/attribution.d.ts +166 -0
- package/modules/risk/dist/attribution.d.ts.map +1 -0
- package/modules/risk/dist/attribution.js +278 -0
- package/modules/risk/dist/attribution.js.map +1 -0
- package/modules/risk/dist/book-var.d.ts +113 -0
- package/modules/risk/dist/book-var.d.ts.map +1 -0
- package/modules/risk/dist/book-var.js +487 -0
- package/modules/risk/dist/book-var.js.map +1 -0
- package/modules/risk/dist/book.d.ts +95 -0
- package/modules/risk/dist/book.d.ts.map +1 -0
- package/modules/risk/dist/book.js +201 -0
- package/modules/risk/dist/book.js.map +1 -0
- package/modules/risk/dist/covariance.d.ts +96 -0
- package/modules/risk/dist/covariance.d.ts.map +1 -0
- package/modules/risk/dist/covariance.js +183 -0
- package/modules/risk/dist/covariance.js.map +1 -0
- package/modules/risk/dist/evt.d.ts +188 -0
- package/modules/risk/dist/evt.d.ts.map +1 -0
- package/modules/risk/dist/evt.js +625 -0
- package/modules/risk/dist/evt.js.map +1 -0
- package/modules/risk/dist/expected-returns.d.ts +139 -0
- package/modules/risk/dist/expected-returns.d.ts.map +1 -0
- package/modules/risk/dist/expected-returns.js +350 -0
- package/modules/risk/dist/expected-returns.js.map +1 -0
- package/modules/risk/dist/factor.d.ts +66 -0
- package/modules/risk/dist/factor.d.ts.map +1 -0
- package/modules/risk/dist/factor.js +133 -0
- package/modules/risk/dist/factor.js.map +1 -0
- package/modules/risk/dist/frontier.d.ts +158 -0
- package/modules/risk/dist/frontier.d.ts.map +1 -0
- package/modules/risk/dist/frontier.js +1183 -0
- package/modules/risk/dist/frontier.js.map +1 -0
- package/modules/risk/dist/index.d.ts +47 -0
- package/modules/risk/dist/index.d.ts.map +1 -0
- package/modules/risk/dist/index.js +43 -0
- package/modules/risk/dist/index.js.map +1 -0
- package/modules/risk/dist/input-description.d.ts +3 -0
- package/modules/risk/dist/input-description.d.ts.map +1 -0
- package/modules/risk/dist/input-description.js +24 -0
- package/modules/risk/dist/input-description.js.map +1 -0
- package/modules/risk/dist/kelly.d.ts +217 -0
- package/modules/risk/dist/kelly.d.ts.map +1 -0
- package/modules/risk/dist/kelly.js +731 -0
- package/modules/risk/dist/kelly.js.map +1 -0
- package/modules/risk/dist/linalg.d.ts +27 -0
- package/modules/risk/dist/linalg.d.ts.map +1 -0
- package/modules/risk/dist/linalg.js +89 -0
- package/modules/risk/dist/linalg.js.map +1 -0
- package/modules/risk/dist/numeric-vector.d.ts +9 -0
- package/modules/risk/dist/numeric-vector.d.ts.map +1 -0
- package/modules/risk/dist/numeric-vector.js +112 -0
- package/modules/risk/dist/numeric-vector.js.map +1 -0
- package/modules/risk/dist/optimize.d.ts +231 -0
- package/modules/risk/dist/optimize.d.ts.map +1 -0
- package/modules/risk/dist/optimize.js +1258 -0
- package/modules/risk/dist/optimize.js.map +1 -0
- package/modules/risk/dist/optimizer-validation.d.ts +26 -0
- package/modules/risk/dist/optimizer-validation.d.ts.map +1 -0
- package/modules/risk/dist/optimizer-validation.js +306 -0
- package/modules/risk/dist/optimizer-validation.js.map +1 -0
- package/modules/risk/dist/options-internal.d.ts +18 -0
- package/modules/risk/dist/options-internal.d.ts.map +1 -0
- package/modules/risk/dist/options-internal.js +49 -0
- package/modules/risk/dist/options-internal.js.map +1 -0
- package/modules/risk/dist/pnl-explain.d.ts +169 -0
- package/modules/risk/dist/pnl-explain.d.ts.map +1 -0
- package/modules/risk/dist/pnl-explain.js +327 -0
- package/modules/risk/dist/pnl-explain.js.map +1 -0
- package/modules/risk/dist/portfolio.d.ts +322 -0
- package/modules/risk/dist/portfolio.d.ts.map +1 -0
- package/modules/risk/dist/portfolio.js +547 -0
- package/modules/risk/dist/portfolio.js.map +1 -0
- package/modules/risk/dist/research-protocol.d.ts +74 -0
- package/modules/risk/dist/research-protocol.d.ts.map +1 -0
- package/modules/risk/dist/research-protocol.js +193 -0
- package/modules/risk/dist/research-protocol.js.map +1 -0
- package/modules/risk/dist/research.d.ts +255 -0
- package/modules/risk/dist/research.d.ts.map +1 -0
- package/modules/risk/dist/research.js +752 -0
- package/modules/risk/dist/research.js.map +1 -0
- package/modules/risk/dist/scenario.d.ts +279 -0
- package/modules/risk/dist/scenario.d.ts.map +1 -0
- package/modules/risk/dist/scenario.js +458 -0
- package/modules/risk/dist/scenario.js.map +1 -0
- package/modules/risk/dist/sizing.d.ts +14 -0
- package/modules/risk/dist/sizing.d.ts.map +1 -0
- package/modules/risk/dist/sizing.js +12 -0
- package/modules/risk/dist/sizing.js.map +1 -0
- package/modules/risk/dist/strategy-shape.d.ts +84 -0
- package/modules/risk/dist/strategy-shape.d.ts.map +1 -0
- package/modules/risk/dist/strategy-shape.js +17 -0
- package/modules/risk/dist/strategy-shape.js.map +1 -0
- package/modules/risk/dist/value-at-risk.d.ts +240 -0
- package/modules/risk/dist/value-at-risk.d.ts.map +1 -0
- package/modules/risk/dist/value-at-risk.js +743 -0
- package/modules/risk/dist/value-at-risk.js.map +1 -0
- package/modules/risk/etc/risk.api.md +228 -0
- package/modules/risk/src/attribution.ts +480 -0
- package/modules/risk/src/book-var.ts +717 -0
- package/modules/risk/src/book.ts +327 -0
- package/modules/risk/src/covariance.ts +293 -0
- package/modules/risk/src/evt.ts +899 -0
- package/modules/risk/src/expected-returns.ts +572 -0
- package/modules/risk/src/factor.ts +199 -0
- package/modules/risk/src/frontier.ts +1570 -0
- package/modules/risk/src/index.ts +281 -0
- package/modules/risk/src/input-description.ts +15 -0
- package/modules/risk/src/kelly.ts +1119 -0
- package/modules/risk/src/linalg.ts +100 -0
- package/modules/risk/src/numeric-vector.ts +153 -0
- package/modules/risk/src/optimize.ts +1769 -0
- package/modules/risk/src/optimizer-validation.ts +467 -0
- package/modules/risk/src/options-internal.ts +73 -0
- package/modules/risk/src/pnl-explain.ts +544 -0
- package/modules/risk/src/portfolio.ts +911 -0
- package/modules/risk/src/research-protocol.ts +277 -0
- package/modules/risk/src/research.ts +1076 -0
- package/modules/risk/src/scenario.ts +728 -0
- package/modules/risk/src/sizing.ts +15 -0
- package/modules/risk/src/strategy-shape.ts +90 -0
- package/modules/risk/src/value-at-risk.ts +1102 -0
- package/modules/scenarios/dist/aggregates.d.ts +27 -0
- package/modules/scenarios/dist/aggregates.d.ts.map +1 -0
- package/modules/scenarios/dist/aggregates.js +262 -0
- package/modules/scenarios/dist/aggregates.js.map +1 -0
- package/modules/scenarios/dist/fx.d.ts +69 -0
- package/modules/scenarios/dist/fx.d.ts.map +1 -0
- package/modules/scenarios/dist/fx.js +349 -0
- package/modules/scenarios/dist/fx.js.map +1 -0
- package/modules/scenarios/dist/index.d.ts +6 -0
- package/modules/scenarios/dist/index.d.ts.map +1 -0
- package/modules/scenarios/dist/index.js +6 -0
- package/modules/scenarios/dist/index.js.map +1 -0
- package/modules/scenarios/dist/internal/behaviors.d.ts +28 -0
- package/modules/scenarios/dist/internal/behaviors.d.ts.map +1 -0
- package/modules/scenarios/dist/internal/behaviors.js +169 -0
- package/modules/scenarios/dist/internal/behaviors.js.map +1 -0
- package/modules/scenarios/dist/internal/data.d.ts +35 -0
- package/modules/scenarios/dist/internal/data.d.ts.map +1 -0
- package/modules/scenarios/dist/internal/data.js +194 -0
- package/modules/scenarios/dist/internal/data.js.map +1 -0
- package/modules/scenarios/dist/internal/failures.d.ts +18 -0
- package/modules/scenarios/dist/internal/failures.d.ts.map +1 -0
- package/modules/scenarios/dist/internal/failures.js +184 -0
- package/modules/scenarios/dist/internal/failures.js.map +1 -0
- package/modules/scenarios/dist/internal/results.d.ts +18 -0
- package/modules/scenarios/dist/internal/results.d.ts.map +1 -0
- package/modules/scenarios/dist/internal/results.js +100 -0
- package/modules/scenarios/dist/internal/results.js.map +1 -0
- package/modules/scenarios/dist/market-resolution.d.ts +32 -0
- package/modules/scenarios/dist/market-resolution.d.ts.map +1 -0
- package/modules/scenarios/dist/market-resolution.js +296 -0
- package/modules/scenarios/dist/market-resolution.js.map +1 -0
- package/modules/scenarios/dist/portfolio.d.ts +11 -0
- package/modules/scenarios/dist/portfolio.d.ts.map +1 -0
- package/modules/scenarios/dist/portfolio.js +419 -0
- package/modules/scenarios/dist/portfolio.js.map +1 -0
- package/modules/scenarios/dist/run.d.ts +4 -0
- package/modules/scenarios/dist/run.d.ts.map +1 -0
- package/modules/scenarios/dist/run.js +933 -0
- package/modules/scenarios/dist/run.js.map +1 -0
- package/modules/scenarios/dist/spot-pricer.d.ts +21 -0
- package/modules/scenarios/dist/spot-pricer.d.ts.map +1 -0
- package/modules/scenarios/dist/spot-pricer.js +97 -0
- package/modules/scenarios/dist/spot-pricer.js.map +1 -0
- package/modules/scenarios/dist/targets.d.ts +18 -0
- package/modules/scenarios/dist/targets.d.ts.map +1 -0
- package/modules/scenarios/dist/targets.js +507 -0
- package/modules/scenarios/dist/targets.js.map +1 -0
- package/modules/scenarios/dist/taylor.d.ts +23 -0
- package/modules/scenarios/dist/taylor.d.ts.map +1 -0
- package/modules/scenarios/dist/taylor.js +209 -0
- package/modules/scenarios/dist/taylor.js.map +1 -0
- package/modules/scenarios/dist/transform.d.ts +31 -0
- package/modules/scenarios/dist/transform.d.ts.map +1 -0
- package/modules/scenarios/dist/transform.js +318 -0
- package/modules/scenarios/dist/transform.js.map +1 -0
- package/modules/scenarios/dist/types.d.ts +591 -0
- package/modules/scenarios/dist/types.d.ts.map +1 -0
- package/modules/scenarios/dist/types.js +2 -0
- package/modules/scenarios/dist/types.js.map +1 -0
- package/modules/scenarios/dist/work.d.ts +85 -0
- package/modules/scenarios/dist/work.d.ts.map +1 -0
- package/modules/scenarios/dist/work.js +629 -0
- package/modules/scenarios/dist/work.js.map +1 -0
- package/modules/scenarios/etc/scenarios.api.md +76 -0
- package/modules/scenarios/src/aggregates.ts +429 -0
- package/modules/scenarios/src/fx.ts +563 -0
- package/modules/scenarios/src/index.ts +5 -0
- package/modules/scenarios/src/internal/behaviors.ts +249 -0
- package/modules/scenarios/src/internal/data.ts +258 -0
- package/modules/scenarios/src/internal/failures.ts +219 -0
- package/modules/scenarios/src/internal/results.ts +131 -0
- package/modules/scenarios/src/market-resolution.ts +436 -0
- package/modules/scenarios/src/portfolio.ts +639 -0
- package/modules/scenarios/src/run.ts +1417 -0
- package/modules/scenarios/src/spot-pricer.ts +129 -0
- package/modules/scenarios/src/targets.ts +729 -0
- package/modules/scenarios/src/taylor.ts +287 -0
- package/modules/scenarios/src/transform.ts +468 -0
- package/modules/scenarios/src/types.ts +713 -0
- package/modules/scenarios/src/work.ts +1055 -0
- package/modules/strategy/dist/auto-range.d.ts +14 -0
- package/modules/strategy/dist/auto-range.d.ts.map +1 -0
- package/modules/strategy/dist/auto-range.js +19 -0
- package/modules/strategy/dist/auto-range.js.map +1 -0
- package/modules/strategy/dist/builders.d.ts +75 -0
- package/modules/strategy/dist/builders.d.ts.map +1 -0
- package/modules/strategy/dist/builders.js +112 -0
- package/modules/strategy/dist/builders.js.map +1 -0
- package/modules/strategy/dist/calendars.d.ts +70 -0
- package/modules/strategy/dist/calendars.d.ts.map +1 -0
- package/modules/strategy/dist/calendars.js +149 -0
- package/modules/strategy/dist/calendars.js.map +1 -0
- package/modules/strategy/dist/classify.d.ts +77 -0
- package/modules/strategy/dist/classify.d.ts.map +1 -0
- package/modules/strategy/dist/classify.js +144 -0
- package/modules/strategy/dist/classify.js.map +1 -0
- package/modules/strategy/dist/explain.d.ts +77 -0
- package/modules/strategy/dist/explain.d.ts.map +1 -0
- package/modules/strategy/dist/explain.js +300 -0
- package/modules/strategy/dist/explain.js.map +1 -0
- package/modules/strategy/dist/from-chain.d.ts +88 -0
- package/modules/strategy/dist/from-chain.d.ts.map +1 -0
- package/modules/strategy/dist/from-chain.js +457 -0
- package/modules/strategy/dist/from-chain.js.map +1 -0
- package/modules/strategy/dist/index.d.ts +102 -0
- package/modules/strategy/dist/index.d.ts.map +1 -0
- package/modules/strategy/dist/index.js +41 -0
- package/modules/strategy/dist/index.js.map +1 -0
- package/modules/strategy/dist/legs.d.ts +47 -0
- package/modules/strategy/dist/legs.d.ts.map +1 -0
- package/modules/strategy/dist/legs.js +87 -0
- package/modules/strategy/dist/legs.js.map +1 -0
- package/modules/strategy/dist/manifest.d.ts +116 -0
- package/modules/strategy/dist/manifest.d.ts.map +1 -0
- package/modules/strategy/dist/manifest.js +376 -0
- package/modules/strategy/dist/manifest.js.map +1 -0
- package/modules/strategy/dist/optimizer.d.ts +184 -0
- package/modules/strategy/dist/optimizer.d.ts.map +1 -0
- package/modules/strategy/dist/optimizer.js +404 -0
- package/modules/strategy/dist/optimizer.js.map +1 -0
- package/modules/strategy/dist/position.d.ts +181 -0
- package/modules/strategy/dist/position.d.ts.map +1 -0
- package/modules/strategy/dist/position.js +1693 -0
- package/modules/strategy/dist/position.js.map +1 -0
- package/modules/strategy/dist/probability.d.ts +192 -0
- package/modules/strategy/dist/probability.d.ts.map +1 -0
- package/modules/strategy/dist/probability.js +106 -0
- package/modules/strategy/dist/probability.js.map +1 -0
- package/modules/strategy/dist/scanner.d.ts +147 -0
- package/modules/strategy/dist/scanner.d.ts.map +1 -0
- package/modules/strategy/dist/scanner.js +438 -0
- package/modules/strategy/dist/scanner.js.map +1 -0
- package/modules/strategy/dist/strategies.d.ts +187 -0
- package/modules/strategy/dist/strategies.d.ts.map +1 -0
- package/modules/strategy/dist/strategies.js +541 -0
- package/modules/strategy/dist/strategies.js.map +1 -0
- package/modules/strategy/dist/svg.d.ts +35 -0
- package/modules/strategy/dist/svg.d.ts.map +1 -0
- package/modules/strategy/dist/svg.js +298 -0
- package/modules/strategy/dist/svg.js.map +1 -0
- package/modules/strategy/dist/thesis-distribution.d.ts +79 -0
- package/modules/strategy/dist/thesis-distribution.d.ts.map +1 -0
- package/modules/strategy/dist/thesis-distribution.js +125 -0
- package/modules/strategy/dist/thesis-distribution.js.map +1 -0
- package/modules/strategy/dist/types.d.ts +370 -0
- package/modules/strategy/dist/types.d.ts.map +1 -0
- package/modules/strategy/dist/types.js +8 -0
- package/modules/strategy/dist/types.js.map +1 -0
- package/modules/strategy/dist/validate.d.ts +63 -0
- package/modules/strategy/dist/validate.d.ts.map +1 -0
- package/modules/strategy/dist/validate.js +146 -0
- package/modules/strategy/dist/validate.js.map +1 -0
- package/modules/strategy/etc/strategy.api.md +174 -0
- package/modules/strategy/src/auto-range.ts +21 -0
- package/modules/strategy/src/builders.ts +221 -0
- package/modules/strategy/src/calendars.ts +245 -0
- package/modules/strategy/src/classify.ts +215 -0
- package/modules/strategy/src/explain.ts +471 -0
- package/modules/strategy/src/from-chain.ts +643 -0
- package/modules/strategy/src/index.ts +212 -0
- package/modules/strategy/src/legs.ts +140 -0
- package/modules/strategy/src/manifest.ts +756 -0
- package/modules/strategy/src/optimizer.ts +679 -0
- package/modules/strategy/src/position.ts +2084 -0
- package/modules/strategy/src/probability.ts +301 -0
- package/modules/strategy/src/scanner.ts +711 -0
- package/modules/strategy/src/strategies.ts +1018 -0
- package/modules/strategy/src/svg.ts +415 -0
- package/modules/strategy/src/thesis-distribution.ts +188 -0
- package/modules/strategy/src/types.ts +380 -0
- package/modules/strategy/src/validate.ts +207 -0
- package/modules/structure/OPTION-FLOW-DRIFT.md +126 -0
- package/modules/structure/dist/exposure.d.ts +350 -0
- package/modules/structure/dist/exposure.d.ts.map +1 -0
- package/modules/structure/dist/exposure.js +917 -0
- package/modules/structure/dist/exposure.js.map +1 -0
- package/modules/structure/dist/flow.d.ts +247 -0
- package/modules/structure/dist/flow.d.ts.map +1 -0
- package/modules/structure/dist/flow.js +643 -0
- package/modules/structure/dist/flow.js.map +1 -0
- package/modules/structure/dist/index.d.ts +20 -0
- package/modules/structure/dist/index.d.ts.map +1 -0
- package/modules/structure/dist/index.js +16 -0
- package/modules/structure/dist/index.js.map +1 -0
- package/modules/structure/dist/market-day.d.ts +29 -0
- package/modules/structure/dist/market-day.d.ts.map +1 -0
- package/modules/structure/dist/market-day.js +43 -0
- package/modules/structure/dist/market-day.js.map +1 -0
- package/modules/structure/dist/option-flow-drift.d.ts +184 -0
- package/modules/structure/dist/option-flow-drift.d.ts.map +1 -0
- package/modules/structure/dist/option-flow-drift.js +475 -0
- package/modules/structure/dist/option-flow-drift.js.map +1 -0
- package/modules/structure/dist/supplied-exposure.d.ts +191 -0
- package/modules/structure/dist/supplied-exposure.d.ts.map +1 -0
- package/modules/structure/dist/supplied-exposure.js +421 -0
- package/modules/structure/dist/supplied-exposure.js.map +1 -0
- package/modules/structure/etc/structure.api.md +72 -0
- package/modules/structure/src/exposure.ts +1330 -0
- package/modules/structure/src/flow.ts +955 -0
- package/modules/structure/src/index.ts +83 -0
- package/modules/structure/src/market-day.ts +47 -0
- package/modules/structure/src/option-flow-drift.ts +726 -0
- package/modules/structure/src/supplied-exposure.ts +671 -0
- package/modules/technical-analysis/dist/aliases.d.ts +42 -0
- package/modules/technical-analysis/dist/aliases.d.ts.map +1 -0
- package/modules/technical-analysis/dist/aliases.js +413 -0
- package/modules/technical-analysis/dist/aliases.js.map +1 -0
- package/modules/technical-analysis/dist/bands.d.ts +31 -0
- package/modules/technical-analysis/dist/bands.d.ts.map +1 -0
- package/modules/technical-analysis/dist/bands.js +79 -0
- package/modules/technical-analysis/dist/bands.js.map +1 -0
- package/modules/technical-analysis/dist/bars.d.ts +113 -0
- package/modules/technical-analysis/dist/bars.d.ts.map +1 -0
- package/modules/technical-analysis/dist/bars.js +374 -0
- package/modules/technical-analysis/dist/bars.js.map +1 -0
- package/modules/technical-analysis/dist/builtin-metadata.d.ts +1817 -0
- package/modules/technical-analysis/dist/builtin-metadata.d.ts.map +1 -0
- package/modules/technical-analysis/dist/builtin-metadata.js +1399 -0
- package/modules/technical-analysis/dist/builtin-metadata.js.map +1 -0
- package/modules/technical-analysis/dist/candle-aliases.d.ts +56 -0
- package/modules/technical-analysis/dist/candle-aliases.d.ts.map +1 -0
- package/modules/technical-analysis/dist/candle-aliases.js +246 -0
- package/modules/technical-analysis/dist/candle-aliases.js.map +1 -0
- package/modules/technical-analysis/dist/candle-talib.d.ts +114 -0
- package/modules/technical-analysis/dist/candle-talib.d.ts.map +1 -0
- package/modules/technical-analysis/dist/candle-talib.js +185 -0
- package/modules/technical-analysis/dist/candle-talib.js.map +1 -0
- package/modules/technical-analysis/dist/candlesticks.d.ts +103 -0
- package/modules/technical-analysis/dist/candlesticks.d.ts.map +1 -0
- package/modules/technical-analysis/dist/candlesticks.js +1009 -0
- package/modules/technical-analysis/dist/candlesticks.js.map +1 -0
- package/modules/technical-analysis/dist/chart-types.d.ts +205 -0
- package/modules/technical-analysis/dist/chart-types.d.ts.map +1 -0
- package/modules/technical-analysis/dist/chart-types.js +633 -0
- package/modules/technical-analysis/dist/chart-types.js.map +1 -0
- package/modules/technical-analysis/dist/columns.d.ts +24 -0
- package/modules/technical-analysis/dist/columns.d.ts.map +1 -0
- package/modules/technical-analysis/dist/columns.js +71 -0
- package/modules/technical-analysis/dist/columns.js.map +1 -0
- package/modules/technical-analysis/dist/cycle.d.ts +174 -0
- package/modules/technical-analysis/dist/cycle.d.ts.map +1 -0
- package/modules/technical-analysis/dist/cycle.js +489 -0
- package/modules/technical-analysis/dist/cycle.js.map +1 -0
- package/modules/technical-analysis/dist/discover.d.ts +100 -0
- package/modules/technical-analysis/dist/discover.d.ts.map +1 -0
- package/modules/technical-analysis/dist/discover.js +273 -0
- package/modules/technical-analysis/dist/discover.js.map +1 -0
- package/modules/technical-analysis/dist/divergence.d.ts +82 -0
- package/modules/technical-analysis/dist/divergence.d.ts.map +1 -0
- package/modules/technical-analysis/dist/divergence.js +269 -0
- package/modules/technical-analysis/dist/divergence.js.map +1 -0
- package/modules/technical-analysis/dist/features-ext.d.ts +162 -0
- package/modules/technical-analysis/dist/features-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/features-ext.js +633 -0
- package/modules/technical-analysis/dist/features-ext.js.map +1 -0
- package/modules/technical-analysis/dist/features.d.ts +10 -0
- package/modules/technical-analysis/dist/features.d.ts.map +1 -0
- package/modules/technical-analysis/dist/features.js +10 -0
- package/modules/technical-analysis/dist/features.js.map +1 -0
- package/modules/technical-analysis/dist/framework.d.ts +353 -0
- package/modules/technical-analysis/dist/framework.d.ts.map +1 -0
- package/modules/technical-analysis/dist/framework.js +999 -0
- package/modules/technical-analysis/dist/framework.js.map +1 -0
- package/modules/technical-analysis/dist/fuzzy.d.ts +33 -0
- package/modules/technical-analysis/dist/fuzzy.d.ts.map +1 -0
- package/modules/technical-analysis/dist/fuzzy.js +80 -0
- package/modules/technical-analysis/dist/fuzzy.js.map +1 -0
- package/modules/technical-analysis/dist/generated/validation-specs.d.ts +12 -0
- package/modules/technical-analysis/dist/generated/validation-specs.d.ts.map +1 -0
- package/modules/technical-analysis/dist/generated/validation-specs.js +1052 -0
- package/modules/technical-analysis/dist/generated/validation-specs.js.map +1 -0
- package/modules/technical-analysis/dist/index.d.ts +132 -0
- package/modules/technical-analysis/dist/index.d.ts.map +1 -0
- package/modules/technical-analysis/dist/index.js +100 -0
- package/modules/technical-analysis/dist/index.js.map +1 -0
- package/modules/technical-analysis/dist/indicator-metadata.d.ts +21 -0
- package/modules/technical-analysis/dist/indicator-metadata.d.ts.map +1 -0
- package/modules/technical-analysis/dist/indicator-metadata.js +23 -0
- package/modules/technical-analysis/dist/indicator-metadata.js.map +1 -0
- package/modules/technical-analysis/dist/limits.d.ts +19 -0
- package/modules/technical-analysis/dist/limits.d.ts.map +1 -0
- package/modules/technical-analysis/dist/limits.js +19 -0
- package/modules/technical-analysis/dist/limits.js.map +1 -0
- package/modules/technical-analysis/dist/macd.d.ts +29 -0
- package/modules/technical-analysis/dist/macd.d.ts.map +1 -0
- package/modules/technical-analysis/dist/macd.js +61 -0
- package/modules/technical-analysis/dist/macd.js.map +1 -0
- package/modules/technical-analysis/dist/math.d.ts +69 -0
- package/modules/technical-analysis/dist/math.d.ts.map +1 -0
- package/modules/technical-analysis/dist/math.js +124 -0
- package/modules/technical-analysis/dist/math.js.map +1 -0
- package/modules/technical-analysis/dist/microstructure.d.ts +252 -0
- package/modules/technical-analysis/dist/microstructure.d.ts.map +1 -0
- package/modules/technical-analysis/dist/microstructure.js +552 -0
- package/modules/technical-analysis/dist/microstructure.js.map +1 -0
- package/modules/technical-analysis/dist/momentum-ext.d.ts +619 -0
- package/modules/technical-analysis/dist/momentum-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/momentum-ext.js +1772 -0
- package/modules/technical-analysis/dist/momentum-ext.js.map +1 -0
- package/modules/technical-analysis/dist/momentum.d.ts +15 -0
- package/modules/technical-analysis/dist/momentum.d.ts.map +1 -0
- package/modules/technical-analysis/dist/momentum.js +14 -0
- package/modules/technical-analysis/dist/momentum.js.map +1 -0
- package/modules/technical-analysis/dist/moving-averages.d.ts +344 -0
- package/modules/technical-analysis/dist/moving-averages.d.ts.map +1 -0
- package/modules/technical-analysis/dist/moving-averages.js +1279 -0
- package/modules/technical-analysis/dist/moving-averages.js.map +1 -0
- package/modules/technical-analysis/dist/nan-policy.d.ts +42 -0
- package/modules/technical-analysis/dist/nan-policy.d.ts.map +1 -0
- package/modules/technical-analysis/dist/nan-policy.js +60 -0
- package/modules/technical-analysis/dist/nan-policy.js.map +1 -0
- package/modules/technical-analysis/dist/oscillators.d.ts +377 -0
- package/modules/technical-analysis/dist/oscillators.d.ts.map +1 -0
- package/modules/technical-analysis/dist/oscillators.js +1225 -0
- package/modules/technical-analysis/dist/oscillators.js.map +1 -0
- package/modules/technical-analysis/dist/output-meta.d.ts +71 -0
- package/modules/technical-analysis/dist/output-meta.d.ts.map +1 -0
- package/modules/technical-analysis/dist/output-meta.js +399 -0
- package/modules/technical-analysis/dist/output-meta.js.map +1 -0
- package/modules/technical-analysis/dist/overlap-ext.d.ts +206 -0
- package/modules/technical-analysis/dist/overlap-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/overlap-ext.js +550 -0
- package/modules/technical-analysis/dist/overlap-ext.js.map +1 -0
- package/modules/technical-analysis/dist/overlap.d.ts +11 -0
- package/modules/technical-analysis/dist/overlap.d.ts.map +1 -0
- package/modules/technical-analysis/dist/overlap.js +10 -0
- package/modules/technical-analysis/dist/overlap.js.map +1 -0
- package/modules/technical-analysis/dist/performance-ext.d.ts +21 -0
- package/modules/technical-analysis/dist/performance-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/performance-ext.js +31 -0
- package/modules/technical-analysis/dist/performance-ext.js.map +1 -0
- package/modules/technical-analysis/dist/pipeline.d.ts +105 -0
- package/modules/technical-analysis/dist/pipeline.d.ts.map +1 -0
- package/modules/technical-analysis/dist/pipeline.js +224 -0
- package/modules/technical-analysis/dist/pipeline.js.map +1 -0
- package/modules/technical-analysis/dist/price-action-ext.d.ts +90 -0
- package/modules/technical-analysis/dist/price-action-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/price-action-ext.js +511 -0
- package/modules/technical-analysis/dist/price-action-ext.js.map +1 -0
- package/modules/technical-analysis/dist/price-action.d.ts +348 -0
- package/modules/technical-analysis/dist/price-action.d.ts.map +1 -0
- package/modules/technical-analysis/dist/price-action.js +613 -0
- package/modules/technical-analysis/dist/price-action.js.map +1 -0
- package/modules/technical-analysis/dist/registry.d.ts +84 -0
- package/modules/technical-analysis/dist/registry.d.ts.map +1 -0
- package/modules/technical-analysis/dist/registry.js +625 -0
- package/modules/technical-analysis/dist/registry.js.map +1 -0
- package/modules/technical-analysis/dist/resample.d.ts +77 -0
- package/modules/technical-analysis/dist/resample.d.ts.map +1 -0
- package/modules/technical-analysis/dist/resample.js +239 -0
- package/modules/technical-analysis/dist/resample.js.map +1 -0
- package/modules/technical-analysis/dist/rsi.d.ts +36 -0
- package/modules/technical-analysis/dist/rsi.d.ts.map +1 -0
- package/modules/technical-analysis/dist/rsi.js +95 -0
- package/modules/technical-analysis/dist/rsi.js.map +1 -0
- package/modules/technical-analysis/dist/series.d.ts +40 -0
- package/modules/technical-analysis/dist/series.d.ts.map +1 -0
- package/modules/technical-analysis/dist/series.js +125 -0
- package/modules/technical-analysis/dist/series.js.map +1 -0
- package/modules/technical-analysis/dist/signal.d.ts +140 -0
- package/modules/technical-analysis/dist/signal.d.ts.map +1 -0
- package/modules/technical-analysis/dist/signal.js +353 -0
- package/modules/technical-analysis/dist/signal.js.map +1 -0
- package/modules/technical-analysis/dist/snapshot-cardinality.d.ts +17 -0
- package/modules/technical-analysis/dist/snapshot-cardinality.d.ts.map +1 -0
- package/modules/technical-analysis/dist/snapshot-cardinality.js +53 -0
- package/modules/technical-analysis/dist/snapshot-cardinality.js.map +1 -0
- package/modules/technical-analysis/dist/snapshot-envelope.d.ts +19 -0
- package/modules/technical-analysis/dist/snapshot-envelope.d.ts.map +1 -0
- package/modules/technical-analysis/dist/snapshot-envelope.js +87 -0
- package/modules/technical-analysis/dist/snapshot-envelope.js.map +1 -0
- package/modules/technical-analysis/dist/statistics.d.ts +146 -0
- package/modules/technical-analysis/dist/statistics.d.ts.map +1 -0
- package/modules/technical-analysis/dist/statistics.js +524 -0
- package/modules/technical-analysis/dist/statistics.js.map +1 -0
- package/modules/technical-analysis/dist/stream-validation.d.ts +14 -0
- package/modules/technical-analysis/dist/stream-validation.d.ts.map +1 -0
- package/modules/technical-analysis/dist/stream-validation.js +35 -0
- package/modules/technical-analysis/dist/stream-validation.js.map +1 -0
- package/modules/technical-analysis/dist/transforms.d.ts +77 -0
- package/modules/technical-analysis/dist/transforms.d.ts.map +1 -0
- package/modules/technical-analysis/dist/transforms.js +246 -0
- package/modules/technical-analysis/dist/transforms.js.map +1 -0
- package/modules/technical-analysis/dist/trend-ext.d.ts +121 -0
- package/modules/technical-analysis/dist/trend-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/trend-ext.js +691 -0
- package/modules/technical-analysis/dist/trend-ext.js.map +1 -0
- package/modules/technical-analysis/dist/trend.d.ts +373 -0
- package/modules/technical-analysis/dist/trend.d.ts.map +1 -0
- package/modules/technical-analysis/dist/trend.js +1159 -0
- package/modules/technical-analysis/dist/trend.js.map +1 -0
- package/modules/technical-analysis/dist/validate.d.ts +61 -0
- package/modules/technical-analysis/dist/validate.d.ts.map +1 -0
- package/modules/technical-analysis/dist/validate.js +334 -0
- package/modules/technical-analysis/dist/validate.js.map +1 -0
- package/modules/technical-analysis/dist/volatility-ext.d.ts +98 -0
- package/modules/technical-analysis/dist/volatility-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/volatility-ext.js +535 -0
- package/modules/technical-analysis/dist/volatility-ext.js.map +1 -0
- package/modules/technical-analysis/dist/volatility.d.ts +239 -0
- package/modules/technical-analysis/dist/volatility.d.ts.map +1 -0
- package/modules/technical-analysis/dist/volatility.js +709 -0
- package/modules/technical-analysis/dist/volatility.js.map +1 -0
- package/modules/technical-analysis/dist/volume-core.d.ts +273 -0
- package/modules/technical-analysis/dist/volume-core.d.ts.map +1 -0
- package/modules/technical-analysis/dist/volume-core.js +847 -0
- package/modules/technical-analysis/dist/volume-core.js.map +1 -0
- package/modules/technical-analysis/dist/volume-ext.d.ts +61 -0
- package/modules/technical-analysis/dist/volume-ext.d.ts.map +1 -0
- package/modules/technical-analysis/dist/volume-ext.js +270 -0
- package/modules/technical-analysis/dist/volume-ext.js.map +1 -0
- package/modules/technical-analysis/dist/volume.d.ts +15 -0
- package/modules/technical-analysis/dist/volume.d.ts.map +1 -0
- package/modules/technical-analysis/dist/volume.js +15 -0
- package/modules/technical-analysis/dist/volume.js.map +1 -0
- package/modules/technical-analysis/dist/warmup.d.ts +38 -0
- package/modules/technical-analysis/dist/warmup.d.ts.map +1 -0
- package/modules/technical-analysis/dist/warmup.js +269 -0
- package/modules/technical-analysis/dist/warmup.js.map +1 -0
- package/modules/technical-analysis/etc/technical-analysis.api.md +663 -0
- package/modules/technical-analysis/src/aliases.ts +466 -0
- package/modules/technical-analysis/src/bands.ts +113 -0
- package/modules/technical-analysis/src/bars.ts +456 -0
- package/modules/technical-analysis/src/builtin-metadata.ts +1686 -0
- package/modules/technical-analysis/src/candle-aliases.ts +289 -0
- package/modules/technical-analysis/src/candle-talib.ts +215 -0
- package/modules/technical-analysis/src/candlesticks.ts +1024 -0
- package/modules/technical-analysis/src/chart-types.ts +813 -0
- package/modules/technical-analysis/src/columns.ts +87 -0
- package/modules/technical-analysis/src/cycle.ts +625 -0
- package/modules/technical-analysis/src/discover.ts +390 -0
- package/modules/technical-analysis/src/divergence.ts +388 -0
- package/modules/technical-analysis/src/features-ext.ts +866 -0
- package/modules/technical-analysis/src/features.ts +9 -0
- package/modules/technical-analysis/src/framework.ts +1331 -0
- package/modules/technical-analysis/src/fuzzy.ts +92 -0
- package/modules/technical-analysis/src/generated/validation-specs.ts +1055 -0
- package/modules/technical-analysis/src/index.ts +825 -0
- package/modules/technical-analysis/src/indicator-metadata.ts +43 -0
- package/modules/technical-analysis/src/limits.ts +19 -0
- package/modules/technical-analysis/src/macd.ts +95 -0
- package/modules/technical-analysis/src/math.ts +181 -0
- package/modules/technical-analysis/src/microstructure.ts +870 -0
- package/modules/technical-analysis/src/momentum-ext.ts +2348 -0
- package/modules/technical-analysis/src/momentum.ts +16 -0
- package/modules/technical-analysis/src/moving-averages.ts +1525 -0
- package/modules/technical-analysis/src/nan-policy.ts +58 -0
- package/modules/technical-analysis/src/oscillators.ts +1586 -0
- package/modules/technical-analysis/src/output-meta.ts +466 -0
- package/modules/technical-analysis/src/overlap-ext.ts +792 -0
- package/modules/technical-analysis/src/overlap.ts +12 -0
- package/modules/technical-analysis/src/performance-ext.ts +57 -0
- package/modules/technical-analysis/src/pipeline.ts +270 -0
- package/modules/technical-analysis/src/price-action-ext.ts +675 -0
- package/modules/technical-analysis/src/price-action.ts +955 -0
- package/modules/technical-analysis/src/registry.ts +784 -0
- package/modules/technical-analysis/src/resample.ts +335 -0
- package/modules/technical-analysis/src/rsi.ts +120 -0
- package/modules/technical-analysis/src/series.ts +168 -0
- package/modules/technical-analysis/src/signal.ts +429 -0
- package/modules/technical-analysis/src/snapshot-cardinality.ts +83 -0
- package/modules/technical-analysis/src/snapshot-envelope.ts +131 -0
- package/modules/technical-analysis/src/statistics.ts +720 -0
- package/modules/technical-analysis/src/stream-validation.ts +42 -0
- package/modules/technical-analysis/src/transforms.ts +351 -0
- package/modules/technical-analysis/src/trend-ext.ts +957 -0
- package/modules/technical-analysis/src/trend.ts +1529 -0
- package/modules/technical-analysis/src/validate.ts +555 -0
- package/modules/technical-analysis/src/volatility-ext.ts +781 -0
- package/modules/technical-analysis/src/volatility.ts +963 -0
- package/modules/technical-analysis/src/volume-core.ts +1106 -0
- package/modules/technical-analysis/src/volume-ext.ts +380 -0
- package/modules/technical-analysis/src/volume.ts +14 -0
- package/modules/technical-analysis/src/warmup.ts +322 -0
- package/modules/totalfinance/dist/backtest.d.ts +3 -0
- package/modules/totalfinance/dist/backtest.d.ts.map +1 -0
- package/modules/totalfinance/dist/backtest.js +3 -0
- package/modules/totalfinance/dist/backtest.js.map +1 -0
- package/modules/totalfinance/dist/calendars.d.ts +3 -0
- package/modules/totalfinance/dist/calendars.d.ts.map +1 -0
- package/modules/totalfinance/dist/calendars.js +3 -0
- package/modules/totalfinance/dist/calendars.js.map +1 -0
- package/modules/totalfinance/dist/commodities.d.ts +2 -0
- package/modules/totalfinance/dist/commodities.d.ts.map +1 -0
- package/modules/totalfinance/dist/commodities.js +2 -0
- package/modules/totalfinance/dist/commodities.js.map +1 -0
- package/modules/totalfinance/dist/core.d.ts +3 -0
- package/modules/totalfinance/dist/core.d.ts.map +1 -0
- package/modules/totalfinance/dist/core.js +3 -0
- package/modules/totalfinance/dist/core.js.map +1 -0
- package/modules/totalfinance/dist/crypto.d.ts +3 -0
- package/modules/totalfinance/dist/crypto.d.ts.map +1 -0
- package/modules/totalfinance/dist/crypto.js +3 -0
- package/modules/totalfinance/dist/crypto.js.map +1 -0
- package/modules/totalfinance/dist/fixed-income.d.ts +3 -0
- package/modules/totalfinance/dist/fixed-income.d.ts.map +1 -0
- package/modules/totalfinance/dist/fixed-income.js +3 -0
- package/modules/totalfinance/dist/fixed-income.js.map +1 -0
- package/modules/totalfinance/dist/foreign-exchange.d.ts +2 -0
- package/modules/totalfinance/dist/foreign-exchange.d.ts.map +1 -0
- package/modules/totalfinance/dist/foreign-exchange.js +2 -0
- package/modules/totalfinance/dist/foreign-exchange.js.map +1 -0
- package/modules/totalfinance/dist/fundamentals.d.ts +3 -0
- package/modules/totalfinance/dist/fundamentals.d.ts.map +1 -0
- package/modules/totalfinance/dist/fundamentals.js +3 -0
- package/modules/totalfinance/dist/fundamentals.js.map +1 -0
- package/modules/totalfinance/dist/index.d.ts +90 -0
- package/modules/totalfinance/dist/index.d.ts.map +1 -0
- package/modules/totalfinance/dist/index.js +68 -0
- package/modules/totalfinance/dist/index.js.map +1 -0
- package/modules/totalfinance/dist/math.d.ts +3 -0
- package/modules/totalfinance/dist/math.d.ts.map +1 -0
- package/modules/totalfinance/dist/math.js +3 -0
- package/modules/totalfinance/dist/math.js.map +1 -0
- package/modules/totalfinance/dist/options.d.ts +3 -0
- package/modules/totalfinance/dist/options.d.ts.map +1 -0
- package/modules/totalfinance/dist/options.js +3 -0
- package/modules/totalfinance/dist/options.js.map +1 -0
- package/modules/totalfinance/dist/performance.d.ts +3 -0
- package/modules/totalfinance/dist/performance.d.ts.map +1 -0
- package/modules/totalfinance/dist/performance.js +3 -0
- package/modules/totalfinance/dist/performance.js.map +1 -0
- package/modules/totalfinance/dist/portfolio.d.ts +2 -0
- package/modules/totalfinance/dist/portfolio.d.ts.map +1 -0
- package/modules/totalfinance/dist/portfolio.js +2 -0
- package/modules/totalfinance/dist/portfolio.js.map +1 -0
- package/modules/totalfinance/dist/research.d.ts +2 -0
- package/modules/totalfinance/dist/research.d.ts.map +1 -0
- package/modules/totalfinance/dist/research.js +2 -0
- package/modules/totalfinance/dist/research.js.map +1 -0
- package/modules/totalfinance/dist/risk.d.ts +3 -0
- package/modules/totalfinance/dist/risk.d.ts.map +1 -0
- package/modules/totalfinance/dist/risk.js +3 -0
- package/modules/totalfinance/dist/risk.js.map +1 -0
- package/modules/totalfinance/dist/scenarios.d.ts +2 -0
- package/modules/totalfinance/dist/scenarios.d.ts.map +1 -0
- package/modules/totalfinance/dist/scenarios.js +2 -0
- package/modules/totalfinance/dist/scenarios.js.map +1 -0
- package/modules/totalfinance/dist/strategy.d.ts +3 -0
- package/modules/totalfinance/dist/strategy.d.ts.map +1 -0
- package/modules/totalfinance/dist/strategy.js +3 -0
- package/modules/totalfinance/dist/strategy.js.map +1 -0
- package/modules/totalfinance/dist/structure.d.ts +3 -0
- package/modules/totalfinance/dist/structure.d.ts.map +1 -0
- package/modules/totalfinance/dist/structure.js +3 -0
- package/modules/totalfinance/dist/structure.js.map +1 -0
- package/modules/totalfinance/dist/technical-analysis.d.ts +3 -0
- package/modules/totalfinance/dist/technical-analysis.d.ts.map +1 -0
- package/modules/totalfinance/dist/technical-analysis.js +3 -0
- package/modules/totalfinance/dist/technical-analysis.js.map +1 -0
- package/modules/totalfinance/dist/valuation.d.ts +3 -0
- package/modules/totalfinance/dist/valuation.d.ts.map +1 -0
- package/modules/totalfinance/dist/valuation.js +3 -0
- package/modules/totalfinance/dist/valuation.js.map +1 -0
- package/modules/totalfinance/dist/volatility.d.ts +3 -0
- package/modules/totalfinance/dist/volatility.d.ts.map +1 -0
- package/modules/totalfinance/dist/volatility.js +3 -0
- package/modules/totalfinance/dist/volatility.js.map +1 -0
- package/modules/totalfinance/etc/totalfinance.api.md +73 -0
- package/modules/totalfinance/src/backtest.ts +2 -0
- package/modules/totalfinance/src/calendars.ts +2 -0
- package/modules/totalfinance/src/commodities.ts +1 -0
- package/modules/totalfinance/src/core.ts +2 -0
- package/modules/totalfinance/src/crypto.ts +2 -0
- package/modules/totalfinance/src/fixed-income.ts +2 -0
- package/modules/totalfinance/src/foreign-exchange.ts +1 -0
- package/modules/totalfinance/src/fundamentals.ts +2 -0
- package/modules/totalfinance/src/index.ts +129 -0
- package/modules/totalfinance/src/math.ts +2 -0
- package/modules/totalfinance/src/options.ts +2 -0
- package/modules/totalfinance/src/performance.ts +2 -0
- package/modules/totalfinance/src/portfolio.ts +1 -0
- package/modules/totalfinance/src/research.ts +1 -0
- package/modules/totalfinance/src/risk.ts +2 -0
- package/modules/totalfinance/src/scenarios.ts +1 -0
- package/modules/totalfinance/src/strategy.ts +2 -0
- package/modules/totalfinance/src/structure.ts +2 -0
- package/modules/totalfinance/src/technical-analysis.ts +2 -0
- package/modules/totalfinance/src/valuation.ts +2 -0
- package/modules/totalfinance/src/volatility.ts +2 -0
- package/modules/valuation/dist/adjusted-present-value.d.ts +62 -0
- package/modules/valuation/dist/adjusted-present-value.d.ts.map +1 -0
- package/modules/valuation/dist/adjusted-present-value.js +85 -0
- package/modules/valuation/dist/adjusted-present-value.js.map +1 -0
- package/modules/valuation/dist/capital-budgeting.d.ts +84 -0
- package/modules/valuation/dist/capital-budgeting.d.ts.map +1 -0
- package/modules/valuation/dist/capital-budgeting.js +204 -0
- package/modules/valuation/dist/capital-budgeting.js.map +1 -0
- package/modules/valuation/dist/cash-flows.d.ts +11 -0
- package/modules/valuation/dist/cash-flows.d.ts.map +1 -0
- package/modules/valuation/dist/cash-flows.js +10 -0
- package/modules/valuation/dist/cash-flows.js.map +1 -0
- package/modules/valuation/dist/comparable.d.ts +101 -0
- package/modules/valuation/dist/comparable.d.ts.map +1 -0
- package/modules/valuation/dist/comparable.js +194 -0
- package/modules/valuation/dist/comparable.js.map +1 -0
- package/modules/valuation/dist/corporate-primitives.d.ts +185 -0
- package/modules/valuation/dist/corporate-primitives.d.ts.map +1 -0
- package/modules/valuation/dist/corporate-primitives.js +337 -0
- package/modules/valuation/dist/corporate-primitives.js.map +1 -0
- package/modules/valuation/dist/corporate.d.ts +14 -0
- package/modules/valuation/dist/corporate.d.ts.map +1 -0
- package/modules/valuation/dist/corporate.js +13 -0
- package/modules/valuation/dist/corporate.js.map +1 -0
- package/modules/valuation/dist/discounted-cash-flow.d.ts +269 -0
- package/modules/valuation/dist/discounted-cash-flow.d.ts.map +1 -0
- package/modules/valuation/dist/discounted-cash-flow.js +611 -0
- package/modules/valuation/dist/discounted-cash-flow.js.map +1 -0
- package/modules/valuation/dist/discounting.d.ts +124 -0
- package/modules/valuation/dist/discounting.d.ts.map +1 -0
- package/modules/valuation/dist/discounting.js +235 -0
- package/modules/valuation/dist/discounting.js.map +1 -0
- package/modules/valuation/dist/equity-valuation.d.ts +104 -0
- package/modules/valuation/dist/equity-valuation.d.ts.map +1 -0
- package/modules/valuation/dist/equity-valuation.js +164 -0
- package/modules/valuation/dist/equity-valuation.js.map +1 -0
- package/modules/valuation/dist/flows.d.ts +30 -0
- package/modules/valuation/dist/flows.d.ts.map +1 -0
- package/modules/valuation/dist/flows.js +77 -0
- package/modules/valuation/dist/flows.js.map +1 -0
- package/modules/valuation/dist/forecasting.d.ts +205 -0
- package/modules/valuation/dist/forecasting.d.ts.map +1 -0
- package/modules/valuation/dist/forecasting.js +359 -0
- package/modules/valuation/dist/forecasting.js.map +1 -0
- package/modules/valuation/dist/index.d.ts +9 -0
- package/modules/valuation/dist/index.d.ts.map +1 -0
- package/modules/valuation/dist/index.js +10 -0
- package/modules/valuation/dist/index.js.map +1 -0
- package/modules/valuation/dist/leveraged-buyout.d.ts +160 -0
- package/modules/valuation/dist/leveraged-buyout.d.ts.map +1 -0
- package/modules/valuation/dist/leveraged-buyout.js +326 -0
- package/modules/valuation/dist/leveraged-buyout.js.map +1 -0
- package/modules/valuation/dist/loans.d.ts +148 -0
- package/modules/valuation/dist/loans.d.ts.map +1 -0
- package/modules/valuation/dist/loans.js +518 -0
- package/modules/valuation/dist/loans.js.map +1 -0
- package/modules/valuation/dist/probabilistic.d.ts +88 -0
- package/modules/valuation/dist/probabilistic.d.ts.map +1 -0
- package/modules/valuation/dist/probabilistic.js +239 -0
- package/modules/valuation/dist/probabilistic.js.map +1 -0
- package/modules/valuation/dist/solvers.d.ts +90 -0
- package/modules/valuation/dist/solvers.d.ts.map +1 -0
- package/modules/valuation/dist/solvers.js +238 -0
- package/modules/valuation/dist/solvers.js.map +1 -0
- package/modules/valuation/etc/valuation.api.md +162 -0
- package/modules/valuation/src/adjusted-present-value.ts +181 -0
- package/modules/valuation/src/capital-budgeting.ts +329 -0
- package/modules/valuation/src/cash-flows.ts +11 -0
- package/modules/valuation/src/comparable.ts +340 -0
- package/modules/valuation/src/corporate-primitives.ts +665 -0
- package/modules/valuation/src/corporate.ts +36 -0
- package/modules/valuation/src/discounted-cash-flow.ts +1083 -0
- package/modules/valuation/src/discounting.ts +437 -0
- package/modules/valuation/src/equity-valuation.ts +313 -0
- package/modules/valuation/src/flows.ts +144 -0
- package/modules/valuation/src/forecasting.ts +666 -0
- package/modules/valuation/src/index.ts +10 -0
- package/modules/valuation/src/leveraged-buyout.ts +560 -0
- package/modules/valuation/src/loans.ts +778 -0
- package/modules/valuation/src/probabilistic.ts +438 -0
- package/modules/valuation/src/solvers.ts +397 -0
- package/modules/volatility/dist/analytics.d.ts +133 -0
- package/modules/volatility/dist/analytics.d.ts.map +1 -0
- package/modules/volatility/dist/analytics.js +320 -0
- package/modules/volatility/dist/analytics.js.map +1 -0
- package/modules/volatility/dist/arbitrage.d.ts +118 -0
- package/modules/volatility/dist/arbitrage.d.ts.map +1 -0
- package/modules/volatility/dist/arbitrage.js +397 -0
- package/modules/volatility/dist/arbitrage.js.map +1 -0
- package/modules/volatility/dist/artifacts.d.ts +24 -0
- package/modules/volatility/dist/artifacts.d.ts.map +1 -0
- package/modules/volatility/dist/artifacts.js +22 -0
- package/modules/volatility/dist/artifacts.js.map +1 -0
- package/modules/volatility/dist/calibration-limits.d.ts +13 -0
- package/modules/volatility/dist/calibration-limits.d.ts.map +1 -0
- package/modules/volatility/dist/calibration-limits.js +46 -0
- package/modules/volatility/dist/calibration-limits.js.map +1 -0
- package/modules/volatility/dist/calibration-start.d.ts +13 -0
- package/modules/volatility/dist/calibration-start.d.ts.map +1 -0
- package/modules/volatility/dist/calibration-start.js +55 -0
- package/modules/volatility/dist/calibration-start.js.map +1 -0
- package/modules/volatility/dist/earnings.d.ts +152 -0
- package/modules/volatility/dist/earnings.d.ts.map +1 -0
- package/modules/volatility/dist/earnings.js +340 -0
- package/modules/volatility/dist/earnings.js.map +1 -0
- package/modules/volatility/dist/essvi.d.ts +115 -0
- package/modules/volatility/dist/essvi.d.ts.map +1 -0
- package/modules/volatility/dist/essvi.js +362 -0
- package/modules/volatility/dist/essvi.js.map +1 -0
- package/modules/volatility/dist/estimate.d.ts +14 -0
- package/modules/volatility/dist/estimate.d.ts.map +1 -0
- package/modules/volatility/dist/estimate.js +18 -0
- package/modules/volatility/dist/estimate.js.map +1 -0
- package/modules/volatility/dist/event.d.ts +155 -0
- package/modules/volatility/dist/event.d.ts.map +1 -0
- package/modules/volatility/dist/event.js +319 -0
- package/modules/volatility/dist/event.js.map +1 -0
- package/modules/volatility/dist/fitted-model-artifacts.d.ts +378 -0
- package/modules/volatility/dist/fitted-model-artifacts.d.ts.map +1 -0
- package/modules/volatility/dist/fitted-model-artifacts.js +1139 -0
- package/modules/volatility/dist/fitted-model-artifacts.js.map +1 -0
- package/modules/volatility/dist/fitted-model-families.d.ts +287 -0
- package/modules/volatility/dist/fitted-model-families.d.ts.map +1 -0
- package/modules/volatility/dist/fitted-model-families.js +1251 -0
- package/modules/volatility/dist/fitted-model-families.js.map +1 -0
- package/modules/volatility/dist/forecast.d.ts +195 -0
- package/modules/volatility/dist/forecast.d.ts.map +1 -0
- package/modules/volatility/dist/forecast.js +493 -0
- package/modules/volatility/dist/forecast.js.map +1 -0
- package/modules/volatility/dist/generated/validation-specs.d.ts +12 -0
- package/modules/volatility/dist/generated/validation-specs.d.ts.map +1 -0
- package/modules/volatility/dist/generated/validation-specs.js +2181 -0
- package/modules/volatility/dist/generated/validation-specs.js.map +1 -0
- package/modules/volatility/dist/heston-surface.d.ts +67 -0
- package/modules/volatility/dist/heston-surface.d.ts.map +1 -0
- package/modules/volatility/dist/heston-surface.js +135 -0
- package/modules/volatility/dist/heston-surface.js.map +1 -0
- package/modules/volatility/dist/index.d.ts +64 -0
- package/modules/volatility/dist/index.d.ts.map +1 -0
- package/modules/volatility/dist/index.js +68 -0
- package/modules/volatility/dist/index.js.map +1 -0
- package/modules/volatility/dist/local-volatility.d.ts +34 -0
- package/modules/volatility/dist/local-volatility.d.ts.map +1 -0
- package/modules/volatility/dist/local-volatility.js +59 -0
- package/modules/volatility/dist/local-volatility.js.map +1 -0
- package/modules/volatility/dist/metrics.d.ts +41 -0
- package/modules/volatility/dist/metrics.d.ts.map +1 -0
- package/modules/volatility/dist/metrics.js +117 -0
- package/modules/volatility/dist/metrics.js.map +1 -0
- package/modules/volatility/dist/min-variance-delta.d.ts +61 -0
- package/modules/volatility/dist/min-variance-delta.d.ts.map +1 -0
- package/modules/volatility/dist/min-variance-delta.js +101 -0
- package/modules/volatility/dist/min-variance-delta.js.map +1 -0
- package/modules/volatility/dist/observed-skew.d.ts +137 -0
- package/modules/volatility/dist/observed-skew.d.ts.map +1 -0
- package/modules/volatility/dist/observed-skew.js +461 -0
- package/modules/volatility/dist/observed-skew.js.map +1 -0
- package/modules/volatility/dist/otm-strip.d.ts +39 -0
- package/modules/volatility/dist/otm-strip.d.ts.map +1 -0
- package/modules/volatility/dist/otm-strip.js +181 -0
- package/modules/volatility/dist/otm-strip.js.map +1 -0
- package/modules/volatility/dist/risk-reversal.d.ts +89 -0
- package/modules/volatility/dist/risk-reversal.d.ts.map +1 -0
- package/modules/volatility/dist/risk-reversal.js +176 -0
- package/modules/volatility/dist/risk-reversal.js.map +1 -0
- package/modules/volatility/dist/sabr-delta.d.ts +67 -0
- package/modules/volatility/dist/sabr-delta.d.ts.map +1 -0
- package/modules/volatility/dist/sabr-delta.js +153 -0
- package/modules/volatility/dist/sabr-delta.js.map +1 -0
- package/modules/volatility/dist/sabr.d.ts +62 -0
- package/modules/volatility/dist/sabr.d.ts.map +1 -0
- package/modules/volatility/dist/sabr.js +262 -0
- package/modules/volatility/dist/sabr.js.map +1 -0
- package/modules/volatility/dist/skew.d.ts +63 -0
- package/modules/volatility/dist/skew.d.ts.map +1 -0
- package/modules/volatility/dist/skew.js +147 -0
- package/modules/volatility/dist/skew.js.map +1 -0
- package/modules/volatility/dist/ssvi-kernel.d.ts +90 -0
- package/modules/volatility/dist/ssvi-kernel.d.ts.map +1 -0
- package/modules/volatility/dist/ssvi-kernel.js +103 -0
- package/modules/volatility/dist/ssvi-kernel.js.map +1 -0
- package/modules/volatility/dist/ssvi.d.ts +181 -0
- package/modules/volatility/dist/ssvi.d.ts.map +1 -0
- package/modules/volatility/dist/ssvi.js +490 -0
- package/modules/volatility/dist/ssvi.js.map +1 -0
- package/modules/volatility/dist/sticky-regime.d.ts +47 -0
- package/modules/volatility/dist/sticky-regime.d.ts.map +1 -0
- package/modules/volatility/dist/sticky-regime.js +81 -0
- package/modules/volatility/dist/sticky-regime.js.map +1 -0
- package/modules/volatility/dist/surface-pca.d.ts +111 -0
- package/modules/volatility/dist/surface-pca.d.ts.map +1 -0
- package/modules/volatility/dist/surface-pca.js +297 -0
- package/modules/volatility/dist/surface-pca.js.map +1 -0
- package/modules/volatility/dist/surface.d.ts +286 -0
- package/modules/volatility/dist/surface.d.ts.map +1 -0
- package/modules/volatility/dist/surface.js +1105 -0
- package/modules/volatility/dist/surface.js.map +1 -0
- package/modules/volatility/dist/svi.d.ts +133 -0
- package/modules/volatility/dist/svi.d.ts.map +1 -0
- package/modules/volatility/dist/svi.js +491 -0
- package/modules/volatility/dist/svi.js.map +1 -0
- package/modules/volatility/dist/swaption-cube.d.ts +125 -0
- package/modules/volatility/dist/swaption-cube.d.ts.map +1 -0
- package/modules/volatility/dist/swaption-cube.js +334 -0
- package/modules/volatility/dist/swaption-cube.js.map +1 -0
- package/modules/volatility/dist/tail-risk.d.ts +65 -0
- package/modules/volatility/dist/tail-risk.d.ts.map +1 -0
- package/modules/volatility/dist/tail-risk.js +155 -0
- package/modules/volatility/dist/tail-risk.js.map +1 -0
- package/modules/volatility/dist/term.d.ts +121 -0
- package/modules/volatility/dist/term.d.ts.map +1 -0
- package/modules/volatility/dist/term.js +336 -0
- package/modules/volatility/dist/term.js.map +1 -0
- package/modules/volatility/dist/vanna-volga.d.ts +278 -0
- package/modules/volatility/dist/vanna-volga.d.ts.map +1 -0
- package/modules/volatility/dist/vanna-volga.js +833 -0
- package/modules/volatility/dist/vanna-volga.js.map +1 -0
- package/modules/volatility/dist/variance-index.d.ts +101 -0
- package/modules/volatility/dist/variance-index.d.ts.map +1 -0
- package/modules/volatility/dist/variance-index.js +240 -0
- package/modules/volatility/dist/variance-index.js.map +1 -0
- package/modules/volatility/dist/volatility-spot-beta.d.ts +57 -0
- package/modules/volatility/dist/volatility-spot-beta.d.ts.map +1 -0
- package/modules/volatility/dist/volatility-spot-beta.js +136 -0
- package/modules/volatility/dist/volatility-spot-beta.js.map +1 -0
- package/modules/volatility/etc/volatility.api.md +207 -0
- package/modules/volatility/src/analytics.ts +513 -0
- package/modules/volatility/src/arbitrage.ts +561 -0
- package/modules/volatility/src/artifacts.ts +62 -0
- package/modules/volatility/src/calibration-limits.ts +61 -0
- package/modules/volatility/src/calibration-start.ts +79 -0
- package/modules/volatility/src/earnings.ts +548 -0
- package/modules/volatility/src/essvi.ts +528 -0
- package/modules/volatility/src/estimate.ts +21 -0
- package/modules/volatility/src/event.ts +542 -0
- package/modules/volatility/src/fitted-model-artifacts.ts +1844 -0
- package/modules/volatility/src/fitted-model-families.ts +1681 -0
- package/modules/volatility/src/forecast.ts +757 -0
- package/modules/volatility/src/generated/validation-specs.ts +2184 -0
- package/modules/volatility/src/heston-surface.ts +215 -0
- package/modules/volatility/src/index.ts +285 -0
- package/modules/volatility/src/local-volatility.ts +104 -0
- package/modules/volatility/src/metrics.ts +176 -0
- package/modules/volatility/src/min-variance-delta.ts +167 -0
- package/modules/volatility/src/observed-skew.ts +684 -0
- package/modules/volatility/src/otm-strip.ts +234 -0
- package/modules/volatility/src/risk-reversal.ts +316 -0
- package/modules/volatility/src/sabr-delta.ts +238 -0
- package/modules/volatility/src/sabr.ts +375 -0
- package/modules/volatility/src/skew.ts +244 -0
- package/modules/volatility/src/ssvi-kernel.ts +134 -0
- package/modules/volatility/src/ssvi.ts +707 -0
- package/modules/volatility/src/sticky-regime.ts +150 -0
- package/modules/volatility/src/surface-pca.ts +439 -0
- package/modules/volatility/src/surface.ts +1499 -0
- package/modules/volatility/src/svi.ts +687 -0
- package/modules/volatility/src/swaption-cube.ts +539 -0
- package/modules/volatility/src/tail-risk.ts +254 -0
- package/modules/volatility/src/term.ts +587 -0
- package/modules/volatility/src/vanna-volga.ts +1337 -0
- package/modules/volatility/src/variance-index.ts +396 -0
- package/modules/volatility/src/volatility-spot-beta.ts +252 -0
- package/modules/workflows/dist/capabilities.d.ts +8 -0
- package/modules/workflows/dist/capabilities.d.ts.map +1 -0
- package/modules/workflows/dist/capabilities.js +50 -0
- package/modules/workflows/dist/capabilities.js.map +1 -0
- package/modules/workflows/dist/envelope-schema.d.ts +36 -0
- package/modules/workflows/dist/envelope-schema.d.ts.map +1 -0
- package/modules/workflows/dist/envelope-schema.js +152 -0
- package/modules/workflows/dist/envelope-schema.js.map +1 -0
- package/modules/workflows/dist/index.d.ts +33 -0
- package/modules/workflows/dist/index.d.ts.map +1 -0
- package/modules/workflows/dist/index.js +27 -0
- package/modules/workflows/dist/index.js.map +1 -0
- package/modules/workflows/dist/json-safe.d.ts +7 -0
- package/modules/workflows/dist/json-safe.d.ts.map +1 -0
- package/modules/workflows/dist/json-safe.js +23 -0
- package/modules/workflows/dist/json-safe.js.map +1 -0
- package/modules/workflows/dist/local/file-lock.d.ts +23 -0
- package/modules/workflows/dist/local/file-lock.d.ts.map +1 -0
- package/modules/workflows/dist/local/file-lock.js +198 -0
- package/modules/workflows/dist/local/file-lock.js.map +1 -0
- package/modules/workflows/dist/local/file-stores.d.ts +33 -0
- package/modules/workflows/dist/local/file-stores.d.ts.map +1 -0
- package/modules/workflows/dist/local/file-stores.js +376 -0
- package/modules/workflows/dist/local/file-stores.js.map +1 -0
- package/modules/workflows/dist/local/index.d.ts +15 -0
- package/modules/workflows/dist/local/index.d.ts.map +1 -0
- package/modules/workflows/dist/local/index.js +12 -0
- package/modules/workflows/dist/local/index.js.map +1 -0
- package/modules/workflows/dist/local/job-worker.d.ts +28 -0
- package/modules/workflows/dist/local/job-worker.d.ts.map +1 -0
- package/modules/workflows/dist/local/job-worker.js +56 -0
- package/modules/workflows/dist/local/job-worker.js.map +1 -0
- package/modules/workflows/dist/local/jobs.d.ts +51 -0
- package/modules/workflows/dist/local/jobs.d.ts.map +1 -0
- package/modules/workflows/dist/local/jobs.js +313 -0
- package/modules/workflows/dist/local/jobs.js.map +1 -0
- package/modules/workflows/dist/local/local-runner.d.ts +39 -0
- package/modules/workflows/dist/local/local-runner.d.ts.map +1 -0
- package/modules/workflows/dist/local/local-runner.js +102 -0
- package/modules/workflows/dist/local/local-runner.js.map +1 -0
- package/modules/workflows/dist/local/profiles.d.ts +27 -0
- package/modules/workflows/dist/local/profiles.d.ts.map +1 -0
- package/modules/workflows/dist/local/profiles.js +77 -0
- package/modules/workflows/dist/local/profiles.js.map +1 -0
- package/modules/workflows/dist/operation-kit.d.ts +10 -0
- package/modules/workflows/dist/operation-kit.d.ts.map +1 -0
- package/modules/workflows/dist/operation-kit.js +193 -0
- package/modules/workflows/dist/operation-kit.js.map +1 -0
- package/modules/workflows/dist/operation.d.ts +210 -0
- package/modules/workflows/dist/operation.d.ts.map +1 -0
- package/modules/workflows/dist/operation.js +255 -0
- package/modules/workflows/dist/operation.js.map +1 -0
- package/modules/workflows/dist/operations-analysis.d.ts +188 -0
- package/modules/workflows/dist/operations-analysis.d.ts.map +1 -0
- package/modules/workflows/dist/operations-analysis.js +908 -0
- package/modules/workflows/dist/operations-analysis.js.map +1 -0
- package/modules/workflows/dist/operations-compute.d.ts +21 -0
- package/modules/workflows/dist/operations-compute.d.ts.map +1 -0
- package/modules/workflows/dist/operations-compute.js +1227 -0
- package/modules/workflows/dist/operations-compute.js.map +1 -0
- package/modules/workflows/dist/operations-journey.d.ts +27 -0
- package/modules/workflows/dist/operations-journey.d.ts.map +1 -0
- package/modules/workflows/dist/operations-journey.js +2445 -0
- package/modules/workflows/dist/operations-journey.js.map +1 -0
- package/modules/workflows/dist/operations-trade.d.ts +3 -0
- package/modules/workflows/dist/operations-trade.d.ts.map +1 -0
- package/modules/workflows/dist/operations-trade.js +648 -0
- package/modules/workflows/dist/operations-trade.js.map +1 -0
- package/modules/workflows/dist/preview.d.ts +16 -0
- package/modules/workflows/dist/preview.d.ts.map +1 -0
- package/modules/workflows/dist/preview.js +30 -0
- package/modules/workflows/dist/preview.js.map +1 -0
- package/modules/workflows/dist/registry.d.ts +26 -0
- package/modules/workflows/dist/registry.d.ts.map +1 -0
- package/modules/workflows/dist/registry.js +110 -0
- package/modules/workflows/dist/registry.js.map +1 -0
- package/modules/workflows/dist/runtime.d.ts +76 -0
- package/modules/workflows/dist/runtime.d.ts.map +1 -0
- package/modules/workflows/dist/runtime.js +445 -0
- package/modules/workflows/dist/runtime.js.map +1 -0
- package/modules/workflows/dist/stores-trade.d.ts +101 -0
- package/modules/workflows/dist/stores-trade.d.ts.map +1 -0
- package/modules/workflows/dist/stores-trade.js +275 -0
- package/modules/workflows/dist/stores-trade.js.map +1 -0
- package/modules/workflows/dist/stores.d.ts +109 -0
- package/modules/workflows/dist/stores.d.ts.map +1 -0
- package/modules/workflows/dist/stores.js +393 -0
- package/modules/workflows/dist/stores.js.map +1 -0
- package/modules/workflows/dist/trade-wire-common-schemas.d.ts +57 -0
- package/modules/workflows/dist/trade-wire-common-schemas.d.ts.map +1 -0
- package/modules/workflows/dist/trade-wire-common-schemas.js +286 -0
- package/modules/workflows/dist/trade-wire-common-schemas.js.map +1 -0
- package/modules/workflows/dist/trade-wire-ledger-schemas.d.ts +102 -0
- package/modules/workflows/dist/trade-wire-ledger-schemas.d.ts.map +1 -0
- package/modules/workflows/dist/trade-wire-ledger-schemas.js +321 -0
- package/modules/workflows/dist/trade-wire-ledger-schemas.js.map +1 -0
- package/modules/workflows/dist/trade-wire-market-schemas.d.ts +5 -0
- package/modules/workflows/dist/trade-wire-market-schemas.d.ts.map +1 -0
- package/modules/workflows/dist/trade-wire-market-schemas.js +84 -0
- package/modules/workflows/dist/trade-wire-market-schemas.js.map +1 -0
- package/modules/workflows/dist/trade-wire-schemas.d.ts +1134 -0
- package/modules/workflows/dist/trade-wire-schemas.d.ts.map +1 -0
- package/modules/workflows/dist/trade-wire-schemas.js +755 -0
- package/modules/workflows/dist/trade-wire-schemas.js.map +1 -0
- package/modules/workflows/dist/version.d.ts +3 -0
- package/modules/workflows/dist/version.d.ts.map +1 -0
- package/modules/workflows/dist/version.js +3 -0
- package/modules/workflows/dist/version.js.map +1 -0
- package/modules/workflows/dist/wire-schemas.d.ts +84 -0
- package/modules/workflows/dist/wire-schemas.d.ts.map +1 -0
- package/modules/workflows/dist/wire-schemas.js +88 -0
- package/modules/workflows/dist/wire-schemas.js.map +1 -0
- package/modules/workflows/etc/workflows.api.md +95 -0
- package/modules/workflows/src/capabilities.ts +67 -0
- package/modules/workflows/src/envelope-schema.ts +170 -0
- package/modules/workflows/src/index.ts +118 -0
- package/modules/workflows/src/json-safe.ts +19 -0
- package/modules/workflows/src/local/file-lock.ts +200 -0
- package/modules/workflows/src/local/file-stores.ts +452 -0
- package/modules/workflows/src/local/index.ts +20 -0
- package/modules/workflows/src/local/job-worker.ts +74 -0
- package/modules/workflows/src/local/jobs.ts +458 -0
- package/modules/workflows/src/local/local-runner.ts +170 -0
- package/modules/workflows/src/local/profiles.ts +113 -0
- package/modules/workflows/src/operation-kit.ts +234 -0
- package/modules/workflows/src/operation.ts +607 -0
- package/modules/workflows/src/operations-analysis.ts +1058 -0
- package/modules/workflows/src/operations-compute.ts +1458 -0
- package/modules/workflows/src/operations-journey.ts +2744 -0
- package/modules/workflows/src/operations-trade.ts +946 -0
- package/modules/workflows/src/preview.ts +34 -0
- package/modules/workflows/src/registry.ts +150 -0
- package/modules/workflows/src/runtime.ts +633 -0
- package/modules/workflows/src/stores-trade.ts +463 -0
- package/modules/workflows/src/stores.ts +608 -0
- package/modules/workflows/src/trade-wire-common-schemas.ts +337 -0
- package/modules/workflows/src/trade-wire-ledger-schemas.ts +359 -0
- package/modules/workflows/src/trade-wire-market-schemas.ts +103 -0
- package/modules/workflows/src/trade-wire-schemas.ts +906 -0
- package/modules/workflows/src/version.ts +2 -0
- package/modules/workflows/src/wire-schemas.ts +100 -0
- package/package.json +1008 -0
|
@@ -0,0 +1,2348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Modern momentum / oscillator coverage (spec §13.3; pandas-ta parity) — part 1.
|
|
3
|
+
*
|
|
4
|
+
* bias, CFO, forecast oscillator, Coppock, CTI, efficiency ratio, center of gravity, psychological
|
|
5
|
+
* line, slope, PVO, Elder Ray, BRAR, KDJ, RVGI, PGO, TRIX histogram, SMI Ergodic, volume-weighted
|
|
6
|
+
* MACD. Each composes the proven base streams and is a serializable batch+stream facade. (RSI, MACD,
|
|
7
|
+
* Stochastic and the Phase-4 oscillators live in their own modules; the harder cycle-style oscillators
|
|
8
|
+
* — QQE, RSX, Schaff, Laguerre, TD Sequential, Squeeze — land in the next slice.)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as builtinMetadata from './builtin-metadata.js';
|
|
12
|
+
import { withBuiltinMetadata } from './indicator-metadata.js';
|
|
13
|
+
import {
|
|
14
|
+
ErrorCode,
|
|
15
|
+
InputError,
|
|
16
|
+
requireArgumentObject,
|
|
17
|
+
requireFiniteFields,
|
|
18
|
+
} from '@totalfinance/core';
|
|
19
|
+
import {
|
|
20
|
+
type BarInput,
|
|
21
|
+
type IndicatorStream,
|
|
22
|
+
type TechnicalAnalysisSnapshot,
|
|
23
|
+
makeIndicator,
|
|
24
|
+
snapshotOf,
|
|
25
|
+
readSnapshot,
|
|
26
|
+
} from './framework.js';
|
|
27
|
+
import { type MacdPoint } from './macd.js';
|
|
28
|
+
import { EmaStream, SmaStream, VwmaStream, WmaStream } from './moving-averages.js';
|
|
29
|
+
import { RocStream, TrixStream, TsiStream } from './oscillators.js';
|
|
30
|
+
import { RsiStream } from './rsi.js';
|
|
31
|
+
import { LinregStream } from './trend.js';
|
|
32
|
+
import { RviStream } from './volatility.js';
|
|
33
|
+
import { dirtyRows, dirtySamples, isDirtySample } from './nan-policy.js';
|
|
34
|
+
import { requireInRange, requirePeriod, requirePositive } from './validate.js';
|
|
35
|
+
import { requireStreamParameters } from './stream-validation.js';
|
|
36
|
+
|
|
37
|
+
const nan = (): number => NaN;
|
|
38
|
+
|
|
39
|
+
// ───────────────────────── bias ─────────────────────────
|
|
40
|
+
|
|
41
|
+
export interface PeriodParameters {
|
|
42
|
+
period: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
class BiasStream implements IndicatorStream<number, number> {
|
|
46
|
+
private sma: SmaStream;
|
|
47
|
+
value: number | null = null;
|
|
48
|
+
constructor(period: number) {
|
|
49
|
+
requirePeriod(period, 'BiasStream');
|
|
50
|
+
this.sma = new SmaStream(period);
|
|
51
|
+
}
|
|
52
|
+
next(value: number): number | null {
|
|
53
|
+
const m = this.sma.next(value);
|
|
54
|
+
this.value = m === null ? null : m === 0 ? NaN : ((value - m) / m) * 100;
|
|
55
|
+
return this.value;
|
|
56
|
+
}
|
|
57
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
58
|
+
return snapshotOf('bias', { sma: this.sma.toJSON(), value: this.value });
|
|
59
|
+
}
|
|
60
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): BiasStream {
|
|
61
|
+
const state = readSnapshot(snapshot, 'bias');
|
|
62
|
+
const x = new BiasStream(1);
|
|
63
|
+
x.sma = SmaStream.fromJSON(state.child('sma'));
|
|
64
|
+
x.value = state.cached<number>('value');
|
|
65
|
+
return x;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const bias = withBuiltinMetadata(
|
|
70
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
71
|
+
(p) => new BiasStream(requirePeriod(p.period ?? 26, 'bias')),
|
|
72
|
+
BiasStream.fromJSON,
|
|
73
|
+
nan,
|
|
74
|
+
),
|
|
75
|
+
builtinMetadata.biasMetadata,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// ───────────────────────── CFO / forecast oscillator ─────────────────────────
|
|
79
|
+
|
|
80
|
+
class LinregOscStream implements IndicatorStream<number, number> {
|
|
81
|
+
private lin: LinregStream;
|
|
82
|
+
value: number | null = null;
|
|
83
|
+
private readonly kind: string;
|
|
84
|
+
private readonly useForecast: boolean;
|
|
85
|
+
constructor(parameters: { period: number; kind: string; useForecast: boolean }) {
|
|
86
|
+
requireStreamParameters('LinregOscStream.constructor#0', 'LinregOscStream', parameters);
|
|
87
|
+
const { period, kind, useForecast } = parameters;
|
|
88
|
+
this.kind = kind;
|
|
89
|
+
this.useForecast = useForecast;
|
|
90
|
+
|
|
91
|
+
this.lin = new LinregStream(period);
|
|
92
|
+
}
|
|
93
|
+
next(value: number): number | null {
|
|
94
|
+
const r = this.lin.next(value);
|
|
95
|
+
if (r === null) {
|
|
96
|
+
this.value = null;
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const ref = this.useForecast ? r.forecast : r.value;
|
|
100
|
+
this.value = value === 0 ? NaN : ((value - ref) / value) * 100;
|
|
101
|
+
return this.value;
|
|
102
|
+
}
|
|
103
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
104
|
+
// `useForecast` is NOT serialized: `LinregOscStream.restore(kind, useForecast)` is bound to it,
|
|
105
|
+
// so a stored copy would be a field nothing reads — change it and the restore ignores you.
|
|
106
|
+
return snapshotOf(this.kind, {
|
|
107
|
+
lin: this.lin.toJSON(),
|
|
108
|
+
value: this.value,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
static restore(kind: string, useForecast: boolean) {
|
|
112
|
+
return (s: TechnicalAnalysisSnapshot): LinregOscStream => {
|
|
113
|
+
const state = readSnapshot(s, kind);
|
|
114
|
+
const x = new LinregOscStream({ period: 1, kind, useForecast });
|
|
115
|
+
x.lin = LinregStream.fromJSON(state.child('lin'));
|
|
116
|
+
x.value = state.cached<number>('value');
|
|
117
|
+
return x;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** Chande Forecast Oscillator: % distance of price from its linear-regression value. */
|
|
123
|
+
export const cfo = withBuiltinMetadata(
|
|
124
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
125
|
+
(p) =>
|
|
126
|
+
new LinregOscStream({
|
|
127
|
+
period: requirePeriod(p.period ?? 14, 'cfo'),
|
|
128
|
+
kind: 'cfo',
|
|
129
|
+
useForecast: false,
|
|
130
|
+
}),
|
|
131
|
+
LinregOscStream.restore('cfo', false),
|
|
132
|
+
nan,
|
|
133
|
+
),
|
|
134
|
+
builtinMetadata.cfoMetadata,
|
|
135
|
+
);
|
|
136
|
+
/** Forecast Oscillator: % distance of price from its time-series forecast (one bar ahead). */
|
|
137
|
+
export const forecastOscillator = withBuiltinMetadata(
|
|
138
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
139
|
+
(p) =>
|
|
140
|
+
new LinregOscStream({
|
|
141
|
+
period: requirePeriod(p.period ?? 14, 'forecastOscillator'),
|
|
142
|
+
kind: 'forecastOscillator',
|
|
143
|
+
useForecast: true,
|
|
144
|
+
}),
|
|
145
|
+
LinregOscStream.restore('forecastOscillator', true),
|
|
146
|
+
nan,
|
|
147
|
+
),
|
|
148
|
+
builtinMetadata.forecastOscillatorMetadata,
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// ───────────────────────── Coppock curve ─────────────────────────
|
|
152
|
+
|
|
153
|
+
export interface CoppockParameters {
|
|
154
|
+
longRoc?: number;
|
|
155
|
+
shortRoc?: number;
|
|
156
|
+
wma?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
class CoppockStream implements IndicatorStream<number, number> {
|
|
160
|
+
private rocLong: RocStream;
|
|
161
|
+
private rocShort: RocStream;
|
|
162
|
+
private wma: WmaStream;
|
|
163
|
+
value: number | null = null;
|
|
164
|
+
constructor(parameters: { longRoc: number; shortRoc: number; wmaPeriod: number }) {
|
|
165
|
+
requireStreamParameters('CoppockStream.constructor#0', 'CoppockStream', parameters);
|
|
166
|
+
const { longRoc, shortRoc, wmaPeriod } = parameters;
|
|
167
|
+
this.rocLong = new RocStream({ period: longRoc, mode: 'roc' });
|
|
168
|
+
this.rocShort = new RocStream({ period: shortRoc, mode: 'roc' });
|
|
169
|
+
this.wma = new WmaStream(wmaPeriod);
|
|
170
|
+
}
|
|
171
|
+
next(value: number): number | null {
|
|
172
|
+
const rl = this.rocLong.next(value);
|
|
173
|
+
const rs = this.rocShort.next(value);
|
|
174
|
+
if (rl === null || rs === null) {
|
|
175
|
+
this.value = null;
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
this.value = this.wma.next(rl + rs);
|
|
179
|
+
return this.value;
|
|
180
|
+
}
|
|
181
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
182
|
+
return snapshotOf('coppock', {
|
|
183
|
+
rocLong: this.rocLong.toJSON(),
|
|
184
|
+
rocShort: this.rocShort.toJSON(),
|
|
185
|
+
wma: this.wma.toJSON(),
|
|
186
|
+
value: this.value,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): CoppockStream {
|
|
190
|
+
const state = readSnapshot(snapshot, 'coppock');
|
|
191
|
+
const x = new CoppockStream({ longRoc: 1, shortRoc: 1, wmaPeriod: 1 });
|
|
192
|
+
x.rocLong = RocStream.restore('roc')(state.child('rocLong'));
|
|
193
|
+
x.rocShort = RocStream.restore('roc')(state.child('rocShort'));
|
|
194
|
+
x.wma = WmaStream.fromJSON(state.child('wma'));
|
|
195
|
+
x.value = state.cached<number>('value');
|
|
196
|
+
return x;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export const coppock = withBuiltinMetadata(
|
|
201
|
+
makeIndicator<CoppockParameters, number, number>(
|
|
202
|
+
(p) =>
|
|
203
|
+
new CoppockStream({
|
|
204
|
+
longRoc: requirePeriod(p.longRoc ?? 14, 'coppock', 'longRoc'),
|
|
205
|
+
shortRoc: requirePeriod(p.shortRoc ?? 11, 'coppock', 'shortRoc'),
|
|
206
|
+
wmaPeriod: requirePeriod(p.wma ?? 10, 'coppock', 'wma'),
|
|
207
|
+
}),
|
|
208
|
+
CoppockStream.fromJSON,
|
|
209
|
+
nan,
|
|
210
|
+
),
|
|
211
|
+
builtinMetadata.coppockMetadata,
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
// ───────────────────────── CTI (correlation trend, Ehlers) ─────────────────────────
|
|
215
|
+
|
|
216
|
+
class CtiStream implements IndicatorStream<number, number> {
|
|
217
|
+
private buf: number[] = [];
|
|
218
|
+
private readonly sumX: number;
|
|
219
|
+
private readonly sumX2: number;
|
|
220
|
+
value: number | null = null;
|
|
221
|
+
constructor(private readonly period: number) {
|
|
222
|
+
requirePeriod(period, 'CtiStream');
|
|
223
|
+
const n = period;
|
|
224
|
+
this.sumX = (n * (n - 1)) / 2;
|
|
225
|
+
this.sumX2 = ((n - 1) * n * (2 * n - 1)) / 6;
|
|
226
|
+
}
|
|
227
|
+
next(value: number): number | null {
|
|
228
|
+
this.buf.push(value);
|
|
229
|
+
if (this.buf.length > this.period) this.buf.shift();
|
|
230
|
+
if (this.buf.length < this.period) {
|
|
231
|
+
this.value = null;
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
const n = this.period;
|
|
235
|
+
let sumY = 0;
|
|
236
|
+
let sumXY = 0;
|
|
237
|
+
let sumY2 = 0;
|
|
238
|
+
for (let i = 0; i < n; i++) {
|
|
239
|
+
const y = this.buf[i]!;
|
|
240
|
+
sumY += y;
|
|
241
|
+
sumXY += i * y;
|
|
242
|
+
sumY2 += y * y;
|
|
243
|
+
}
|
|
244
|
+
const denom = Math.sqrt((n * this.sumX2 - this.sumX * this.sumX) * (n * sumY2 - sumY * sumY));
|
|
245
|
+
this.value = denom === 0 ? 0 : (n * sumXY - this.sumX * sumY) / denom;
|
|
246
|
+
return this.value;
|
|
247
|
+
}
|
|
248
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
249
|
+
return snapshotOf('cti', { period: this.period, buf: [...this.buf], value: this.value });
|
|
250
|
+
}
|
|
251
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): CtiStream {
|
|
252
|
+
const state = readSnapshot(snapshot, 'cti');
|
|
253
|
+
const x = new CtiStream(state.lookback('period'));
|
|
254
|
+
x.buf = state.numbers('buf');
|
|
255
|
+
x.value = state.cached<number>('value');
|
|
256
|
+
return x;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export const cti = withBuiltinMetadata(
|
|
261
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
262
|
+
(p) => new CtiStream(requirePeriod(p.period ?? 12, 'cti')),
|
|
263
|
+
CtiStream.fromJSON,
|
|
264
|
+
nan,
|
|
265
|
+
),
|
|
266
|
+
builtinMetadata.ctiMetadata,
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
// ───────────────────────── efficiency ratio (Kaufman) ─────────────────────────
|
|
270
|
+
|
|
271
|
+
class EfficiencyRatioStream implements IndicatorStream<number, number> {
|
|
272
|
+
private prices: number[] = [];
|
|
273
|
+
private diffs: number[] = [];
|
|
274
|
+
private volatilitySum = 0;
|
|
275
|
+
/** Non-finite samples inside the window — the interior-NaN gate (see `./nan-policy`). */
|
|
276
|
+
private nanCount = 0;
|
|
277
|
+
value: number | null = null;
|
|
278
|
+
constructor(private readonly period: number) {
|
|
279
|
+
requirePeriod(period, 'EfficiencyRatioStream');
|
|
280
|
+
}
|
|
281
|
+
next(value: number): number | null {
|
|
282
|
+
if (this.prices.length > 0) {
|
|
283
|
+
const d = Math.abs(value - this.prices[this.prices.length - 1]!);
|
|
284
|
+
this.diffs.push(d);
|
|
285
|
+
// Interior-NaN policy: only finite deltas enter the running sum.
|
|
286
|
+
if (isDirtySample(d)) this.nanCount++;
|
|
287
|
+
else this.volatilitySum += d;
|
|
288
|
+
if (this.diffs.length > this.period) {
|
|
289
|
+
const gone = this.diffs.shift()!;
|
|
290
|
+
if (isDirtySample(gone)) this.nanCount--;
|
|
291
|
+
else this.volatilitySum -= gone;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
this.prices.push(value);
|
|
295
|
+
if (this.prices.length > this.period + 1) this.prices.shift();
|
|
296
|
+
if (this.diffs.length < this.period) {
|
|
297
|
+
this.value = null;
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
if (this.nanCount > 0) {
|
|
301
|
+
this.value = NaN;
|
|
302
|
+
return this.value;
|
|
303
|
+
}
|
|
304
|
+
const change = Math.abs(value - this.prices[0]!);
|
|
305
|
+
this.value = this.volatilitySum === 0 ? 0 : change / this.volatilitySum;
|
|
306
|
+
return this.value;
|
|
307
|
+
}
|
|
308
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
309
|
+
return snapshotOf('efficiencyRatio', {
|
|
310
|
+
period: this.period,
|
|
311
|
+
prices: [...this.prices],
|
|
312
|
+
diffs: [...this.diffs],
|
|
313
|
+
volatilitySum: this.volatilitySum,
|
|
314
|
+
value: this.value,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): EfficiencyRatioStream {
|
|
318
|
+
const state = readSnapshot(snapshot, 'efficiencyRatio');
|
|
319
|
+
const x = new EfficiencyRatioStream(state.lookback('period'));
|
|
320
|
+
Object.assign(x, { volatilitySum: state.number('volatilitySum') });
|
|
321
|
+
x.prices = state.numbers('prices');
|
|
322
|
+
x.diffs = state.numbers('diffs');
|
|
323
|
+
x.nanCount = dirtySamples(x.diffs);
|
|
324
|
+
x.value = state.cached<number>('value');
|
|
325
|
+
return x;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export const efficiencyRatio = withBuiltinMetadata(
|
|
330
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
331
|
+
(p) => new EfficiencyRatioStream(requirePeriod(p.period ?? 10, 'efficiencyRatio')),
|
|
332
|
+
EfficiencyRatioStream.fromJSON,
|
|
333
|
+
nan,
|
|
334
|
+
),
|
|
335
|
+
builtinMetadata.efficiencyRatioMetadata,
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
// ───────────────────────── center of gravity (Ehlers) ─────────────────────────
|
|
339
|
+
|
|
340
|
+
class CenterOfGravityStream implements IndicatorStream<number, number> {
|
|
341
|
+
private buf: number[] = [];
|
|
342
|
+
value: number | null = null;
|
|
343
|
+
constructor(private readonly period: number) {
|
|
344
|
+
requirePeriod(period, 'CenterOfGravityStream');
|
|
345
|
+
}
|
|
346
|
+
next(value: number): number | null {
|
|
347
|
+
this.buf.push(value);
|
|
348
|
+
if (this.buf.length > this.period) this.buf.shift();
|
|
349
|
+
if (this.buf.length < this.period) {
|
|
350
|
+
this.value = null;
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
const n = this.period;
|
|
354
|
+
let num = 0;
|
|
355
|
+
let den = 0;
|
|
356
|
+
for (let i = 0; i < n; i++) {
|
|
357
|
+
const price = this.buf[n - 1 - i]!; // i bars ago (0 = current)
|
|
358
|
+
num += (1 + i) * price;
|
|
359
|
+
den += price;
|
|
360
|
+
}
|
|
361
|
+
this.value = den === 0 ? 0 : -num / den + (n + 1) / 2;
|
|
362
|
+
return this.value;
|
|
363
|
+
}
|
|
364
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
365
|
+
return snapshotOf('centerOfGravity', {
|
|
366
|
+
period: this.period,
|
|
367
|
+
buf: [...this.buf],
|
|
368
|
+
value: this.value,
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): CenterOfGravityStream {
|
|
372
|
+
const state = readSnapshot(snapshot, 'centerOfGravity');
|
|
373
|
+
const x = new CenterOfGravityStream(state.lookback('period'));
|
|
374
|
+
x.buf = state.numbers('buf');
|
|
375
|
+
x.value = state.cached<number>('value');
|
|
376
|
+
return x;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export const centerOfGravity = withBuiltinMetadata(
|
|
381
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
382
|
+
(p) => new CenterOfGravityStream(requirePeriod(p.period ?? 10, 'centerOfGravity')),
|
|
383
|
+
CenterOfGravityStream.fromJSON,
|
|
384
|
+
nan,
|
|
385
|
+
),
|
|
386
|
+
builtinMetadata.centerOfGravityMetadata,
|
|
387
|
+
);
|
|
388
|
+
|
|
389
|
+
// ───────────────────────── psychological line ─────────────────────────
|
|
390
|
+
|
|
391
|
+
class PsychologicalLineStream implements IndicatorStream<number, number> {
|
|
392
|
+
private prev: number | null = null;
|
|
393
|
+
private ups: number[] = [];
|
|
394
|
+
private sum = 0;
|
|
395
|
+
/** Non-finite samples inside the window — the interior-NaN gate (see `./nan-policy`). */
|
|
396
|
+
private nanCount = 0;
|
|
397
|
+
value: number | null = null;
|
|
398
|
+
constructor(private readonly period: number) {
|
|
399
|
+
requirePeriod(period, 'PsychologicalLineStream');
|
|
400
|
+
}
|
|
401
|
+
next(value: number): number | null {
|
|
402
|
+
if (this.prev === null) {
|
|
403
|
+
this.prev = value;
|
|
404
|
+
this.value = null;
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
// A non-finite bar is not an "up" bar under `>`; recording it as 0 would understate the ratio
|
|
408
|
+
// with no disclosure, so it enters the window as NaN and gates the output instead.
|
|
409
|
+
const bad = isDirtySample(value) || isDirtySample(this.prev);
|
|
410
|
+
const up = bad ? NaN : value > this.prev ? 1 : 0;
|
|
411
|
+
this.prev = value;
|
|
412
|
+
this.ups.push(up);
|
|
413
|
+
if (bad) this.nanCount++;
|
|
414
|
+
else this.sum += up;
|
|
415
|
+
if (this.ups.length > this.period) {
|
|
416
|
+
const gone = this.ups.shift()!;
|
|
417
|
+
if (isDirtySample(gone)) this.nanCount--;
|
|
418
|
+
else this.sum -= gone;
|
|
419
|
+
}
|
|
420
|
+
if (this.ups.length < this.period) {
|
|
421
|
+
this.value = null;
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
if (this.nanCount > 0) {
|
|
425
|
+
this.value = NaN;
|
|
426
|
+
return this.value;
|
|
427
|
+
}
|
|
428
|
+
this.value = (100 * this.sum) / this.period;
|
|
429
|
+
return this.value;
|
|
430
|
+
}
|
|
431
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
432
|
+
return snapshotOf('psychologicalLine', {
|
|
433
|
+
period: this.period,
|
|
434
|
+
prev: this.prev,
|
|
435
|
+
ups: [...this.ups],
|
|
436
|
+
sum: this.sum,
|
|
437
|
+
value: this.value,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): PsychologicalLineStream {
|
|
441
|
+
const state = readSnapshot(snapshot, 'psychologicalLine');
|
|
442
|
+
const x = new PsychologicalLineStream(state.lookback('period'));
|
|
443
|
+
Object.assign(x, { prev: state.numberOrNull('prev'), sum: state.number('sum') });
|
|
444
|
+
x.ups = state.numbers('ups');
|
|
445
|
+
x.nanCount = dirtySamples(x.ups);
|
|
446
|
+
x.value = state.cached<number>('value');
|
|
447
|
+
return x;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export const psychologicalLine = withBuiltinMetadata(
|
|
452
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
453
|
+
(p) => new PsychologicalLineStream(requirePeriod(p.period ?? 12, 'psychologicalLine')),
|
|
454
|
+
PsychologicalLineStream.fromJSON,
|
|
455
|
+
nan,
|
|
456
|
+
),
|
|
457
|
+
builtinMetadata.psychologicalLineMetadata,
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
// ───────────────────────── slope (rise / run) ─────────────────────────
|
|
461
|
+
|
|
462
|
+
class SlopeStream implements IndicatorStream<number, number> {
|
|
463
|
+
private buf: number[] = [];
|
|
464
|
+
value: number | null = null;
|
|
465
|
+
constructor(private readonly period: number) {
|
|
466
|
+
requirePeriod(period, 'SlopeStream');
|
|
467
|
+
}
|
|
468
|
+
next(value: number): number | null {
|
|
469
|
+
this.buf.push(value);
|
|
470
|
+
if (this.buf.length > this.period + 1) this.buf.shift();
|
|
471
|
+
if (this.buf.length < this.period + 1) {
|
|
472
|
+
this.value = null;
|
|
473
|
+
return null;
|
|
474
|
+
}
|
|
475
|
+
this.value = (value - this.buf[0]!) / this.period;
|
|
476
|
+
return this.value;
|
|
477
|
+
}
|
|
478
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
479
|
+
return snapshotOf('slope', { period: this.period, buf: [...this.buf], value: this.value });
|
|
480
|
+
}
|
|
481
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SlopeStream {
|
|
482
|
+
const state = readSnapshot(snapshot, 'slope');
|
|
483
|
+
const x = new SlopeStream(state.lookback('period'));
|
|
484
|
+
x.buf = state.numbers('buf');
|
|
485
|
+
x.value = state.cached<number>('value');
|
|
486
|
+
return x;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export const slope = withBuiltinMetadata(
|
|
491
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
492
|
+
(p) => new SlopeStream(requirePeriod(p.period ?? 1, 'slope')),
|
|
493
|
+
SlopeStream.fromJSON,
|
|
494
|
+
nan,
|
|
495
|
+
),
|
|
496
|
+
builtinMetadata.slopeMetadata,
|
|
497
|
+
);
|
|
498
|
+
|
|
499
|
+
// ───────────────────────── PVO (percentage volume oscillator) ─────────────────────────
|
|
500
|
+
|
|
501
|
+
export interface PvoParameters {
|
|
502
|
+
fast?: number;
|
|
503
|
+
slow?: number;
|
|
504
|
+
signal?: number;
|
|
505
|
+
}
|
|
506
|
+
export interface PvoPoint {
|
|
507
|
+
pvo: number;
|
|
508
|
+
signal: number;
|
|
509
|
+
histogram: number;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
class PvoStream implements IndicatorStream<BarInput, PvoPoint> {
|
|
513
|
+
private fast: EmaStream;
|
|
514
|
+
private slow: EmaStream;
|
|
515
|
+
private signalEma: EmaStream;
|
|
516
|
+
value: PvoPoint | null = null;
|
|
517
|
+
constructor(parameters: { fast: number; slow: number; signal: number }) {
|
|
518
|
+
requireStreamParameters('PvoStream.constructor#0', 'PvoStream', parameters);
|
|
519
|
+
const { fast, slow, signal } = parameters;
|
|
520
|
+
this.fast = new EmaStream(fast);
|
|
521
|
+
this.slow = new EmaStream(slow);
|
|
522
|
+
this.signalEma = new EmaStream(signal);
|
|
523
|
+
}
|
|
524
|
+
next(bar: BarInput): PvoPoint | null {
|
|
525
|
+
const volume = bar.volume ?? 0;
|
|
526
|
+
const f = this.fast.next(volume);
|
|
527
|
+
const s = this.slow.next(volume);
|
|
528
|
+
if (f === null || s === null || s === 0) {
|
|
529
|
+
this.value = null;
|
|
530
|
+
return null;
|
|
531
|
+
}
|
|
532
|
+
const pvo = ((f - s) / s) * 100;
|
|
533
|
+
const sig = this.signalEma.next(pvo);
|
|
534
|
+
if (sig === null) {
|
|
535
|
+
this.value = null;
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
this.value = { pvo, signal: sig, histogram: pvo - sig };
|
|
539
|
+
return this.value;
|
|
540
|
+
}
|
|
541
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
542
|
+
return snapshotOf('pvo', {
|
|
543
|
+
fast: this.fast.toJSON(),
|
|
544
|
+
slow: this.slow.toJSON(),
|
|
545
|
+
signal: this.signalEma.toJSON(),
|
|
546
|
+
value: this.value,
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): PvoStream {
|
|
550
|
+
const state = readSnapshot(snapshot, 'pvo');
|
|
551
|
+
const x = new PvoStream({ fast: 1, slow: 1, signal: 1 });
|
|
552
|
+
x.fast = EmaStream.fromJSON(state.child('fast'));
|
|
553
|
+
x.slow = EmaStream.fromJSON(state.child('slow'));
|
|
554
|
+
x.signalEma = EmaStream.fromJSON(state.child('signal'));
|
|
555
|
+
x.value = state.cached<PvoPoint>('value');
|
|
556
|
+
return x;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export const pvo = withBuiltinMetadata(
|
|
561
|
+
makeIndicator<PvoParameters, BarInput, PvoPoint>(
|
|
562
|
+
(p) =>
|
|
563
|
+
new PvoStream({
|
|
564
|
+
fast: requirePeriod(p.fast ?? 12, 'pvo', 'fast'),
|
|
565
|
+
slow: requirePeriod(p.slow ?? 26, 'pvo', 'slow'),
|
|
566
|
+
signal: requirePeriod(p.signal ?? 9, 'pvo', 'signal'),
|
|
567
|
+
}),
|
|
568
|
+
PvoStream.fromJSON,
|
|
569
|
+
() => ({ pvo: NaN, signal: NaN, histogram: NaN }),
|
|
570
|
+
),
|
|
571
|
+
builtinMetadata.pvoMetadata,
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
// ───────────────────────── Elder Ray ─────────────────────────
|
|
575
|
+
|
|
576
|
+
export interface ElderRayPoint {
|
|
577
|
+
bull: number;
|
|
578
|
+
bear: number;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
class ElderRayStream implements IndicatorStream<BarInput, ElderRayPoint> {
|
|
582
|
+
private ema: EmaStream;
|
|
583
|
+
value: ElderRayPoint | null = null;
|
|
584
|
+
constructor(period: number) {
|
|
585
|
+
requirePeriod(period, 'ElderRayStream');
|
|
586
|
+
this.ema = new EmaStream(period);
|
|
587
|
+
}
|
|
588
|
+
next(bar: BarInput): ElderRayPoint | null {
|
|
589
|
+
const e = this.ema.next(bar.close);
|
|
590
|
+
if (e === null) {
|
|
591
|
+
this.value = null;
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
this.value = { bull: bar.high - e, bear: bar.low - e };
|
|
595
|
+
return this.value;
|
|
596
|
+
}
|
|
597
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
598
|
+
return snapshotOf('elderRay', { ema: this.ema.toJSON(), value: this.value });
|
|
599
|
+
}
|
|
600
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): ElderRayStream {
|
|
601
|
+
const state = readSnapshot(snapshot, 'elderRay');
|
|
602
|
+
const x = new ElderRayStream(1);
|
|
603
|
+
x.ema = EmaStream.fromJSON(state.child('ema'));
|
|
604
|
+
x.value = state.cached<ElderRayPoint>('value');
|
|
605
|
+
return x;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
export const elderRay = withBuiltinMetadata(
|
|
610
|
+
makeIndicator<{ period?: number }, BarInput, ElderRayPoint>(
|
|
611
|
+
(p) => new ElderRayStream(requirePeriod(p.period ?? 13, 'elderRay')),
|
|
612
|
+
ElderRayStream.fromJSON,
|
|
613
|
+
() => ({ bull: NaN, bear: NaN }),
|
|
614
|
+
),
|
|
615
|
+
builtinMetadata.elderRayMetadata,
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
// ───────────────────────── BRAR ─────────────────────────
|
|
619
|
+
|
|
620
|
+
export interface BrarPoint {
|
|
621
|
+
/**
|
|
622
|
+
* AR, the popularity index: `100 · Σ(high − open) / Σ(open − low)` over the window. Measures
|
|
623
|
+
* intraday strength against the open.
|
|
624
|
+
*/
|
|
625
|
+
popularityIndex: number;
|
|
626
|
+
/**
|
|
627
|
+
* BR, the willingness index: `100 · Σmax(0, high − prevClose) / Σmax(0, prevClose − low)`.
|
|
628
|
+
* Measures strength against the PRIOR close, which is what distinguishes it from AR.
|
|
629
|
+
*/
|
|
630
|
+
willingnessIndex: number;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
class BrarStream implements IndicatorStream<BarInput, BrarPoint> {
|
|
634
|
+
private previousClose: number | null = null;
|
|
635
|
+
private hoSum = 0; // Σ(high − open)
|
|
636
|
+
private olSum = 0; // Σ(open − low)
|
|
637
|
+
private hcSum = 0; // Σ(high − previousClose)
|
|
638
|
+
private clSum = 0; // Σ(previousClose − low)
|
|
639
|
+
private ho: number[] = [];
|
|
640
|
+
private ol: number[] = [];
|
|
641
|
+
private hc: number[] = [];
|
|
642
|
+
private cl: number[] = [];
|
|
643
|
+
/** Non-finite rows inside each window — the interior-NaN gate (see `./nan-policy`). */
|
|
644
|
+
private nanHoOl = 0;
|
|
645
|
+
private nanHcCl = 0;
|
|
646
|
+
value: BrarPoint | null = null;
|
|
647
|
+
constructor(private readonly period: number) {
|
|
648
|
+
requirePeriod(period, 'BrarStream', 'period', 1, 'bars');
|
|
649
|
+
}
|
|
650
|
+
next(bar: BarInput): BrarPoint | null {
|
|
651
|
+
const open = bar.open ?? bar.close;
|
|
652
|
+
const ho = bar.high - open;
|
|
653
|
+
const ol = open - bar.low;
|
|
654
|
+
this.ho.push(ho);
|
|
655
|
+
this.ol.push(ol);
|
|
656
|
+
// Interior-NaN policy: only finite rows enter the running sums.
|
|
657
|
+
if (isDirtySample(ho) || isDirtySample(ol)) this.nanHoOl++;
|
|
658
|
+
else {
|
|
659
|
+
this.hoSum += ho;
|
|
660
|
+
this.olSum += ol;
|
|
661
|
+
}
|
|
662
|
+
if (this.previousClose !== null) {
|
|
663
|
+
// `Math.max(0, NaN)` is NaN, so a bad prior close stays visible rather than clamping to 0.
|
|
664
|
+
const hc = Math.max(0, bar.high - this.previousClose);
|
|
665
|
+
const cl = Math.max(0, this.previousClose - bar.low);
|
|
666
|
+
this.hc.push(hc);
|
|
667
|
+
this.cl.push(cl);
|
|
668
|
+
if (isDirtySample(hc) || isDirtySample(cl)) this.nanHcCl++;
|
|
669
|
+
else {
|
|
670
|
+
this.hcSum += hc;
|
|
671
|
+
this.clSum += cl;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
this.previousClose = bar.close;
|
|
675
|
+
if (this.ho.length > this.period) {
|
|
676
|
+
const goneHo = this.ho.shift()!;
|
|
677
|
+
const goneOl = this.ol.shift()!;
|
|
678
|
+
if (isDirtySample(goneHo) || isDirtySample(goneOl)) this.nanHoOl--;
|
|
679
|
+
else {
|
|
680
|
+
this.hoSum -= goneHo;
|
|
681
|
+
this.olSum -= goneOl;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
if (this.hc.length > this.period) {
|
|
685
|
+
const goneHc = this.hc.shift()!;
|
|
686
|
+
const goneCl = this.cl.shift()!;
|
|
687
|
+
if (isDirtySample(goneHc) || isDirtySample(goneCl)) this.nanHcCl--;
|
|
688
|
+
else {
|
|
689
|
+
this.hcSum -= goneHc;
|
|
690
|
+
this.clSum -= goneCl;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (this.ho.length < this.period || this.hc.length < this.period) {
|
|
694
|
+
this.value = null;
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
if (this.nanHoOl > 0 || this.nanHcCl > 0) {
|
|
698
|
+
this.value = { popularityIndex: NaN, willingnessIndex: NaN };
|
|
699
|
+
return this.value;
|
|
700
|
+
}
|
|
701
|
+
this.value = {
|
|
702
|
+
popularityIndex: this.olSum === 0 ? 0 : (100 * this.hoSum) / this.olSum,
|
|
703
|
+
willingnessIndex: this.clSum === 0 ? 0 : (100 * this.hcSum) / this.clSum,
|
|
704
|
+
};
|
|
705
|
+
return this.value;
|
|
706
|
+
}
|
|
707
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
708
|
+
return snapshotOf('brar', {
|
|
709
|
+
period: this.period,
|
|
710
|
+
previousClose: this.previousClose,
|
|
711
|
+
hoSum: this.hoSum,
|
|
712
|
+
olSum: this.olSum,
|
|
713
|
+
hcSum: this.hcSum,
|
|
714
|
+
clSum: this.clSum,
|
|
715
|
+
ho: [...this.ho],
|
|
716
|
+
ol: [...this.ol],
|
|
717
|
+
hc: [...this.hc],
|
|
718
|
+
cl: [...this.cl],
|
|
719
|
+
value: this.value,
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): BrarStream {
|
|
723
|
+
const state = readSnapshot(snapshot, 'brar');
|
|
724
|
+
const x = new BrarStream(state.lookback('period'));
|
|
725
|
+
Object.assign(x, {
|
|
726
|
+
previousClose: state.numberOrNull('previousClose'),
|
|
727
|
+
hoSum: state.number('hoSum'),
|
|
728
|
+
olSum: state.number('olSum'),
|
|
729
|
+
hcSum: state.number('hcSum'),
|
|
730
|
+
clSum: state.number('clSum'),
|
|
731
|
+
});
|
|
732
|
+
x.ho = state.numbers('ho');
|
|
733
|
+
x.ol = state.numbers('ol');
|
|
734
|
+
x.hc = state.numbers('hc');
|
|
735
|
+
x.cl = state.numbers('cl');
|
|
736
|
+
x.nanHoOl = dirtyRows(x.ho, x.ol);
|
|
737
|
+
x.nanHcCl = dirtyRows(x.hc, x.cl);
|
|
738
|
+
x.value = state.cached<BrarPoint>('value');
|
|
739
|
+
return x;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export const brar = withBuiltinMetadata(
|
|
744
|
+
makeIndicator<{ period?: number }, BarInput, BrarPoint>(
|
|
745
|
+
(p) => new BrarStream(requirePeriod(p.period ?? 26, 'brar')),
|
|
746
|
+
BrarStream.fromJSON,
|
|
747
|
+
() => ({ popularityIndex: NaN, willingnessIndex: NaN }),
|
|
748
|
+
),
|
|
749
|
+
builtinMetadata.brarMetadata,
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
// ───────────────────────── KDJ ─────────────────────────
|
|
753
|
+
|
|
754
|
+
export interface KdjParameters {
|
|
755
|
+
period?: number;
|
|
756
|
+
signal?: number;
|
|
757
|
+
}
|
|
758
|
+
export interface KdjPoint {
|
|
759
|
+
k: number;
|
|
760
|
+
d: number;
|
|
761
|
+
j: number;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
class KdjStream implements IndicatorStream<BarInput, KdjPoint> {
|
|
765
|
+
private highs: number[] = [];
|
|
766
|
+
private lows: number[] = [];
|
|
767
|
+
private k: number | null = null;
|
|
768
|
+
private d: number | null = null;
|
|
769
|
+
private readonly alpha: number;
|
|
770
|
+
value: KdjPoint | null = null;
|
|
771
|
+
private readonly period: number;
|
|
772
|
+
constructor(parameters: { period: number; signal: number }) {
|
|
773
|
+
requireStreamParameters('KdjStream.constructor#0', 'KdjStream', parameters);
|
|
774
|
+
const { period, signal } = parameters;
|
|
775
|
+
this.period = period;
|
|
776
|
+
|
|
777
|
+
this.alpha = 1 / signal;
|
|
778
|
+
}
|
|
779
|
+
next(bar: BarInput): KdjPoint | null {
|
|
780
|
+
this.highs.push(bar.high);
|
|
781
|
+
this.lows.push(bar.low);
|
|
782
|
+
if (this.highs.length > this.period) {
|
|
783
|
+
this.highs.shift();
|
|
784
|
+
this.lows.shift();
|
|
785
|
+
}
|
|
786
|
+
if (this.highs.length < this.period) {
|
|
787
|
+
this.value = null;
|
|
788
|
+
return null;
|
|
789
|
+
}
|
|
790
|
+
let hh = this.highs[0]!;
|
|
791
|
+
let ll = this.lows[0]!;
|
|
792
|
+
for (let i = 1; i < this.period; i++) {
|
|
793
|
+
if (this.highs[i]! > hh) hh = this.highs[i]!;
|
|
794
|
+
if (this.lows[i]! < ll) ll = this.lows[i]!;
|
|
795
|
+
}
|
|
796
|
+
const rsv = hh === ll ? 50 : (100 * (bar.close - ll)) / (hh - ll);
|
|
797
|
+
this.k = this.k === null ? rsv : this.k + this.alpha * (rsv - this.k);
|
|
798
|
+
this.d = this.d === null ? this.k : this.d + this.alpha * (this.k - this.d);
|
|
799
|
+
this.value = { k: this.k, d: this.d, j: 3 * this.k - 2 * this.d };
|
|
800
|
+
return this.value;
|
|
801
|
+
}
|
|
802
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
803
|
+
return snapshotOf('kdj', {
|
|
804
|
+
period: this.period,
|
|
805
|
+
alpha: this.alpha,
|
|
806
|
+
highs: [...this.highs],
|
|
807
|
+
lows: [...this.lows],
|
|
808
|
+
k: this.k,
|
|
809
|
+
d: this.d,
|
|
810
|
+
value: this.value,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): KdjStream {
|
|
814
|
+
const state = readSnapshot(snapshot, 'kdj');
|
|
815
|
+
const x = new KdjStream({ period: state.lookback('period'), signal: 1 });
|
|
816
|
+
Object.assign(x, {
|
|
817
|
+
alpha: state.number('alpha'),
|
|
818
|
+
k: state.numberOrNull('k'),
|
|
819
|
+
d: state.numberOrNull('d'),
|
|
820
|
+
});
|
|
821
|
+
x.highs = state.numbers('highs');
|
|
822
|
+
x.lows = state.numbers('lows');
|
|
823
|
+
x.value = state.cached<KdjPoint>('value');
|
|
824
|
+
return x;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
export const kdj = withBuiltinMetadata(
|
|
829
|
+
makeIndicator<KdjParameters, BarInput, KdjPoint>(
|
|
830
|
+
(p) =>
|
|
831
|
+
new KdjStream({
|
|
832
|
+
period: requirePeriod(p.period ?? 9, 'kdj'),
|
|
833
|
+
signal: requirePeriod(p.signal ?? 3, 'kdj', 'signal'),
|
|
834
|
+
}),
|
|
835
|
+
KdjStream.fromJSON,
|
|
836
|
+
() => ({ k: NaN, d: NaN, j: NaN }),
|
|
837
|
+
),
|
|
838
|
+
builtinMetadata.kdjMetadata,
|
|
839
|
+
);
|
|
840
|
+
|
|
841
|
+
// ───────────────────────── Relative Vigor Index (RVGI) ─────────────────────────
|
|
842
|
+
|
|
843
|
+
export interface RvgiPoint {
|
|
844
|
+
rvi: number;
|
|
845
|
+
signal: number;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
class RvgiStream implements IndicatorStream<BarInput, RvgiPoint> {
|
|
849
|
+
private co: number[] = []; // close − open, last 4
|
|
850
|
+
private hl: number[] = []; // high − low, last 4
|
|
851
|
+
private numSma: SmaStream;
|
|
852
|
+
private denSma: SmaStream;
|
|
853
|
+
private rvis: number[] = []; // last 4 RVI values for the signal swma
|
|
854
|
+
value: RvgiPoint | null = null;
|
|
855
|
+
constructor(period: number) {
|
|
856
|
+
requirePeriod(period, 'RvgiStream');
|
|
857
|
+
this.numSma = new SmaStream(period);
|
|
858
|
+
this.denSma = new SmaStream(period);
|
|
859
|
+
}
|
|
860
|
+
private static swma4(a: number[]): number {
|
|
861
|
+
// most-recent-last; weights 1,2,2,1 over the last four
|
|
862
|
+
const n = a.length;
|
|
863
|
+
return (a[n - 1]! + 2 * a[n - 2]! + 2 * a[n - 3]! + a[n - 4]!) / 6;
|
|
864
|
+
}
|
|
865
|
+
next(bar: BarInput): RvgiPoint | null {
|
|
866
|
+
const open = bar.open ?? bar.close;
|
|
867
|
+
this.co.push(bar.close - open);
|
|
868
|
+
this.hl.push(bar.high - bar.low);
|
|
869
|
+
if (this.co.length > 4) {
|
|
870
|
+
this.co.shift();
|
|
871
|
+
this.hl.shift();
|
|
872
|
+
}
|
|
873
|
+
if (this.co.length < 4) {
|
|
874
|
+
this.value = null;
|
|
875
|
+
return null;
|
|
876
|
+
}
|
|
877
|
+
const num = RvgiStream.swma4(this.co);
|
|
878
|
+
const den = RvgiStream.swma4(this.hl);
|
|
879
|
+
const numS = this.numSma.next(num);
|
|
880
|
+
const denS = this.denSma.next(den);
|
|
881
|
+
if (numS === null || denS === null) {
|
|
882
|
+
this.value = null;
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
const rvi = denS === 0 ? 0 : numS / denS;
|
|
886
|
+
this.rvis.push(rvi);
|
|
887
|
+
if (this.rvis.length > 4) this.rvis.shift();
|
|
888
|
+
if (this.rvis.length < 4) {
|
|
889
|
+
this.value = null;
|
|
890
|
+
return null;
|
|
891
|
+
}
|
|
892
|
+
this.value = { rvi, signal: RvgiStream.swma4(this.rvis) };
|
|
893
|
+
return this.value;
|
|
894
|
+
}
|
|
895
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
896
|
+
return snapshotOf('rvgi', {
|
|
897
|
+
co: [...this.co],
|
|
898
|
+
hl: [...this.hl],
|
|
899
|
+
numSma: this.numSma.toJSON(),
|
|
900
|
+
denSma: this.denSma.toJSON(),
|
|
901
|
+
rvis: [...this.rvis],
|
|
902
|
+
value: this.value,
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): RvgiStream {
|
|
906
|
+
const state = readSnapshot(snapshot, 'rvgi');
|
|
907
|
+
const x = new RvgiStream(1);
|
|
908
|
+
x.numSma = SmaStream.fromJSON(state.child('numSma'));
|
|
909
|
+
x.denSma = SmaStream.fromJSON(state.child('denSma'));
|
|
910
|
+
x.co = state.numbers('co');
|
|
911
|
+
x.hl = state.numbers('hl');
|
|
912
|
+
x.rvis = state.numbers('rvis');
|
|
913
|
+
x.value = state.cached<RvgiPoint>('value');
|
|
914
|
+
return x;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
export const relativeVigorIndex = withBuiltinMetadata(
|
|
919
|
+
makeIndicator<{ period?: number }, BarInput, RvgiPoint>(
|
|
920
|
+
(p) => new RvgiStream(requirePeriod(p.period ?? 14, 'relativeVigorIndex')),
|
|
921
|
+
RvgiStream.fromJSON,
|
|
922
|
+
() => ({ rvi: NaN, signal: NaN }),
|
|
923
|
+
),
|
|
924
|
+
builtinMetadata.relativeVigorIndexMetadata,
|
|
925
|
+
);
|
|
926
|
+
|
|
927
|
+
// ───────────────────────── PGO (Pretty Good Oscillator) ─────────────────────────
|
|
928
|
+
|
|
929
|
+
class PgoStream implements IndicatorStream<BarInput, number> {
|
|
930
|
+
private previousClose: number | null = null;
|
|
931
|
+
private sma: SmaStream;
|
|
932
|
+
private trEma: EmaStream;
|
|
933
|
+
value: number | null = null;
|
|
934
|
+
constructor(period: number) {
|
|
935
|
+
requirePeriod(period, 'PgoStream', 'period', 1, 'bars');
|
|
936
|
+
this.sma = new SmaStream(period);
|
|
937
|
+
this.trEma = new EmaStream(period);
|
|
938
|
+
}
|
|
939
|
+
next(bar: BarInput): number | null {
|
|
940
|
+
const tr =
|
|
941
|
+
this.previousClose === null
|
|
942
|
+
? bar.high - bar.low
|
|
943
|
+
: Math.max(
|
|
944
|
+
bar.high - bar.low,
|
|
945
|
+
Math.abs(bar.high - this.previousClose),
|
|
946
|
+
Math.abs(bar.low - this.previousClose),
|
|
947
|
+
);
|
|
948
|
+
this.previousClose = bar.close;
|
|
949
|
+
const m = this.sma.next(bar.close);
|
|
950
|
+
const atr = this.trEma.next(tr);
|
|
951
|
+
if (m === null || atr === null) {
|
|
952
|
+
this.value = null;
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
955
|
+
this.value = atr === 0 ? 0 : (bar.close - m) / atr;
|
|
956
|
+
return this.value;
|
|
957
|
+
}
|
|
958
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
959
|
+
return snapshotOf('pgo', {
|
|
960
|
+
previousClose: this.previousClose,
|
|
961
|
+
sma: this.sma.toJSON(),
|
|
962
|
+
trEma: this.trEma.toJSON(),
|
|
963
|
+
value: this.value,
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): PgoStream {
|
|
967
|
+
const state = readSnapshot(snapshot, 'pgo');
|
|
968
|
+
const x = new PgoStream(1);
|
|
969
|
+
Object.assign(x, { previousClose: state.numberOrNull('previousClose') });
|
|
970
|
+
x.sma = SmaStream.fromJSON(state.child('sma'));
|
|
971
|
+
x.trEma = EmaStream.fromJSON(state.child('trEma'));
|
|
972
|
+
x.value = state.cached<number>('value');
|
|
973
|
+
return x;
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
export const pgo = withBuiltinMetadata(
|
|
978
|
+
makeIndicator<{ period?: number }, BarInput, number>(
|
|
979
|
+
(p) => new PgoStream(requirePeriod(p.period ?? 14, 'pgo')),
|
|
980
|
+
PgoStream.fromJSON,
|
|
981
|
+
nan,
|
|
982
|
+
),
|
|
983
|
+
builtinMetadata.pgoMetadata,
|
|
984
|
+
);
|
|
985
|
+
|
|
986
|
+
// ───────────────────────── TRIX histogram ─────────────────────────
|
|
987
|
+
|
|
988
|
+
export interface TrixHistogramPoint {
|
|
989
|
+
trix: number;
|
|
990
|
+
signal: number;
|
|
991
|
+
histogram: number;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
class TrixHistogramStream implements IndicatorStream<number, TrixHistogramPoint> {
|
|
995
|
+
private trix: TrixStream;
|
|
996
|
+
private signalEma: EmaStream;
|
|
997
|
+
value: TrixHistogramPoint | null = null;
|
|
998
|
+
constructor(parameters: { period: number; signal: number }) {
|
|
999
|
+
requireStreamParameters('TrixHistogramStream.constructor#0', 'TrixHistogramStream', parameters);
|
|
1000
|
+
const { period, signal } = parameters;
|
|
1001
|
+
this.trix = new TrixStream(period);
|
|
1002
|
+
this.signalEma = new EmaStream(signal);
|
|
1003
|
+
}
|
|
1004
|
+
next(value: number): TrixHistogramPoint | null {
|
|
1005
|
+
const t = this.trix.next(value);
|
|
1006
|
+
if (t === null) {
|
|
1007
|
+
this.value = null;
|
|
1008
|
+
return null;
|
|
1009
|
+
}
|
|
1010
|
+
const sig = this.signalEma.next(t);
|
|
1011
|
+
if (sig === null) {
|
|
1012
|
+
this.value = null;
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
1015
|
+
this.value = { trix: t, signal: sig, histogram: t - sig };
|
|
1016
|
+
return this.value;
|
|
1017
|
+
}
|
|
1018
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1019
|
+
return snapshotOf('trixHistogram', {
|
|
1020
|
+
trix: this.trix.toJSON(),
|
|
1021
|
+
signal: this.signalEma.toJSON(),
|
|
1022
|
+
value: this.value,
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): TrixHistogramStream {
|
|
1026
|
+
const state = readSnapshot(snapshot, 'trixHistogram');
|
|
1027
|
+
const x = new TrixHistogramStream({ period: 1, signal: 1 });
|
|
1028
|
+
x.trix = TrixStream.fromJSON(state.child('trix'));
|
|
1029
|
+
x.signalEma = EmaStream.fromJSON(state.child('signal'));
|
|
1030
|
+
x.value = state.cached<TrixHistogramPoint>('value');
|
|
1031
|
+
return x;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
export interface TrixHistogramParameters {
|
|
1036
|
+
period?: number;
|
|
1037
|
+
signal?: number;
|
|
1038
|
+
}
|
|
1039
|
+
export const trixHistogram = withBuiltinMetadata(
|
|
1040
|
+
makeIndicator<TrixHistogramParameters, number, TrixHistogramPoint>(
|
|
1041
|
+
(p) =>
|
|
1042
|
+
new TrixHistogramStream({
|
|
1043
|
+
period: requirePeriod(p.period ?? 15, 'trixHistogram'),
|
|
1044
|
+
signal: requirePeriod(p.signal ?? 9, 'trixHistogram', 'signal'),
|
|
1045
|
+
}),
|
|
1046
|
+
TrixHistogramStream.fromJSON,
|
|
1047
|
+
() => ({ trix: NaN, signal: NaN, histogram: NaN }),
|
|
1048
|
+
),
|
|
1049
|
+
builtinMetadata.trixHistogramMetadata,
|
|
1050
|
+
);
|
|
1051
|
+
|
|
1052
|
+
// ───────────────────────── SMI Ergodic ─────────────────────────
|
|
1053
|
+
|
|
1054
|
+
export interface SmiParameters {
|
|
1055
|
+
long?: number;
|
|
1056
|
+
short?: number;
|
|
1057
|
+
signal?: number;
|
|
1058
|
+
}
|
|
1059
|
+
export interface SmiPoint {
|
|
1060
|
+
smi: number;
|
|
1061
|
+
signal: number;
|
|
1062
|
+
oscillator: number;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
class SmiErgodicStream implements IndicatorStream<number, SmiPoint> {
|
|
1066
|
+
private tsi: TsiStream;
|
|
1067
|
+
value: SmiPoint | null = null;
|
|
1068
|
+
constructor(parameters: { long: number; short: number; signal: number }) {
|
|
1069
|
+
requireStreamParameters('SmiErgodicStream.constructor#0', 'SmiErgodicStream', parameters);
|
|
1070
|
+
const { long, short, signal } = parameters;
|
|
1071
|
+
this.tsi = new TsiStream({ long, short, signal });
|
|
1072
|
+
}
|
|
1073
|
+
next(value: number): SmiPoint | null {
|
|
1074
|
+
const t = this.tsi.next(value);
|
|
1075
|
+
if (t === null) {
|
|
1076
|
+
this.value = null;
|
|
1077
|
+
return null;
|
|
1078
|
+
}
|
|
1079
|
+
this.value = { smi: t.tsi, signal: t.signal, oscillator: t.tsi - t.signal };
|
|
1080
|
+
return this.value;
|
|
1081
|
+
}
|
|
1082
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1083
|
+
return snapshotOf('smiErgodic', { tsi: this.tsi.toJSON(), value: this.value });
|
|
1084
|
+
}
|
|
1085
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SmiErgodicStream {
|
|
1086
|
+
const state = readSnapshot(snapshot, 'smiErgodic');
|
|
1087
|
+
const x = new SmiErgodicStream({ long: 1, short: 1, signal: 1 });
|
|
1088
|
+
x.tsi = TsiStream.fromJSON(state.child('tsi'));
|
|
1089
|
+
x.value = state.cached<SmiPoint>('value');
|
|
1090
|
+
return x;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
export const smiErgodic = withBuiltinMetadata(
|
|
1095
|
+
makeIndicator<SmiParameters, number, SmiPoint>(
|
|
1096
|
+
(p) =>
|
|
1097
|
+
new SmiErgodicStream({
|
|
1098
|
+
long: requirePeriod(p.long ?? 20, 'smiErgodic', 'long'),
|
|
1099
|
+
short: requirePeriod(p.short ?? 5, 'smiErgodic', 'short'),
|
|
1100
|
+
signal: requirePeriod(p.signal ?? 5, 'smiErgodic', 'signal'),
|
|
1101
|
+
}),
|
|
1102
|
+
SmiErgodicStream.fromJSON,
|
|
1103
|
+
() => ({ smi: NaN, signal: NaN, oscillator: NaN }),
|
|
1104
|
+
),
|
|
1105
|
+
builtinMetadata.smiErgodicMetadata,
|
|
1106
|
+
);
|
|
1107
|
+
|
|
1108
|
+
// ───────────────────────── volume-weighted MACD ─────────────────────────
|
|
1109
|
+
|
|
1110
|
+
export interface VwMacdParameters {
|
|
1111
|
+
fast?: number;
|
|
1112
|
+
slow?: number;
|
|
1113
|
+
signal?: number;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
class VolumeWeightedMacdStream implements IndicatorStream<BarInput, MacdPoint> {
|
|
1117
|
+
private fast: VwmaStream;
|
|
1118
|
+
private slow: VwmaStream;
|
|
1119
|
+
private signalEma: EmaStream;
|
|
1120
|
+
value: MacdPoint | null = null;
|
|
1121
|
+
constructor(parameters: { fast: number; slow: number; signal: number }) {
|
|
1122
|
+
requireStreamParameters(
|
|
1123
|
+
'VolumeWeightedMacdStream.constructor#0',
|
|
1124
|
+
'VolumeWeightedMacdStream',
|
|
1125
|
+
parameters,
|
|
1126
|
+
);
|
|
1127
|
+
const { fast, slow, signal } = parameters;
|
|
1128
|
+
this.fast = new VwmaStream(fast);
|
|
1129
|
+
this.slow = new VwmaStream(slow);
|
|
1130
|
+
this.signalEma = new EmaStream(signal);
|
|
1131
|
+
}
|
|
1132
|
+
next(bar: BarInput): MacdPoint | null {
|
|
1133
|
+
const f = this.fast.next(bar);
|
|
1134
|
+
const s = this.slow.next(bar);
|
|
1135
|
+
if (f === null || s === null) {
|
|
1136
|
+
this.value = null;
|
|
1137
|
+
return null;
|
|
1138
|
+
}
|
|
1139
|
+
const macd = f - s;
|
|
1140
|
+
const sig = this.signalEma.next(macd);
|
|
1141
|
+
if (sig === null) {
|
|
1142
|
+
this.value = null;
|
|
1143
|
+
return null;
|
|
1144
|
+
}
|
|
1145
|
+
this.value = { macd, signal: sig, histogram: macd - sig };
|
|
1146
|
+
return this.value;
|
|
1147
|
+
}
|
|
1148
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1149
|
+
return snapshotOf('volumeWeightedMacd', {
|
|
1150
|
+
fast: this.fast.toJSON(),
|
|
1151
|
+
slow: this.slow.toJSON(),
|
|
1152
|
+
signal: this.signalEma.toJSON(),
|
|
1153
|
+
value: this.value,
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): VolumeWeightedMacdStream {
|
|
1157
|
+
const state = readSnapshot(snapshot, 'volumeWeightedMacd');
|
|
1158
|
+
const x = new VolumeWeightedMacdStream({ fast: 1, slow: 1, signal: 1 });
|
|
1159
|
+
x.fast = VwmaStream.fromJSON(state.child('fast'));
|
|
1160
|
+
x.slow = VwmaStream.fromJSON(state.child('slow'));
|
|
1161
|
+
x.signalEma = EmaStream.fromJSON(state.child('signal'));
|
|
1162
|
+
x.value = state.cached<MacdPoint>('value');
|
|
1163
|
+
return x;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
export const volumeWeightedMacd = withBuiltinMetadata(
|
|
1168
|
+
makeIndicator<VwMacdParameters, BarInput, MacdPoint>(
|
|
1169
|
+
(p) =>
|
|
1170
|
+
new VolumeWeightedMacdStream({
|
|
1171
|
+
fast: requirePeriod(p.fast ?? 12, 'volumeWeightedMacd', 'fast'),
|
|
1172
|
+
slow: requirePeriod(p.slow ?? 26, 'volumeWeightedMacd', 'slow'),
|
|
1173
|
+
signal: requirePeriod(p.signal ?? 9, 'volumeWeightedMacd', 'signal'),
|
|
1174
|
+
}),
|
|
1175
|
+
VolumeWeightedMacdStream.fromJSON,
|
|
1176
|
+
() => ({ macd: NaN, signal: NaN, histogram: NaN }),
|
|
1177
|
+
),
|
|
1178
|
+
builtinMetadata.volumeWeightedMacdMetadata,
|
|
1179
|
+
);
|
|
1180
|
+
|
|
1181
|
+
// ───────────────────────── inertia (linreg of RVI) ─────────────────────────
|
|
1182
|
+
|
|
1183
|
+
export interface InertiaParameters {
|
|
1184
|
+
period?: number;
|
|
1185
|
+
rviPeriod?: number;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
class InertiaStream implements IndicatorStream<number, number> {
|
|
1189
|
+
private rvi: RviStream;
|
|
1190
|
+
private lin: LinregStream;
|
|
1191
|
+
value: number | null = null;
|
|
1192
|
+
constructor(parameters: { period: number; rviPeriod: number }) {
|
|
1193
|
+
requireStreamParameters('InertiaStream.constructor#0', 'InertiaStream', parameters);
|
|
1194
|
+
const { period, rviPeriod } = parameters;
|
|
1195
|
+
this.rvi = new RviStream({ stdevPeriod: rviPeriod, smoothPeriod: rviPeriod });
|
|
1196
|
+
this.lin = new LinregStream(period);
|
|
1197
|
+
}
|
|
1198
|
+
next(value: number): number | null {
|
|
1199
|
+
const r = this.rvi.next(value);
|
|
1200
|
+
if (r === null) {
|
|
1201
|
+
this.value = null;
|
|
1202
|
+
return null;
|
|
1203
|
+
}
|
|
1204
|
+
const l = this.lin.next(r);
|
|
1205
|
+
this.value = l === null ? null : l.value;
|
|
1206
|
+
return this.value;
|
|
1207
|
+
}
|
|
1208
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1209
|
+
return snapshotOf('inertia', {
|
|
1210
|
+
rvi: this.rvi.toJSON(),
|
|
1211
|
+
lin: this.lin.toJSON(),
|
|
1212
|
+
value: this.value,
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): InertiaStream {
|
|
1216
|
+
const state = readSnapshot(snapshot, 'inertia');
|
|
1217
|
+
const x = new InertiaStream({ period: 1, rviPeriod: 2 });
|
|
1218
|
+
x.rvi = RviStream.fromJSON(state.child('rvi'));
|
|
1219
|
+
x.lin = LinregStream.fromJSON(state.child('lin'));
|
|
1220
|
+
x.value = state.cached<number>('value');
|
|
1221
|
+
return x;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
export const inertia = withBuiltinMetadata(
|
|
1226
|
+
makeIndicator<InertiaParameters, number, number>(
|
|
1227
|
+
(p) =>
|
|
1228
|
+
new InertiaStream({
|
|
1229
|
+
period: requirePeriod(p.period ?? 20, 'inertia'),
|
|
1230
|
+
rviPeriod: requirePeriod(p.rviPeriod ?? 14, 'inertia', 'rviPeriod', 2),
|
|
1231
|
+
}),
|
|
1232
|
+
InertiaStream.fromJSON,
|
|
1233
|
+
nan,
|
|
1234
|
+
),
|
|
1235
|
+
builtinMetadata.inertiaMetadata,
|
|
1236
|
+
);
|
|
1237
|
+
|
|
1238
|
+
// ───────────────────────── Laguerre RSI (Ehlers) ─────────────────────────
|
|
1239
|
+
|
|
1240
|
+
export interface LaguerreParameters {
|
|
1241
|
+
gamma?: number;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
class LaguerreRsiStream implements IndicatorStream<number, number> {
|
|
1245
|
+
private l0: number | null = null;
|
|
1246
|
+
private l1 = 0;
|
|
1247
|
+
private l2 = 0;
|
|
1248
|
+
private l3 = 0;
|
|
1249
|
+
value: number | null = null;
|
|
1250
|
+
constructor(private readonly gamma: number) {}
|
|
1251
|
+
next(price: number): number | null {
|
|
1252
|
+
const g = this.gamma;
|
|
1253
|
+
if (this.l0 === null) {
|
|
1254
|
+
this.l0 = price;
|
|
1255
|
+
this.l1 = price;
|
|
1256
|
+
this.l2 = price;
|
|
1257
|
+
this.l3 = price;
|
|
1258
|
+
this.value = 0;
|
|
1259
|
+
return 0;
|
|
1260
|
+
}
|
|
1261
|
+
const l0 = (1 - g) * price + g * this.l0;
|
|
1262
|
+
const l1 = -g * l0 + this.l0 + g * this.l1;
|
|
1263
|
+
const l2 = -g * l1 + this.l1 + g * this.l2;
|
|
1264
|
+
const l3 = -g * l2 + this.l2 + g * this.l3;
|
|
1265
|
+
let cu = 0;
|
|
1266
|
+
let cd = 0;
|
|
1267
|
+
if (l0 >= l1) cu += l0 - l1;
|
|
1268
|
+
else cd += l1 - l0;
|
|
1269
|
+
if (l1 >= l2) cu += l1 - l2;
|
|
1270
|
+
else cd += l2 - l1;
|
|
1271
|
+
if (l2 >= l3) cu += l2 - l3;
|
|
1272
|
+
else cd += l3 - l2;
|
|
1273
|
+
this.l0 = l0;
|
|
1274
|
+
this.l1 = l1;
|
|
1275
|
+
this.l2 = l2;
|
|
1276
|
+
this.l3 = l3;
|
|
1277
|
+
this.value = cu + cd === 0 ? 0 : cu / (cu + cd);
|
|
1278
|
+
return this.value;
|
|
1279
|
+
}
|
|
1280
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1281
|
+
return snapshotOf('laguerreRsi', {
|
|
1282
|
+
gamma: this.gamma,
|
|
1283
|
+
l0: this.l0,
|
|
1284
|
+
l1: this.l1,
|
|
1285
|
+
l2: this.l2,
|
|
1286
|
+
l3: this.l3,
|
|
1287
|
+
value: this.value,
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): LaguerreRsiStream {
|
|
1291
|
+
const state = readSnapshot(snapshot, 'laguerreRsi');
|
|
1292
|
+
const x = new LaguerreRsiStream(state.number('gamma'));
|
|
1293
|
+
Object.assign(x, {
|
|
1294
|
+
l0: state.numberOrNull('l0'),
|
|
1295
|
+
l1: state.number('l1'),
|
|
1296
|
+
l2: state.number('l2'),
|
|
1297
|
+
l3: state.number('l3'),
|
|
1298
|
+
});
|
|
1299
|
+
x.value = state.cached<number>('value');
|
|
1300
|
+
return x;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
export const laguerreRsi = withBuiltinMetadata(
|
|
1305
|
+
makeIndicator<LaguerreParameters, number, number>(
|
|
1306
|
+
(p) => new LaguerreRsiStream(requireInRange(p.gamma ?? 0.5, 'laguerreRsi', 'gamma', 0, 1)),
|
|
1307
|
+
LaguerreRsiStream.fromJSON,
|
|
1308
|
+
nan,
|
|
1309
|
+
),
|
|
1310
|
+
builtinMetadata.laguerreRsiMetadata,
|
|
1311
|
+
);
|
|
1312
|
+
|
|
1313
|
+
// ───────────────────────── QQE (Quantitative Qualitative Estimation) ─────────────────────────
|
|
1314
|
+
|
|
1315
|
+
export interface QqeParameters {
|
|
1316
|
+
rsiPeriod?: number;
|
|
1317
|
+
smooth?: number;
|
|
1318
|
+
factor?: number;
|
|
1319
|
+
}
|
|
1320
|
+
export interface QqePoint {
|
|
1321
|
+
rsiMovingAverage: number;
|
|
1322
|
+
longBand: number;
|
|
1323
|
+
shortBand: number;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
class QqeStream implements IndicatorStream<number, QqePoint> {
|
|
1327
|
+
private rsi: RsiStream;
|
|
1328
|
+
private rsiMaEma: EmaStream;
|
|
1329
|
+
private atrMa: EmaStream;
|
|
1330
|
+
private darEma: EmaStream;
|
|
1331
|
+
private prevRsiMa: number | null = null;
|
|
1332
|
+
private longBand = 0;
|
|
1333
|
+
private shortBand = 0;
|
|
1334
|
+
private initialized = false;
|
|
1335
|
+
value: QqePoint | null = null;
|
|
1336
|
+
private readonly factor: number;
|
|
1337
|
+
constructor(parameters: { rsiPeriod: number; smooth: number; factor: number }) {
|
|
1338
|
+
requireStreamParameters('QqeStream.constructor#0', 'QqeStream', parameters);
|
|
1339
|
+
const { rsiPeriod, smooth, factor } = parameters;
|
|
1340
|
+
this.factor = factor;
|
|
1341
|
+
|
|
1342
|
+
const wilders = 2 * rsiPeriod - 1;
|
|
1343
|
+
this.rsi = new RsiStream(rsiPeriod);
|
|
1344
|
+
this.rsiMaEma = new EmaStream(smooth);
|
|
1345
|
+
this.atrMa = new EmaStream(wilders);
|
|
1346
|
+
this.darEma = new EmaStream(wilders);
|
|
1347
|
+
}
|
|
1348
|
+
next(value: number): QqePoint | null {
|
|
1349
|
+
const r = this.rsi.next(value);
|
|
1350
|
+
if (r === null) {
|
|
1351
|
+
this.value = null;
|
|
1352
|
+
return null;
|
|
1353
|
+
}
|
|
1354
|
+
const rm = this.rsiMaEma.next(r);
|
|
1355
|
+
if (rm === null) {
|
|
1356
|
+
this.value = null;
|
|
1357
|
+
return null;
|
|
1358
|
+
}
|
|
1359
|
+
if (this.prevRsiMa === null) {
|
|
1360
|
+
this.prevRsiMa = rm;
|
|
1361
|
+
this.value = null;
|
|
1362
|
+
return null;
|
|
1363
|
+
}
|
|
1364
|
+
const atrRsi = Math.abs(rm - this.prevRsiMa);
|
|
1365
|
+
const m1 = this.atrMa.next(atrRsi);
|
|
1366
|
+
if (m1 === null) {
|
|
1367
|
+
this.prevRsiMa = rm;
|
|
1368
|
+
this.value = null;
|
|
1369
|
+
return null;
|
|
1370
|
+
}
|
|
1371
|
+
const d = this.darEma.next(m1);
|
|
1372
|
+
if (d === null) {
|
|
1373
|
+
this.prevRsiMa = rm;
|
|
1374
|
+
this.value = null;
|
|
1375
|
+
return null;
|
|
1376
|
+
}
|
|
1377
|
+
const dar = d * this.factor;
|
|
1378
|
+
const newLong = rm - dar;
|
|
1379
|
+
const newShort = rm + dar;
|
|
1380
|
+
if (!this.initialized) {
|
|
1381
|
+
this.longBand = newLong;
|
|
1382
|
+
this.shortBand = newShort;
|
|
1383
|
+
this.initialized = true;
|
|
1384
|
+
} else {
|
|
1385
|
+
const pl = this.longBand;
|
|
1386
|
+
const ps = this.shortBand;
|
|
1387
|
+
this.longBand = this.prevRsiMa > pl && rm > pl ? Math.max(pl, newLong) : newLong;
|
|
1388
|
+
this.shortBand = this.prevRsiMa < ps && rm < ps ? Math.min(ps, newShort) : newShort;
|
|
1389
|
+
}
|
|
1390
|
+
this.prevRsiMa = rm;
|
|
1391
|
+
this.value = { rsiMovingAverage: rm, longBand: this.longBand, shortBand: this.shortBand };
|
|
1392
|
+
return this.value;
|
|
1393
|
+
}
|
|
1394
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1395
|
+
return snapshotOf('qqe', {
|
|
1396
|
+
factor: this.factor,
|
|
1397
|
+
rsi: this.rsi.toJSON(),
|
|
1398
|
+
rsiMaEma: this.rsiMaEma.toJSON(),
|
|
1399
|
+
atrMa: this.atrMa.toJSON(),
|
|
1400
|
+
darEma: this.darEma.toJSON(),
|
|
1401
|
+
prevRsiMa: this.prevRsiMa,
|
|
1402
|
+
longBand: this.longBand,
|
|
1403
|
+
shortBand: this.shortBand,
|
|
1404
|
+
initialized: this.initialized,
|
|
1405
|
+
value: this.value,
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): QqeStream {
|
|
1409
|
+
const state = readSnapshot(snapshot, 'qqe');
|
|
1410
|
+
const x = new QqeStream({ rsiPeriod: 2, smooth: 1, factor: state.number('factor') });
|
|
1411
|
+
x.rsi = RsiStream.fromJSON(state.child('rsi'));
|
|
1412
|
+
x.rsiMaEma = EmaStream.fromJSON(state.child('rsiMaEma'));
|
|
1413
|
+
x.atrMa = EmaStream.fromJSON(state.child('atrMa'));
|
|
1414
|
+
x.darEma = EmaStream.fromJSON(state.child('darEma'));
|
|
1415
|
+
Object.assign(x, {
|
|
1416
|
+
prevRsiMa: state.numberOrNull('prevRsiMa'),
|
|
1417
|
+
longBand: state.number('longBand'),
|
|
1418
|
+
shortBand: state.number('shortBand'),
|
|
1419
|
+
initialized: state.boolean('initialized'),
|
|
1420
|
+
});
|
|
1421
|
+
x.value = state.cached<QqePoint>('value');
|
|
1422
|
+
return x;
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
export const qqe = withBuiltinMetadata(
|
|
1427
|
+
makeIndicator<QqeParameters, number, QqePoint>(
|
|
1428
|
+
(p) =>
|
|
1429
|
+
new QqeStream({
|
|
1430
|
+
rsiPeriod: requirePeriod(p.rsiPeriod ?? 14, 'qqe', 'rsiPeriod'),
|
|
1431
|
+
smooth: requirePeriod(p.smooth ?? 5, 'qqe', 'smooth'),
|
|
1432
|
+
factor: requirePositive(p.factor ?? 4.236, 'qqe', 'factor'),
|
|
1433
|
+
}),
|
|
1434
|
+
QqeStream.fromJSON,
|
|
1435
|
+
() => ({ rsiMovingAverage: NaN, longBand: NaN, shortBand: NaN }),
|
|
1436
|
+
),
|
|
1437
|
+
builtinMetadata.qqeMetadata,
|
|
1438
|
+
);
|
|
1439
|
+
|
|
1440
|
+
// ───────────────────────── RSX (Jurik) ─────────────────────────
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* Jurik RSX — the cascaded double-smoother momentum/|momentum| ratio mapped to [0, 100]. Uses the
|
|
1444
|
+
* canonical Jurik filter cascade; the reference's f88/f90 warmup counter is replaced by the framework
|
|
1445
|
+
* warmup (emits once `period` bars have been seen).
|
|
1446
|
+
*/
|
|
1447
|
+
class RsxStream implements IndicatorStream<number, number> {
|
|
1448
|
+
private count = 0;
|
|
1449
|
+
private f10: number | null = null;
|
|
1450
|
+
private readonly f18: number;
|
|
1451
|
+
private readonly f20: number;
|
|
1452
|
+
private f28 = 0;
|
|
1453
|
+
private f30 = 0;
|
|
1454
|
+
private f38 = 0;
|
|
1455
|
+
private f40 = 0;
|
|
1456
|
+
private f48 = 0;
|
|
1457
|
+
private f50 = 0;
|
|
1458
|
+
private f58 = 0;
|
|
1459
|
+
private f60 = 0;
|
|
1460
|
+
private f68 = 0;
|
|
1461
|
+
private f70 = 0;
|
|
1462
|
+
private f78 = 0;
|
|
1463
|
+
private f80 = 0;
|
|
1464
|
+
value: number | null = null;
|
|
1465
|
+
constructor(private readonly period: number) {
|
|
1466
|
+
requirePeriod(period, 'RsxStream');
|
|
1467
|
+
this.f18 = 3 / (period + 2);
|
|
1468
|
+
this.f20 = 1 - this.f18;
|
|
1469
|
+
}
|
|
1470
|
+
next(price: number): number | null {
|
|
1471
|
+
this.count++;
|
|
1472
|
+
const f8 = 100 * price;
|
|
1473
|
+
if (this.f10 === null) {
|
|
1474
|
+
this.f10 = f8;
|
|
1475
|
+
this.value = null;
|
|
1476
|
+
return null;
|
|
1477
|
+
}
|
|
1478
|
+
const v8 = f8 - this.f10;
|
|
1479
|
+
this.f10 = f8;
|
|
1480
|
+
const { f18, f20 } = this;
|
|
1481
|
+
this.f28 = f20 * this.f28 + f18 * v8;
|
|
1482
|
+
this.f30 = f18 * this.f28 + f20 * this.f30;
|
|
1483
|
+
const vC = this.f28 * 1.5 - this.f30 * 0.5;
|
|
1484
|
+
this.f38 = f20 * this.f38 + f18 * vC;
|
|
1485
|
+
this.f40 = f18 * this.f38 + f20 * this.f40;
|
|
1486
|
+
const v10 = this.f38 * 1.5 - this.f40 * 0.5;
|
|
1487
|
+
this.f48 = f20 * this.f48 + f18 * v10;
|
|
1488
|
+
this.f50 = f18 * this.f48 + f20 * this.f50;
|
|
1489
|
+
const v14 = this.f48 * 1.5 - this.f50 * 0.5;
|
|
1490
|
+
this.f58 = f20 * this.f58 + f18 * Math.abs(v8);
|
|
1491
|
+
this.f60 = f18 * this.f58 + f20 * this.f60;
|
|
1492
|
+
const v18 = this.f58 * 1.5 - this.f60 * 0.5;
|
|
1493
|
+
this.f68 = f20 * this.f68 + f18 * v18;
|
|
1494
|
+
this.f70 = f18 * this.f68 + f20 * this.f70;
|
|
1495
|
+
const v1C = this.f68 * 1.5 - this.f70 * 0.5;
|
|
1496
|
+
this.f78 = f20 * this.f78 + f18 * v1C;
|
|
1497
|
+
this.f80 = f18 * this.f78 + f20 * this.f80;
|
|
1498
|
+
const v20 = this.f78 * 1.5 - this.f80 * 0.5;
|
|
1499
|
+
if (this.count <= this.period) {
|
|
1500
|
+
this.value = null;
|
|
1501
|
+
return null;
|
|
1502
|
+
}
|
|
1503
|
+
const raw = v20 === 0 ? 50 : (v14 / v20 + 1) * 50;
|
|
1504
|
+
this.value = Math.max(0, Math.min(100, raw));
|
|
1505
|
+
return this.value;
|
|
1506
|
+
}
|
|
1507
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1508
|
+
return snapshotOf('rsx', {
|
|
1509
|
+
period: this.period,
|
|
1510
|
+
count: this.count,
|
|
1511
|
+
f10: this.f10,
|
|
1512
|
+
f28: this.f28,
|
|
1513
|
+
f30: this.f30,
|
|
1514
|
+
f38: this.f38,
|
|
1515
|
+
f40: this.f40,
|
|
1516
|
+
f48: this.f48,
|
|
1517
|
+
f50: this.f50,
|
|
1518
|
+
f58: this.f58,
|
|
1519
|
+
f60: this.f60,
|
|
1520
|
+
f68: this.f68,
|
|
1521
|
+
f70: this.f70,
|
|
1522
|
+
f78: this.f78,
|
|
1523
|
+
f80: this.f80,
|
|
1524
|
+
value: this.value,
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): RsxStream {
|
|
1528
|
+
const state = readSnapshot(snapshot, 'rsx');
|
|
1529
|
+
const x = new RsxStream(state.lookback('period'));
|
|
1530
|
+
Object.assign(x, {
|
|
1531
|
+
count: state.number('count'),
|
|
1532
|
+
f10: state.numberOrNull('f10'),
|
|
1533
|
+
f28: state.number('f28'),
|
|
1534
|
+
f30: state.number('f30'),
|
|
1535
|
+
f38: state.number('f38'),
|
|
1536
|
+
f40: state.number('f40'),
|
|
1537
|
+
f48: state.number('f48'),
|
|
1538
|
+
f50: state.number('f50'),
|
|
1539
|
+
f58: state.number('f58'),
|
|
1540
|
+
f60: state.number('f60'),
|
|
1541
|
+
f68: state.number('f68'),
|
|
1542
|
+
f70: state.number('f70'),
|
|
1543
|
+
f78: state.number('f78'),
|
|
1544
|
+
f80: state.number('f80'),
|
|
1545
|
+
});
|
|
1546
|
+
x.value = state.cached<number>('value');
|
|
1547
|
+
return x;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
export const rsx = withBuiltinMetadata(
|
|
1552
|
+
makeIndicator<{ period?: number }, number, number>(
|
|
1553
|
+
(p) => new RsxStream(requirePeriod(p.period ?? 14, 'rsx')),
|
|
1554
|
+
RsxStream.fromJSON,
|
|
1555
|
+
nan,
|
|
1556
|
+
),
|
|
1557
|
+
builtinMetadata.rsxMetadata,
|
|
1558
|
+
);
|
|
1559
|
+
|
|
1560
|
+
// ───────────────────────── Schaff Trend Cycle ─────────────────────────
|
|
1561
|
+
|
|
1562
|
+
export interface StcParameters {
|
|
1563
|
+
fast?: number;
|
|
1564
|
+
slow?: number;
|
|
1565
|
+
cycle?: number;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
class SchaffTrendCycleStream implements IndicatorStream<number, number> {
|
|
1569
|
+
private emaFast: EmaStream;
|
|
1570
|
+
private emaSlow: EmaStream;
|
|
1571
|
+
private macdBuf: number[] = [];
|
|
1572
|
+
private d1: number | null = null;
|
|
1573
|
+
private d1Buf: number[] = [];
|
|
1574
|
+
private d2: number | null = null;
|
|
1575
|
+
value: number | null = null;
|
|
1576
|
+
private readonly cycle: number;
|
|
1577
|
+
constructor(parameters: { fast: number; slow: number; cycle: number }) {
|
|
1578
|
+
requireStreamParameters(
|
|
1579
|
+
'SchaffTrendCycleStream.constructor#0',
|
|
1580
|
+
'SchaffTrendCycleStream',
|
|
1581
|
+
parameters,
|
|
1582
|
+
);
|
|
1583
|
+
const { fast, slow, cycle } = parameters;
|
|
1584
|
+
this.cycle = cycle;
|
|
1585
|
+
|
|
1586
|
+
this.emaFast = new EmaStream(fast);
|
|
1587
|
+
this.emaSlow = new EmaStream(slow);
|
|
1588
|
+
}
|
|
1589
|
+
private static stoch(buf: number[], cur: number, prevSmoothed: number | null): number {
|
|
1590
|
+
let lo = buf[0]!;
|
|
1591
|
+
let hi = buf[0]!;
|
|
1592
|
+
for (const x of buf) {
|
|
1593
|
+
if (x < lo) lo = x;
|
|
1594
|
+
if (x > hi) hi = x;
|
|
1595
|
+
}
|
|
1596
|
+
return hi === lo ? (prevSmoothed ?? 0) : (100 * (cur - lo)) / (hi - lo);
|
|
1597
|
+
}
|
|
1598
|
+
next(value: number): number | null {
|
|
1599
|
+
const ef = this.emaFast.next(value);
|
|
1600
|
+
const es = this.emaSlow.next(value);
|
|
1601
|
+
if (ef === null || es === null) {
|
|
1602
|
+
this.value = null;
|
|
1603
|
+
return null;
|
|
1604
|
+
}
|
|
1605
|
+
const macd = ef - es;
|
|
1606
|
+
this.macdBuf.push(macd);
|
|
1607
|
+
if (this.macdBuf.length > this.cycle) this.macdBuf.shift();
|
|
1608
|
+
if (this.macdBuf.length < this.cycle) {
|
|
1609
|
+
this.value = null;
|
|
1610
|
+
return null;
|
|
1611
|
+
}
|
|
1612
|
+
const stoch1 = SchaffTrendCycleStream.stoch(this.macdBuf, macd, this.d1);
|
|
1613
|
+
this.d1 = this.d1 === null ? stoch1 : this.d1 + 0.5 * (stoch1 - this.d1);
|
|
1614
|
+
this.d1Buf.push(this.d1);
|
|
1615
|
+
if (this.d1Buf.length > this.cycle) this.d1Buf.shift();
|
|
1616
|
+
if (this.d1Buf.length < this.cycle) {
|
|
1617
|
+
this.value = null;
|
|
1618
|
+
return null;
|
|
1619
|
+
}
|
|
1620
|
+
const stoch2 = SchaffTrendCycleStream.stoch(this.d1Buf, this.d1, this.d2);
|
|
1621
|
+
this.d2 = this.d2 === null ? stoch2 : this.d2 + 0.5 * (stoch2 - this.d2);
|
|
1622
|
+
this.value = Math.max(0, Math.min(100, this.d2));
|
|
1623
|
+
return this.value;
|
|
1624
|
+
}
|
|
1625
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1626
|
+
return snapshotOf('schaffTrendCycle', {
|
|
1627
|
+
cycle: this.cycle,
|
|
1628
|
+
emaFast: this.emaFast.toJSON(),
|
|
1629
|
+
emaSlow: this.emaSlow.toJSON(),
|
|
1630
|
+
macdBuf: [...this.macdBuf],
|
|
1631
|
+
d1: this.d1,
|
|
1632
|
+
d1Buf: [...this.d1Buf],
|
|
1633
|
+
d2: this.d2,
|
|
1634
|
+
value: this.value,
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SchaffTrendCycleStream {
|
|
1638
|
+
const state = readSnapshot(snapshot, 'schaffTrendCycle');
|
|
1639
|
+
const x = new SchaffTrendCycleStream({ fast: 1, slow: 1, cycle: state.number('cycle') });
|
|
1640
|
+
x.emaFast = EmaStream.fromJSON(state.child('emaFast'));
|
|
1641
|
+
x.emaSlow = EmaStream.fromJSON(state.child('emaSlow'));
|
|
1642
|
+
Object.assign(x, { d1: state.numberOrNull('d1'), d2: state.numberOrNull('d2') });
|
|
1643
|
+
x.macdBuf = state.numbers('macdBuf');
|
|
1644
|
+
x.d1Buf = state.numbers('d1Buf');
|
|
1645
|
+
x.value = state.cached<number>('value');
|
|
1646
|
+
return x;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
export const schaffTrendCycle = withBuiltinMetadata(
|
|
1651
|
+
makeIndicator<StcParameters, number, number>(
|
|
1652
|
+
(p) =>
|
|
1653
|
+
new SchaffTrendCycleStream({
|
|
1654
|
+
fast: requirePeriod(p.fast ?? 23, 'schaffTrendCycle', 'fast'),
|
|
1655
|
+
slow: requirePeriod(p.slow ?? 50, 'schaffTrendCycle', 'slow'),
|
|
1656
|
+
cycle: requirePeriod(p.cycle ?? 10, 'schaffTrendCycle', 'cycle'),
|
|
1657
|
+
}),
|
|
1658
|
+
SchaffTrendCycleStream.fromJSON,
|
|
1659
|
+
nan,
|
|
1660
|
+
),
|
|
1661
|
+
builtinMetadata.schaffTrendCycleMetadata,
|
|
1662
|
+
);
|
|
1663
|
+
|
|
1664
|
+
// ───────────────────────── TTM Squeeze ─────────────────────────
|
|
1665
|
+
|
|
1666
|
+
function popStdev(buf: number[]): number {
|
|
1667
|
+
const n = buf.length;
|
|
1668
|
+
let sum = 0;
|
|
1669
|
+
for (const x of buf) sum += x;
|
|
1670
|
+
const mean = sum / n;
|
|
1671
|
+
let acc = 0;
|
|
1672
|
+
for (const x of buf) {
|
|
1673
|
+
const d = x - mean;
|
|
1674
|
+
acc += d * d;
|
|
1675
|
+
}
|
|
1676
|
+
return Math.sqrt(acc / n);
|
|
1677
|
+
}
|
|
1678
|
+
function maxOf(xs: number[]): number {
|
|
1679
|
+
let m = xs[0]!;
|
|
1680
|
+
for (let i = 1; i < xs.length; i++) if (xs[i]! > m) m = xs[i]!;
|
|
1681
|
+
return m;
|
|
1682
|
+
}
|
|
1683
|
+
function minOf(xs: number[]): number {
|
|
1684
|
+
let m = xs[0]!;
|
|
1685
|
+
for (let i = 1; i < xs.length; i++) if (xs[i]! < m) m = xs[i]!;
|
|
1686
|
+
return m;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/** Shared Bollinger-inside-Keltner squeeze machinery + the LazyBear momentum histogram. */
|
|
1690
|
+
class SqueezeCore {
|
|
1691
|
+
private previousClose: number | null = null;
|
|
1692
|
+
private smaKc: SmaStream;
|
|
1693
|
+
private trSma: SmaStream;
|
|
1694
|
+
private smaBb: SmaStream;
|
|
1695
|
+
private bbBuf: number[] = [];
|
|
1696
|
+
private highs: number[] = [];
|
|
1697
|
+
private lows: number[] = [];
|
|
1698
|
+
private lin: LinregStream;
|
|
1699
|
+
readonly bollingerBandPeriod: number;
|
|
1700
|
+
readonly bollingerStandardDeviations: number;
|
|
1701
|
+
readonly keltnerChannelPeriod: number;
|
|
1702
|
+
constructor(parameters: {
|
|
1703
|
+
bollingerBandPeriod: number;
|
|
1704
|
+
bollingerStandardDeviations: number;
|
|
1705
|
+
keltnerChannelPeriod: number;
|
|
1706
|
+
}) {
|
|
1707
|
+
requireStreamParameters('SqueezeCore.constructor#0', 'SqueezeCore', parameters);
|
|
1708
|
+
const { bollingerBandPeriod, bollingerStandardDeviations, keltnerChannelPeriod } = parameters;
|
|
1709
|
+
this.bollingerBandPeriod = bollingerBandPeriod;
|
|
1710
|
+
this.bollingerStandardDeviations = bollingerStandardDeviations;
|
|
1711
|
+
this.keltnerChannelPeriod = keltnerChannelPeriod;
|
|
1712
|
+
|
|
1713
|
+
this.smaKc = new SmaStream(keltnerChannelPeriod);
|
|
1714
|
+
this.trSma = new SmaStream(keltnerChannelPeriod);
|
|
1715
|
+
this.smaBb = new SmaStream(bollingerBandPeriod);
|
|
1716
|
+
this.lin = new LinregStream(keltnerChannelPeriod);
|
|
1717
|
+
}
|
|
1718
|
+
/** Returns null until both bands and the momentum regression are warm. */
|
|
1719
|
+
update(bar: BarInput): {
|
|
1720
|
+
upperBollingerBand: number;
|
|
1721
|
+
lowerBollingerBand: number;
|
|
1722
|
+
keltnerChannelMiddle: number;
|
|
1723
|
+
keltnerChannelRange: number;
|
|
1724
|
+
momentum: number;
|
|
1725
|
+
} | null {
|
|
1726
|
+
// Public per-tick entry: a malformed bar used to fold NaN into every band and poison the
|
|
1727
|
+
// window state for all later ticks (first-touch law). Three typeof checks per tick is noise
|
|
1728
|
+
// next to the window arithmetic that follows.
|
|
1729
|
+
requireArgumentObject('SqueezeCore.update', 'bar', bar);
|
|
1730
|
+
requireFiniteFields('SqueezeCore.update', bar, ['high', 'low', 'close'], {
|
|
1731
|
+
exampleCall: 'SqueezeCore.update({ high: 11, low: 9, close: 10.5 })',
|
|
1732
|
+
});
|
|
1733
|
+
const tr =
|
|
1734
|
+
this.previousClose === null
|
|
1735
|
+
? bar.high - bar.low
|
|
1736
|
+
: Math.max(
|
|
1737
|
+
bar.high - bar.low,
|
|
1738
|
+
Math.abs(bar.high - this.previousClose),
|
|
1739
|
+
Math.abs(bar.low - this.previousClose),
|
|
1740
|
+
);
|
|
1741
|
+
this.previousClose = bar.close;
|
|
1742
|
+
this.highs.push(bar.high);
|
|
1743
|
+
this.lows.push(bar.low);
|
|
1744
|
+
if (this.highs.length > this.keltnerChannelPeriod) {
|
|
1745
|
+
this.highs.shift();
|
|
1746
|
+
this.lows.shift();
|
|
1747
|
+
}
|
|
1748
|
+
this.bbBuf.push(bar.close);
|
|
1749
|
+
if (this.bbBuf.length > this.bollingerBandPeriod) this.bbBuf.shift();
|
|
1750
|
+
const keltnerChannelMiddle = this.smaKc.next(bar.close);
|
|
1751
|
+
const keltnerChannelRange = this.trSma.next(tr);
|
|
1752
|
+
const bbMid = this.smaBb.next(bar.close);
|
|
1753
|
+
if (keltnerChannelMiddle === null || keltnerChannelRange === null || bbMid === null)
|
|
1754
|
+
return null;
|
|
1755
|
+
if (
|
|
1756
|
+
this.highs.length < this.keltnerChannelPeriod ||
|
|
1757
|
+
this.bbBuf.length < this.bollingerBandPeriod
|
|
1758
|
+
)
|
|
1759
|
+
return null;
|
|
1760
|
+
const hh = maxOf(this.highs);
|
|
1761
|
+
const ll = minOf(this.lows);
|
|
1762
|
+
const mm = ((hh + ll) / 2 + keltnerChannelMiddle) / 2;
|
|
1763
|
+
const lr = this.lin.next(bar.close - mm);
|
|
1764
|
+
if (lr === null) return null;
|
|
1765
|
+
const dev = this.bollingerStandardDeviations * popStdev(this.bbBuf);
|
|
1766
|
+
return {
|
|
1767
|
+
upperBollingerBand: bbMid + dev,
|
|
1768
|
+
lowerBollingerBand: bbMid - dev,
|
|
1769
|
+
keltnerChannelMiddle,
|
|
1770
|
+
keltnerChannelRange,
|
|
1771
|
+
momentum: lr.value,
|
|
1772
|
+
};
|
|
1773
|
+
}
|
|
1774
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1775
|
+
return snapshotOf('squeezeCore', {
|
|
1776
|
+
bollingerBandPeriod: this.bollingerBandPeriod,
|
|
1777
|
+
bollingerStandardDeviations: this.bollingerStandardDeviations,
|
|
1778
|
+
keltnerChannelPeriod: this.keltnerChannelPeriod,
|
|
1779
|
+
previousClose: this.previousClose,
|
|
1780
|
+
smaKc: this.smaKc.toJSON(),
|
|
1781
|
+
trSma: this.trSma.toJSON(),
|
|
1782
|
+
smaBb: this.smaBb.toJSON(),
|
|
1783
|
+
bbBuf: [...this.bbBuf],
|
|
1784
|
+
highs: [...this.highs],
|
|
1785
|
+
lows: [...this.lows],
|
|
1786
|
+
lin: this.lin.toJSON(),
|
|
1787
|
+
});
|
|
1788
|
+
}
|
|
1789
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SqueezeCore {
|
|
1790
|
+
const state = readSnapshot(snapshot, 'squeezeCore');
|
|
1791
|
+
const x = new SqueezeCore({
|
|
1792
|
+
bollingerBandPeriod: state.number('bollingerBandPeriod'),
|
|
1793
|
+
bollingerStandardDeviations: state.number('bollingerStandardDeviations'),
|
|
1794
|
+
keltnerChannelPeriod: state.number('keltnerChannelPeriod'),
|
|
1795
|
+
});
|
|
1796
|
+
Object.assign(x, { previousClose: state.numberOrNull('previousClose') });
|
|
1797
|
+
x.smaKc = SmaStream.fromJSON(state.child('smaKc'));
|
|
1798
|
+
x.trSma = SmaStream.fromJSON(state.child('trSma'));
|
|
1799
|
+
x.smaBb = SmaStream.fromJSON(state.child('smaBb'));
|
|
1800
|
+
x.lin = LinregStream.fromJSON(state.child('lin'));
|
|
1801
|
+
x.bbBuf = state.numbers('bbBuf');
|
|
1802
|
+
x.highs = state.numbers('highs');
|
|
1803
|
+
x.lows = state.numbers('lows');
|
|
1804
|
+
return x;
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
export interface SqueezeParameters {
|
|
1809
|
+
bollingerBandPeriod?: number;
|
|
1810
|
+
bollingerStandardDeviations?: number;
|
|
1811
|
+
keltnerChannelPeriod?: number;
|
|
1812
|
+
keltnerChannelMultiplier?: number;
|
|
1813
|
+
}
|
|
1814
|
+
export interface SqueezePoint {
|
|
1815
|
+
/** 1 when the Bollinger Bands sit inside the Keltner Channel (squeeze on), else 0. */
|
|
1816
|
+
on: number;
|
|
1817
|
+
/** LazyBear squeeze momentum histogram. */
|
|
1818
|
+
momentum: number;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
class SqueezeStream implements IndicatorStream<BarInput, SqueezePoint> {
|
|
1822
|
+
private core: SqueezeCore;
|
|
1823
|
+
value: SqueezePoint | null = null;
|
|
1824
|
+
private readonly keltnerChannelMultiplier: number;
|
|
1825
|
+
constructor(parameters: {
|
|
1826
|
+
bollingerBandPeriod: number;
|
|
1827
|
+
bollingerStandardDeviations: number;
|
|
1828
|
+
keltnerChannelPeriod: number;
|
|
1829
|
+
keltnerChannelMultiplier: number;
|
|
1830
|
+
}) {
|
|
1831
|
+
requireStreamParameters('SqueezeStream.constructor#0', 'SqueezeStream', parameters);
|
|
1832
|
+
const {
|
|
1833
|
+
bollingerBandPeriod,
|
|
1834
|
+
bollingerStandardDeviations,
|
|
1835
|
+
keltnerChannelPeriod,
|
|
1836
|
+
keltnerChannelMultiplier,
|
|
1837
|
+
} = parameters;
|
|
1838
|
+
this.keltnerChannelMultiplier = keltnerChannelMultiplier;
|
|
1839
|
+
|
|
1840
|
+
this.core = new SqueezeCore({
|
|
1841
|
+
bollingerBandPeriod,
|
|
1842
|
+
bollingerStandardDeviations,
|
|
1843
|
+
keltnerChannelPeriod,
|
|
1844
|
+
});
|
|
1845
|
+
}
|
|
1846
|
+
next(bar: BarInput): SqueezePoint | null {
|
|
1847
|
+
const o = this.core.update(bar);
|
|
1848
|
+
if (o === null) {
|
|
1849
|
+
this.value = null;
|
|
1850
|
+
return null;
|
|
1851
|
+
}
|
|
1852
|
+
const upperKC = o.keltnerChannelMiddle + this.keltnerChannelMultiplier * o.keltnerChannelRange;
|
|
1853
|
+
const lowerKC = o.keltnerChannelMiddle - this.keltnerChannelMultiplier * o.keltnerChannelRange;
|
|
1854
|
+
const on = o.lowerBollingerBand > lowerKC && o.upperBollingerBand < upperKC ? 1 : 0;
|
|
1855
|
+
this.value = { on, momentum: o.momentum };
|
|
1856
|
+
return this.value;
|
|
1857
|
+
}
|
|
1858
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
1859
|
+
return snapshotOf('squeeze', {
|
|
1860
|
+
keltnerChannelMultiplier: this.keltnerChannelMultiplier,
|
|
1861
|
+
core: this.core.toJSON(),
|
|
1862
|
+
value: this.value,
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SqueezeStream {
|
|
1866
|
+
const state = readSnapshot(snapshot, 'squeeze');
|
|
1867
|
+
const x = new SqueezeStream({
|
|
1868
|
+
bollingerBandPeriod: 1,
|
|
1869
|
+
bollingerStandardDeviations: 1,
|
|
1870
|
+
keltnerChannelPeriod: 1,
|
|
1871
|
+
keltnerChannelMultiplier: state.number('keltnerChannelMultiplier'),
|
|
1872
|
+
});
|
|
1873
|
+
x.core = SqueezeCore.fromJSON(state.child('core'));
|
|
1874
|
+
x.value = state.cached<SqueezePoint>('value');
|
|
1875
|
+
return x;
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
export const squeeze = withBuiltinMetadata(
|
|
1880
|
+
makeIndicator<SqueezeParameters, BarInput, SqueezePoint>(
|
|
1881
|
+
(p) =>
|
|
1882
|
+
new SqueezeStream({
|
|
1883
|
+
bollingerBandPeriod: requirePeriod(
|
|
1884
|
+
p.bollingerBandPeriod ?? 20,
|
|
1885
|
+
'squeeze',
|
|
1886
|
+
'bollingerBandPeriod',
|
|
1887
|
+
),
|
|
1888
|
+
bollingerStandardDeviations: requirePositive(
|
|
1889
|
+
p.bollingerStandardDeviations ?? 2,
|
|
1890
|
+
'squeeze',
|
|
1891
|
+
'bollingerStandardDeviations',
|
|
1892
|
+
),
|
|
1893
|
+
keltnerChannelPeriod: requirePeriod(
|
|
1894
|
+
p.keltnerChannelPeriod ?? 20,
|
|
1895
|
+
'squeeze',
|
|
1896
|
+
'keltnerChannelPeriod',
|
|
1897
|
+
),
|
|
1898
|
+
keltnerChannelMultiplier: requirePositive(
|
|
1899
|
+
p.keltnerChannelMultiplier ?? 1.5,
|
|
1900
|
+
'squeeze',
|
|
1901
|
+
'keltnerChannelMultiplier',
|
|
1902
|
+
),
|
|
1903
|
+
}),
|
|
1904
|
+
SqueezeStream.fromJSON,
|
|
1905
|
+
() => ({ on: NaN, momentum: NaN }),
|
|
1906
|
+
),
|
|
1907
|
+
builtinMetadata.squeezeMetadata,
|
|
1908
|
+
);
|
|
1909
|
+
|
|
1910
|
+
// ───────────────────────── SqueezePro (3 compression levels) ─────────────────────────
|
|
1911
|
+
|
|
1912
|
+
export interface SqueezeProParameters {
|
|
1913
|
+
bollingerBandPeriod?: number;
|
|
1914
|
+
bollingerStandardDeviations?: number;
|
|
1915
|
+
keltnerChannelPeriod?: number;
|
|
1916
|
+
/**
|
|
1917
|
+
* Keltner multipliers, wide → tight. Default 2.0 / 1.5 / 1.0.
|
|
1918
|
+
*
|
|
1919
|
+
* Named for the CHANNEL, not the compression level they detect. As `low`/`mid`/`high` they
|
|
1920
|
+
* inverted against their own values — `lowMultiplier` was the LARGEST number (2.0, the widest
|
|
1921
|
+
* channel, the loosest squeeze) — so the reader had to know which of the two scales the word
|
|
1922
|
+
* referred to. The point's fields are now `lowCompression`/`normalCompression`/
|
|
1923
|
+
* `highCompression`, so both halves of the indicator say which scale they are on.
|
|
1924
|
+
*/
|
|
1925
|
+
wideKeltnerChannelMultiplier?: number;
|
|
1926
|
+
normalKeltnerChannelMultiplier?: number;
|
|
1927
|
+
narrowKeltnerChannelMultiplier?: number;
|
|
1928
|
+
}
|
|
1929
|
+
export interface SqueezeProPoint {
|
|
1930
|
+
/**
|
|
1931
|
+
* The three compression levels, named for what they measure.
|
|
1932
|
+
*
|
|
1933
|
+
* `low`/`mid`/`high` sat beside multipliers that ran the other way — the loosest squeeze uses the
|
|
1934
|
+
* WIDEST channel (×2) — so a reader had to know which of two scales each word referred to. Renamed
|
|
1935
|
+
* while breaking changes are still cheap.
|
|
1936
|
+
*/
|
|
1937
|
+
/** Loosest compression (BB inside KC×wideKeltnerChannelMultiplier). */
|
|
1938
|
+
lowCompression: number;
|
|
1939
|
+
/** Normal compression. */
|
|
1940
|
+
normalCompression: number;
|
|
1941
|
+
/** Tightest compression (BB inside KC×narrowKeltnerChannelMultiplier). */
|
|
1942
|
+
highCompression: number;
|
|
1943
|
+
momentum: number;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
class SqueezeProStream implements IndicatorStream<BarInput, SqueezeProPoint> {
|
|
1947
|
+
private core: SqueezeCore;
|
|
1948
|
+
value: SqueezeProPoint | null = null;
|
|
1949
|
+
private readonly wideKeltnerChannelMultiplier: number;
|
|
1950
|
+
private readonly normalKeltnerChannelMultiplier: number;
|
|
1951
|
+
private readonly narrowKeltnerChannelMultiplier: number;
|
|
1952
|
+
constructor(parameters: {
|
|
1953
|
+
bollingerBandPeriod: number;
|
|
1954
|
+
bollingerStandardDeviations: number;
|
|
1955
|
+
keltnerChannelPeriod: number;
|
|
1956
|
+
wideKeltnerChannelMultiplier: number;
|
|
1957
|
+
normalKeltnerChannelMultiplier: number;
|
|
1958
|
+
narrowKeltnerChannelMultiplier: number;
|
|
1959
|
+
}) {
|
|
1960
|
+
requireStreamParameters('SqueezeProStream.constructor#0', 'SqueezeProStream', parameters);
|
|
1961
|
+
const {
|
|
1962
|
+
bollingerBandPeriod,
|
|
1963
|
+
bollingerStandardDeviations,
|
|
1964
|
+
keltnerChannelPeriod,
|
|
1965
|
+
wideKeltnerChannelMultiplier,
|
|
1966
|
+
normalKeltnerChannelMultiplier,
|
|
1967
|
+
narrowKeltnerChannelMultiplier,
|
|
1968
|
+
} = parameters;
|
|
1969
|
+
this.wideKeltnerChannelMultiplier = wideKeltnerChannelMultiplier;
|
|
1970
|
+
this.normalKeltnerChannelMultiplier = normalKeltnerChannelMultiplier;
|
|
1971
|
+
this.narrowKeltnerChannelMultiplier = narrowKeltnerChannelMultiplier;
|
|
1972
|
+
|
|
1973
|
+
this.core = new SqueezeCore({
|
|
1974
|
+
bollingerBandPeriod,
|
|
1975
|
+
bollingerStandardDeviations,
|
|
1976
|
+
keltnerChannelPeriod,
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
private inside(
|
|
1980
|
+
o: {
|
|
1981
|
+
upperBollingerBand: number;
|
|
1982
|
+
lowerBollingerBand: number;
|
|
1983
|
+
keltnerChannelMiddle: number;
|
|
1984
|
+
keltnerChannelRange: number;
|
|
1985
|
+
},
|
|
1986
|
+
mult: number,
|
|
1987
|
+
): number {
|
|
1988
|
+
return o.lowerBollingerBand > o.keltnerChannelMiddle - mult * o.keltnerChannelRange &&
|
|
1989
|
+
o.upperBollingerBand < o.keltnerChannelMiddle + mult * o.keltnerChannelRange
|
|
1990
|
+
? 1
|
|
1991
|
+
: 0;
|
|
1992
|
+
}
|
|
1993
|
+
next(bar: BarInput): SqueezeProPoint | null {
|
|
1994
|
+
const o = this.core.update(bar);
|
|
1995
|
+
if (o === null) {
|
|
1996
|
+
this.value = null;
|
|
1997
|
+
return null;
|
|
1998
|
+
}
|
|
1999
|
+
this.value = {
|
|
2000
|
+
lowCompression: this.inside(o, this.wideKeltnerChannelMultiplier),
|
|
2001
|
+
normalCompression: this.inside(o, this.normalKeltnerChannelMultiplier),
|
|
2002
|
+
highCompression: this.inside(o, this.narrowKeltnerChannelMultiplier),
|
|
2003
|
+
momentum: o.momentum,
|
|
2004
|
+
};
|
|
2005
|
+
return this.value;
|
|
2006
|
+
}
|
|
2007
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
2008
|
+
return snapshotOf('squeezePro', {
|
|
2009
|
+
wideKeltnerChannelMultiplier: this.wideKeltnerChannelMultiplier,
|
|
2010
|
+
normalKeltnerChannelMultiplier: this.normalKeltnerChannelMultiplier,
|
|
2011
|
+
narrowKeltnerChannelMultiplier: this.narrowKeltnerChannelMultiplier,
|
|
2012
|
+
core: this.core.toJSON(),
|
|
2013
|
+
value: this.value,
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): SqueezeProStream {
|
|
2017
|
+
const state = readSnapshot(snapshot, 'squeezePro');
|
|
2018
|
+
const x = new SqueezeProStream({
|
|
2019
|
+
bollingerBandPeriod: 1,
|
|
2020
|
+
bollingerStandardDeviations: 1,
|
|
2021
|
+
keltnerChannelPeriod: 1,
|
|
2022
|
+
wideKeltnerChannelMultiplier: state.number('wideKeltnerChannelMultiplier'),
|
|
2023
|
+
normalKeltnerChannelMultiplier: state.number('normalKeltnerChannelMultiplier'),
|
|
2024
|
+
narrowKeltnerChannelMultiplier: state.number('narrowKeltnerChannelMultiplier'),
|
|
2025
|
+
});
|
|
2026
|
+
x.core = SqueezeCore.fromJSON(state.child('core'));
|
|
2027
|
+
x.value = state.cached<SqueezeProPoint>('value');
|
|
2028
|
+
return x;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* The three multipliers must WIDEN monotonically, or the levels stop meaning what they are named.
|
|
2034
|
+
*
|
|
2035
|
+
* Positivity was checked and ordering was not, so `wide: 1, narrow: 2` was accepted and inverted the
|
|
2036
|
+
* whole indicator: `lowCompression` (the loosest squeeze) would be computed from the TIGHTEST
|
|
2037
|
+
* channel. The canonical warmup shipped exactly that inversion, which is how a defaults table can
|
|
2038
|
+
* teach a configuration the implementation never intended.
|
|
2039
|
+
*
|
|
2040
|
+
* Returns nothing — it exists for the throw.
|
|
2041
|
+
*/
|
|
2042
|
+
interface OrderedMultipliers {
|
|
2043
|
+
wideKeltnerChannelMultiplier: number;
|
|
2044
|
+
normalKeltnerChannelMultiplier: number;
|
|
2045
|
+
narrowKeltnerChannelMultiplier: number;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
/**
|
|
2049
|
+
* The three Keltner multipliers, each validated as a NUMBER before their ORDERING is judged.
|
|
2050
|
+
*
|
|
2051
|
+
* RV10 — order of validation is part of the contract. This checked `wide > normal > narrow` first
|
|
2052
|
+
* and left positivity to three separate `requirePositive` calls spread in after it, so
|
|
2053
|
+
* `wideKeltnerChannelMultiplier: NaN` reported `input.out_of_range` with the message "must satisfy
|
|
2054
|
+
* wideKeltnerChannelMultiplier > normalKeltnerChannelMultiplier > …". `NaN > 1.5` is false, so a
|
|
2055
|
+
* TYPE failure was reported as a RELATION failure, and the caller was told to reorder three numbers
|
|
2056
|
+
* when one of them was not a number. `Infinity` happened to read correctly only because
|
|
2057
|
+
* `Infinity > 1.5` is true and it fell through to the finiteness check — the taxonomy was right by
|
|
2058
|
+
* luck on one input class and wrong on the other.
|
|
2059
|
+
*
|
|
2060
|
+
* Ordering is a relation between three already-valid numbers, so it cannot be judged until they are
|
|
2061
|
+
* known to be numbers. Validating and returning them here also removes the duplicate
|
|
2062
|
+
* `requirePositive` calls at the call site, where the object-literal evaluation order was the only
|
|
2063
|
+
* thing sequencing the two checks.
|
|
2064
|
+
*/
|
|
2065
|
+
function requireOrderedMultipliers(p: SqueezeProParameters): OrderedMultipliers {
|
|
2066
|
+
const wide = requirePositive(
|
|
2067
|
+
p.wideKeltnerChannelMultiplier ?? 2.0,
|
|
2068
|
+
'squeezePro',
|
|
2069
|
+
'wideKeltnerChannelMultiplier',
|
|
2070
|
+
);
|
|
2071
|
+
const normal = requirePositive(
|
|
2072
|
+
p.normalKeltnerChannelMultiplier ?? 1.5,
|
|
2073
|
+
'squeezePro',
|
|
2074
|
+
'normalKeltnerChannelMultiplier',
|
|
2075
|
+
);
|
|
2076
|
+
const narrow = requirePositive(
|
|
2077
|
+
p.narrowKeltnerChannelMultiplier ?? 1.0,
|
|
2078
|
+
'squeezePro',
|
|
2079
|
+
'narrowKeltnerChannelMultiplier',
|
|
2080
|
+
);
|
|
2081
|
+
if (!(wide > normal && normal > narrow)) {
|
|
2082
|
+
throw new InputError(
|
|
2083
|
+
'squeezePro: the Keltner multipliers must satisfy ' +
|
|
2084
|
+
'wideKeltnerChannelMultiplier > normalKeltnerChannelMultiplier > ' +
|
|
2085
|
+
`narrowKeltnerChannelMultiplier; got wideKeltnerChannelMultiplier=${wide}, ` +
|
|
2086
|
+
`normalKeltnerChannelMultiplier=${normal}, narrowKeltnerChannelMultiplier=${narrow}.` +
|
|
2087
|
+
'\n e.g. squeezePro(bars, { wideKeltnerChannelMultiplier: 2, ' +
|
|
2088
|
+
'normalKeltnerChannelMultiplier: 1.5, narrowKeltnerChannelMultiplier: 1 })',
|
|
2089
|
+
{
|
|
2090
|
+
code: ErrorCode.InputOutOfRange,
|
|
2091
|
+
context: {
|
|
2092
|
+
function: 'squeezePro',
|
|
2093
|
+
wideKeltnerChannelMultiplier: wide,
|
|
2094
|
+
normalKeltnerChannelMultiplier: normal,
|
|
2095
|
+
narrowKeltnerChannelMultiplier: narrow,
|
|
2096
|
+
},
|
|
2097
|
+
},
|
|
2098
|
+
);
|
|
2099
|
+
}
|
|
2100
|
+
return {
|
|
2101
|
+
wideKeltnerChannelMultiplier: wide,
|
|
2102
|
+
normalKeltnerChannelMultiplier: normal,
|
|
2103
|
+
narrowKeltnerChannelMultiplier: narrow,
|
|
2104
|
+
};
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
export const squeezePro = withBuiltinMetadata(
|
|
2108
|
+
makeIndicator<SqueezeProParameters, BarInput, SqueezeProPoint>(
|
|
2109
|
+
(p) =>
|
|
2110
|
+
new SqueezeProStream({
|
|
2111
|
+
bollingerBandPeriod: requirePeriod(
|
|
2112
|
+
p.bollingerBandPeriod ?? 20,
|
|
2113
|
+
'squeezePro',
|
|
2114
|
+
'bollingerBandPeriod',
|
|
2115
|
+
),
|
|
2116
|
+
bollingerStandardDeviations: requirePositive(
|
|
2117
|
+
p.bollingerStandardDeviations ?? 2,
|
|
2118
|
+
'squeezePro',
|
|
2119
|
+
'bollingerStandardDeviations',
|
|
2120
|
+
),
|
|
2121
|
+
keltnerChannelPeriod: requirePeriod(
|
|
2122
|
+
p.keltnerChannelPeriod ?? 20,
|
|
2123
|
+
'squeezePro',
|
|
2124
|
+
'keltnerChannelPeriod',
|
|
2125
|
+
),
|
|
2126
|
+
...requireOrderedMultipliers(p),
|
|
2127
|
+
}),
|
|
2128
|
+
SqueezeProStream.fromJSON,
|
|
2129
|
+
() => ({ lowCompression: NaN, normalCompression: NaN, highCompression: NaN, momentum: NaN }),
|
|
2130
|
+
),
|
|
2131
|
+
builtinMetadata.squeezeProMetadata,
|
|
2132
|
+
);
|
|
2133
|
+
|
|
2134
|
+
// ───────────────────────── projection oscillator (Widner) ─────────────────────────
|
|
2135
|
+
|
|
2136
|
+
export interface ProjectionPoint {
|
|
2137
|
+
po: number;
|
|
2138
|
+
upper: number;
|
|
2139
|
+
lower: number;
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
class ProjectionOscillatorStream implements IndicatorStream<BarInput, ProjectionPoint> {
|
|
2143
|
+
private lin: LinregStream;
|
|
2144
|
+
private highs: number[] = [];
|
|
2145
|
+
private lows: number[] = [];
|
|
2146
|
+
value: ProjectionPoint | null = null;
|
|
2147
|
+
constructor(private readonly period: number) {
|
|
2148
|
+
requirePeriod(period, 'ProjectionOscillatorStream');
|
|
2149
|
+
this.lin = new LinregStream(period);
|
|
2150
|
+
}
|
|
2151
|
+
next(bar: BarInput): ProjectionPoint | null {
|
|
2152
|
+
const lr = this.lin.next(bar.close);
|
|
2153
|
+
this.highs.push(bar.high);
|
|
2154
|
+
this.lows.push(bar.low);
|
|
2155
|
+
if (this.highs.length > this.period) {
|
|
2156
|
+
this.highs.shift();
|
|
2157
|
+
this.lows.shift();
|
|
2158
|
+
}
|
|
2159
|
+
if (lr === null || this.highs.length < this.period) {
|
|
2160
|
+
this.value = null;
|
|
2161
|
+
return null;
|
|
2162
|
+
}
|
|
2163
|
+
const slope = lr.slope;
|
|
2164
|
+
const n = this.period;
|
|
2165
|
+
let pu = -Infinity;
|
|
2166
|
+
let pl = Infinity;
|
|
2167
|
+
for (let i = 0; i < n; i++) {
|
|
2168
|
+
// i bars ago, projected forward to now along the regression slope
|
|
2169
|
+
const hi = this.highs[n - 1 - i]! + slope * i;
|
|
2170
|
+
const lo = this.lows[n - 1 - i]! + slope * i;
|
|
2171
|
+
if (hi > pu) pu = hi;
|
|
2172
|
+
if (lo < pl) pl = lo;
|
|
2173
|
+
}
|
|
2174
|
+
const po = pu === pl ? 50 : (100 * (bar.close - pl)) / (pu - pl);
|
|
2175
|
+
this.value = { po, upper: pu, lower: pl };
|
|
2176
|
+
return this.value;
|
|
2177
|
+
}
|
|
2178
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
2179
|
+
return snapshotOf('projectionOscillator', {
|
|
2180
|
+
period: this.period,
|
|
2181
|
+
lin: this.lin.toJSON(),
|
|
2182
|
+
highs: [...this.highs],
|
|
2183
|
+
lows: [...this.lows],
|
|
2184
|
+
value: this.value,
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): ProjectionOscillatorStream {
|
|
2188
|
+
const state = readSnapshot(snapshot, 'projectionOscillator');
|
|
2189
|
+
const x = new ProjectionOscillatorStream(state.lookback('period'));
|
|
2190
|
+
x.lin = LinregStream.fromJSON(state.child('lin'));
|
|
2191
|
+
x.highs = state.numbers('highs');
|
|
2192
|
+
x.lows = state.numbers('lows');
|
|
2193
|
+
x.value = state.cached<ProjectionPoint>('value');
|
|
2194
|
+
return x;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
export const projectionOscillator = withBuiltinMetadata(
|
|
2199
|
+
makeIndicator<{ period?: number }, BarInput, ProjectionPoint>(
|
|
2200
|
+
(p) => new ProjectionOscillatorStream(requirePeriod(p.period ?? 14, 'projectionOscillator')),
|
|
2201
|
+
ProjectionOscillatorStream.fromJSON,
|
|
2202
|
+
() => ({ po: NaN, upper: NaN, lower: NaN }),
|
|
2203
|
+
),
|
|
2204
|
+
builtinMetadata.projectionOscillatorMetadata,
|
|
2205
|
+
);
|
|
2206
|
+
|
|
2207
|
+
// ───────────────────────── TD Sequential (DeMark core) ─────────────────────────
|
|
2208
|
+
|
|
2209
|
+
export interface TdSequentialParameters {
|
|
2210
|
+
/** Comparison lookback for the setup (DeMark uses 4). */
|
|
2211
|
+
lookback?: number;
|
|
2212
|
+
}
|
|
2213
|
+
export interface TdSequentialPoint {
|
|
2214
|
+
/** Active setup count, 1–9 (0 if none). */
|
|
2215
|
+
setup: number;
|
|
2216
|
+
/** Active countdown count, 1–13 (0 if none). */
|
|
2217
|
+
countdown: number;
|
|
2218
|
+
/** +1 sell side (price strength), −1 buy side (price weakness), 0 none. */
|
|
2219
|
+
direction: number;
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
/**
|
|
2223
|
+
* Core TD Sequential: the price-flip setup (1–9) and a basic countdown (1–13). This implements the
|
|
2224
|
+
* essential setup/countdown signal, not the full DeMark ruleset (no perfection / cancellation /
|
|
2225
|
+
* deferral qualifiers).
|
|
2226
|
+
*/
|
|
2227
|
+
class TdSequentialStream implements IndicatorStream<BarInput, TdSequentialPoint> {
|
|
2228
|
+
private closes: number[] = []; // last lookback+1 closes
|
|
2229
|
+
private bars: BarInput[] = []; // last 3 bars (for low[2]/high[2])
|
|
2230
|
+
private buySetup = 0;
|
|
2231
|
+
private sellSetup = 0;
|
|
2232
|
+
private armed = 0; // +1 sell countdown, −1 buy countdown, 0 none
|
|
2233
|
+
private countdown = 0;
|
|
2234
|
+
value: TdSequentialPoint | null = null;
|
|
2235
|
+
constructor(private readonly lookback: number) {
|
|
2236
|
+
requirePeriod(lookback, 'TdSequentialStream', 'lookback', 1, 'bars');
|
|
2237
|
+
}
|
|
2238
|
+
next(bar: BarInput): TdSequentialPoint | null {
|
|
2239
|
+
this.closes.push(bar.close);
|
|
2240
|
+
if (this.closes.length > this.lookback + 1) this.closes.shift();
|
|
2241
|
+
this.bars.push(bar);
|
|
2242
|
+
if (this.bars.length > 3) this.bars.shift();
|
|
2243
|
+
if (this.closes.length < this.lookback + 1) {
|
|
2244
|
+
this.value = null;
|
|
2245
|
+
return null;
|
|
2246
|
+
}
|
|
2247
|
+
const refClose = this.closes[0]!; // `lookback` bars ago
|
|
2248
|
+
let setup = 0;
|
|
2249
|
+
let direction = 0;
|
|
2250
|
+
if (bar.close < refClose) {
|
|
2251
|
+
const was = this.buySetup;
|
|
2252
|
+
this.buySetup = Math.min(this.buySetup + 1, 9);
|
|
2253
|
+
this.sellSetup = 0;
|
|
2254
|
+
if (was === 8 && this.buySetup === 9) {
|
|
2255
|
+
this.armed = -1;
|
|
2256
|
+
this.countdown = 0;
|
|
2257
|
+
}
|
|
2258
|
+
setup = this.buySetup;
|
|
2259
|
+
direction = -1;
|
|
2260
|
+
} else if (bar.close > refClose) {
|
|
2261
|
+
const was = this.sellSetup;
|
|
2262
|
+
this.sellSetup = Math.min(this.sellSetup + 1, 9);
|
|
2263
|
+
this.buySetup = 0;
|
|
2264
|
+
if (was === 8 && this.sellSetup === 9) {
|
|
2265
|
+
this.armed = 1;
|
|
2266
|
+
this.countdown = 0;
|
|
2267
|
+
}
|
|
2268
|
+
setup = this.sellSetup;
|
|
2269
|
+
direction = 1;
|
|
2270
|
+
} else {
|
|
2271
|
+
this.buySetup = 0;
|
|
2272
|
+
this.sellSetup = 0;
|
|
2273
|
+
}
|
|
2274
|
+
if (this.armed !== 0 && this.bars.length === 3) {
|
|
2275
|
+
const ago2 = this.bars[0]!; // 2 bars ago
|
|
2276
|
+
if (this.armed === -1 && bar.close <= ago2.low && this.countdown < 13) this.countdown++;
|
|
2277
|
+
else if (this.armed === 1 && bar.close >= ago2.high && this.countdown < 13) this.countdown++;
|
|
2278
|
+
if (this.countdown >= 13) this.armed = 0; // countdown complete
|
|
2279
|
+
}
|
|
2280
|
+
this.value = { setup, countdown: this.countdown, direction };
|
|
2281
|
+
return this.value;
|
|
2282
|
+
}
|
|
2283
|
+
toJSON(): TechnicalAnalysisSnapshot {
|
|
2284
|
+
return snapshotOf('tdSequential', {
|
|
2285
|
+
lookback: this.lookback,
|
|
2286
|
+
closes: [...this.closes],
|
|
2287
|
+
bars: this.bars.map((x) => ({ ...x })),
|
|
2288
|
+
buySetup: this.buySetup,
|
|
2289
|
+
sellSetup: this.sellSetup,
|
|
2290
|
+
armed: this.armed,
|
|
2291
|
+
countdown: this.countdown,
|
|
2292
|
+
value: this.value,
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
static fromJSON(snapshot: TechnicalAnalysisSnapshot): TdSequentialStream {
|
|
2296
|
+
const state = readSnapshot(snapshot, 'tdSequential');
|
|
2297
|
+
const x = new TdSequentialStream(state.lookback('lookback'));
|
|
2298
|
+
Object.assign(x, {
|
|
2299
|
+
buySetup: state.number('buySetup'),
|
|
2300
|
+
sellSetup: state.number('sellSetup'),
|
|
2301
|
+
armed: state.number('armed'),
|
|
2302
|
+
countdown: state.number('countdown'),
|
|
2303
|
+
});
|
|
2304
|
+
x.closes = state.numbers('closes');
|
|
2305
|
+
x.bars = state.records<BarInput>('bars').map((y) => ({ ...y }));
|
|
2306
|
+
x.value = state.cached<TdSequentialPoint>('value');
|
|
2307
|
+
return x;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
export const tdSequential = withBuiltinMetadata(
|
|
2312
|
+
makeIndicator<TdSequentialParameters, BarInput, TdSequentialPoint>(
|
|
2313
|
+
(p) => new TdSequentialStream(requirePeriod(p.lookback ?? 4, 'tdSequential', 'lookback')),
|
|
2314
|
+
TdSequentialStream.fromJSON,
|
|
2315
|
+
() => ({ setup: NaN, countdown: NaN, direction: NaN }),
|
|
2316
|
+
),
|
|
2317
|
+
builtinMetadata.tdSequentialMetadata,
|
|
2318
|
+
);
|
|
2319
|
+
|
|
2320
|
+
export {
|
|
2321
|
+
BiasStream,
|
|
2322
|
+
LinregOscStream,
|
|
2323
|
+
CoppockStream,
|
|
2324
|
+
CtiStream,
|
|
2325
|
+
EfficiencyRatioStream,
|
|
2326
|
+
CenterOfGravityStream,
|
|
2327
|
+
PsychologicalLineStream,
|
|
2328
|
+
SlopeStream,
|
|
2329
|
+
PvoStream,
|
|
2330
|
+
ElderRayStream,
|
|
2331
|
+
BrarStream,
|
|
2332
|
+
KdjStream,
|
|
2333
|
+
RvgiStream,
|
|
2334
|
+
PgoStream,
|
|
2335
|
+
TrixHistogramStream,
|
|
2336
|
+
SmiErgodicStream,
|
|
2337
|
+
VolumeWeightedMacdStream,
|
|
2338
|
+
InertiaStream,
|
|
2339
|
+
LaguerreRsiStream,
|
|
2340
|
+
QqeStream,
|
|
2341
|
+
RsxStream,
|
|
2342
|
+
SchaffTrendCycleStream,
|
|
2343
|
+
SqueezeCore,
|
|
2344
|
+
SqueezeStream,
|
|
2345
|
+
SqueezeProStream,
|
|
2346
|
+
ProjectionOscillatorStream,
|
|
2347
|
+
TdSequentialStream,
|
|
2348
|
+
};
|