@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,1228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simulated broker for the event-driven engine (spec §16.2).
|
|
3
|
+
*
|
|
4
|
+
* Holds a cash + positions account and fills orders against incoming bars with realistic mechanics:
|
|
5
|
+
* market / limit / stop / stop-limit order types, OCO and bracket links, shorting with borrow fees,
|
|
6
|
+
* a gross-leverage (margin) cap, commission + slippage, optional volume-participation partial fills,
|
|
7
|
+
* and dividend / split corporate actions. Deterministic — no clock, no randomness.
|
|
8
|
+
*
|
|
9
|
+
* The no-look-ahead contract is enforced by the engine: a strategy submits orders while handling bar
|
|
10
|
+
* `i`; `processBar` fills them against bar `i+1` (market orders at its open, stops/limits intrabar).
|
|
11
|
+
*/
|
|
12
|
+
import { ErrorCode, InputError, ensureFinite, ensureKnownKeys, ensurePositive, requireArgumentObject, ORDER_TYPES, TIME_IN_FORCE_VALUES, signOf, WarningCode, } from '../../core/dist/index.js';
|
|
13
|
+
import { borrow as borrowNs, fees as feesNs, slippage as slipNs, } from './costs.js';
|
|
14
|
+
/**
|
|
15
|
+
* Reject impossible bars before they reach the fill logic, which reads `open`/`high`/`low` — a
|
|
16
|
+
* negative or non-finite price (or `low > min(open,close)` / `high < max(open,close)`) would otherwise
|
|
17
|
+
* produce a fabricated fill. Backtests must fail loudly on impossible inputs (design law #4).
|
|
18
|
+
*/
|
|
19
|
+
function validateBar(bar, functionName) {
|
|
20
|
+
for (const field of ['open', 'high', 'low', 'close']) {
|
|
21
|
+
const v = bar[field];
|
|
22
|
+
if (!(v > 0) || !Number.isFinite(v)) {
|
|
23
|
+
throw new InputError(`${functionName}: bar ${field} must be a positive finite number, got ${v} (${bar.symbol}@${bar.timestampMs}).`, {
|
|
24
|
+
code: ErrorCode.InputNegativeSpot,
|
|
25
|
+
context: { symbol: bar.symbol, timestampMs: bar.timestampMs, field, value: v },
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const lo = Math.min(bar.open, bar.close);
|
|
30
|
+
const hi = Math.max(bar.open, bar.close);
|
|
31
|
+
if (bar.low > lo + 1e-9 || bar.high < hi - 1e-9 || bar.low > bar.high) {
|
|
32
|
+
throw new InputError(`${functionName}: bar OHLC is inconsistent (need low ≤ min(open,close) and high ≥ max(open,close)) for ${bar.symbol}@${bar.timestampMs}.`, {
|
|
33
|
+
code: ErrorCode.InputOutOfRange,
|
|
34
|
+
context: { open: bar.open, high: bar.high, low: bar.low, close: bar.close },
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Broker factory (spec §16.2: `brokers.simulated({ cash, commission, slippage })`). */
|
|
39
|
+
export const brokers = {
|
|
40
|
+
/** Construct a simulated broker. */
|
|
41
|
+
simulated(config) {
|
|
42
|
+
requireArgumentObject('brokers.simulated', 'config', config);
|
|
43
|
+
return new SimulatedBroker(config);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
let counter = 0;
|
|
47
|
+
function nextId() {
|
|
48
|
+
counter += 1;
|
|
49
|
+
return `o${counter}`;
|
|
50
|
+
}
|
|
51
|
+
/** A deterministic simulated broker. */
|
|
52
|
+
export class SimulatedBroker {
|
|
53
|
+
cash;
|
|
54
|
+
positions = new Map();
|
|
55
|
+
_orders = [];
|
|
56
|
+
_trades = [];
|
|
57
|
+
_warnings = [];
|
|
58
|
+
_settlements = [];
|
|
59
|
+
// The broker is LIVE simulator state: the engine appends to these arrays as the simulation runs,
|
|
60
|
+
// so they are exposed as readonly live views (not frozen snapshots — dx §4.4). Callers observing
|
|
61
|
+
// mid-run see growth; callers must never mutate (the readonly types enforce this in TS).
|
|
62
|
+
/** All orders ever submitted (live view, readonly). */
|
|
63
|
+
get orders() {
|
|
64
|
+
return this._orders;
|
|
65
|
+
}
|
|
66
|
+
/** All fills (live view, readonly). */
|
|
67
|
+
get trades() {
|
|
68
|
+
return this._trades;
|
|
69
|
+
}
|
|
70
|
+
/** Structured warnings raised during simulation (live view, readonly). */
|
|
71
|
+
get warnings() {
|
|
72
|
+
return this._warnings;
|
|
73
|
+
}
|
|
74
|
+
/** Option positions settled at expiry — exercise / assignment / worthless (live view, readonly). */
|
|
75
|
+
get settlements() {
|
|
76
|
+
return this._settlements;
|
|
77
|
+
}
|
|
78
|
+
optionSpecs = new Map();
|
|
79
|
+
fee;
|
|
80
|
+
slip;
|
|
81
|
+
brw;
|
|
82
|
+
periodsPerYear;
|
|
83
|
+
maxLeverage;
|
|
84
|
+
noShort;
|
|
85
|
+
participation;
|
|
86
|
+
assignmentModel;
|
|
87
|
+
assignmentThreshold;
|
|
88
|
+
riskFreeRate;
|
|
89
|
+
lastMark = new Map();
|
|
90
|
+
/** Timestamp of the bar currently/last processed — the broker's only notion of "now". */
|
|
91
|
+
lastTs = null;
|
|
92
|
+
/** Symbols already warned about being marked at cost (averagePrice) — one warning per symbol (WS2.8). */
|
|
93
|
+
markedAtCost = new Set();
|
|
94
|
+
cashLowWater = Infinity;
|
|
95
|
+
negativeCashWarning = null;
|
|
96
|
+
constructor(config) {
|
|
97
|
+
requireArgumentObject('SimulatedBroker', 'config', config);
|
|
98
|
+
// Law 12 + when-present ladders (the 350c2796 ruling): `{ assignment: null }` used to run the
|
|
99
|
+
// 'none' policy silently, and a `comission` typo left the fee model at zero cost.
|
|
100
|
+
ensureKnownKeys('SimulatedBroker', 'config', config, [
|
|
101
|
+
'cash',
|
|
102
|
+
'commission',
|
|
103
|
+
'slippage',
|
|
104
|
+
'borrow',
|
|
105
|
+
'periodsPerYear',
|
|
106
|
+
'maxLeverage',
|
|
107
|
+
'noShort',
|
|
108
|
+
'maxVolumeParticipation',
|
|
109
|
+
'assignment',
|
|
110
|
+
'assignmentThreshold',
|
|
111
|
+
'riskFreeRate',
|
|
112
|
+
]);
|
|
113
|
+
for (const field of [
|
|
114
|
+
'periodsPerYear',
|
|
115
|
+
'maxLeverage',
|
|
116
|
+
'maxVolumeParticipation',
|
|
117
|
+
'assignmentThreshold',
|
|
118
|
+
'riskFreeRate',
|
|
119
|
+
]) {
|
|
120
|
+
const value = config[field];
|
|
121
|
+
if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value))) {
|
|
122
|
+
throw new InputError(`SimulatedBroker: ${field} must be a finite number when provided. Received ${value === null ? 'null' : typeof value}.`, { code: ErrorCode.InputWrongType, context: { field } });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (config.noShort !== undefined && typeof config.noShort !== 'boolean') {
|
|
126
|
+
throw new InputError(`SimulatedBroker: noShort must be a boolean when provided. Received ${config.noShort === null ? 'null' : typeof config.noShort}.`, { code: ErrorCode.InputWrongType, context: { field: 'noShort' } });
|
|
127
|
+
}
|
|
128
|
+
if (config.assignment !== undefined &&
|
|
129
|
+
config.assignment !== 'model' &&
|
|
130
|
+
config.assignment !== 'none') {
|
|
131
|
+
throw new InputError(`SimulatedBroker: assignment must be 'model' | 'none' when provided. Received ${config.assignment === null ? 'null' : JSON.stringify(config.assignment)}.`, { code: ErrorCode.InputInvalidEnum, context: { field: 'assignment' } });
|
|
132
|
+
}
|
|
133
|
+
for (const modelField of ['commission', 'slippage', 'borrow']) {
|
|
134
|
+
const value = config[modelField];
|
|
135
|
+
if (value !== undefined && (value === null || typeof value !== 'object')) {
|
|
136
|
+
throw new InputError(`SimulatedBroker: ${modelField} must be a cost-model object when provided — build one with the fees/slippage/borrow namespaces. Received ${value === null ? 'null' : typeof value}.`, { code: ErrorCode.InputWrongType, context: { field: modelField } });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
ensureFinite(config.cash, 'cash', 'SimulatedBroker');
|
|
140
|
+
this.cash = config.cash;
|
|
141
|
+
this.fee = config.commission ?? feesNs.none();
|
|
142
|
+
this.slip = config.slippage ?? slipNs.none();
|
|
143
|
+
this.brw = config.borrow ?? borrowNs.none();
|
|
144
|
+
this.periodsPerYear = config.periodsPerYear ?? 252;
|
|
145
|
+
ensurePositive(this.periodsPerYear, 'periodsPerYear', 'SimulatedBroker');
|
|
146
|
+
// maxLeverage / participation default to Infinity (no cap), so allow Infinity but reject ≤ 0 / NaN.
|
|
147
|
+
if (config.maxLeverage !== undefined && !(config.maxLeverage > 0)) {
|
|
148
|
+
throw new InputError(`SimulatedBroker: maxLeverage must be > 0, got ${config.maxLeverage}.`, {
|
|
149
|
+
code: ErrorCode.InputOutOfRange,
|
|
150
|
+
context: { maxLeverage: config.maxLeverage },
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (config.maxVolumeParticipation !== undefined && !(config.maxVolumeParticipation > 0)) {
|
|
154
|
+
throw new InputError(`SimulatedBroker: maxVolumeParticipation must be > 0, got ${config.maxVolumeParticipation}.`, {
|
|
155
|
+
code: ErrorCode.InputOutOfRange,
|
|
156
|
+
context: { maxVolumeParticipation: config.maxVolumeParticipation },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
this.maxLeverage = config.maxLeverage ?? Infinity;
|
|
160
|
+
this.noShort = config.noShort ?? false;
|
|
161
|
+
this.participation = config.maxVolumeParticipation ?? Infinity;
|
|
162
|
+
const assignment = config.assignment ?? 'none';
|
|
163
|
+
if (assignment !== 'model' && assignment !== 'none') {
|
|
164
|
+
throw new InputError(`SimulatedBroker: assignment must be 'model' or 'none', got "${assignment}".`, {
|
|
165
|
+
code: ErrorCode.InputInvalidEnum,
|
|
166
|
+
context: { assignment },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
this.assignmentModel = assignment === 'model';
|
|
170
|
+
this.riskFreeRate = config.riskFreeRate ?? 0;
|
|
171
|
+
ensureFinite(this.riskFreeRate, 'riskFreeRate', 'SimulatedBroker');
|
|
172
|
+
this.assignmentThreshold = config.assignmentThreshold ?? 0.02;
|
|
173
|
+
if (!(this.assignmentThreshold >= 0)) {
|
|
174
|
+
throw new InputError(`SimulatedBroker: assignmentThreshold must be ≥ 0, got ${this.assignmentThreshold}.`, {
|
|
175
|
+
code: ErrorCode.InputOutOfRange,
|
|
176
|
+
context: { assignmentThreshold: this.assignmentThreshold },
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/** The policy labels for the implementation-risk diagnostics. */
|
|
181
|
+
policies() {
|
|
182
|
+
return {
|
|
183
|
+
cost: this.fee.label,
|
|
184
|
+
slippage: this.slip.label,
|
|
185
|
+
// Infinite leverage means fills are never funding-checked — disclose it rather than hide it.
|
|
186
|
+
margin: Number.isFinite(this.maxLeverage) ? 'maxLeverage' : 'unconstrained',
|
|
187
|
+
assignment: this.assignmentModel ? 'model' : 'none',
|
|
188
|
+
// A bar that touches a bracket's take-profit AND its stop-loss is ambiguous — nothing in OHLC
|
|
189
|
+
// says which came first. Orders fill in submission order and `onParentFilled` submits the
|
|
190
|
+
// take-profit first, so the optimistic leg wins. Disclosed, never silent.
|
|
191
|
+
oco: 'take-profit-first-on-ambiguous-bar',
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
position(symbol) {
|
|
195
|
+
return this.positions.get(symbol) ?? { symbol, quantity: 0, averagePrice: 0 };
|
|
196
|
+
}
|
|
197
|
+
/** Contract multiplier for a symbol (registered option ⇒ its multiplier; a share ⇒ 1). */
|
|
198
|
+
multiplierOf(symbol) {
|
|
199
|
+
return this.optionSpecs.get(symbol)?.multiplier ?? 1;
|
|
200
|
+
}
|
|
201
|
+
/** Portfolio equity = cash + Σ position market value at the supplied marks (option positions ×multiplier). */
|
|
202
|
+
equity(marks) {
|
|
203
|
+
let v = this.cash;
|
|
204
|
+
for (const pos of this.positions.values()) {
|
|
205
|
+
let m = marks.get(pos.symbol) ?? this.lastMark.get(pos.symbol);
|
|
206
|
+
if (m === undefined) {
|
|
207
|
+
// No live mark and no prior mark — value the position at its own cost basis. That is a
|
|
208
|
+
// stand-in, not a market price, so flag it once per symbol rather than pretend it's a mark.
|
|
209
|
+
m = pos.averagePrice;
|
|
210
|
+
if (pos.quantity !== 0 && !this.markedAtCost.has(pos.symbol)) {
|
|
211
|
+
this.markedAtCost.add(pos.symbol);
|
|
212
|
+
this._warnings.push({
|
|
213
|
+
code: WarningCode.BacktestMarkedAtCost,
|
|
214
|
+
message: `Position '${pos.symbol}' has no market mark yet; valued at its average cost (${pos.averagePrice}) until a bar arrives.`,
|
|
215
|
+
severity: 'info',
|
|
216
|
+
context: { symbol: pos.symbol, averagePrice: pos.averagePrice },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
v += pos.quantity * m * this.multiplierOf(pos.symbol);
|
|
221
|
+
}
|
|
222
|
+
return v;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Register an option symbol so the broker marks it by its contract multiplier and settles it at
|
|
226
|
+
* expiry (spec §16.2). Required before trading or settling an option position.
|
|
227
|
+
*/
|
|
228
|
+
registerOption(symbol, specification) {
|
|
229
|
+
const functionName = 'SimulatedBroker.registerOption';
|
|
230
|
+
if (typeof symbol !== 'string' || symbol.length === 0) {
|
|
231
|
+
throw new InputError(`${functionName}: symbol must be a non-empty symbol id. Received ${symbol === null ? 'null' : symbol === undefined ? 'undefined' : typeof symbol}.`, { code: ErrorCode.InputWrongType, context: { field: 'symbol' } });
|
|
232
|
+
}
|
|
233
|
+
requireArgumentObject(functionName, 'specification', specification);
|
|
234
|
+
ensureKnownKeys(functionName, 'specification', specification, [
|
|
235
|
+
'underlying',
|
|
236
|
+
'type',
|
|
237
|
+
'strike',
|
|
238
|
+
'expiresAt',
|
|
239
|
+
'multiplier',
|
|
240
|
+
'settlement',
|
|
241
|
+
'style',
|
|
242
|
+
]);
|
|
243
|
+
if (typeof specification.underlying !== 'string' || specification.underlying.length === 0) {
|
|
244
|
+
throw new InputError(`${functionName}: underlying must be a non-empty symbol id (the symbol the option exercises into). Received ${specification.underlying === null ? 'null' : specification.underlying === undefined ? 'undefined' : typeof specification.underlying}.`, { code: ErrorCode.InputWrongType, context: { field: 'underlying' } });
|
|
245
|
+
}
|
|
246
|
+
if (specification.style !== undefined &&
|
|
247
|
+
specification.style !== 'american' &&
|
|
248
|
+
specification.style !== 'european') {
|
|
249
|
+
throw new InputError(`${functionName}: style must be 'american' | 'european' when provided. Received ${specification.style === null ? 'null' : JSON.stringify(specification.style)}.`, { code: ErrorCode.InputInvalidEnum, context: { field: 'style' } });
|
|
250
|
+
}
|
|
251
|
+
if (specification.multiplier !== undefined &&
|
|
252
|
+
(typeof specification.multiplier !== 'number' || !Number.isFinite(specification.multiplier))) {
|
|
253
|
+
throw new InputError(`${functionName}: multiplier must be a finite number when provided. Received ${specification.multiplier === null ? 'null' : typeof specification.multiplier}.`, { code: ErrorCode.InputWrongType, context: { field: 'multiplier' } });
|
|
254
|
+
}
|
|
255
|
+
if (specification.settlement !== undefined &&
|
|
256
|
+
specification.settlement !== 'physical' &&
|
|
257
|
+
specification.settlement !== 'cash') {
|
|
258
|
+
throw new InputError(`${functionName}: settlement must be 'physical' | 'cash' when provided. Received ${specification.settlement === null ? 'null' : JSON.stringify(specification.settlement)}.`, { code: ErrorCode.InputInvalidEnum, context: { field: 'settlement' } });
|
|
259
|
+
}
|
|
260
|
+
ensurePositive(specification.strike, 'strike', functionName);
|
|
261
|
+
ensureFinite(specification.expiresAt, 'expiresAt', functionName);
|
|
262
|
+
if (specification.type !== 'call' && specification.type !== 'put') {
|
|
263
|
+
throw new InputError(`${functionName}: type must be 'call' or 'put', got "${String(specification.type)}".`, {
|
|
264
|
+
code: ErrorCode.InputInvalidEnum,
|
|
265
|
+
context: { type: specification.type },
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
const multiplier = specification.multiplier ?? 100;
|
|
269
|
+
ensurePositive(multiplier, 'multiplier', functionName);
|
|
270
|
+
const settlement = specification.settlement ?? 'physical';
|
|
271
|
+
if (settlement !== 'physical' && settlement !== 'cash') {
|
|
272
|
+
throw new InputError(`${functionName}: settlement must be 'physical' or 'cash', got "${settlement}".`, {
|
|
273
|
+
code: ErrorCode.InputInvalidEnum,
|
|
274
|
+
context: { settlement },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const style = specification.style ?? 'american';
|
|
278
|
+
if (style !== 'american' && style !== 'european') {
|
|
279
|
+
throw new InputError(`${functionName}: style must be 'american' or 'european', got "${style}".`, {
|
|
280
|
+
code: ErrorCode.InputInvalidEnum,
|
|
281
|
+
context: { style },
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
this.optionSpecs.set(symbol, {
|
|
285
|
+
underlying: specification.underlying,
|
|
286
|
+
type: specification.type,
|
|
287
|
+
strike: specification.strike,
|
|
288
|
+
expiresAt: specification.expiresAt,
|
|
289
|
+
multiplier,
|
|
290
|
+
settlement,
|
|
291
|
+
style,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Settle every registered option whose expiry is at or before `asOfTimestampMs`. ITM long positions are
|
|
296
|
+
* exercised and ITM shorts assigned (physical: the underlier position is adjusted at the strike;
|
|
297
|
+
* cash: the intrinsic is paid/received); OTM positions expire worthless. Returns the new settlements.
|
|
298
|
+
* The underlier settlement price comes from `underlierMarks` or the broker's last seen mark.
|
|
299
|
+
*/
|
|
300
|
+
settleExpiries(asOfTimestampMs, underlierMarks) {
|
|
301
|
+
if (typeof asOfTimestampMs !== 'number' || !Number.isFinite(asOfTimestampMs)) {
|
|
302
|
+
throw new InputError(`SimulatedBroker.settleExpiries: asOfTimestampMs must be a finite epoch-ms timestamp. Received ${asOfTimestampMs === null ? 'null' : asOfTimestampMs === undefined ? 'undefined' : typeof asOfTimestampMs}.`, { code: ErrorCode.InputWrongType, context: { field: 'asOfTimestampMs' } });
|
|
303
|
+
}
|
|
304
|
+
const out = [];
|
|
305
|
+
for (const [symbol, specification] of [...this.optionSpecs]) {
|
|
306
|
+
if (specification.expiresAt > asOfTimestampMs)
|
|
307
|
+
continue;
|
|
308
|
+
const contracts = this.positions.get(symbol)?.quantity ?? 0;
|
|
309
|
+
// Resolve and validate the underlier settlement price BEFORE mutating any state: a missing or
|
|
310
|
+
// malformed (NaN / non-positive) mark must throw with the option still registered so the
|
|
311
|
+
// settlement stays retryable, rather than stranding the option or writing a NaN into cash/shares.
|
|
312
|
+
let S;
|
|
313
|
+
if (contracts !== 0) {
|
|
314
|
+
S =
|
|
315
|
+
underlierMarks?.get(specification.underlying) ??
|
|
316
|
+
this.lastMark.get(specification.underlying);
|
|
317
|
+
if (S === undefined || !Number.isFinite(S) || S <= 0) {
|
|
318
|
+
throw new InputError(`SimulatedBroker.settleExpiries: no valid settlement price for underlier ${specification.underlying} of ${symbol} (got ${S}).`, {
|
|
319
|
+
code: S === undefined ? ErrorCode.InputMissingField : ErrorCode.InputOutOfRange,
|
|
320
|
+
context: { underlying: specification.underlying, symbol, settlementPrice: S },
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// The option ceases to exist at expiry: drop its registration and cancel any working orders.
|
|
325
|
+
for (const o of this.orders) {
|
|
326
|
+
if (o.symbol === symbol && (o.status === 'pending' || o.status === 'partially-filled')) {
|
|
327
|
+
o.status = 'cancelled';
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
this.optionSpecs.delete(symbol);
|
|
331
|
+
this.lastMark.delete(symbol);
|
|
332
|
+
if (contracts === 0) {
|
|
333
|
+
this.positions.delete(symbol);
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
const s = S;
|
|
337
|
+
const intrinsic = specification.type === 'call'
|
|
338
|
+
? Math.max(s - specification.strike, 0)
|
|
339
|
+
: Math.max(specification.strike - s, 0);
|
|
340
|
+
const cashBefore = this.cash;
|
|
341
|
+
this.positions.delete(symbol); // remove the option leg before adjusting the underlier
|
|
342
|
+
let action;
|
|
343
|
+
let shares = 0;
|
|
344
|
+
if (intrinsic <= 0) {
|
|
345
|
+
action = 'expired';
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
action = contracts > 0 ? 'exercised' : 'assigned';
|
|
349
|
+
if (specification.settlement === 'cash') {
|
|
350
|
+
this.cash += intrinsic * specification.multiplier * contracts;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
const sharesAbs = specification.multiplier * Math.abs(contracts);
|
|
354
|
+
// Calls deliver shares to the long; puts deliver from the long. Short positions mirror.
|
|
355
|
+
const side = specification.type === 'call'
|
|
356
|
+
? contracts > 0
|
|
357
|
+
? 'buy'
|
|
358
|
+
: 'sell'
|
|
359
|
+
: contracts > 0
|
|
360
|
+
? 'sell'
|
|
361
|
+
: 'buy';
|
|
362
|
+
this.applyFill({
|
|
363
|
+
symbol: specification.underlying,
|
|
364
|
+
side,
|
|
365
|
+
quantity: sharesAbs,
|
|
366
|
+
price: specification.strike,
|
|
367
|
+
commission: 0,
|
|
368
|
+
});
|
|
369
|
+
shares = signOf(side) * sharesAbs;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
const settlement = {
|
|
373
|
+
symbol,
|
|
374
|
+
underlying: specification.underlying,
|
|
375
|
+
timestampMs: asOfTimestampMs,
|
|
376
|
+
type: specification.type,
|
|
377
|
+
strike: specification.strike,
|
|
378
|
+
multiplier: specification.multiplier,
|
|
379
|
+
contracts,
|
|
380
|
+
underlierPrice: s,
|
|
381
|
+
intrinsic,
|
|
382
|
+
action,
|
|
383
|
+
settlement: specification.settlement,
|
|
384
|
+
cashFlow: this.cash - cashBefore,
|
|
385
|
+
shares,
|
|
386
|
+
};
|
|
387
|
+
this._settlements.push(settlement);
|
|
388
|
+
out.push(settlement);
|
|
389
|
+
}
|
|
390
|
+
return out;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* American early exercise/assignment checks for one bar (WS7.4), run before dividends are applied.
|
|
394
|
+
* Two triggers: (a) an ex-dividend on an underlier assigns each American SHORT call on it when
|
|
395
|
+
* `dividend > remaining extrinsic` (dividend-capture early exercise); (b) a bar that prices an
|
|
396
|
+
* American SHORT put assigns it when the interest CARRY benefit of exercising now exceeds the
|
|
397
|
+
* remaining extrinsic (time value) — the economics that actually drive early put exercise.
|
|
398
|
+
*/
|
|
399
|
+
earlyAssignmentsForBar(bar, action) {
|
|
400
|
+
// (b) Deep-ITM short put — this bar prices the option itself; its close is the mark.
|
|
401
|
+
const ownSpecification = this.optionSpecs.get(bar.symbol);
|
|
402
|
+
if (ownSpecification &&
|
|
403
|
+
ownSpecification.style === 'american' &&
|
|
404
|
+
ownSpecification.type === 'put') {
|
|
405
|
+
const contracts = this.positions.get(bar.symbol)?.quantity ?? 0;
|
|
406
|
+
const under = this.lastMark.get(ownSpecification.underlying);
|
|
407
|
+
if (contracts < 0 && under !== undefined && under > 0) {
|
|
408
|
+
const intrinsic = Math.max(ownSpecification.strike - under, 0);
|
|
409
|
+
// Early put exercise is driven by CARRY: receiving the strike now earns interest over the
|
|
410
|
+
// option's remaining life. Assign when that benefit exceeds the remaining extrinsic (time
|
|
411
|
+
// value = mark − intrinsic) by the buffer. The old `intrinsic − mark > threshold` test was
|
|
412
|
+
// backwards — on arbitrage-free prices an American put's mark is ≥ intrinsic, so it required
|
|
413
|
+
// a sub-intrinsic mark and never fired. (Underlier price is the last mark before this
|
|
414
|
+
// option-bar — a bar-ordering approximation.)
|
|
415
|
+
const extrinsic = Math.max(0, bar.close - intrinsic);
|
|
416
|
+
const tau = Math.max(0, ownSpecification.expiresAt - bar.timestampMs) / (365 * 86_400_000);
|
|
417
|
+
const carryBenefit = ownSpecification.strike * (1 - Math.exp(-this.riskFreeRate * tau));
|
|
418
|
+
if (carryBenefit - extrinsic > this.assignmentThreshold * ownSpecification.strike) {
|
|
419
|
+
this.settleEarly({
|
|
420
|
+
symbol: bar.symbol,
|
|
421
|
+
specification: ownSpecification,
|
|
422
|
+
contracts,
|
|
423
|
+
underlierPrice: under,
|
|
424
|
+
timestampMs: bar.timestampMs,
|
|
425
|
+
reason: 'deep-itm',
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// (a) Ex-dividend short calls — the bar's symbol is an underlier paying a dividend.
|
|
431
|
+
if (action?.dividend && action.dividend > 0) {
|
|
432
|
+
for (const [symbol, specification] of [...this.optionSpecs]) {
|
|
433
|
+
if (specification.underlying !== bar.symbol ||
|
|
434
|
+
specification.type !== 'call' ||
|
|
435
|
+
specification.style !== 'american') {
|
|
436
|
+
continue;
|
|
437
|
+
}
|
|
438
|
+
const contracts = this.positions.get(symbol)?.quantity ?? 0;
|
|
439
|
+
if (contracts >= 0)
|
|
440
|
+
continue; // only shorts are assigned
|
|
441
|
+
const optionMark = this.lastMark.get(symbol);
|
|
442
|
+
const under = this.lastMark.get(specification.underlying); // the ex-date-eve underlier mark
|
|
443
|
+
if (optionMark === undefined || under === undefined || under <= 0)
|
|
444
|
+
continue;
|
|
445
|
+
const extrinsic = Math.max(0, optionMark - Math.max(under - specification.strike, 0));
|
|
446
|
+
if (action.dividend > extrinsic) {
|
|
447
|
+
this.settleEarly({
|
|
448
|
+
symbol,
|
|
449
|
+
specification,
|
|
450
|
+
contracts,
|
|
451
|
+
underlierPrice: under,
|
|
452
|
+
timestampMs: bar.timestampMs,
|
|
453
|
+
reason: 'dividend',
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/** Settle `contracts` (signed) of a registered option early: physical/cash, record + warn (WS7.4). */
|
|
460
|
+
settleEarly(input) {
|
|
461
|
+
const { symbol, specification, contracts, underlierPrice, timestampMs, reason } = input;
|
|
462
|
+
const intrinsic = specification.type === 'call'
|
|
463
|
+
? Math.max(underlierPrice - specification.strike, 0)
|
|
464
|
+
: Math.max(specification.strike - underlierPrice, 0);
|
|
465
|
+
const cashBefore = this.cash;
|
|
466
|
+
const pos = this.positions.get(symbol);
|
|
467
|
+
if (pos) {
|
|
468
|
+
pos.quantity -= contracts;
|
|
469
|
+
if (pos.quantity === 0)
|
|
470
|
+
this.positions.delete(symbol);
|
|
471
|
+
}
|
|
472
|
+
const action = contracts > 0 ? 'exercised' : 'assigned';
|
|
473
|
+
let shares = 0;
|
|
474
|
+
if (specification.settlement === 'cash') {
|
|
475
|
+
this.cash += intrinsic * specification.multiplier * contracts;
|
|
476
|
+
}
|
|
477
|
+
else {
|
|
478
|
+
const sharesAbs = specification.multiplier * Math.abs(contracts);
|
|
479
|
+
const side = specification.type === 'call'
|
|
480
|
+
? contracts > 0
|
|
481
|
+
? 'buy'
|
|
482
|
+
: 'sell'
|
|
483
|
+
: contracts > 0
|
|
484
|
+
? 'sell'
|
|
485
|
+
: 'buy';
|
|
486
|
+
this.applyFill({
|
|
487
|
+
symbol: specification.underlying,
|
|
488
|
+
side,
|
|
489
|
+
quantity: sharesAbs,
|
|
490
|
+
price: specification.strike,
|
|
491
|
+
commission: 0,
|
|
492
|
+
});
|
|
493
|
+
shares = signOf(side) * sharesAbs;
|
|
494
|
+
}
|
|
495
|
+
const settlement = {
|
|
496
|
+
symbol,
|
|
497
|
+
underlying: specification.underlying,
|
|
498
|
+
timestampMs,
|
|
499
|
+
type: specification.type,
|
|
500
|
+
strike: specification.strike,
|
|
501
|
+
multiplier: specification.multiplier,
|
|
502
|
+
contracts,
|
|
503
|
+
underlierPrice,
|
|
504
|
+
intrinsic,
|
|
505
|
+
action,
|
|
506
|
+
settlement: specification.settlement,
|
|
507
|
+
cashFlow: this.cash - cashBefore,
|
|
508
|
+
shares,
|
|
509
|
+
early: true,
|
|
510
|
+
reason,
|
|
511
|
+
};
|
|
512
|
+
this._settlements.push(settlement);
|
|
513
|
+
this._warnings.push({
|
|
514
|
+
code: WarningCode.BacktestAssignment,
|
|
515
|
+
message: `American ${specification.type} ${symbol} ${action} early (${reason}) at underlier ${underlierPrice}: ${Math.abs(contracts)} contract(s).`,
|
|
516
|
+
severity: 'warn',
|
|
517
|
+
context: {
|
|
518
|
+
symbol,
|
|
519
|
+
underlying: specification.underlying,
|
|
520
|
+
action,
|
|
521
|
+
reason,
|
|
522
|
+
contracts,
|
|
523
|
+
strike: specification.strike,
|
|
524
|
+
underlierPrice,
|
|
525
|
+
timestampMs,
|
|
526
|
+
},
|
|
527
|
+
});
|
|
528
|
+
return settlement;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Manually exercise a LONG American option early (WS7.4) — the `context.exercise` hook. `quantity` is
|
|
532
|
+
* the number of contracts (≤ the current long position). Requires the `assignment: 'model'` policy.
|
|
533
|
+
*/
|
|
534
|
+
exerciseOption(input) {
|
|
535
|
+
const functionName = 'SimulatedBroker.exerciseOption';
|
|
536
|
+
requireArgumentObject(functionName, 'input', input);
|
|
537
|
+
ensureKnownKeys(functionName, 'input', input, [
|
|
538
|
+
'symbol',
|
|
539
|
+
'quantity',
|
|
540
|
+
'timestampMs',
|
|
541
|
+
'underlierMarks',
|
|
542
|
+
]);
|
|
543
|
+
const { symbol, quantity, timestampMs, underlierMarks } = input;
|
|
544
|
+
if (!this.assignmentModel) {
|
|
545
|
+
throw new InputError(`${functionName}: early exercise requires the broker's assignment: 'model' policy.`, {
|
|
546
|
+
code: ErrorCode.EngineUnsupportedContract,
|
|
547
|
+
context: { symbol },
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
const specification = this.optionSpecs.get(symbol);
|
|
551
|
+
if (!specification) {
|
|
552
|
+
throw new InputError(`${functionName}: ${symbol} is not a registered option.`, {
|
|
553
|
+
code: ErrorCode.InputMissingField,
|
|
554
|
+
context: { symbol },
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
if (specification.style !== 'american') {
|
|
558
|
+
throw new InputError(`${functionName}: ${symbol} is European; only American options exercise early.`, {
|
|
559
|
+
code: ErrorCode.EngineUnsupportedContract,
|
|
560
|
+
context: { symbol, style: specification.style },
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
// Safe integer (2026-08-23 review, P0): a contract count above 2^53 is no longer exact, and
|
|
564
|
+
// though the held-position check below bounds it in practice, the count must be real on its own.
|
|
565
|
+
if (!Number.isSafeInteger(quantity) || quantity < 1) {
|
|
566
|
+
throw new InputError(`${functionName}: quantity must be a positive integer, got ${quantity}.`, {
|
|
567
|
+
code: ErrorCode.InputOutOfRange,
|
|
568
|
+
context: { quantity },
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
const held = this.positions.get(symbol)?.quantity ?? 0;
|
|
572
|
+
if (held < quantity) {
|
|
573
|
+
throw new InputError(`${functionName}: cannot exercise ${quantity} of ${symbol}; the long position is ${held}.`, { code: ErrorCode.InputOutOfRange, context: { symbol, quantity, held } });
|
|
574
|
+
}
|
|
575
|
+
const under = underlierMarks?.get(specification.underlying) ?? this.lastMark.get(specification.underlying);
|
|
576
|
+
if (under === undefined || !Number.isFinite(under) || under <= 0) {
|
|
577
|
+
throw new InputError(`${functionName}: no valid underlier price for ${specification.underlying}.`, {
|
|
578
|
+
code: ErrorCode.InputMissingField,
|
|
579
|
+
context: { underlying: specification.underlying, price: under },
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
return this.settleEarly({
|
|
583
|
+
symbol,
|
|
584
|
+
specification,
|
|
585
|
+
contracts: quantity,
|
|
586
|
+
underlierPrice: under,
|
|
587
|
+
timestampMs,
|
|
588
|
+
reason: 'manual',
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
/** Submit an order; returns its id. Validates the request. */
|
|
592
|
+
submit(request) {
|
|
593
|
+
const functionName = 'SimulatedBroker.submit';
|
|
594
|
+
requireArgumentObject(functionName, 'request', request);
|
|
595
|
+
// Law 12: an `ocoGrup` typo silently un-linked the bracket - the exact class the closed
|
|
596
|
+
// request exists to kill.
|
|
597
|
+
ensureKnownKeys(functionName, 'request', request, [
|
|
598
|
+
'symbol',
|
|
599
|
+
'side',
|
|
600
|
+
'quantity',
|
|
601
|
+
'notional',
|
|
602
|
+
'type',
|
|
603
|
+
'limitPrice',
|
|
604
|
+
'stopPrice',
|
|
605
|
+
'timeInForce',
|
|
606
|
+
'takeProfit',
|
|
607
|
+
'stopLoss',
|
|
608
|
+
'ocoGroup',
|
|
609
|
+
]);
|
|
610
|
+
if (typeof request.symbol !== 'string' || request.symbol.length === 0) {
|
|
611
|
+
throw new InputError(`${functionName}: symbol must be a non-empty symbol id. Received ${request.symbol === null ? 'null' : request.symbol === undefined ? 'undefined' : typeof request.symbol}.`, { code: ErrorCode.InputWrongType, context: { field: 'symbol' } });
|
|
612
|
+
}
|
|
613
|
+
if (request.ocoGroup !== undefined && typeof request.ocoGroup !== 'string') {
|
|
614
|
+
throw new InputError(`${functionName}: ocoGroup must be a string when provided. Received ${request.ocoGroup === null ? 'null' : typeof request.ocoGroup}.`, { code: ErrorCode.InputWrongType, context: { field: 'ocoGroup' } });
|
|
615
|
+
}
|
|
616
|
+
for (const field of [
|
|
617
|
+
'quantity',
|
|
618
|
+
'notional',
|
|
619
|
+
'limitPrice',
|
|
620
|
+
'stopPrice',
|
|
621
|
+
'takeProfit',
|
|
622
|
+
'stopLoss',
|
|
623
|
+
]) {
|
|
624
|
+
const value = request[field];
|
|
625
|
+
if (value !== undefined && (typeof value !== 'number' || !Number.isFinite(value))) {
|
|
626
|
+
throw new InputError(`${functionName}: ${field} must be a finite number when provided. Received ${value === null ? 'null' : typeof value}.`, { code: ErrorCode.InputWrongType, context: { field } });
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const hasQty = request.quantity !== undefined;
|
|
630
|
+
const hasNotional = request.notional !== undefined;
|
|
631
|
+
if (hasQty === hasNotional) {
|
|
632
|
+
throw new InputError(`${functionName}: provide exactly one of quantity or notional.`, {
|
|
633
|
+
code: ErrorCode.InputMissingField,
|
|
634
|
+
context: { quantity: request.quantity, notional: request.notional },
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
if (hasQty)
|
|
638
|
+
ensurePositive(request.quantity, 'quantity', functionName);
|
|
639
|
+
if (hasNotional)
|
|
640
|
+
ensurePositive(request.notional, 'notional', functionName);
|
|
641
|
+
// Pre-coalesce: `type: null` used to coalesce into 'market' and BUY AT MARKET a request that
|
|
642
|
+
// never chose an order type. When present it must be a valid OrderType; only omission defaults.
|
|
643
|
+
if (request.type !== undefined && !ORDER_TYPES.includes(request.type)) {
|
|
644
|
+
throw new InputError(`${functionName}: type must be one of ${ORDER_TYPES.join(', ')} when provided. Received ${request.type === null ? 'null' : JSON.stringify(request.type)}.`, { code: ErrorCode.InputInvalidEnum, context: { field: 'type' } });
|
|
645
|
+
}
|
|
646
|
+
const type = request.type ?? 'market';
|
|
647
|
+
if (request.side !== 'buy' && request.side !== 'sell') {
|
|
648
|
+
throw new InputError(`${functionName}: side must be 'buy' or 'sell', got "${request.side}".`, {
|
|
649
|
+
code: ErrorCode.InputInvalidEnum,
|
|
650
|
+
context: { side: request.side },
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
// Reject unknown order types / TIF rather than letting a typo become a permanently-pending order
|
|
654
|
+
// (unknown type never triggers) or a silently-mistreated TIF.
|
|
655
|
+
if (!ORDER_TYPES.includes(type)) {
|
|
656
|
+
throw new InputError(`${functionName}: type must be one of ${ORDER_TYPES.join(', ')}; got "${type}".`, {
|
|
657
|
+
code: ErrorCode.InputInvalidEnum,
|
|
658
|
+
context: { type },
|
|
659
|
+
});
|
|
660
|
+
}
|
|
661
|
+
if (request.timeInForce !== undefined && !TIME_IN_FORCE_VALUES.includes(request.timeInForce)) {
|
|
662
|
+
throw new InputError(`${functionName}: timeInForce must be one of ${TIME_IN_FORCE_VALUES.join(', ')}; got "${request.timeInForce}".`, {
|
|
663
|
+
code: ErrorCode.InputInvalidEnum,
|
|
664
|
+
context: { timeInForce: request.timeInForce },
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
if ((type === 'limit' || type === 'stop-limit') && request.limitPrice === undefined) {
|
|
668
|
+
throw new InputError(`${functionName}: ${type} order requires a limitPrice.`, {
|
|
669
|
+
code: ErrorCode.InputMissingField,
|
|
670
|
+
context: { type },
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
if ((type === 'stop' || type === 'stop-limit') && request.stopPrice === undefined) {
|
|
674
|
+
throw new InputError(`${functionName}: ${type} order requires a stopPrice.`, {
|
|
675
|
+
code: ErrorCode.InputMissingField,
|
|
676
|
+
context: { type },
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
// Any supplied trigger / bracket price must be a positive finite number.
|
|
680
|
+
if (request.limitPrice !== undefined)
|
|
681
|
+
ensurePositive(request.limitPrice, 'limitPrice', functionName);
|
|
682
|
+
if (request.stopPrice !== undefined)
|
|
683
|
+
ensurePositive(request.stopPrice, 'stopPrice', functionName);
|
|
684
|
+
if (request.takeProfit !== undefined)
|
|
685
|
+
ensurePositive(request.takeProfit, 'takeProfit', functionName);
|
|
686
|
+
if (request.stopLoss !== undefined)
|
|
687
|
+
ensurePositive(request.stopLoss, 'stopLoss', functionName);
|
|
688
|
+
const order = {
|
|
689
|
+
id: nextId(),
|
|
690
|
+
symbol: request.symbol,
|
|
691
|
+
side: request.side,
|
|
692
|
+
type,
|
|
693
|
+
quantity: request.quantity ?? 0,
|
|
694
|
+
filledQuantity: 0,
|
|
695
|
+
filledNotional: 0,
|
|
696
|
+
status: 'pending',
|
|
697
|
+
timeInForce: request.timeInForce ?? 'gtc',
|
|
698
|
+
// The broker's clock is the bar stream: stamp the bar being processed when the order arrived
|
|
699
|
+
// (a strategy submits while handling that bar). Before the first bar there is no clock — omit.
|
|
700
|
+
...(this.lastTs !== null ? { submittedTimestampMs: this.lastTs } : {}),
|
|
701
|
+
...(request.notional !== undefined ? { notional: request.notional } : {}),
|
|
702
|
+
...(request.limitPrice !== undefined ? { limitPrice: request.limitPrice } : {}),
|
|
703
|
+
...(request.stopPrice !== undefined ? { stopPrice: request.stopPrice } : {}),
|
|
704
|
+
...(request.ocoGroup !== undefined ? { ocoGroup: request.ocoGroup } : {}),
|
|
705
|
+
...(request.takeProfit !== undefined ? { takeProfit: request.takeProfit } : {}),
|
|
706
|
+
...(request.stopLoss !== undefined ? { stopLoss: request.stopLoss } : {}),
|
|
707
|
+
};
|
|
708
|
+
this._orders.push(order);
|
|
709
|
+
return order.id;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Per bracket group, the share quantity that bracket may exit — the parent's filled quantity.
|
|
713
|
+
*
|
|
714
|
+
* A hand-rolled OCO group (one a caller wired up with its own `ocoGroup`) has no entry here, and
|
|
715
|
+
* cannot: nothing declares what such a group owns.
|
|
716
|
+
*/
|
|
717
|
+
bracketCapacity = new Map();
|
|
718
|
+
/** Cancel a pending order (and its OCO group). */
|
|
719
|
+
cancel(id) {
|
|
720
|
+
const order = this.orders.find((o) => o.id === id);
|
|
721
|
+
if (order && (order.status === 'pending' || order.status === 'partially-filled')) {
|
|
722
|
+
order.status = 'cancelled';
|
|
723
|
+
if (order.ocoGroup)
|
|
724
|
+
this.cancelGroup(order.ocoGroup, order.id);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* After a PARTIAL fill of an OCO member, re-size its siblings to the position that is actually
|
|
729
|
+
* left to exit, cancelling any sibling with nothing left to do.
|
|
730
|
+
*
|
|
731
|
+
* OCO siblings used to be cancelled only on a COMPLETE fill, so a partially-filled bracket leg
|
|
732
|
+
* left BOTH legs alive at their original size. A 10-lot bracket throttled to 5 lots/bar exited 5
|
|
733
|
+
* on the take-profit and 5 on the stop for a flat book — then filled the two 5-lot remainders on
|
|
734
|
+
* the next bar and went 10 lots SHORT, a position the strategy never asked for.
|
|
735
|
+
*/
|
|
736
|
+
reduceGroupToOpenPosition(order, fillPrice) {
|
|
737
|
+
const group = order.ocoGroup;
|
|
738
|
+
const remaining = this.groupRemaining(group, order.symbol);
|
|
739
|
+
for (const o of this.orders) {
|
|
740
|
+
if (o.ocoGroup !== group || o.id === order.id)
|
|
741
|
+
continue;
|
|
742
|
+
if (o.status !== 'pending' && o.status !== 'partially-filled')
|
|
743
|
+
continue;
|
|
744
|
+
if (!(remaining > 1e-9)) {
|
|
745
|
+
o.status = 'cancelled';
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
if (o.notional !== undefined) {
|
|
749
|
+
// A notional sibling's cap is expressed in cash: value the units still open at the price
|
|
750
|
+
// the sibling's own symbol just printed at (the only price this bar establishes for it),
|
|
751
|
+
// in the cash a unit of that symbol moves.
|
|
752
|
+
o.notional = Math.min(o.notional, o.filledNotional + remaining * fillPrice * this.multiplierOf(o.symbol));
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
o.quantity = Math.min(o.quantity, o.filledQuantity + remaining);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* How many shares this OCO group still has the right to exit.
|
|
761
|
+
*
|
|
762
|
+
* The first version asked the ACCOUNT — `Math.abs(this.position(symbol).quantity)` — which is only
|
|
763
|
+
* the bracket's own size when the bracket is the entire position. Layer a 10-share bracket on top
|
|
764
|
+
* of a 100-share holding and the siblings resized against 110: a take-profit filling 5 left the
|
|
765
|
+
* stop at its full 10, so the bracket exited 15 shares of a position it owned 10 of, and the
|
|
766
|
+
* original holding came back 95 instead of 100. The regression that caught the ORIGINAL bug
|
|
767
|
+
* started flat, where the two numbers coincide, so it could not see this one.
|
|
768
|
+
*
|
|
769
|
+
* A bracket is bounded by BOTH its own capacity and the position actually held — it may not exit
|
|
770
|
+
* shares it never owned, and it may not exit shares the strategy has already closed out from under
|
|
771
|
+
* it. A hand-rolled OCO group has no declared capacity, so the held position is the only bound
|
|
772
|
+
* available and it keeps the previous behaviour.
|
|
773
|
+
*/
|
|
774
|
+
groupRemaining(group, symbol) {
|
|
775
|
+
const held = Math.abs(this.position(symbol).quantity);
|
|
776
|
+
const capacity = this.bracketCapacity.get(group);
|
|
777
|
+
if (capacity === undefined)
|
|
778
|
+
return held;
|
|
779
|
+
let exited = 0;
|
|
780
|
+
for (const o of this.orders)
|
|
781
|
+
if (o.ocoGroup === group)
|
|
782
|
+
exited += o.filledQuantity;
|
|
783
|
+
return Math.max(0, Math.min(capacity - exited, held));
|
|
784
|
+
}
|
|
785
|
+
cancelGroup(group, exceptId) {
|
|
786
|
+
// The group is over — a member filled completely, or the caller cancelled it. Nothing else will
|
|
787
|
+
// consult its capacity, and a backtest may open thousands of brackets.
|
|
788
|
+
this.bracketCapacity.delete(group);
|
|
789
|
+
for (const o of this.orders) {
|
|
790
|
+
if (o.ocoGroup === group &&
|
|
791
|
+
o.id !== exceptId &&
|
|
792
|
+
(o.status === 'pending' || o.status === 'partially-filled')) {
|
|
793
|
+
o.status = 'cancelled';
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Advance the broker by one bar: apply corporate actions, accrue borrow on shorts, then try to fill
|
|
799
|
+
* every working order for this bar's symbol. Returns this bar's fills.
|
|
800
|
+
*/
|
|
801
|
+
processBar(bar, action) {
|
|
802
|
+
requireArgumentObject('SimulatedBroker.processBar', 'bar', bar);
|
|
803
|
+
if (action !== undefined) {
|
|
804
|
+
requireArgumentObject('SimulatedBroker.processBar', 'action', action);
|
|
805
|
+
// Law 12: a `divident` typo must teach, never silently skip the cash flow.
|
|
806
|
+
ensureKnownKeys('SimulatedBroker.processBar', 'action', action, [
|
|
807
|
+
'dividend',
|
|
808
|
+
'split',
|
|
809
|
+
]);
|
|
810
|
+
const splitValue = action['split'];
|
|
811
|
+
if (splitValue !== undefined &&
|
|
812
|
+
(typeof splitValue !== 'number' || !Number.isFinite(splitValue))) {
|
|
813
|
+
throw new InputError(`SimulatedBroker.processBar: action.split must be a finite split ratio when provided. Received ${splitValue === null ? 'null' : typeof splitValue}.`, { code: ErrorCode.InputWrongType, context: { field: 'split' } });
|
|
814
|
+
}
|
|
815
|
+
const dividendValue = action['dividend'];
|
|
816
|
+
if (dividendValue !== undefined &&
|
|
817
|
+
(typeof dividendValue !== 'number' || !Number.isFinite(dividendValue))) {
|
|
818
|
+
throw new InputError(`SimulatedBroker.processBar: action.dividend must be a finite number when provided. Received ${dividendValue === null ? 'null' : typeof dividendValue}.`, { code: ErrorCode.InputWrongType, context: { field: 'dividend' } });
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (bar.adjusted !== undefined && typeof bar.adjusted !== 'boolean') {
|
|
822
|
+
throw new InputError(`SimulatedBroker.processBar: bar.adjusted must be a boolean when present. Received ${bar.adjusted === null ? 'null' : typeof bar.adjusted}.`, { code: ErrorCode.InputWrongType, context: { field: 'adjusted' } });
|
|
823
|
+
}
|
|
824
|
+
validateBar(bar, 'SimulatedBroker.processBar');
|
|
825
|
+
this.lastTs = bar.timestampMs; // the broker's "now" — stamped on orders submitted during this bar
|
|
826
|
+
const sym = bar.symbol;
|
|
827
|
+
// 0. American early exercise/assignment (WS7.4, opt-in). Runs BEFORE the dividend so an assigned
|
|
828
|
+
// covered call surrenders the stock — and thus the dividend — the day the ex-div is known.
|
|
829
|
+
if (this.assignmentModel)
|
|
830
|
+
this.earlyAssignmentsForBar(bar, action);
|
|
831
|
+
// 1. corporate actions (split first, then dividend on the post-split quantity)
|
|
832
|
+
if (action?.split && action.split > 0 && action.split !== 1) {
|
|
833
|
+
this.applySplit(sym, action.split);
|
|
834
|
+
}
|
|
835
|
+
if (action?.dividend && action.dividend !== 0) {
|
|
836
|
+
const pos = this.positions.get(sym);
|
|
837
|
+
if (pos)
|
|
838
|
+
this.cash += pos.quantity * action.dividend; // long credited, short debited
|
|
839
|
+
}
|
|
840
|
+
// 2. borrow accrual on a short carried since the last bar
|
|
841
|
+
if (this.brw.annualRate > 0) {
|
|
842
|
+
const pos = this.positions.get(sym);
|
|
843
|
+
const prevMark = this.lastMark.get(sym);
|
|
844
|
+
if (pos && pos.quantity < 0 && prevMark !== undefined) {
|
|
845
|
+
this.cash -=
|
|
846
|
+
(Math.abs(pos.quantity) * prevMark * this.brw.annualRate) / this.periodsPerYear;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
// 3. fill working orders for this symbol
|
|
850
|
+
const fills = [];
|
|
851
|
+
for (const order of this.orders) {
|
|
852
|
+
if (order.symbol !== sym)
|
|
853
|
+
continue;
|
|
854
|
+
if (order.status !== 'pending' && order.status !== 'partially-filled')
|
|
855
|
+
continue;
|
|
856
|
+
const fill = this.tryFill(order, bar);
|
|
857
|
+
if (fill) {
|
|
858
|
+
fills.push(fill);
|
|
859
|
+
// tryFill may have advanced status to 'filled'; the cast defeats the stale control-flow
|
|
860
|
+
// narrowing TS carries from the `continue` guard above (it can't see the mutation).
|
|
861
|
+
if (order.status === 'filled')
|
|
862
|
+
this.onParentFilled(order, bar);
|
|
863
|
+
}
|
|
864
|
+
// expire unfilled day orders at the end of the bar
|
|
865
|
+
if (order.timeInForce === 'day' &&
|
|
866
|
+
(order.status === 'pending' || order.status === 'partially-filled')) {
|
|
867
|
+
order.status = 'cancelled';
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
this.lastMark.set(sym, bar.close);
|
|
871
|
+
return fills;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Apply an `R`-for-1 split to one symbol: quantities ×R and prices ÷R, EVERYWHERE the broker
|
|
875
|
+
* holds one — the position, the last mark, and every resting order.
|
|
876
|
+
*
|
|
877
|
+
* Adjusting only the position (the old behaviour) left three silent wrong numbers behind:
|
|
878
|
+
*
|
|
879
|
+
* - a resting limit/stop kept its PRE-split trigger, so a GTC "buy limit 90" on a stock that split
|
|
880
|
+
* 2:1 from 100 to 50 fired instantly at 50 — a phantom fill on a price that never moved;
|
|
881
|
+
* - the stale `lastMark` was still the pre-split price while the position had already doubled, so
|
|
882
|
+
* the borrow accrual on a short charged 2× the real market value for that bar;
|
|
883
|
+
* - a resting order's `quantity` kept its pre-split share count, silently halving the economic
|
|
884
|
+
* size of the order the caller placed.
|
|
885
|
+
*
|
|
886
|
+
* Cash quantities are NOT scaled: a notional order's dollar amount and the notional already filled
|
|
887
|
+
* are unaffected by a split. Every adjusted order is disclosed via `backtest.order_split_adjusted`.
|
|
888
|
+
*/
|
|
889
|
+
applySplit(symbol, ratio) {
|
|
890
|
+
const pos = this.positions.get(symbol);
|
|
891
|
+
if (pos) {
|
|
892
|
+
pos.quantity *= ratio;
|
|
893
|
+
pos.averagePrice /= ratio;
|
|
894
|
+
}
|
|
895
|
+
const mark = this.lastMark.get(symbol);
|
|
896
|
+
if (mark !== undefined)
|
|
897
|
+
this.lastMark.set(symbol, mark / ratio);
|
|
898
|
+
for (const o of this.orders) {
|
|
899
|
+
if (o.symbol !== symbol)
|
|
900
|
+
continue;
|
|
901
|
+
if (o.status !== 'pending' && o.status !== 'partially-filled')
|
|
902
|
+
continue;
|
|
903
|
+
const before = {
|
|
904
|
+
quantity: o.quantity,
|
|
905
|
+
limitPrice: o.limitPrice,
|
|
906
|
+
stopPrice: o.stopPrice,
|
|
907
|
+
takeProfit: o.takeProfit,
|
|
908
|
+
stopLoss: o.stopLoss,
|
|
909
|
+
};
|
|
910
|
+
// Prices ÷ ratio — BOTH of a stop-limit's prices, and the bracket triggers a resting parent
|
|
911
|
+
// will hand to its children when it fills.
|
|
912
|
+
if (o.limitPrice !== undefined)
|
|
913
|
+
o.limitPrice /= ratio;
|
|
914
|
+
if (o.stopPrice !== undefined)
|
|
915
|
+
o.stopPrice /= ratio;
|
|
916
|
+
if (o.takeProfit !== undefined)
|
|
917
|
+
o.takeProfit /= ratio;
|
|
918
|
+
if (o.stopLoss !== undefined)
|
|
919
|
+
o.stopLoss /= ratio;
|
|
920
|
+
// Share counts × ratio (a notional order carries quantity 0 and is sized at fill, so it is
|
|
921
|
+
// untouched); `filledQuantity` scales with it so the REMAINING size stays economically equal.
|
|
922
|
+
o.quantity *= ratio;
|
|
923
|
+
o.filledQuantity *= ratio;
|
|
924
|
+
this._warnings.push({
|
|
925
|
+
code: ErrorCode.BacktestOrderSplitAdjusted,
|
|
926
|
+
message: `Order ${o.id} (${o.type} ${o.side} ${symbol}) was adjusted for a ${ratio}-for-1 split: ` +
|
|
927
|
+
`quantity ${before.quantity} → ${o.quantity}` +
|
|
928
|
+
(before.limitPrice !== undefined
|
|
929
|
+
? `, limitPrice ${before.limitPrice} → ${o.limitPrice}`
|
|
930
|
+
: '') +
|
|
931
|
+
(before.stopPrice !== undefined
|
|
932
|
+
? `, stopPrice ${before.stopPrice} → ${o.stopPrice}`
|
|
933
|
+
: '') +
|
|
934
|
+
(before.takeProfit !== undefined
|
|
935
|
+
? `, takeProfit ${before.takeProfit} → ${o.takeProfit}`
|
|
936
|
+
: '') +
|
|
937
|
+
(before.stopLoss !== undefined ? `, stopLoss ${before.stopLoss} → ${o.stopLoss}` : '') +
|
|
938
|
+
'.',
|
|
939
|
+
severity: 'info',
|
|
940
|
+
context: {
|
|
941
|
+
order: o.id,
|
|
942
|
+
symbol,
|
|
943
|
+
split: ratio,
|
|
944
|
+
before,
|
|
945
|
+
after: {
|
|
946
|
+
quantity: o.quantity,
|
|
947
|
+
limitPrice: o.limitPrice,
|
|
948
|
+
stopPrice: o.stopPrice,
|
|
949
|
+
takeProfit: o.takeProfit,
|
|
950
|
+
stopLoss: o.stopLoss,
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
/** When a bracket parent fills, activate its OCO take-profit / stop-loss children. */
|
|
957
|
+
onParentFilled(order, bar) {
|
|
958
|
+
if (order.takeProfit === undefined && order.stopLoss === undefined)
|
|
959
|
+
return;
|
|
960
|
+
const exitSide = order.side === 'buy' ? 'sell' : 'buy';
|
|
961
|
+
const group = `bracket-${order.id}`;
|
|
962
|
+
const exitQty = order.filledQuantity; // the actual position to exit (works for notional orders too)
|
|
963
|
+
// What this bracket is entitled to exit, recorded at the moment it is entitled to it. Recovering
|
|
964
|
+
// it later is not possible: `reduceGroupToOpenPosition` resizes the siblings, so by the second
|
|
965
|
+
// partial fill their quantities no longer say how large the bracket was.
|
|
966
|
+
this.bracketCapacity.set(group, exitQty);
|
|
967
|
+
if (order.takeProfit !== undefined) {
|
|
968
|
+
this.submit({
|
|
969
|
+
symbol: order.symbol,
|
|
970
|
+
side: exitSide,
|
|
971
|
+
quantity: exitQty,
|
|
972
|
+
type: 'limit',
|
|
973
|
+
limitPrice: order.takeProfit,
|
|
974
|
+
ocoGroup: group,
|
|
975
|
+
timeInForce: 'gtc',
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
if (order.stopLoss !== undefined) {
|
|
979
|
+
this.submit({
|
|
980
|
+
symbol: order.symbol,
|
|
981
|
+
side: exitSide,
|
|
982
|
+
quantity: exitQty,
|
|
983
|
+
type: 'stop',
|
|
984
|
+
stopPrice: order.stopLoss,
|
|
985
|
+
ocoGroup: group,
|
|
986
|
+
timeInForce: 'gtc',
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
void bar;
|
|
990
|
+
}
|
|
991
|
+
/** Attempt to fill one order against a bar; returns the trade or null if it doesn't fill. */
|
|
992
|
+
tryFill(order, bar) {
|
|
993
|
+
const ref = this.triggerPrice(order, bar);
|
|
994
|
+
if (ref === null)
|
|
995
|
+
return null;
|
|
996
|
+
// The cash a unit of this symbol moves per point of price: 1 for a share, the registered
|
|
997
|
+
// contract multiplier for an option. Every cash figure below — notional sizing, commission,
|
|
998
|
+
// slippage, the fill's own value — is quoted in it, so a 100-share contract is never billed,
|
|
999
|
+
// sized or reported as one share.
|
|
1000
|
+
const multiplier = this.multiplierOf(order.symbol);
|
|
1001
|
+
// Two-pass sizing: estimate the intended quantity at the reference price first, so a
|
|
1002
|
+
// size-dependent slippage model sees the REAL order size (the old code hardcoded qty = 1). Then
|
|
1003
|
+
// re-quantize a notional order once at the slipped price — a single iteration, no second slip call.
|
|
1004
|
+
let intendedQty = order.notional !== undefined
|
|
1005
|
+
? (order.notional - order.filledNotional) / (ref * multiplier)
|
|
1006
|
+
: order.quantity - order.filledQuantity;
|
|
1007
|
+
/**
|
|
1008
|
+
* A BRACKET may never exit more than it owns, and the sibling-resize path alone cannot promise
|
|
1009
|
+
* that: resizing happens after a PARTIAL fill, so a leg that fills completely in one go never
|
|
1010
|
+
* passes through it. Close a bracketed position by hand and leave the bracket working, and the
|
|
1011
|
+
* next bar to touch the take-profit sold ten shares that were no longer there — flipping the
|
|
1012
|
+
* book short, the same "position the strategy never asked for" the resize was added to prevent.
|
|
1013
|
+
*
|
|
1014
|
+
* Only bracket groups are capped. The broker created both of those legs and owns their
|
|
1015
|
+
* lifecycle; a hand-rolled OCO group is the caller's own resting order, and cancelling it out
|
|
1016
|
+
* from under them because the account went flat would be the simulator inventing policy.
|
|
1017
|
+
*/
|
|
1018
|
+
if (order.ocoGroup !== undefined && this.bracketCapacity.has(order.ocoGroup)) {
|
|
1019
|
+
const owned = this.groupRemaining(order.ocoGroup, order.symbol);
|
|
1020
|
+
if (!(owned > 1e-9)) {
|
|
1021
|
+
this.cancelGroup(order.ocoGroup, order.id);
|
|
1022
|
+
order.status = 'cancelled';
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
if (owned < intendedQty)
|
|
1026
|
+
intendedQty = owned;
|
|
1027
|
+
}
|
|
1028
|
+
if (Number.isFinite(this.participation) && bar.volume !== undefined) {
|
|
1029
|
+
const cap = bar.volume * this.participation;
|
|
1030
|
+
if (cap < intendedQty)
|
|
1031
|
+
intendedQty = cap;
|
|
1032
|
+
}
|
|
1033
|
+
if (!(intendedQty > 0))
|
|
1034
|
+
return null;
|
|
1035
|
+
const fillPrice = this.slip.fill({
|
|
1036
|
+
referencePrice: ref,
|
|
1037
|
+
side: order.side,
|
|
1038
|
+
quantity: intendedQty,
|
|
1039
|
+
});
|
|
1040
|
+
let qty = order.notional !== undefined
|
|
1041
|
+
? (order.notional - order.filledNotional) / (fillPrice * multiplier)
|
|
1042
|
+
: intendedQty;
|
|
1043
|
+
if (Number.isFinite(this.participation) && bar.volume !== undefined) {
|
|
1044
|
+
const cap = bar.volume * this.participation;
|
|
1045
|
+
if (cap < qty)
|
|
1046
|
+
qty = cap;
|
|
1047
|
+
}
|
|
1048
|
+
if (!(qty > 0))
|
|
1049
|
+
return null;
|
|
1050
|
+
if (this.noShort) {
|
|
1051
|
+
const pos = this.position(order.symbol);
|
|
1052
|
+
const after = pos.quantity + (order.side === 'buy' ? qty : -qty);
|
|
1053
|
+
if (after < -1e-9) {
|
|
1054
|
+
order.status = 'cancelled';
|
|
1055
|
+
this._warnings.push({
|
|
1056
|
+
code: WarningCode.BacktestShortRejected,
|
|
1057
|
+
message: `Order ${order.id} would open a short while noShort is set; cancelled.`,
|
|
1058
|
+
severity: 'warn',
|
|
1059
|
+
context: { order: order.id },
|
|
1060
|
+
});
|
|
1061
|
+
return null;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
// leverage cap (margin): reject the fill if it would breach the gross-leverage limit
|
|
1065
|
+
if (Number.isFinite(this.maxLeverage)) {
|
|
1066
|
+
if (this.wouldBreachLeverage(order.symbol, order.side, qty, fillPrice, bar)) {
|
|
1067
|
+
order.status = 'cancelled';
|
|
1068
|
+
this._warnings.push({
|
|
1069
|
+
code: WarningCode.BacktestMarginRejected,
|
|
1070
|
+
message: `Order ${order.id} would breach the ${this.maxLeverage}× gross-leverage limit; cancelled.`,
|
|
1071
|
+
severity: 'warn',
|
|
1072
|
+
context: { order: order.id, maxLeverage: this.maxLeverage },
|
|
1073
|
+
});
|
|
1074
|
+
return null;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
// Commission is charged on the price the trade actually PRINTED at, not on the pre-slippage
|
|
1078
|
+
// reference: a bps schedule billed at `ref` under-charged every buy and over-charged every sell
|
|
1079
|
+
// by exactly the slippage, so the modelled cost drifted from the modelled fill. The price is
|
|
1080
|
+
// the cash price of one unit (premium × multiplier for a contract), exactly as the shared fill
|
|
1081
|
+
// kernel bills it, so a bps schedule sees the contract's notional and a per-unit schedule
|
|
1082
|
+
// sees the contract count.
|
|
1083
|
+
const commission = this.fee.commission({ quantity: qty, price: fillPrice * multiplier });
|
|
1084
|
+
this.applyFill({
|
|
1085
|
+
symbol: order.symbol,
|
|
1086
|
+
side: order.side,
|
|
1087
|
+
quantity: qty,
|
|
1088
|
+
price: fillPrice,
|
|
1089
|
+
commission,
|
|
1090
|
+
});
|
|
1091
|
+
// Under unconstrained leverage a fill can drive cash negative (unfunded). Surface it ONCE, and
|
|
1092
|
+
// keep the low-water mark current on the same warning object so the final result carries it.
|
|
1093
|
+
if (this.cash < this.cashLowWater)
|
|
1094
|
+
this.cashLowWater = this.cash;
|
|
1095
|
+
if (this.cash < 0) {
|
|
1096
|
+
if (!this.negativeCashWarning) {
|
|
1097
|
+
this.negativeCashWarning = {
|
|
1098
|
+
code: WarningCode.BacktestNegativeCash,
|
|
1099
|
+
message: 'Cash went negative — unconstrained leverage (maxLeverage = Infinity) permitted an unfunded fill.',
|
|
1100
|
+
severity: 'warn',
|
|
1101
|
+
context: { firstTs: bar.timestampMs, lowWaterCash: this.cash },
|
|
1102
|
+
};
|
|
1103
|
+
this._warnings.push(this.negativeCashWarning);
|
|
1104
|
+
}
|
|
1105
|
+
this.negativeCashWarning.context['lowWaterCash'] = this.cashLowWater;
|
|
1106
|
+
}
|
|
1107
|
+
order.filledQuantity += qty;
|
|
1108
|
+
order.filledNotional += qty * fillPrice * multiplier;
|
|
1109
|
+
const done = order.notional !== undefined
|
|
1110
|
+
? order.filledNotional >= order.notional - 1e-6 * Math.max(1, order.notional)
|
|
1111
|
+
: order.filledQuantity >= order.quantity - 1e-9;
|
|
1112
|
+
order.status = done ? 'filled' : 'partially-filled';
|
|
1113
|
+
if (order.ocoGroup) {
|
|
1114
|
+
if (order.status === 'filled') {
|
|
1115
|
+
this.cancelGroup(order.ocoGroup, order.id); // one-cancels-other: unchanged on a FULL fill
|
|
1116
|
+
}
|
|
1117
|
+
else {
|
|
1118
|
+
this.reduceGroupToOpenPosition(order, fillPrice);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
const trade = {
|
|
1122
|
+
symbol: order.symbol,
|
|
1123
|
+
timestampMs: bar.timestampMs,
|
|
1124
|
+
side: order.side,
|
|
1125
|
+
quantity: qty,
|
|
1126
|
+
price: fillPrice,
|
|
1127
|
+
commission,
|
|
1128
|
+
// Slippage is a cash cost like commission: the per-unit price concession times the cash a
|
|
1129
|
+
// unit moves. Left in premium points, an option's slippage was reported at 1% of its size.
|
|
1130
|
+
slippage: qty * Math.abs(fillPrice - ref) * multiplier,
|
|
1131
|
+
// The contract multiplier this symbol trades in (1 for a share, the registered option's
|
|
1132
|
+
// multiplier otherwise) — so downstream turnover / realized-P&L attribution can value the
|
|
1133
|
+
// fill in cash without re-deriving the instrument's registration.
|
|
1134
|
+
multiplier,
|
|
1135
|
+
};
|
|
1136
|
+
this._trades.push(trade);
|
|
1137
|
+
return trade;
|
|
1138
|
+
}
|
|
1139
|
+
/** The reference (pre-slippage) execution price if `order` triggers on `bar`, else null. */
|
|
1140
|
+
triggerPrice(order, bar) {
|
|
1141
|
+
const { open, high, low, close } = bar;
|
|
1142
|
+
switch (order.type) {
|
|
1143
|
+
case 'market':
|
|
1144
|
+
case 'market-on-open':
|
|
1145
|
+
return open;
|
|
1146
|
+
case 'market-on-close':
|
|
1147
|
+
// The bar's close is the auction print a bar simulator has; slippage applies after.
|
|
1148
|
+
return close;
|
|
1149
|
+
case 'limit': {
|
|
1150
|
+
const L = order.limitPrice;
|
|
1151
|
+
if (order.side === 'buy')
|
|
1152
|
+
return open <= L ? open : low <= L ? L : null;
|
|
1153
|
+
return open >= L ? open : high >= L ? L : null;
|
|
1154
|
+
}
|
|
1155
|
+
case 'stop': {
|
|
1156
|
+
const S = order.stopPrice;
|
|
1157
|
+
if (order.side === 'buy')
|
|
1158
|
+
return high >= S ? Math.max(open, S) : null;
|
|
1159
|
+
return low <= S ? Math.min(open, S) : null;
|
|
1160
|
+
}
|
|
1161
|
+
case 'stop-limit': {
|
|
1162
|
+
const S = order.stopPrice;
|
|
1163
|
+
const L = order.limitPrice;
|
|
1164
|
+
const triggered = order.side === 'buy' ? high >= S : low <= S;
|
|
1165
|
+
if (!triggered)
|
|
1166
|
+
return null;
|
|
1167
|
+
// A stop-limit is NOT a live limit order until the stop trips. Evaluating the limit against
|
|
1168
|
+
// the bar's raw `open` filled at a price that existed BEFORE the order was working: a buy
|
|
1169
|
+
// stop-limit (stop 100, limit 100) on a bar that opened at 95 and rallied through 100 used to
|
|
1170
|
+
// fill at 95 — a free 5 points the order could never have captured. The order's effective
|
|
1171
|
+
// open is therefore the stop price, unless the bar already GAPPED through it (open beyond the
|
|
1172
|
+
// stop), which is the same flooring the plain `stop` case applies via Math.max/Math.min.
|
|
1173
|
+
if (order.side === 'buy') {
|
|
1174
|
+
const entry = Math.max(open, S);
|
|
1175
|
+
return entry <= L ? entry : low <= L ? L : null;
|
|
1176
|
+
}
|
|
1177
|
+
const entry = Math.min(open, S);
|
|
1178
|
+
return entry >= L ? entry : high >= L ? L : null;
|
|
1179
|
+
}
|
|
1180
|
+
default:
|
|
1181
|
+
return null;
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
applyFill(input) {
|
|
1185
|
+
const { symbol, side, quantity: qty, price, commission } = input;
|
|
1186
|
+
const signed = signOf(side) * qty;
|
|
1187
|
+
this.cash -= signed * price * this.multiplierOf(symbol) + commission;
|
|
1188
|
+
const pos = this.positions.get(symbol) ?? { symbol, quantity: 0, averagePrice: 0 };
|
|
1189
|
+
const newQty = pos.quantity + signed;
|
|
1190
|
+
if (pos.quantity === 0 || Math.sign(pos.quantity) === Math.sign(newQty) || newQty === 0) {
|
|
1191
|
+
// adding to (or flattening) a position: weighted-average the entry price when growing
|
|
1192
|
+
if (Math.abs(newQty) > Math.abs(pos.quantity)) {
|
|
1193
|
+
pos.averagePrice = (pos.averagePrice * pos.quantity + price * signed) / newQty;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
else {
|
|
1197
|
+
// crossed through zero: the remainder opens a fresh position at this price
|
|
1198
|
+
pos.averagePrice = price;
|
|
1199
|
+
}
|
|
1200
|
+
pos.quantity = newQty;
|
|
1201
|
+
if (Math.abs(pos.quantity) < 1e-12) {
|
|
1202
|
+
this.positions.delete(symbol);
|
|
1203
|
+
}
|
|
1204
|
+
else {
|
|
1205
|
+
this.positions.set(symbol, pos);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
wouldBreachLeverage(symbol, side, qty, price, bar) {
|
|
1209
|
+
const marks = new Map(this.lastMark);
|
|
1210
|
+
marks.set(symbol, bar.close);
|
|
1211
|
+
const equity = this.equity(marks);
|
|
1212
|
+
if (!(equity > 0))
|
|
1213
|
+
return true;
|
|
1214
|
+
let gross = 0;
|
|
1215
|
+
for (const pos of this.positions.values()) {
|
|
1216
|
+
const m = marks.get(pos.symbol) ?? pos.averagePrice;
|
|
1217
|
+
gross += Math.abs(pos.quantity * m) * this.multiplierOf(pos.symbol);
|
|
1218
|
+
}
|
|
1219
|
+
const pos = this.position(symbol);
|
|
1220
|
+
const mult = this.multiplierOf(symbol);
|
|
1221
|
+
const before = Math.abs(pos.quantity * bar.close) * mult;
|
|
1222
|
+
const after = Math.abs((pos.quantity + signOf(side) * qty) * bar.close) * mult;
|
|
1223
|
+
gross += after - before;
|
|
1224
|
+
void price;
|
|
1225
|
+
return gross / equity > this.maxLeverage + 1e-9;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
//# sourceMappingURL=broker.js.map
|