@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,1891 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The investment-policy grammar behind `@insiderfinance/totalfinance/portfolio/policy` (FC7 slice 4, Stage 4.4): model
|
|
3
|
+
* portfolios with versioned strategic/tactical/glide-path targets and hierarchical sleeves, the
|
|
4
|
+
* user-supplied `InvestmentPolicy`, and the ONE target-resolution law that `allocatePortfolio`,
|
|
5
|
+
* `proposePortfolioRebalance`, and `monitorPortfolio` share. This module is INTERNAL: `policy.ts`
|
|
6
|
+
* is the public subpath and re-exports only the reviewed surface.
|
|
7
|
+
*
|
|
8
|
+
* Decisions this module executes (agent-native doc, "Portfolio management workflows" →
|
|
9
|
+
* "Investment policy"; tracker §FC7 "Portfolio-side management"):
|
|
10
|
+
*
|
|
11
|
+
* - A policy is a USER-SUPPLIED artifact, never advice: every goal is explicit and **missing goals
|
|
12
|
+
* do not become secret defaults** — a group target with no way to split it, a universe the
|
|
13
|
+
* targets do not cover, or a risk budget without a covariance is reported as `unresolved`, never
|
|
14
|
+
* quietly filled in.
|
|
15
|
+
* - Targets are declared on GROUPS (`instrumentId`, `sleeveId`, `assetClass`, `currency`, `tag`,
|
|
16
|
+
* `underlying`, `strategy`) — the same identity vocabulary the P&L and timeline groupings use —
|
|
17
|
+
* and `{ assetClass: 'cash' }` is THE cash target (the accepted example's spelling).
|
|
18
|
+
* - A model portfolio is an immutable, content-addressed artifact (`kind: 'totalfinance.model-portfolio'`)
|
|
19
|
+
* whose targets resolve at an explicit `asOf`: tactical sets effective at that instant win over
|
|
20
|
+
* the glide path, which wins over the strategic set. Nothing is interpolated unless the model says
|
|
21
|
+
* `interpolation: 'linear'`.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
import {
|
|
25
|
+
CONVENTIONS_VERSION,
|
|
26
|
+
DataError,
|
|
27
|
+
ErrorCode,
|
|
28
|
+
InputError,
|
|
29
|
+
ensureKnownKeys,
|
|
30
|
+
requireArgumentArray,
|
|
31
|
+
requireArgumentObject,
|
|
32
|
+
resolveAsOf,
|
|
33
|
+
type EpochMs,
|
|
34
|
+
} from '@totalfinance/core';
|
|
35
|
+
import { contentHash } from '@totalfinance/core/artifacts';
|
|
36
|
+
import {
|
|
37
|
+
deepFreeze,
|
|
38
|
+
describeInputValue,
|
|
39
|
+
epochMsToUtcDate,
|
|
40
|
+
ownValue,
|
|
41
|
+
requireCurrencyCode,
|
|
42
|
+
requireEpochMsField,
|
|
43
|
+
requireFiniteNumberField,
|
|
44
|
+
requireIdentityString,
|
|
45
|
+
requirePositiveNumberField,
|
|
46
|
+
} from './internal.js';
|
|
47
|
+
import type { InstrumentClassification } from './pnl.js';
|
|
48
|
+
|
|
49
|
+
// ---------------------------------------------------------------------------------------------------
|
|
50
|
+
// Public types — targets
|
|
51
|
+
// ---------------------------------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The group a target applies to — EXACTLY ONE key. `instrumentId` and `sleeveId` resolve through
|
|
55
|
+
* the model; the classification keys resolve through the caller's `instrumentClassification`
|
|
56
|
+
* (`currency` through each position's trading currency). `{ assetClass: 'cash' }` targets cash.
|
|
57
|
+
*/
|
|
58
|
+
export interface TargetGroup {
|
|
59
|
+
instrumentId?: string;
|
|
60
|
+
sleeveId?: string;
|
|
61
|
+
assetClass?: string;
|
|
62
|
+
currency?: string;
|
|
63
|
+
tag?: string;
|
|
64
|
+
underlying?: string;
|
|
65
|
+
strategy?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type TargetGroupKey = keyof TargetGroup;
|
|
69
|
+
|
|
70
|
+
/** One allocation goal. Exactly one of `weight` (share of NAV) or `riskBudget` (share of risk). */
|
|
71
|
+
export interface AllocationTarget {
|
|
72
|
+
group: TargetGroup;
|
|
73
|
+
/** Target weight as a decimal fraction of net asset value (negative = short target). */
|
|
74
|
+
weight?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Target share of total portfolio risk (decimal). Carried on the artifact; this build's
|
|
77
|
+
* portfolio-side calls act on WEIGHTS and report a risk-budget target as unresolved — turning a
|
|
78
|
+
* risk budget into weights needs a covariance, which lives on the risk side (`@insiderfinance/totalfinance/risk`).
|
|
79
|
+
*/
|
|
80
|
+
riskBudget?: number;
|
|
81
|
+
/** Absolute drift band for this target (decimal of NAV); overrides the policy's `driftBand`. */
|
|
82
|
+
driftBand?: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** A dated, complete set of targets. */
|
|
86
|
+
export interface TargetSet {
|
|
87
|
+
/** When the set becomes effective (`'YYYY-MM-DD'`, zoned ISO datetime, or epoch ms). */
|
|
88
|
+
effectiveFrom: EpochMs | string;
|
|
89
|
+
/** Optional end of effectiveness (exclusive) — for tactical overrides. */
|
|
90
|
+
effectiveTo?: EpochMs | string;
|
|
91
|
+
targets: AllocationTarget[];
|
|
92
|
+
note?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A sleeve member: an instrument and its weight WITHIN the sleeve (members sum to 1). */
|
|
96
|
+
export interface SleeveMember {
|
|
97
|
+
instrumentId: string;
|
|
98
|
+
weight: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A hierarchical sleeve. A LEAF declares `members`; a CHILD declares `parentSleeveId` and its
|
|
103
|
+
* `weightWithinParent` (siblings sum to 1). A parent's own target weight flows down the tree.
|
|
104
|
+
*/
|
|
105
|
+
export interface ModelSleeve {
|
|
106
|
+
sleeveId: string;
|
|
107
|
+
parentSleeveId?: string;
|
|
108
|
+
weightWithinParent?: number;
|
|
109
|
+
members?: SleeveMember[];
|
|
110
|
+
note?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface BenchmarkConstituent {
|
|
114
|
+
instrumentId: string;
|
|
115
|
+
weight: number;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** Benchmark identity — a name and, when known, its dated membership. */
|
|
119
|
+
export interface BenchmarkIdentity {
|
|
120
|
+
benchmarkId: string;
|
|
121
|
+
/** The instant the membership below is stated at. */
|
|
122
|
+
asOf?: EpochMs | string;
|
|
123
|
+
/** Constituent weights (sum to 1) — the identity a tracking comparison is made against. */
|
|
124
|
+
constituents?: BenchmarkConstituent[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface LiabilityEntry {
|
|
128
|
+
date: EpochMs | string;
|
|
129
|
+
/** Positive amount due on `date`, in `currency`. */
|
|
130
|
+
amount: number;
|
|
131
|
+
currency: string;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** A schedule of dated liabilities / planned withdrawals the portfolio must fund. */
|
|
135
|
+
export interface LiabilitySchedule {
|
|
136
|
+
entries: LiabilityEntry[];
|
|
137
|
+
note?: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** One glide-path point: a dated target set that runs until the next point (no `effectiveTo`). */
|
|
141
|
+
export type GlidePathPoint = Omit<TargetSet, 'effectiveTo'>;
|
|
142
|
+
|
|
143
|
+
/** Dated strategic target sets along a horizon; `interpolation` is REQUIRED (never guessed). */
|
|
144
|
+
export interface GlidePath {
|
|
145
|
+
interpolation: 'step' | 'linear';
|
|
146
|
+
points: GlidePathPoint[];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The definition {@link createModelPortfolio} freezes. */
|
|
150
|
+
export interface ModelPortfolioDefinition {
|
|
151
|
+
modelId: string;
|
|
152
|
+
/** Safe integer ≥ 1 — a changed model is a new version, never an edit in place. */
|
|
153
|
+
version: number;
|
|
154
|
+
baseCurrency: string;
|
|
155
|
+
strategic: TargetSet;
|
|
156
|
+
/** Dated complete overrides; the latest set effective at `asOf` wins. */
|
|
157
|
+
tactical?: TargetSet[];
|
|
158
|
+
glidePath?: GlidePath;
|
|
159
|
+
sleeves?: ModelSleeve[];
|
|
160
|
+
benchmark?: BenchmarkIdentity;
|
|
161
|
+
liabilities?: LiabilitySchedule;
|
|
162
|
+
horizonEndDate?: EpochMs | string;
|
|
163
|
+
note?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export const MODEL_PORTFOLIO_KIND = 'totalfinance.model-portfolio';
|
|
167
|
+
export const MODEL_PORTFOLIO_SCHEMA_VERSION = 1;
|
|
168
|
+
|
|
169
|
+
/** The immutable, content-addressed model artifact. */
|
|
170
|
+
export interface ModelPortfolio extends ModelPortfolioDefinition {
|
|
171
|
+
kind: typeof MODEL_PORTFOLIO_KIND;
|
|
172
|
+
schemaVersion: number;
|
|
173
|
+
/** `sha256:` over the canonical definition (kind and schemaVersion included). */
|
|
174
|
+
contentHash: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// ---------------------------------------------------------------------------------------------------
|
|
178
|
+
// Public types — the investment policy
|
|
179
|
+
// ---------------------------------------------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
export type WithinGroupAllocation = 'proportional-to-current' | 'equal';
|
|
182
|
+
export type ContributionHandling = 'invest-to-targets' | 'hold-as-cash';
|
|
183
|
+
export type WithdrawalHandling = 'raise-from-overweights' | 'pro-rata';
|
|
184
|
+
export type IncomeReinvestment = 'reinvest' | 'hold-as-cash';
|
|
185
|
+
|
|
186
|
+
export interface GroupWeightLimit {
|
|
187
|
+
group: TargetGroup;
|
|
188
|
+
/** Maximum absolute weight of the group (decimal of NAV). */
|
|
189
|
+
maximumWeight: number;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Hard limits a proposal must satisfy and a monitor evaluates. Every limit is explicit. */
|
|
193
|
+
export interface PolicyLimits {
|
|
194
|
+
/** Maximum absolute weight of any single instrument (decimal of NAV). */
|
|
195
|
+
maximumPositionWeight?: number;
|
|
196
|
+
maximumGroupWeights?: GroupWeightLimit[];
|
|
197
|
+
/** Maximum gross exposure ÷ NAV (1 = unlevered). */
|
|
198
|
+
maximumGrossLeverage?: number;
|
|
199
|
+
/** Maximum peak-to-trough drawdown of NAV (decimal). */
|
|
200
|
+
maximumDrawdown?: number;
|
|
201
|
+
/** Maximum one-evaluation NAV loss (decimal of the prior NAV). */
|
|
202
|
+
maximumDailyLoss?: number;
|
|
203
|
+
/** Maximum days to liquidate any position at the supplied participation rate. */
|
|
204
|
+
maximumDaysToLiquidate?: number;
|
|
205
|
+
/** Minimum settled cash in base currency (a margin/buying-power floor; may be negative). */
|
|
206
|
+
minimumSettledCash?: number;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The user-supplied investment policy (agent-native "Investment policy"). Targets come inline or
|
|
211
|
+
* from a model artifact — never both. Everything else is optional and explicit.
|
|
212
|
+
*/
|
|
213
|
+
export interface InvestmentPolicy {
|
|
214
|
+
targets?: AllocationTarget[];
|
|
215
|
+
model?: ModelPortfolio;
|
|
216
|
+
/**
|
|
217
|
+
* How a GROUP target (assetClass/currency/tag/underlying/strategy) is split across its member
|
|
218
|
+
* instruments. REQUIRED whenever such a target resolves to more than one instrument.
|
|
219
|
+
*/
|
|
220
|
+
withinGroupAllocation?: WithinGroupAllocation;
|
|
221
|
+
/** Default absolute drift band (decimal of NAV) — a target outside its band triggers trades/alerts. */
|
|
222
|
+
driftBand?: number;
|
|
223
|
+
reviewCadenceDays?: number;
|
|
224
|
+
/** Maximum turnover per proposal: `Σ|trade notional| ÷ NAV` (buys and sells both counted). */
|
|
225
|
+
maximumTurnover?: number;
|
|
226
|
+
/** Maximum estimated transaction cost per proposal, in base currency. */
|
|
227
|
+
maximumEstimatedTransactionCost?: number;
|
|
228
|
+
/** Cash reserve in base currency that a proposal may never spend below. */
|
|
229
|
+
minimumCash?: number;
|
|
230
|
+
/** Cash reserve as a decimal of NAV (alternative spelling; both may be set — the larger binds). */
|
|
231
|
+
minimumCashWeight?: number;
|
|
232
|
+
limits?: PolicyLimits;
|
|
233
|
+
allowedInstruments?: string[];
|
|
234
|
+
restrictedInstruments?: string[];
|
|
235
|
+
allowedAccounts?: string[];
|
|
236
|
+
benchmark?: BenchmarkIdentity;
|
|
237
|
+
/** Prose statement of the performance objective. String-typed by design. */
|
|
238
|
+
performanceObjective?: string;
|
|
239
|
+
contributionHandling?: ContributionHandling;
|
|
240
|
+
withdrawalHandling?: WithdrawalHandling;
|
|
241
|
+
incomeReinvestment?: IncomeReinvestment;
|
|
242
|
+
/**
|
|
243
|
+
* Identity of an external tax-aware lot-selection objective. This build reports lots under the
|
|
244
|
+
* ledger's own relief policy and echoes this identity; it never applies an objective it does not
|
|
245
|
+
* implement.
|
|
246
|
+
*/
|
|
247
|
+
lotSelectionObjective?: string;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ---------------------------------------------------------------------------------------------------
|
|
251
|
+
// Public types — resolution
|
|
252
|
+
// ---------------------------------------------------------------------------------------------------
|
|
253
|
+
|
|
254
|
+
export type ResolvedTargetSource = 'inline' | 'strategic' | 'tactical' | 'glide-path';
|
|
255
|
+
|
|
256
|
+
/** The targets effective at one instant, with where they came from. */
|
|
257
|
+
export interface ResolvedTargets {
|
|
258
|
+
targets: AllocationTarget[];
|
|
259
|
+
source: ResolvedTargetSource;
|
|
260
|
+
/** The effective-from instant of the winning set (`null` for inline targets). */
|
|
261
|
+
effectiveFrom: EpochMs | null;
|
|
262
|
+
/** Present when a linear glide path interpolated between two points. */
|
|
263
|
+
interpolation?: { from: EpochMs; to: EpochMs; fraction: number };
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** One instrument's resolved target after group expansion. */
|
|
267
|
+
export interface InstrumentTarget {
|
|
268
|
+
instrumentId: string;
|
|
269
|
+
targetWeight: number;
|
|
270
|
+
driftBand: number | null;
|
|
271
|
+
/** The target group keys (`'assetClass:equity'`) that produced this weight. */
|
|
272
|
+
sourceGroups: string[];
|
|
273
|
+
/** True when the instrument was covered by no target and the targets sum to 1 (implied zero). */
|
|
274
|
+
implied: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/** One group target after membership resolution. */
|
|
278
|
+
export interface GroupTarget {
|
|
279
|
+
key: string;
|
|
280
|
+
group: TargetGroup;
|
|
281
|
+
targetWeight: number;
|
|
282
|
+
driftBand: number | null;
|
|
283
|
+
members: string[];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export interface UnresolvedTarget {
|
|
287
|
+
key: string;
|
|
288
|
+
group: TargetGroup;
|
|
289
|
+
reason: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The expansion of group targets to instrument targets — what allocation and rebalancing act on. */
|
|
293
|
+
export interface ExpandedTargets {
|
|
294
|
+
instrumentTargets: InstrumentTarget[];
|
|
295
|
+
groupTargets: GroupTarget[];
|
|
296
|
+
/** The cash target (`{ assetClass: 'cash' }`), implied zero when the targets sum to 1 without one. */
|
|
297
|
+
cashTarget: { targetWeight: number; driftBand: number | null; implied: boolean } | null;
|
|
298
|
+
/** Σ of the resolved group weights including cash (before implied zeros). */
|
|
299
|
+
declaredWeightTotal: number;
|
|
300
|
+
unresolved: UnresolvedTarget[];
|
|
301
|
+
warnings: string[];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export interface ExpandTargetsInput {
|
|
305
|
+
targets: AllocationTarget[];
|
|
306
|
+
/** Every instrument the expansion may assign a target to (holdings ∪ allowed ∪ sleeve members). */
|
|
307
|
+
universe: string[];
|
|
308
|
+
instrumentClassification: Record<string, InstrumentClassification>;
|
|
309
|
+
/** Trading currency per instrument — resolves `currency` targets. */
|
|
310
|
+
instrumentCurrency: Record<string, string>;
|
|
311
|
+
/** Current weights per instrument (decimal of NAV) — for `'proportional-to-current'`. */
|
|
312
|
+
currentWeights: Record<string, number>;
|
|
313
|
+
sleeves: ModelSleeve[];
|
|
314
|
+
withinGroupAllocation: WithinGroupAllocation | undefined;
|
|
315
|
+
defaultDriftBand: number | undefined;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// ---------------------------------------------------------------------------------------------------
|
|
319
|
+
// Constants
|
|
320
|
+
// ---------------------------------------------------------------------------------------------------
|
|
321
|
+
|
|
322
|
+
const TARGET_GROUP_KEYS = [
|
|
323
|
+
'instrumentId',
|
|
324
|
+
'sleeveId',
|
|
325
|
+
'assetClass',
|
|
326
|
+
'currency',
|
|
327
|
+
'tag',
|
|
328
|
+
'underlying',
|
|
329
|
+
'strategy',
|
|
330
|
+
] as const;
|
|
331
|
+
const TARGET_KEYS = ['group', 'weight', 'riskBudget', 'driftBand'] as const;
|
|
332
|
+
const TARGET_SET_KEYS = ['effectiveFrom', 'effectiveTo', 'targets', 'note'] as const;
|
|
333
|
+
const SLEEVE_KEYS = [
|
|
334
|
+
'sleeveId',
|
|
335
|
+
'parentSleeveId',
|
|
336
|
+
'weightWithinParent',
|
|
337
|
+
'members',
|
|
338
|
+
'note',
|
|
339
|
+
] as const;
|
|
340
|
+
const SLEEVE_MEMBER_KEYS = ['instrumentId', 'weight'] as const;
|
|
341
|
+
const BENCHMARK_KEYS = ['benchmarkId', 'asOf', 'constituents'] as const;
|
|
342
|
+
const CONSTITUENT_KEYS = ['instrumentId', 'weight'] as const;
|
|
343
|
+
const LIABILITY_KEYS = ['entries', 'note'] as const;
|
|
344
|
+
const LIABILITY_ENTRY_KEYS = ['date', 'amount', 'currency'] as const;
|
|
345
|
+
const GLIDE_PATH_KEYS = ['interpolation', 'points'] as const;
|
|
346
|
+
const GLIDE_INTERPOLATIONS = ['step', 'linear'] as const;
|
|
347
|
+
const DEFINITION_KEYS = [
|
|
348
|
+
'modelId',
|
|
349
|
+
'version',
|
|
350
|
+
'baseCurrency',
|
|
351
|
+
'strategic',
|
|
352
|
+
'tactical',
|
|
353
|
+
'glidePath',
|
|
354
|
+
'sleeves',
|
|
355
|
+
'benchmark',
|
|
356
|
+
'liabilities',
|
|
357
|
+
'horizonEndDate',
|
|
358
|
+
'note',
|
|
359
|
+
] as const;
|
|
360
|
+
const ARTIFACT_KEYS = [...DEFINITION_KEYS, 'kind', 'schemaVersion', 'contentHash'] as const;
|
|
361
|
+
const LIMIT_KEYS = [
|
|
362
|
+
'maximumPositionWeight',
|
|
363
|
+
'maximumGroupWeights',
|
|
364
|
+
'maximumGrossLeverage',
|
|
365
|
+
'maximumDrawdown',
|
|
366
|
+
'maximumDailyLoss',
|
|
367
|
+
'maximumDaysToLiquidate',
|
|
368
|
+
'minimumSettledCash',
|
|
369
|
+
] as const;
|
|
370
|
+
const GROUP_LIMIT_KEYS = ['group', 'maximumWeight'] as const;
|
|
371
|
+
const POLICY_KEYS = [
|
|
372
|
+
'targets',
|
|
373
|
+
'model',
|
|
374
|
+
'withinGroupAllocation',
|
|
375
|
+
'driftBand',
|
|
376
|
+
'reviewCadenceDays',
|
|
377
|
+
'maximumTurnover',
|
|
378
|
+
'maximumEstimatedTransactionCost',
|
|
379
|
+
'minimumCash',
|
|
380
|
+
'minimumCashWeight',
|
|
381
|
+
'limits',
|
|
382
|
+
'allowedInstruments',
|
|
383
|
+
'restrictedInstruments',
|
|
384
|
+
'allowedAccounts',
|
|
385
|
+
'benchmark',
|
|
386
|
+
'performanceObjective',
|
|
387
|
+
'contributionHandling',
|
|
388
|
+
'withdrawalHandling',
|
|
389
|
+
'incomeReinvestment',
|
|
390
|
+
'lotSelectionObjective',
|
|
391
|
+
] as const;
|
|
392
|
+
const WITHIN_GROUP_ALLOCATIONS: readonly WithinGroupAllocation[] = [
|
|
393
|
+
'proportional-to-current',
|
|
394
|
+
'equal',
|
|
395
|
+
];
|
|
396
|
+
const CONTRIBUTION_HANDLINGS: readonly ContributionHandling[] = [
|
|
397
|
+
'invest-to-targets',
|
|
398
|
+
'hold-as-cash',
|
|
399
|
+
];
|
|
400
|
+
const WITHDRAWAL_HANDLINGS: readonly WithdrawalHandling[] = ['raise-from-overweights', 'pro-rata'];
|
|
401
|
+
const INCOME_REINVESTMENTS: readonly IncomeReinvestment[] = ['reinvest', 'hold-as-cash'];
|
|
402
|
+
|
|
403
|
+
/** Weight sums are compared at this tolerance (float arithmetic on declared decimals). */
|
|
404
|
+
export const WEIGHT_TOLERANCE = 1e-9;
|
|
405
|
+
/** The cash target's spelling — the accepted example's `{ assetClass: 'cash' }`. */
|
|
406
|
+
export const CASH_ASSET_CLASS = 'cash';
|
|
407
|
+
|
|
408
|
+
const MODEL_EXAMPLE_CALL =
|
|
409
|
+
"createModelPortfolio({ modelId: 'balanced', version: 1, baseCurrency: 'USD', strategic: { effectiveFrom: '2026-01-01', targets: [{ group: { tag: 'equity' }, weight: 0.6 }, { group: { tag: 'fixed-income' }, weight: 0.3 }, { group: { assetClass: 'cash' }, weight: 0.1 }] } })";
|
|
410
|
+
|
|
411
|
+
const POLICY_EXAMPLE =
|
|
412
|
+
"policy: { targets: [{ group: { tag: 'equity' }, weight: 0.6 }, { group: { tag: 'fixed-income' }, weight: 0.3 }, { group: { assetClass: 'cash' }, weight: 0.1 }], withinGroupAllocation: 'proportional-to-current', driftBand: 0.03, maximumTurnover: 0.15, minimumCash: 5_000 }";
|
|
413
|
+
|
|
414
|
+
// ---------------------------------------------------------------------------------------------------
|
|
415
|
+
// Small helpers
|
|
416
|
+
// ---------------------------------------------------------------------------------------------------
|
|
417
|
+
|
|
418
|
+
function outOfRange(functionName: string, field: string, message: string): never {
|
|
419
|
+
throw new InputError(`${functionName}: ${message}`, {
|
|
420
|
+
code: ErrorCode.InputOutOfRange,
|
|
421
|
+
context: { function: functionName, field },
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function missingField(functionName: string, field: string, message: string): never {
|
|
426
|
+
throw new InputError(`${functionName}: ${message}`, {
|
|
427
|
+
code: ErrorCode.InputMissingField,
|
|
428
|
+
context: { function: functionName, field },
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function requireLiteral<T extends string>(
|
|
433
|
+
functionName: string,
|
|
434
|
+
field: string,
|
|
435
|
+
value: unknown,
|
|
436
|
+
allowed: readonly T[],
|
|
437
|
+
): T {
|
|
438
|
+
if (typeof value !== 'string' || !(allowed as readonly string[]).includes(value)) {
|
|
439
|
+
throw new InputError(
|
|
440
|
+
`${functionName}: ${field} must be one of ${allowed.map((v) => `'${v}'`).join(', ')}. Received ${describeInputValue(value)}.`,
|
|
441
|
+
{
|
|
442
|
+
code: typeof value === 'string' ? ErrorCode.InputInvalidEnum : ErrorCode.InputWrongType,
|
|
443
|
+
context: { function: functionName, field },
|
|
444
|
+
},
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
return value as T;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
function requireNonNegative(functionName: string, field: string, value: unknown): number {
|
|
451
|
+
requireFiniteNumberField(functionName, field, value);
|
|
452
|
+
if (value < 0) outOfRange(functionName, field, `${field} must be ≥ 0. Received ${value}.`);
|
|
453
|
+
return value;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function requireSafeIntegerAtLeast(
|
|
457
|
+
functionName: string,
|
|
458
|
+
field: string,
|
|
459
|
+
value: unknown,
|
|
460
|
+
minimum: number,
|
|
461
|
+
): number {
|
|
462
|
+
requireFiniteNumberField(functionName, field, value);
|
|
463
|
+
if (!Number.isSafeInteger(value) || value < minimum) {
|
|
464
|
+
outOfRange(
|
|
465
|
+
functionName,
|
|
466
|
+
field,
|
|
467
|
+
`${field} must be a safe integer ≥ ${minimum}. Received ${value}.`,
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
return value;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function requireInstant(functionName: string, field: string, value: unknown): EpochMs {
|
|
474
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
475
|
+
throw new InputError(
|
|
476
|
+
`${functionName}: ${field} must be an epoch-millisecond number, a 'YYYY-MM-DD' date, or a zoned ISO datetime. Received ${
|
|
477
|
+
value === null ? 'null' : typeof value
|
|
478
|
+
}.`,
|
|
479
|
+
{ code: ErrorCode.InputWrongType, context: { function: functionName, field } },
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
const resolved = resolveAsOf(value, functionName);
|
|
483
|
+
requireEpochMsField(functionName, field, resolved);
|
|
484
|
+
return resolved;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
function requireIdentityList(functionName: string, field: string, value: unknown): string[] {
|
|
488
|
+
requireArgumentArray(functionName, field, value);
|
|
489
|
+
const out: string[] = [];
|
|
490
|
+
const seen = new Set<string>();
|
|
491
|
+
(value as unknown[]).forEach((entry, index) => {
|
|
492
|
+
requireIdentityString(functionName, `${field}[${index}]`, entry);
|
|
493
|
+
if (seen.has(entry)) {
|
|
494
|
+
outOfRange(functionName, field, `${field} lists '${entry}' twice.`);
|
|
495
|
+
}
|
|
496
|
+
seen.add(entry);
|
|
497
|
+
out.push(entry);
|
|
498
|
+
});
|
|
499
|
+
return out;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/** A declared-weight total for prose: 12 significant digits, so 0.6 + 0.3 reads 0.9. */
|
|
503
|
+
function readable(value: number): string {
|
|
504
|
+
return String(Number(value.toPrecision(12)));
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function sum(values: readonly number[]): number {
|
|
508
|
+
let total = 0;
|
|
509
|
+
for (const value of values) total += value;
|
|
510
|
+
return total;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/** The single key of a validated target group, as `'<dimension>:<value>'`. */
|
|
514
|
+
export function targetGroupKey(group: TargetGroup): string {
|
|
515
|
+
for (const key of TARGET_GROUP_KEYS) {
|
|
516
|
+
const value = group[key];
|
|
517
|
+
if (value !== undefined) return `${key}:${value}`;
|
|
518
|
+
}
|
|
519
|
+
throw new DataError('targetGroupKey: the group names no dimension.', {
|
|
520
|
+
code: ErrorCode.InputMissingField,
|
|
521
|
+
context: { function: 'targetGroupKey', field: 'group' },
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/** Whether a group is the cash target. */
|
|
526
|
+
export function isCashTargetGroup(group: TargetGroup): boolean {
|
|
527
|
+
return group.assetClass === CASH_ASSET_CLASS;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// ---------------------------------------------------------------------------------------------------
|
|
531
|
+
// Validation — targets
|
|
532
|
+
// ---------------------------------------------------------------------------------------------------
|
|
533
|
+
|
|
534
|
+
/** Validate one target group: an object with exactly ONE dimension key holding an identity string. */
|
|
535
|
+
export function requireTargetGroup(
|
|
536
|
+
functionName: string,
|
|
537
|
+
path: string,
|
|
538
|
+
value: unknown,
|
|
539
|
+
): TargetGroup {
|
|
540
|
+
requireArgumentObject(functionName, path, value);
|
|
541
|
+
ensureKnownKeys(functionName, path, value as object, TARGET_GROUP_KEYS);
|
|
542
|
+
const group = value as Record<string, unknown>;
|
|
543
|
+
const present = TARGET_GROUP_KEYS.filter((key) => group[key] !== undefined);
|
|
544
|
+
if (present.length !== 1) {
|
|
545
|
+
throw new InputError(
|
|
546
|
+
`${functionName}: ${path} must name exactly ONE dimension (${TARGET_GROUP_KEYS.join(', ')}); received ${
|
|
547
|
+
present.length === 0 ? 'none' : present.join(' + ')
|
|
548
|
+
}. A target on two dimensions is two targets.`,
|
|
549
|
+
{
|
|
550
|
+
code: present.length === 0 ? ErrorCode.InputMissingField : ErrorCode.InputOutOfRange,
|
|
551
|
+
context: { function: functionName, field: path },
|
|
552
|
+
},
|
|
553
|
+
);
|
|
554
|
+
}
|
|
555
|
+
const key = present[0]!;
|
|
556
|
+
requireIdentityString(functionName, `${path}.${key}`, group[key]);
|
|
557
|
+
return { [key]: group[key] } as TargetGroup;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/** Validate one allocation target. */
|
|
561
|
+
export function requireAllocationTarget(
|
|
562
|
+
functionName: string,
|
|
563
|
+
path: string,
|
|
564
|
+
value: unknown,
|
|
565
|
+
): AllocationTarget {
|
|
566
|
+
requireArgumentObject(functionName, path, value);
|
|
567
|
+
ensureKnownKeys(functionName, path, value as object, TARGET_KEYS);
|
|
568
|
+
const target = value as Record<string, unknown>;
|
|
569
|
+
const group = requireTargetGroup(functionName, `${path}.group`, target['group']);
|
|
570
|
+
const hasWeight = target['weight'] !== undefined;
|
|
571
|
+
const hasRiskBudget = target['riskBudget'] !== undefined;
|
|
572
|
+
if (hasWeight === hasRiskBudget) {
|
|
573
|
+
throw new InputError(
|
|
574
|
+
`${functionName}: ${path} must declare exactly one of weight (share of NAV) or riskBudget (share of risk)${
|
|
575
|
+
hasWeight ? ' — both were given' : ' — neither was given'
|
|
576
|
+
}.\n e.g. { group: { tag: 'equity' }, weight: 0.6 }`,
|
|
577
|
+
{
|
|
578
|
+
code: hasWeight ? ErrorCode.InputOutOfRange : ErrorCode.InputMissingField,
|
|
579
|
+
context: { function: functionName, field: path },
|
|
580
|
+
},
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
const out: AllocationTarget = { group };
|
|
584
|
+
if (hasWeight) {
|
|
585
|
+
requireFiniteNumberField(functionName, `${path}.weight`, target['weight']);
|
|
586
|
+
if (Math.abs(target['weight']) > 1) {
|
|
587
|
+
outOfRange(
|
|
588
|
+
functionName,
|
|
589
|
+
`${path}.weight`,
|
|
590
|
+
`${path}.weight is a decimal fraction of NAV, so |weight| ≤ 1. Received ${target['weight']} (a percentage?).`,
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
out.weight = target['weight'];
|
|
594
|
+
} else {
|
|
595
|
+
requireFiniteNumberField(functionName, `${path}.riskBudget`, target['riskBudget']);
|
|
596
|
+
if (target['riskBudget'] < 0 || target['riskBudget'] > 1) {
|
|
597
|
+
outOfRange(
|
|
598
|
+
functionName,
|
|
599
|
+
`${path}.riskBudget`,
|
|
600
|
+
`${path}.riskBudget is a decimal share of total risk in [0, 1]. Received ${target['riskBudget']}.`,
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
out.riskBudget = target['riskBudget'];
|
|
604
|
+
}
|
|
605
|
+
if (target['driftBand'] !== undefined) {
|
|
606
|
+
out.driftBand = requireNonNegative(functionName, `${path}.driftBand`, target['driftBand']);
|
|
607
|
+
}
|
|
608
|
+
return out;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/** Validate a target list: each target valid, no duplicate groups, per-dimension sums ≤ 1. */
|
|
612
|
+
export function requireAllocationTargets(
|
|
613
|
+
functionName: string,
|
|
614
|
+
path: string,
|
|
615
|
+
value: unknown,
|
|
616
|
+
): AllocationTarget[] {
|
|
617
|
+
requireArgumentArray(functionName, path, value);
|
|
618
|
+
if ((value as unknown[]).length === 0) {
|
|
619
|
+
missingField(
|
|
620
|
+
functionName,
|
|
621
|
+
path,
|
|
622
|
+
`${path} must contain at least one target.\n e.g. ${POLICY_EXAMPLE}`,
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
const targets = (value as unknown[]).map((entry, index) =>
|
|
626
|
+
requireAllocationTarget(functionName, `${path}[${index}]`, entry),
|
|
627
|
+
);
|
|
628
|
+
const seen = new Set<string>();
|
|
629
|
+
const weightByDimension = new Map<string, number>();
|
|
630
|
+
const riskByDimension = new Map<string, number>();
|
|
631
|
+
targets.forEach((target, index) => {
|
|
632
|
+
const key = targetGroupKey(target.group);
|
|
633
|
+
if (seen.has(key)) {
|
|
634
|
+
outOfRange(
|
|
635
|
+
functionName,
|
|
636
|
+
`${path}[${index}].group`,
|
|
637
|
+
`${path} names the group '${key}' twice — one target per group.`,
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
seen.add(key);
|
|
641
|
+
const dimension = key.slice(0, key.indexOf(':'));
|
|
642
|
+
if (target.weight !== undefined) {
|
|
643
|
+
weightByDimension.set(dimension, (weightByDimension.get(dimension) ?? 0) + target.weight);
|
|
644
|
+
} else {
|
|
645
|
+
riskByDimension.set(dimension, (riskByDimension.get(dimension) ?? 0) + target.riskBudget!);
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
for (const [dimension, total] of weightByDimension) {
|
|
649
|
+
if (total > 1 + WEIGHT_TOLERANCE) {
|
|
650
|
+
outOfRange(
|
|
651
|
+
functionName,
|
|
652
|
+
path,
|
|
653
|
+
`${path} allocates ${total} of NAV across the '${dimension}' dimension — weights on one dimension cannot exceed 1.`,
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
for (const [dimension, total] of riskByDimension) {
|
|
658
|
+
if (total > 1 + WEIGHT_TOLERANCE) {
|
|
659
|
+
outOfRange(
|
|
660
|
+
functionName,
|
|
661
|
+
path,
|
|
662
|
+
`${path} budgets ${total} of total risk across the '${dimension}' dimension — risk budgets on one dimension cannot exceed 1.`,
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
return targets;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function requireTargetSet(functionName: string, path: string, value: unknown): TargetSet {
|
|
670
|
+
requireArgumentObject(functionName, path, value);
|
|
671
|
+
ensureKnownKeys(functionName, path, value as object, TARGET_SET_KEYS);
|
|
672
|
+
const set = value as Record<string, unknown>;
|
|
673
|
+
if (set['effectiveFrom'] === undefined) {
|
|
674
|
+
missingField(
|
|
675
|
+
functionName,
|
|
676
|
+
`${path}.effectiveFrom`,
|
|
677
|
+
`${path}.effectiveFrom is required — a target set is dated.`,
|
|
678
|
+
);
|
|
679
|
+
}
|
|
680
|
+
const effectiveFrom = requireInstant(functionName, `${path}.effectiveFrom`, set['effectiveFrom']);
|
|
681
|
+
const out: TargetSet = {
|
|
682
|
+
effectiveFrom: set['effectiveFrom'] as EpochMs | string,
|
|
683
|
+
targets: requireAllocationTargets(functionName, `${path}.targets`, set['targets']),
|
|
684
|
+
};
|
|
685
|
+
if (set['effectiveTo'] !== undefined) {
|
|
686
|
+
const effectiveTo = requireInstant(functionName, `${path}.effectiveTo`, set['effectiveTo']);
|
|
687
|
+
if (effectiveTo <= effectiveFrom) {
|
|
688
|
+
outOfRange(
|
|
689
|
+
functionName,
|
|
690
|
+
`${path}.effectiveTo`,
|
|
691
|
+
`${path}.effectiveTo (${epochMsToUtcDate(effectiveTo)}) must be after effectiveFrom (${epochMsToUtcDate(effectiveFrom)}).`,
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
out.effectiveTo = set['effectiveTo'] as EpochMs | string;
|
|
695
|
+
}
|
|
696
|
+
if (set['note'] !== undefined) {
|
|
697
|
+
if (typeof set['note'] !== 'string') {
|
|
698
|
+
throw new InputError(`${functionName}: ${path}.note must be a string.`, {
|
|
699
|
+
code: ErrorCode.InputWrongType,
|
|
700
|
+
context: { function: functionName, field: `${path}.note` },
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
out.note = set['note'];
|
|
704
|
+
}
|
|
705
|
+
return out;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function requireSleeves(functionName: string, path: string, value: unknown): ModelSleeve[] {
|
|
709
|
+
requireArgumentArray(functionName, path, value);
|
|
710
|
+
const sleeves: ModelSleeve[] = [];
|
|
711
|
+
const byId = new Map<string, ModelSleeve>();
|
|
712
|
+
(value as unknown[]).forEach((entry, index) => {
|
|
713
|
+
const entryPath = `${path}[${index}]`;
|
|
714
|
+
requireArgumentObject(functionName, entryPath, entry);
|
|
715
|
+
ensureKnownKeys(functionName, entryPath, entry as object, SLEEVE_KEYS);
|
|
716
|
+
const raw = entry as Record<string, unknown>;
|
|
717
|
+
requireIdentityString(functionName, `${entryPath}.sleeveId`, raw['sleeveId']);
|
|
718
|
+
if (byId.has(raw['sleeveId'])) {
|
|
719
|
+
outOfRange(
|
|
720
|
+
functionName,
|
|
721
|
+
`${entryPath}.sleeveId`,
|
|
722
|
+
`${path} declares sleeve '${raw['sleeveId']}' twice.`,
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
const sleeve: ModelSleeve = { sleeveId: raw['sleeveId'] };
|
|
726
|
+
if (raw['parentSleeveId'] !== undefined) {
|
|
727
|
+
requireIdentityString(functionName, `${entryPath}.parentSleeveId`, raw['parentSleeveId']);
|
|
728
|
+
if (raw['parentSleeveId'] === sleeve.sleeveId) {
|
|
729
|
+
outOfRange(
|
|
730
|
+
functionName,
|
|
731
|
+
`${entryPath}.parentSleeveId`,
|
|
732
|
+
`sleeve '${sleeve.sleeveId}' cannot be its own parent.`,
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
sleeve.parentSleeveId = raw['parentSleeveId'];
|
|
736
|
+
if (raw['weightWithinParent'] === undefined) {
|
|
737
|
+
missingField(
|
|
738
|
+
functionName,
|
|
739
|
+
`${entryPath}.weightWithinParent`,
|
|
740
|
+
`${entryPath}.weightWithinParent is required for a child sleeve (siblings sum to 1).`,
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
sleeve.weightWithinParent = requireNonNegative(
|
|
744
|
+
functionName,
|
|
745
|
+
`${entryPath}.weightWithinParent`,
|
|
746
|
+
raw['weightWithinParent'],
|
|
747
|
+
);
|
|
748
|
+
} else if (raw['weightWithinParent'] !== undefined) {
|
|
749
|
+
outOfRange(
|
|
750
|
+
functionName,
|
|
751
|
+
`${entryPath}.weightWithinParent`,
|
|
752
|
+
`${entryPath}.weightWithinParent is only meaningful with parentSleeveId.`,
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
if (raw['members'] !== undefined) {
|
|
756
|
+
requireArgumentArray(functionName, `${entryPath}.members`, raw['members']);
|
|
757
|
+
if ((raw['members'] as unknown[]).length === 0) {
|
|
758
|
+
missingField(
|
|
759
|
+
functionName,
|
|
760
|
+
`${entryPath}.members`,
|
|
761
|
+
`${entryPath}.members must not be empty.`,
|
|
762
|
+
);
|
|
763
|
+
}
|
|
764
|
+
const seen = new Set<string>();
|
|
765
|
+
sleeve.members = (raw['members'] as unknown[]).map((member, memberIndex) => {
|
|
766
|
+
const memberPath = `${entryPath}.members[${memberIndex}]`;
|
|
767
|
+
requireArgumentObject(functionName, memberPath, member);
|
|
768
|
+
ensureKnownKeys(functionName, memberPath, member as object, SLEEVE_MEMBER_KEYS);
|
|
769
|
+
const m = member as Record<string, unknown>;
|
|
770
|
+
requireIdentityString(functionName, `${memberPath}.instrumentId`, m['instrumentId']);
|
|
771
|
+
if (seen.has(m['instrumentId'])) {
|
|
772
|
+
outOfRange(
|
|
773
|
+
functionName,
|
|
774
|
+
memberPath,
|
|
775
|
+
`sleeve '${sleeve.sleeveId}' lists '${m['instrumentId']}' twice.`,
|
|
776
|
+
);
|
|
777
|
+
}
|
|
778
|
+
seen.add(m['instrumentId']);
|
|
779
|
+
return {
|
|
780
|
+
instrumentId: m['instrumentId'],
|
|
781
|
+
weight: requireNonNegative(functionName, `${memberPath}.weight`, m['weight']),
|
|
782
|
+
};
|
|
783
|
+
});
|
|
784
|
+
const total = sum(sleeve.members.map((member) => member.weight));
|
|
785
|
+
if (Math.abs(total - 1) > WEIGHT_TOLERANCE) {
|
|
786
|
+
outOfRange(
|
|
787
|
+
functionName,
|
|
788
|
+
`${entryPath}.members`,
|
|
789
|
+
`sleeve '${sleeve.sleeveId}' member weights sum to ${total}; they must sum to 1 (weights are WITHIN the sleeve).`,
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (raw['note'] !== undefined) {
|
|
794
|
+
if (typeof raw['note'] !== 'string') {
|
|
795
|
+
throw new InputError(`${functionName}: ${entryPath}.note must be a string.`, {
|
|
796
|
+
code: ErrorCode.InputWrongType,
|
|
797
|
+
context: { function: functionName, field: `${entryPath}.note` },
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
sleeve.note = raw['note'];
|
|
801
|
+
}
|
|
802
|
+
byId.set(sleeve.sleeveId, sleeve);
|
|
803
|
+
sleeves.push(sleeve);
|
|
804
|
+
});
|
|
805
|
+
// Structure: parents exist, no cycles, siblings sum to 1, every sleeve is a leaf or a parent.
|
|
806
|
+
const children = new Map<string, ModelSleeve[]>();
|
|
807
|
+
for (const sleeve of sleeves) {
|
|
808
|
+
if (sleeve.parentSleeveId !== undefined) {
|
|
809
|
+
if (!byId.has(sleeve.parentSleeveId)) {
|
|
810
|
+
outOfRange(
|
|
811
|
+
functionName,
|
|
812
|
+
path,
|
|
813
|
+
`sleeve '${sleeve.sleeveId}' names parent '${sleeve.parentSleeveId}', which is not declared.`,
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
const list = children.get(sleeve.parentSleeveId) ?? [];
|
|
817
|
+
list.push(sleeve);
|
|
818
|
+
children.set(sleeve.parentSleeveId, list);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
for (const sleeve of sleeves) {
|
|
822
|
+
const seen = new Set<string>([sleeve.sleeveId]);
|
|
823
|
+
let cursor = sleeve.parentSleeveId;
|
|
824
|
+
while (cursor !== undefined) {
|
|
825
|
+
if (seen.has(cursor)) {
|
|
826
|
+
outOfRange(functionName, path, `sleeves form a cycle through '${cursor}'.`);
|
|
827
|
+
}
|
|
828
|
+
seen.add(cursor);
|
|
829
|
+
cursor = byId.get(cursor)!.parentSleeveId;
|
|
830
|
+
}
|
|
831
|
+
const kids = children.get(sleeve.sleeveId) ?? [];
|
|
832
|
+
if (kids.length > 0 && sleeve.members !== undefined) {
|
|
833
|
+
outOfRange(
|
|
834
|
+
functionName,
|
|
835
|
+
path,
|
|
836
|
+
`sleeve '${sleeve.sleeveId}' declares members AND has child sleeves — a sleeve is a leaf or a parent, not both.`,
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
if (kids.length === 0 && sleeve.members === undefined) {
|
|
840
|
+
missingField(
|
|
841
|
+
functionName,
|
|
842
|
+
path,
|
|
843
|
+
`sleeve '${sleeve.sleeveId}' has neither members nor child sleeves — an empty sleeve cannot be allocated.`,
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
if (kids.length > 0) {
|
|
847
|
+
const total = sum(kids.map((kid) => kid.weightWithinParent!));
|
|
848
|
+
if (Math.abs(total - 1) > WEIGHT_TOLERANCE) {
|
|
849
|
+
outOfRange(
|
|
850
|
+
functionName,
|
|
851
|
+
path,
|
|
852
|
+
`the child sleeves of '${sleeve.sleeveId}' weigh ${total} within it; siblings must sum to 1.`,
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
return sleeves;
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function requireBenchmark(functionName: string, path: string, value: unknown): BenchmarkIdentity {
|
|
861
|
+
requireArgumentObject(functionName, path, value);
|
|
862
|
+
ensureKnownKeys(functionName, path, value as object, BENCHMARK_KEYS);
|
|
863
|
+
const raw = value as Record<string, unknown>;
|
|
864
|
+
requireIdentityString(functionName, `${path}.benchmarkId`, raw['benchmarkId']);
|
|
865
|
+
const out: BenchmarkIdentity = { benchmarkId: raw['benchmarkId'] };
|
|
866
|
+
if (raw['asOf'] !== undefined) {
|
|
867
|
+
requireInstant(functionName, `${path}.asOf`, raw['asOf']);
|
|
868
|
+
out.asOf = raw['asOf'] as EpochMs | string;
|
|
869
|
+
}
|
|
870
|
+
if (raw['constituents'] !== undefined) {
|
|
871
|
+
requireArgumentArray(functionName, `${path}.constituents`, raw['constituents']);
|
|
872
|
+
const seen = new Set<string>();
|
|
873
|
+
out.constituents = (raw['constituents'] as unknown[]).map((entry, index) => {
|
|
874
|
+
const entryPath = `${path}.constituents[${index}]`;
|
|
875
|
+
requireArgumentObject(functionName, entryPath, entry);
|
|
876
|
+
ensureKnownKeys(functionName, entryPath, entry as object, CONSTITUENT_KEYS);
|
|
877
|
+
const c = entry as Record<string, unknown>;
|
|
878
|
+
requireIdentityString(functionName, `${entryPath}.instrumentId`, c['instrumentId']);
|
|
879
|
+
if (seen.has(c['instrumentId'])) {
|
|
880
|
+
outOfRange(functionName, entryPath, `${path} lists '${c['instrumentId']}' twice.`);
|
|
881
|
+
}
|
|
882
|
+
seen.add(c['instrumentId']);
|
|
883
|
+
requireFiniteNumberField(functionName, `${entryPath}.weight`, c['weight']);
|
|
884
|
+
return { instrumentId: c['instrumentId'], weight: c['weight'] };
|
|
885
|
+
});
|
|
886
|
+
if (out.constituents.length === 0) {
|
|
887
|
+
missingField(
|
|
888
|
+
functionName,
|
|
889
|
+
`${path}.constituents`,
|
|
890
|
+
`${path}.constituents must not be empty when given.`,
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
const total = sum(out.constituents.map((c) => c.weight));
|
|
894
|
+
if (Math.abs(total - 1) > WEIGHT_TOLERANCE) {
|
|
895
|
+
outOfRange(
|
|
896
|
+
functionName,
|
|
897
|
+
`${path}.constituents`,
|
|
898
|
+
`${path}.constituents weigh ${total}; a benchmark's membership sums to 1.`,
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
return out;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
function requireLiabilities(functionName: string, path: string, value: unknown): LiabilitySchedule {
|
|
906
|
+
requireArgumentObject(functionName, path, value);
|
|
907
|
+
ensureKnownKeys(functionName, path, value as object, LIABILITY_KEYS);
|
|
908
|
+
const raw = value as Record<string, unknown>;
|
|
909
|
+
requireArgumentArray(functionName, `${path}.entries`, raw['entries']);
|
|
910
|
+
let previous = -Infinity;
|
|
911
|
+
const entries = (raw['entries'] as unknown[]).map((entry, index) => {
|
|
912
|
+
const entryPath = `${path}.entries[${index}]`;
|
|
913
|
+
requireArgumentObject(functionName, entryPath, entry);
|
|
914
|
+
ensureKnownKeys(functionName, entryPath, entry as object, LIABILITY_ENTRY_KEYS);
|
|
915
|
+
const e = entry as Record<string, unknown>;
|
|
916
|
+
const date = requireInstant(functionName, `${entryPath}.date`, e['date']);
|
|
917
|
+
if (date < previous) {
|
|
918
|
+
outOfRange(
|
|
919
|
+
functionName,
|
|
920
|
+
`${entryPath}.date`,
|
|
921
|
+
`${path}.entries must be in non-decreasing date order.`,
|
|
922
|
+
);
|
|
923
|
+
}
|
|
924
|
+
previous = date;
|
|
925
|
+
requirePositiveNumberField(
|
|
926
|
+
functionName,
|
|
927
|
+
`${entryPath}.amount`,
|
|
928
|
+
e['amount'],
|
|
929
|
+
'a liability is an amount due',
|
|
930
|
+
);
|
|
931
|
+
return {
|
|
932
|
+
date: e['date'] as EpochMs | string,
|
|
933
|
+
amount: e['amount'] as number,
|
|
934
|
+
currency: (() => {
|
|
935
|
+
requireCurrencyCode(functionName, `${entryPath}.currency`, e['currency']);
|
|
936
|
+
return e['currency'] as string;
|
|
937
|
+
})(),
|
|
938
|
+
};
|
|
939
|
+
});
|
|
940
|
+
const out: LiabilitySchedule = { entries };
|
|
941
|
+
if (raw['note'] !== undefined) {
|
|
942
|
+
if (typeof raw['note'] !== 'string') {
|
|
943
|
+
throw new InputError(`${functionName}: ${path}.note must be a string.`, {
|
|
944
|
+
code: ErrorCode.InputWrongType,
|
|
945
|
+
context: { function: functionName, field: `${path}.note` },
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
out.note = raw['note'];
|
|
949
|
+
}
|
|
950
|
+
return out;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
function requireGlidePath(functionName: string, path: string, value: unknown): GlidePath {
|
|
954
|
+
requireArgumentObject(functionName, path, value);
|
|
955
|
+
ensureKnownKeys(functionName, path, value as object, GLIDE_PATH_KEYS);
|
|
956
|
+
const raw = value as Record<string, unknown>;
|
|
957
|
+
if (raw['interpolation'] === undefined) {
|
|
958
|
+
missingField(
|
|
959
|
+
functionName,
|
|
960
|
+
`${path}.interpolation`,
|
|
961
|
+
`${path}.interpolation is required ('step' holds each point until the next; 'linear' interpolates weights between points) — a glide path's shape is a goal, not a default.`,
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
const interpolation = requireLiteral(
|
|
965
|
+
functionName,
|
|
966
|
+
`${path}.interpolation`,
|
|
967
|
+
raw['interpolation'],
|
|
968
|
+
GLIDE_INTERPOLATIONS,
|
|
969
|
+
);
|
|
970
|
+
requireArgumentArray(functionName, `${path}.points`, raw['points']);
|
|
971
|
+
if ((raw['points'] as unknown[]).length === 0) {
|
|
972
|
+
missingField(
|
|
973
|
+
functionName,
|
|
974
|
+
`${path}.points`,
|
|
975
|
+
`${path}.points must contain at least one dated target set.`,
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
const points = (raw['points'] as unknown[]).map((entry, index) =>
|
|
979
|
+
requireTargetSet(functionName, `${path}.points[${index}]`, entry),
|
|
980
|
+
);
|
|
981
|
+
let previous = -Infinity;
|
|
982
|
+
points.forEach((point, index) => {
|
|
983
|
+
const from = resolveAsOf(point.effectiveFrom, functionName);
|
|
984
|
+
if (from <= previous) {
|
|
985
|
+
outOfRange(
|
|
986
|
+
functionName,
|
|
987
|
+
`${path}.points[${index}].effectiveFrom`,
|
|
988
|
+
`${path}.points must be in strictly increasing effectiveFrom order.`,
|
|
989
|
+
);
|
|
990
|
+
}
|
|
991
|
+
previous = from;
|
|
992
|
+
if (point.effectiveTo !== undefined) {
|
|
993
|
+
outOfRange(
|
|
994
|
+
functionName,
|
|
995
|
+
`${path}.points[${index}].effectiveTo`,
|
|
996
|
+
`a glide-path point runs until the next point; effectiveTo is not allowed here.`,
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
if (interpolation === 'linear' && index > 0) {
|
|
1000
|
+
const before = new Set(points[index - 1]!.targets.map((t) => targetGroupKey(t.group)));
|
|
1001
|
+
const now = new Set(point.targets.map((t) => targetGroupKey(t.group)));
|
|
1002
|
+
const same = before.size === now.size && [...before].every((k) => now.has(k));
|
|
1003
|
+
if (!same) {
|
|
1004
|
+
outOfRange(
|
|
1005
|
+
functionName,
|
|
1006
|
+
`${path}.points[${index}].targets`,
|
|
1007
|
+
`linear interpolation needs every point to name the SAME groups (point ${index - 1} names ${[...before].join(', ')}; point ${index} names ${[...now].join(', ')}). Use 'step', or restate both points over one group set.`,
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
const riskMixed =
|
|
1011
|
+
points[index - 1]!.targets.some((t) => t.riskBudget !== undefined) ||
|
|
1012
|
+
point.targets.some((t) => t.riskBudget !== undefined);
|
|
1013
|
+
if (riskMixed) {
|
|
1014
|
+
outOfRange(
|
|
1015
|
+
functionName,
|
|
1016
|
+
`${path}.points[${index}].targets`,
|
|
1017
|
+
`linear interpolation is defined over weights; risk-budget targets need 'step'.`,
|
|
1018
|
+
);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
return { interpolation, points };
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1026
|
+
// Validation — the model and the policy
|
|
1027
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1028
|
+
|
|
1029
|
+
/** Validate a {@link ModelPortfolioDefinition} (closed keys, dated sets, sleeve structure). */
|
|
1030
|
+
export function requireModelPortfolioDefinition(
|
|
1031
|
+
functionName: string,
|
|
1032
|
+
path: string,
|
|
1033
|
+
value: unknown,
|
|
1034
|
+
): ModelPortfolioDefinition {
|
|
1035
|
+
requireArgumentObject(functionName, path, value);
|
|
1036
|
+
ensureKnownKeys(functionName, path, value as object, DEFINITION_KEYS);
|
|
1037
|
+
const raw = value as Record<string, unknown>;
|
|
1038
|
+
requireIdentityString(functionName, `${path}.modelId`, raw['modelId']);
|
|
1039
|
+
if (raw['version'] === undefined) {
|
|
1040
|
+
missingField(
|
|
1041
|
+
functionName,
|
|
1042
|
+
`${path}.version`,
|
|
1043
|
+
`${path}.version is required (a safe integer ≥ 1; a changed model is a new version).\n e.g. ${MODEL_EXAMPLE_CALL}`,
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
const version = requireSafeIntegerAtLeast(functionName, `${path}.version`, raw['version'], 1);
|
|
1047
|
+
requireCurrencyCode(functionName, `${path}.baseCurrency`, raw['baseCurrency']);
|
|
1048
|
+
const baseCurrency = raw['baseCurrency'] as string;
|
|
1049
|
+
if (raw['strategic'] === undefined) {
|
|
1050
|
+
missingField(
|
|
1051
|
+
functionName,
|
|
1052
|
+
`${path}.strategic`,
|
|
1053
|
+
`${path}.strategic is required — the dated strategic target set.\n e.g. ${MODEL_EXAMPLE_CALL}`,
|
|
1054
|
+
);
|
|
1055
|
+
}
|
|
1056
|
+
const out: ModelPortfolioDefinition = {
|
|
1057
|
+
modelId: raw['modelId'],
|
|
1058
|
+
version,
|
|
1059
|
+
baseCurrency,
|
|
1060
|
+
strategic: requireTargetSet(functionName, `${path}.strategic`, raw['strategic']),
|
|
1061
|
+
};
|
|
1062
|
+
if (raw['tactical'] !== undefined) {
|
|
1063
|
+
requireArgumentArray(functionName, `${path}.tactical`, raw['tactical']);
|
|
1064
|
+
out.tactical = (raw['tactical'] as unknown[]).map((entry, index) =>
|
|
1065
|
+
requireTargetSet(functionName, `${path}.tactical[${index}]`, entry),
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
if (raw['glidePath'] !== undefined) {
|
|
1069
|
+
out.glidePath = requireGlidePath(functionName, `${path}.glidePath`, raw['glidePath']);
|
|
1070
|
+
}
|
|
1071
|
+
if (raw['sleeves'] !== undefined) {
|
|
1072
|
+
out.sleeves = requireSleeves(functionName, `${path}.sleeves`, raw['sleeves']);
|
|
1073
|
+
}
|
|
1074
|
+
if (raw['benchmark'] !== undefined) {
|
|
1075
|
+
out.benchmark = requireBenchmark(functionName, `${path}.benchmark`, raw['benchmark']);
|
|
1076
|
+
}
|
|
1077
|
+
if (raw['liabilities'] !== undefined) {
|
|
1078
|
+
out.liabilities = requireLiabilities(functionName, `${path}.liabilities`, raw['liabilities']);
|
|
1079
|
+
}
|
|
1080
|
+
if (raw['horizonEndDate'] !== undefined) {
|
|
1081
|
+
requireInstant(functionName, `${path}.horizonEndDate`, raw['horizonEndDate']);
|
|
1082
|
+
out.horizonEndDate = raw['horizonEndDate'] as EpochMs | string;
|
|
1083
|
+
}
|
|
1084
|
+
if (raw['note'] !== undefined) {
|
|
1085
|
+
if (typeof raw['note'] !== 'string') {
|
|
1086
|
+
throw new InputError(`${functionName}: ${path}.note must be a string.`, {
|
|
1087
|
+
code: ErrorCode.InputWrongType,
|
|
1088
|
+
context: { function: functionName, field: `${path}.note` },
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
out.note = raw['note'];
|
|
1092
|
+
}
|
|
1093
|
+
// Every sleeve target must name a declared sleeve.
|
|
1094
|
+
const sleeveIds = new Set((out.sleeves ?? []).map((s) => s.sleeveId));
|
|
1095
|
+
const sets: [string, TargetSet][] = [
|
|
1096
|
+
[`${path}.strategic`, out.strategic],
|
|
1097
|
+
...(out.tactical ?? []).map((set, i): [string, TargetSet] => [`${path}.tactical[${i}]`, set]),
|
|
1098
|
+
...(out.glidePath?.points ?? []).map((set, i): [string, TargetSet] => [
|
|
1099
|
+
`${path}.glidePath.points[${i}]`,
|
|
1100
|
+
set,
|
|
1101
|
+
]),
|
|
1102
|
+
];
|
|
1103
|
+
for (const [setPath, set] of sets) {
|
|
1104
|
+
set.targets.forEach((target, index) => {
|
|
1105
|
+
if (target.group.sleeveId !== undefined && !sleeveIds.has(target.group.sleeveId)) {
|
|
1106
|
+
outOfRange(
|
|
1107
|
+
functionName,
|
|
1108
|
+
`${setPath}.targets[${index}].group.sleeveId`,
|
|
1109
|
+
`${setPath}.targets[${index}] targets sleeve '${target.group.sleeveId}', which ${path}.sleeves does not declare.`,
|
|
1110
|
+
);
|
|
1111
|
+
}
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
return out;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
function modelContentHash(definition: ModelPortfolioDefinition): string {
|
|
1118
|
+
return contentHash({
|
|
1119
|
+
kind: MODEL_PORTFOLIO_KIND,
|
|
1120
|
+
schemaVersion: MODEL_PORTFOLIO_SCHEMA_VERSION,
|
|
1121
|
+
...definition,
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Freeze a {@link ModelPortfolioDefinition} into an immutable, content-addressed
|
|
1127
|
+
* {@link ModelPortfolio} artifact. The definition is fully validated first; the hash covers
|
|
1128
|
+
* everything (a changed target is a different model).
|
|
1129
|
+
*
|
|
1130
|
+
* @example
|
|
1131
|
+
* ```ts
|
|
1132
|
+
* import { createModelPortfolio } from '@insiderfinance/totalfinance/portfolio/policy';
|
|
1133
|
+
*
|
|
1134
|
+
* const model = createModelPortfolio({
|
|
1135
|
+
* modelId: 'balanced',
|
|
1136
|
+
* version: 1,
|
|
1137
|
+
* baseCurrency: 'USD',
|
|
1138
|
+
* strategic: {
|
|
1139
|
+
* effectiveFrom: '2026-01-01',
|
|
1140
|
+
* targets: [
|
|
1141
|
+
* { group: { tag: 'equity' }, weight: 0.6 },
|
|
1142
|
+
* { group: { tag: 'fixed-income' }, weight: 0.3 },
|
|
1143
|
+
* { group: { assetClass: 'cash' }, weight: 0.1 },
|
|
1144
|
+
* ],
|
|
1145
|
+
* },
|
|
1146
|
+
* });
|
|
1147
|
+
* model.contentHash; // 'sha256:…'
|
|
1148
|
+
* ```
|
|
1149
|
+
*/
|
|
1150
|
+
export function createModelPortfolio(definition: ModelPortfolioDefinition): ModelPortfolio {
|
|
1151
|
+
const functionName = 'createModelPortfolio';
|
|
1152
|
+
const validated = requireModelPortfolioDefinition(functionName, 'definition', definition);
|
|
1153
|
+
const artifact: ModelPortfolio = {
|
|
1154
|
+
kind: MODEL_PORTFOLIO_KIND,
|
|
1155
|
+
schemaVersion: MODEL_PORTFOLIO_SCHEMA_VERSION,
|
|
1156
|
+
...validated,
|
|
1157
|
+
contentHash: modelContentHash(validated),
|
|
1158
|
+
};
|
|
1159
|
+
return deepFreeze(artifact);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
/** Validate a {@link ModelPortfolio} artifact, including that its hash matches its content. */
|
|
1163
|
+
export function requireModelPortfolio(
|
|
1164
|
+
functionName: string,
|
|
1165
|
+
path: string,
|
|
1166
|
+
value: unknown,
|
|
1167
|
+
): ModelPortfolio {
|
|
1168
|
+
requireArgumentObject(functionName, path, value);
|
|
1169
|
+
ensureKnownKeys(functionName, path, value as object, ARTIFACT_KEYS);
|
|
1170
|
+
const raw = value as Record<string, unknown>;
|
|
1171
|
+
if (raw['kind'] !== MODEL_PORTFOLIO_KIND) {
|
|
1172
|
+
throw new InputError(
|
|
1173
|
+
`${functionName}: ${path}.kind must be '${MODEL_PORTFOLIO_KIND}' (a createModelPortfolio artifact). Received ${describeInputValue(raw['kind'])}.`,
|
|
1174
|
+
{
|
|
1175
|
+
code: ErrorCode.SnapshotKindMismatch,
|
|
1176
|
+
context: { function: functionName, field: `${path}.kind` },
|
|
1177
|
+
},
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
if (raw['schemaVersion'] !== MODEL_PORTFOLIO_SCHEMA_VERSION) {
|
|
1181
|
+
throw new InputError(
|
|
1182
|
+
`${functionName}: ${path}.schemaVersion must be ${MODEL_PORTFOLIO_SCHEMA_VERSION}. Received ${describeInputValue(raw['schemaVersion'])}.`,
|
|
1183
|
+
{
|
|
1184
|
+
code: ErrorCode.SnapshotUnsupportedVersion,
|
|
1185
|
+
context: { function: functionName, field: `${path}.schemaVersion` },
|
|
1186
|
+
},
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1189
|
+
requireIdentityString(functionName, `${path}.contentHash`, raw['contentHash']);
|
|
1190
|
+
const body: Record<string, unknown> = { ...raw };
|
|
1191
|
+
delete body['kind'];
|
|
1192
|
+
delete body['schemaVersion'];
|
|
1193
|
+
delete body['contentHash'];
|
|
1194
|
+
const definition = requireModelPortfolioDefinition(functionName, path, body);
|
|
1195
|
+
const expected = modelContentHash(definition);
|
|
1196
|
+
if (expected !== raw['contentHash']) {
|
|
1197
|
+
throw new DataError(
|
|
1198
|
+
`${functionName}: ${path}.contentHash (${String(raw['contentHash'])}) does not match the model's content (${expected}) — the artifact was edited after creation. Create a new version with createModelPortfolio.`,
|
|
1199
|
+
{
|
|
1200
|
+
code: ErrorCode.ArtifactIdMismatch,
|
|
1201
|
+
context: { function: functionName, field: `${path}.contentHash` },
|
|
1202
|
+
},
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
return {
|
|
1206
|
+
kind: MODEL_PORTFOLIO_KIND,
|
|
1207
|
+
schemaVersion: MODEL_PORTFOLIO_SCHEMA_VERSION,
|
|
1208
|
+
...definition,
|
|
1209
|
+
contentHash: expected,
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/** Whether a value is a structurally valid, untampered model artifact (a predicate: never throws). */
|
|
1214
|
+
export function isModelPortfolio(value: unknown): value is ModelPortfolio {
|
|
1215
|
+
try {
|
|
1216
|
+
requireModelPortfolio('isModelPortfolio', 'value', value);
|
|
1217
|
+
return true;
|
|
1218
|
+
} catch {
|
|
1219
|
+
return false;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/** Validate {@link PolicyLimits}. */
|
|
1224
|
+
export function requirePolicyLimits(
|
|
1225
|
+
functionName: string,
|
|
1226
|
+
path: string,
|
|
1227
|
+
value: unknown,
|
|
1228
|
+
): PolicyLimits {
|
|
1229
|
+
requireArgumentObject(functionName, path, value);
|
|
1230
|
+
ensureKnownKeys(functionName, path, value as object, LIMIT_KEYS);
|
|
1231
|
+
const raw = value as Record<string, unknown>;
|
|
1232
|
+
const out: PolicyLimits = {};
|
|
1233
|
+
if (raw['maximumPositionWeight'] !== undefined) {
|
|
1234
|
+
out.maximumPositionWeight = requireNonNegative(
|
|
1235
|
+
functionName,
|
|
1236
|
+
`${path}.maximumPositionWeight`,
|
|
1237
|
+
raw['maximumPositionWeight'],
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
if (raw['maximumGroupWeights'] !== undefined) {
|
|
1241
|
+
requireArgumentArray(functionName, `${path}.maximumGroupWeights`, raw['maximumGroupWeights']);
|
|
1242
|
+
const seen = new Set<string>();
|
|
1243
|
+
out.maximumGroupWeights = (raw['maximumGroupWeights'] as unknown[]).map((entry, index) => {
|
|
1244
|
+
const entryPath = `${path}.maximumGroupWeights[${index}]`;
|
|
1245
|
+
requireArgumentObject(functionName, entryPath, entry);
|
|
1246
|
+
ensureKnownKeys(functionName, entryPath, entry as object, GROUP_LIMIT_KEYS);
|
|
1247
|
+
const limit = entry as Record<string, unknown>;
|
|
1248
|
+
const group = requireTargetGroup(functionName, `${entryPath}.group`, limit['group']);
|
|
1249
|
+
const key = targetGroupKey(group);
|
|
1250
|
+
if (seen.has(key))
|
|
1251
|
+
outOfRange(functionName, entryPath, `${path}.maximumGroupWeights limits '${key}' twice.`);
|
|
1252
|
+
seen.add(key);
|
|
1253
|
+
return {
|
|
1254
|
+
group,
|
|
1255
|
+
maximumWeight: requireNonNegative(
|
|
1256
|
+
functionName,
|
|
1257
|
+
`${entryPath}.maximumWeight`,
|
|
1258
|
+
limit['maximumWeight'],
|
|
1259
|
+
),
|
|
1260
|
+
};
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
if (raw['maximumGrossLeverage'] !== undefined) {
|
|
1264
|
+
requirePositiveNumberField(
|
|
1265
|
+
functionName,
|
|
1266
|
+
`${path}.maximumGrossLeverage`,
|
|
1267
|
+
raw['maximumGrossLeverage'],
|
|
1268
|
+
'gross exposure ÷ NAV (1 = unlevered)',
|
|
1269
|
+
);
|
|
1270
|
+
out.maximumGrossLeverage = raw['maximumGrossLeverage'] as number;
|
|
1271
|
+
}
|
|
1272
|
+
if (raw['maximumDrawdown'] !== undefined) {
|
|
1273
|
+
const v = requireNonNegative(functionName, `${path}.maximumDrawdown`, raw['maximumDrawdown']);
|
|
1274
|
+
if (v > 1)
|
|
1275
|
+
outOfRange(
|
|
1276
|
+
functionName,
|
|
1277
|
+
`${path}.maximumDrawdown`,
|
|
1278
|
+
`${path}.maximumDrawdown is a decimal in [0, 1]. Received ${v}.`,
|
|
1279
|
+
);
|
|
1280
|
+
out.maximumDrawdown = v;
|
|
1281
|
+
}
|
|
1282
|
+
if (raw['maximumDailyLoss'] !== undefined) {
|
|
1283
|
+
const v = requireNonNegative(functionName, `${path}.maximumDailyLoss`, raw['maximumDailyLoss']);
|
|
1284
|
+
if (v > 1)
|
|
1285
|
+
outOfRange(
|
|
1286
|
+
functionName,
|
|
1287
|
+
`${path}.maximumDailyLoss`,
|
|
1288
|
+
`${path}.maximumDailyLoss is a decimal in [0, 1]. Received ${v}.`,
|
|
1289
|
+
);
|
|
1290
|
+
out.maximumDailyLoss = v;
|
|
1291
|
+
}
|
|
1292
|
+
if (raw['maximumDaysToLiquidate'] !== undefined) {
|
|
1293
|
+
requirePositiveNumberField(
|
|
1294
|
+
functionName,
|
|
1295
|
+
`${path}.maximumDaysToLiquidate`,
|
|
1296
|
+
raw['maximumDaysToLiquidate'],
|
|
1297
|
+
'a liquidation horizon in days',
|
|
1298
|
+
);
|
|
1299
|
+
out.maximumDaysToLiquidate = raw['maximumDaysToLiquidate'] as number;
|
|
1300
|
+
}
|
|
1301
|
+
if (raw['minimumSettledCash'] !== undefined) {
|
|
1302
|
+
requireFiniteNumberField(functionName, `${path}.minimumSettledCash`, raw['minimumSettledCash']);
|
|
1303
|
+
out.minimumSettledCash = raw['minimumSettledCash'];
|
|
1304
|
+
}
|
|
1305
|
+
return out;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* Validate an {@link InvestmentPolicy}: closed keys, typed limits, targets inline XOR from a model
|
|
1310
|
+
* artifact (whose hash is re-verified), identity lists without duplicates.
|
|
1311
|
+
*/
|
|
1312
|
+
export function requireInvestmentPolicy(
|
|
1313
|
+
functionName: string,
|
|
1314
|
+
path: string,
|
|
1315
|
+
value: unknown,
|
|
1316
|
+
): InvestmentPolicy {
|
|
1317
|
+
requireArgumentObject(functionName, path, value);
|
|
1318
|
+
ensureKnownKeys(functionName, path, value as object, POLICY_KEYS);
|
|
1319
|
+
const raw = value as Record<string, unknown>;
|
|
1320
|
+
const out: InvestmentPolicy = {};
|
|
1321
|
+
if (raw['targets'] !== undefined && raw['model'] !== undefined) {
|
|
1322
|
+
outOfRange(
|
|
1323
|
+
functionName,
|
|
1324
|
+
path,
|
|
1325
|
+
`${path} declares both targets and model — a policy's goals come from exactly one place.`,
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
if (raw['targets'] !== undefined) {
|
|
1329
|
+
out.targets = requireAllocationTargets(functionName, `${path}.targets`, raw['targets']);
|
|
1330
|
+
}
|
|
1331
|
+
if (raw['model'] !== undefined) {
|
|
1332
|
+
out.model = requireModelPortfolio(functionName, `${path}.model`, raw['model']);
|
|
1333
|
+
}
|
|
1334
|
+
if (raw['withinGroupAllocation'] !== undefined) {
|
|
1335
|
+
out.withinGroupAllocation = requireLiteral(
|
|
1336
|
+
functionName,
|
|
1337
|
+
`${path}.withinGroupAllocation`,
|
|
1338
|
+
raw['withinGroupAllocation'],
|
|
1339
|
+
WITHIN_GROUP_ALLOCATIONS,
|
|
1340
|
+
);
|
|
1341
|
+
}
|
|
1342
|
+
if (raw['driftBand'] !== undefined) {
|
|
1343
|
+
out.driftBand = requireNonNegative(functionName, `${path}.driftBand`, raw['driftBand']);
|
|
1344
|
+
}
|
|
1345
|
+
if (raw['reviewCadenceDays'] !== undefined) {
|
|
1346
|
+
requirePositiveNumberField(
|
|
1347
|
+
functionName,
|
|
1348
|
+
`${path}.reviewCadenceDays`,
|
|
1349
|
+
raw['reviewCadenceDays'],
|
|
1350
|
+
'a review cadence in days',
|
|
1351
|
+
);
|
|
1352
|
+
out.reviewCadenceDays = raw['reviewCadenceDays'] as number;
|
|
1353
|
+
}
|
|
1354
|
+
if (raw['maximumTurnover'] !== undefined) {
|
|
1355
|
+
out.maximumTurnover = requireNonNegative(
|
|
1356
|
+
functionName,
|
|
1357
|
+
`${path}.maximumTurnover`,
|
|
1358
|
+
raw['maximumTurnover'],
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
if (raw['maximumEstimatedTransactionCost'] !== undefined) {
|
|
1362
|
+
out.maximumEstimatedTransactionCost = requireNonNegative(
|
|
1363
|
+
functionName,
|
|
1364
|
+
`${path}.maximumEstimatedTransactionCost`,
|
|
1365
|
+
raw['maximumEstimatedTransactionCost'],
|
|
1366
|
+
);
|
|
1367
|
+
}
|
|
1368
|
+
if (raw['minimumCash'] !== undefined) {
|
|
1369
|
+
requireFiniteNumberField(functionName, `${path}.minimumCash`, raw['minimumCash']);
|
|
1370
|
+
out.minimumCash = raw['minimumCash'];
|
|
1371
|
+
}
|
|
1372
|
+
if (raw['minimumCashWeight'] !== undefined) {
|
|
1373
|
+
const v = requireNonNegative(
|
|
1374
|
+
functionName,
|
|
1375
|
+
`${path}.minimumCashWeight`,
|
|
1376
|
+
raw['minimumCashWeight'],
|
|
1377
|
+
);
|
|
1378
|
+
if (v > 1)
|
|
1379
|
+
outOfRange(
|
|
1380
|
+
functionName,
|
|
1381
|
+
`${path}.minimumCashWeight`,
|
|
1382
|
+
`${path}.minimumCashWeight is a decimal of NAV in [0, 1]. Received ${v}.`,
|
|
1383
|
+
);
|
|
1384
|
+
out.minimumCashWeight = v;
|
|
1385
|
+
}
|
|
1386
|
+
if (raw['limits'] !== undefined) {
|
|
1387
|
+
out.limits = requirePolicyLimits(functionName, `${path}.limits`, raw['limits']);
|
|
1388
|
+
}
|
|
1389
|
+
if (raw['allowedInstruments'] !== undefined) {
|
|
1390
|
+
out.allowedInstruments = requireIdentityList(
|
|
1391
|
+
functionName,
|
|
1392
|
+
`${path}.allowedInstruments`,
|
|
1393
|
+
raw['allowedInstruments'],
|
|
1394
|
+
);
|
|
1395
|
+
}
|
|
1396
|
+
if (raw['restrictedInstruments'] !== undefined) {
|
|
1397
|
+
out.restrictedInstruments = requireIdentityList(
|
|
1398
|
+
functionName,
|
|
1399
|
+
`${path}.restrictedInstruments`,
|
|
1400
|
+
raw['restrictedInstruments'],
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
if (out.allowedInstruments !== undefined && out.restrictedInstruments !== undefined) {
|
|
1404
|
+
const both = out.allowedInstruments.filter((id) => out.restrictedInstruments!.includes(id));
|
|
1405
|
+
if (both.length > 0) {
|
|
1406
|
+
outOfRange(
|
|
1407
|
+
functionName,
|
|
1408
|
+
`${path}.restrictedInstruments`,
|
|
1409
|
+
`${path} both allows and restricts ${both.join(', ')}.`,
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
if (raw['allowedAccounts'] !== undefined) {
|
|
1414
|
+
out.allowedAccounts = requireIdentityList(
|
|
1415
|
+
functionName,
|
|
1416
|
+
`${path}.allowedAccounts`,
|
|
1417
|
+
raw['allowedAccounts'],
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
if (raw['benchmark'] !== undefined) {
|
|
1421
|
+
out.benchmark = requireBenchmark(functionName, `${path}.benchmark`, raw['benchmark']);
|
|
1422
|
+
}
|
|
1423
|
+
if (raw['performanceObjective'] !== undefined) {
|
|
1424
|
+
if (typeof raw['performanceObjective'] !== 'string') {
|
|
1425
|
+
throw new InputError(`${functionName}: ${path}.performanceObjective must be a string.`, {
|
|
1426
|
+
code: ErrorCode.InputWrongType,
|
|
1427
|
+
context: { function: functionName, field: `${path}.performanceObjective` },
|
|
1428
|
+
});
|
|
1429
|
+
}
|
|
1430
|
+
out.performanceObjective = raw['performanceObjective'];
|
|
1431
|
+
}
|
|
1432
|
+
if (raw['contributionHandling'] !== undefined) {
|
|
1433
|
+
out.contributionHandling = requireLiteral(
|
|
1434
|
+
functionName,
|
|
1435
|
+
`${path}.contributionHandling`,
|
|
1436
|
+
raw['contributionHandling'],
|
|
1437
|
+
CONTRIBUTION_HANDLINGS,
|
|
1438
|
+
);
|
|
1439
|
+
}
|
|
1440
|
+
if (raw['withdrawalHandling'] !== undefined) {
|
|
1441
|
+
out.withdrawalHandling = requireLiteral(
|
|
1442
|
+
functionName,
|
|
1443
|
+
`${path}.withdrawalHandling`,
|
|
1444
|
+
raw['withdrawalHandling'],
|
|
1445
|
+
WITHDRAWAL_HANDLINGS,
|
|
1446
|
+
);
|
|
1447
|
+
}
|
|
1448
|
+
if (raw['incomeReinvestment'] !== undefined) {
|
|
1449
|
+
out.incomeReinvestment = requireLiteral(
|
|
1450
|
+
functionName,
|
|
1451
|
+
`${path}.incomeReinvestment`,
|
|
1452
|
+
raw['incomeReinvestment'],
|
|
1453
|
+
INCOME_REINVESTMENTS,
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
if (raw['lotSelectionObjective'] !== undefined) {
|
|
1457
|
+
requireIdentityString(
|
|
1458
|
+
functionName,
|
|
1459
|
+
`${path}.lotSelectionObjective`,
|
|
1460
|
+
raw['lotSelectionObjective'],
|
|
1461
|
+
);
|
|
1462
|
+
out.lotSelectionObjective = raw['lotSelectionObjective'];
|
|
1463
|
+
}
|
|
1464
|
+
return out;
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1468
|
+
// Resolution — which targets are effective at an instant
|
|
1469
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1470
|
+
|
|
1471
|
+
function interpolateTargets(from: TargetSet, to: TargetSet, fraction: number): AllocationTarget[] {
|
|
1472
|
+
const later = new Map(to.targets.map((t) => [targetGroupKey(t.group), t] as const));
|
|
1473
|
+
return from.targets.map((target) => {
|
|
1474
|
+
const next = later.get(targetGroupKey(target.group))!;
|
|
1475
|
+
const out: AllocationTarget = {
|
|
1476
|
+
group: target.group,
|
|
1477
|
+
weight: target.weight! + (next.weight! - target.weight!) * fraction,
|
|
1478
|
+
};
|
|
1479
|
+
const band = next.driftBand ?? target.driftBand;
|
|
1480
|
+
if (band !== undefined) out.driftBand = band;
|
|
1481
|
+
return out;
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/** Input for {@link resolveModelTargets}. */
|
|
1486
|
+
export interface ResolveModelTargetsInput {
|
|
1487
|
+
model: ModelPortfolio;
|
|
1488
|
+
/** The instant to resolve at (`'YYYY-MM-DD'`, zoned ISO datetime, or epoch ms). */
|
|
1489
|
+
asOf: EpochMs | string;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
const RESOLVE_KEYS = ['model', 'asOf'] as const;
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* The targets a model makes effective at `asOf`: the latest tactical set covering the instant,
|
|
1496
|
+
* else the glide path (stepped or interpolated), else the strategic set. An instant before the
|
|
1497
|
+
* strategic set is effective is a typed refusal — a model has no targets there.
|
|
1498
|
+
*
|
|
1499
|
+
* @example
|
|
1500
|
+
* ```ts
|
|
1501
|
+
* const effective = resolveModelTargets({ model, asOf: '2026-06-30' });
|
|
1502
|
+
* effective.source; // 'strategic' | 'tactical' | 'glide-path'
|
|
1503
|
+
* ```
|
|
1504
|
+
*/
|
|
1505
|
+
export function resolveModelTargets(input: ResolveModelTargetsInput): ResolvedTargets {
|
|
1506
|
+
const functionName = 'resolveModelTargets';
|
|
1507
|
+
requireArgumentObject(functionName, 'input', input);
|
|
1508
|
+
ensureKnownKeys(functionName, 'input', input as object, RESOLVE_KEYS);
|
|
1509
|
+
if (input.asOf === undefined) {
|
|
1510
|
+
missingField(
|
|
1511
|
+
functionName,
|
|
1512
|
+
'asOf',
|
|
1513
|
+
`asOf is required — a model's targets are dated, so the instant they are resolved at is a goal, not a default.\n e.g. resolveModelTargets({ model, asOf: '2026-06-30' })`,
|
|
1514
|
+
);
|
|
1515
|
+
}
|
|
1516
|
+
const { model, asOf } = input;
|
|
1517
|
+
const validated = requireModelPortfolio(functionName, 'model', model);
|
|
1518
|
+
const instant = requireInstant(functionName, 'asOf', asOf);
|
|
1519
|
+
let winner: { set: TargetSet; from: EpochMs } | null = null;
|
|
1520
|
+
for (const set of validated.tactical ?? []) {
|
|
1521
|
+
const from = resolveAsOf(set.effectiveFrom, functionName);
|
|
1522
|
+
const to =
|
|
1523
|
+
set.effectiveTo === undefined ? Infinity : resolveAsOf(set.effectiveTo, functionName);
|
|
1524
|
+
if (from <= instant && instant < to && (winner === null || from >= winner.from)) {
|
|
1525
|
+
winner = { set, from };
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
if (winner !== null) {
|
|
1529
|
+
return { targets: winner.set.targets, source: 'tactical', effectiveFrom: winner.from };
|
|
1530
|
+
}
|
|
1531
|
+
if (validated.glidePath !== undefined) {
|
|
1532
|
+
const points = validated.glidePath.points.map((set) => ({
|
|
1533
|
+
set,
|
|
1534
|
+
from: resolveAsOf(set.effectiveFrom, functionName),
|
|
1535
|
+
}));
|
|
1536
|
+
let index = -1;
|
|
1537
|
+
for (let i = 0; i < points.length; i++) if (points[i]!.from <= instant) index = i;
|
|
1538
|
+
if (index >= 0) {
|
|
1539
|
+
const current = points[index]!;
|
|
1540
|
+
const next = points[index + 1];
|
|
1541
|
+
if (validated.glidePath.interpolation === 'linear' && next !== undefined) {
|
|
1542
|
+
const fraction = (instant - current.from) / (next.from - current.from);
|
|
1543
|
+
return {
|
|
1544
|
+
targets: interpolateTargets(current.set, next.set, fraction),
|
|
1545
|
+
source: 'glide-path',
|
|
1546
|
+
effectiveFrom: current.from,
|
|
1547
|
+
interpolation: { from: current.from, to: next.from, fraction },
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
return { targets: current.set.targets, source: 'glide-path', effectiveFrom: current.from };
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
const strategicFrom = resolveAsOf(validated.strategic.effectiveFrom, functionName);
|
|
1554
|
+
if (instant < strategicFrom) {
|
|
1555
|
+
outOfRange(
|
|
1556
|
+
functionName,
|
|
1557
|
+
'asOf',
|
|
1558
|
+
`no target set is effective at ${epochMsToUtcDate(instant)} — the strategic set of model '${validated.modelId}' v${validated.version} starts ${epochMsToUtcDate(strategicFrom)}. A model has no goals before its first dated set.`,
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
return {
|
|
1562
|
+
targets: validated.strategic.targets,
|
|
1563
|
+
source: 'strategic',
|
|
1564
|
+
effectiveFrom: strategicFrom,
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/**
|
|
1569
|
+
* The targets a POLICY makes effective at `asOf`: inline targets verbatim, or the model's
|
|
1570
|
+
* resolution. A policy without targets is a typed refusal from the caller that needs them.
|
|
1571
|
+
*/
|
|
1572
|
+
export function resolvePolicyTargets(
|
|
1573
|
+
functionName: string,
|
|
1574
|
+
policy: InvestmentPolicy,
|
|
1575
|
+
asOf: EpochMs | string,
|
|
1576
|
+
): ResolvedTargets {
|
|
1577
|
+
if (policy.targets !== undefined) {
|
|
1578
|
+
return { targets: policy.targets, source: 'inline', effectiveFrom: null };
|
|
1579
|
+
}
|
|
1580
|
+
if (policy.model !== undefined) return resolveModelTargets({ model: policy.model, asOf });
|
|
1581
|
+
throw new InputError(
|
|
1582
|
+
`${functionName}: policy declares no targets — give policy.targets or policy.model (a createModelPortfolio artifact). Missing goals are never defaulted.\n e.g. ${POLICY_EXAMPLE}`,
|
|
1583
|
+
{
|
|
1584
|
+
code: ErrorCode.InputMissingField,
|
|
1585
|
+
context: { function: functionName, field: 'policy.targets' },
|
|
1586
|
+
},
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1591
|
+
// Expansion — group targets to instrument targets
|
|
1592
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1593
|
+
|
|
1594
|
+
/** The classification group keys an instrument belongs to (`'assetClass:equity'`, `'tag:tech'`, …). */
|
|
1595
|
+
export function instrumentGroupKeys(
|
|
1596
|
+
instrumentId: string,
|
|
1597
|
+
classification: InstrumentClassification | undefined,
|
|
1598
|
+
currency: string | undefined,
|
|
1599
|
+
): string[] {
|
|
1600
|
+
const keys = [`instrumentId:${instrumentId}`];
|
|
1601
|
+
if (currency !== undefined) keys.push(`currency:${currency}`);
|
|
1602
|
+
if (classification?.assetClass !== undefined)
|
|
1603
|
+
keys.push(`assetClass:${classification.assetClass}`);
|
|
1604
|
+
if (classification?.underlying !== undefined)
|
|
1605
|
+
keys.push(`underlying:${classification.underlying}`);
|
|
1606
|
+
if (classification?.strategy !== undefined) keys.push(`strategy:${classification.strategy}`);
|
|
1607
|
+
for (const tag of classification?.tags ?? []) keys.push(`tag:${tag}`);
|
|
1608
|
+
return keys;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
/** Leaf instrument weights of a sleeve subtree, each scaled by the path's within-parent weights. */
|
|
1612
|
+
function sleeveLeafWeights(sleeveId: string, sleeves: ModelSleeve[]): Map<string, number> {
|
|
1613
|
+
const out = new Map<string, number>();
|
|
1614
|
+
const sleeve = sleeves.find((s) => s.sleeveId === sleeveId)!;
|
|
1615
|
+
if (sleeve.members !== undefined) {
|
|
1616
|
+
for (const member of sleeve.members) {
|
|
1617
|
+
out.set(member.instrumentId, (out.get(member.instrumentId) ?? 0) + member.weight);
|
|
1618
|
+
}
|
|
1619
|
+
return out;
|
|
1620
|
+
}
|
|
1621
|
+
for (const child of sleeves.filter((s) => s.parentSleeveId === sleeveId)) {
|
|
1622
|
+
for (const [instrumentId, weight] of sleeveLeafWeights(child.sleeveId, sleeves)) {
|
|
1623
|
+
out.set(instrumentId, (out.get(instrumentId) ?? 0) + weight * child.weightWithinParent!);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
return out;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* Expand resolved group targets to per-instrument target weights under the ONE resolution law:
|
|
1631
|
+
*
|
|
1632
|
+
* - `instrumentId` targets bind directly; `sleeveId` targets flow down the sleeve tree;
|
|
1633
|
+
* - classification/currency targets bind to the universe members that carry the group and split
|
|
1634
|
+
* by `withinGroupAllocation` (REQUIRED when a group has more than one member — never guessed);
|
|
1635
|
+
* - an instrument named by two targets is a CONFLICT (both unresolved); a group with no members
|
|
1636
|
+
* is unresolved; a risk-budget target is unresolved (needs a covariance — risk side);
|
|
1637
|
+
* - `{ assetClass: 'cash' }` is the cash target. When the declared weights sum to 1, every
|
|
1638
|
+
* uncovered instrument (and a missing cash target) has an IMPLIED target of 0 and is flagged
|
|
1639
|
+
* `implied`; when they sum to less than 1 the remainder is undeclared and the uncovered
|
|
1640
|
+
* instruments are unresolved — missing goals do not become secret defaults.
|
|
1641
|
+
*/
|
|
1642
|
+
export function expandTargets(functionName: string, input: ExpandTargetsInput): ExpandedTargets {
|
|
1643
|
+
const warnings: string[] = [];
|
|
1644
|
+
const unresolved: UnresolvedTarget[] = [];
|
|
1645
|
+
const groupTargets: GroupTarget[] = [];
|
|
1646
|
+
const perInstrument = new Map<
|
|
1647
|
+
string,
|
|
1648
|
+
{ weight: number; band: number | null; sources: string[] }
|
|
1649
|
+
>();
|
|
1650
|
+
const universe = [...new Set(input.universe)].sort();
|
|
1651
|
+
const universeKeys = new Map(
|
|
1652
|
+
universe.map((id) => [
|
|
1653
|
+
id,
|
|
1654
|
+
new Set(
|
|
1655
|
+
instrumentGroupKeys(
|
|
1656
|
+
id,
|
|
1657
|
+
ownValue(input.instrumentClassification, id),
|
|
1658
|
+
ownValue(input.instrumentCurrency, id),
|
|
1659
|
+
),
|
|
1660
|
+
),
|
|
1661
|
+
]),
|
|
1662
|
+
);
|
|
1663
|
+
let cashTarget: ExpandedTargets['cashTarget'] = null;
|
|
1664
|
+
let declaredWeightTotal = 0;
|
|
1665
|
+
|
|
1666
|
+
const bind = (
|
|
1667
|
+
instrumentId: string,
|
|
1668
|
+
weight: number,
|
|
1669
|
+
band: number | null,
|
|
1670
|
+
source: string,
|
|
1671
|
+
): void => {
|
|
1672
|
+
const existing = perInstrument.get(instrumentId);
|
|
1673
|
+
if (existing === undefined) {
|
|
1674
|
+
perInstrument.set(instrumentId, { weight, band, sources: [source] });
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
existing.weight += weight;
|
|
1678
|
+
existing.sources.push(source);
|
|
1679
|
+
if (band !== null)
|
|
1680
|
+
existing.band = existing.band === null ? band : Math.min(existing.band, band);
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
for (const target of input.targets) {
|
|
1684
|
+
const key = targetGroupKey(target.group);
|
|
1685
|
+
const band = target.driftBand ?? input.defaultDriftBand ?? null;
|
|
1686
|
+
if (target.riskBudget !== undefined) {
|
|
1687
|
+
unresolved.push({
|
|
1688
|
+
key,
|
|
1689
|
+
group: target.group,
|
|
1690
|
+
reason: `risk budget ${target.riskBudget} needs a covariance to become weights — resolve it on the risk side (@insiderfinance/totalfinance/risk) and restate as weight targets.`,
|
|
1691
|
+
});
|
|
1692
|
+
continue;
|
|
1693
|
+
}
|
|
1694
|
+
const weight = target.weight!;
|
|
1695
|
+
declaredWeightTotal += weight;
|
|
1696
|
+
if (isCashTargetGroup(target.group)) {
|
|
1697
|
+
cashTarget = { targetWeight: weight, driftBand: band, implied: false };
|
|
1698
|
+
groupTargets.push({
|
|
1699
|
+
key,
|
|
1700
|
+
group: target.group,
|
|
1701
|
+
targetWeight: weight,
|
|
1702
|
+
driftBand: band,
|
|
1703
|
+
members: [],
|
|
1704
|
+
});
|
|
1705
|
+
continue;
|
|
1706
|
+
}
|
|
1707
|
+
if (target.group.instrumentId !== undefined) {
|
|
1708
|
+
const id = target.group.instrumentId;
|
|
1709
|
+
if (!universeKeys.has(id)) {
|
|
1710
|
+
universe.push(id);
|
|
1711
|
+
universeKeys.set(
|
|
1712
|
+
id,
|
|
1713
|
+
new Set(
|
|
1714
|
+
instrumentGroupKeys(
|
|
1715
|
+
id,
|
|
1716
|
+
ownValue(input.instrumentClassification, id),
|
|
1717
|
+
ownValue(input.instrumentCurrency, id),
|
|
1718
|
+
),
|
|
1719
|
+
),
|
|
1720
|
+
);
|
|
1721
|
+
}
|
|
1722
|
+
bind(id, weight, band, key);
|
|
1723
|
+
groupTargets.push({
|
|
1724
|
+
key,
|
|
1725
|
+
group: target.group,
|
|
1726
|
+
targetWeight: weight,
|
|
1727
|
+
driftBand: band,
|
|
1728
|
+
members: [id],
|
|
1729
|
+
});
|
|
1730
|
+
continue;
|
|
1731
|
+
}
|
|
1732
|
+
if (target.group.sleeveId !== undefined) {
|
|
1733
|
+
const leaves = sleeveLeafWeights(target.group.sleeveId, input.sleeves);
|
|
1734
|
+
const members = [...leaves.keys()].sort();
|
|
1735
|
+
for (const id of members) {
|
|
1736
|
+
if (!universeKeys.has(id)) {
|
|
1737
|
+
universe.push(id);
|
|
1738
|
+
universeKeys.set(
|
|
1739
|
+
id,
|
|
1740
|
+
new Set(
|
|
1741
|
+
instrumentGroupKeys(
|
|
1742
|
+
id,
|
|
1743
|
+
ownValue(input.instrumentClassification, id),
|
|
1744
|
+
ownValue(input.instrumentCurrency, id),
|
|
1745
|
+
),
|
|
1746
|
+
),
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
bind(id, weight * leaves.get(id)!, band, key);
|
|
1750
|
+
}
|
|
1751
|
+
groupTargets.push({
|
|
1752
|
+
key,
|
|
1753
|
+
group: target.group,
|
|
1754
|
+
targetWeight: weight,
|
|
1755
|
+
driftBand: band,
|
|
1756
|
+
members,
|
|
1757
|
+
});
|
|
1758
|
+
continue;
|
|
1759
|
+
}
|
|
1760
|
+
// Classification / currency dimension.
|
|
1761
|
+
const members = universe.filter((id) => universeKeys.get(id)!.has(key)).sort();
|
|
1762
|
+
if (members.length === 0) {
|
|
1763
|
+
unresolved.push({
|
|
1764
|
+
key,
|
|
1765
|
+
group: target.group,
|
|
1766
|
+
reason: `no instrument in the universe carries '${key}' — declare the group's members through instrumentClassification (or a sleeve), or add an instrumentId target.`,
|
|
1767
|
+
});
|
|
1768
|
+
groupTargets.push({
|
|
1769
|
+
key,
|
|
1770
|
+
group: target.group,
|
|
1771
|
+
targetWeight: weight,
|
|
1772
|
+
driftBand: band,
|
|
1773
|
+
members: [],
|
|
1774
|
+
});
|
|
1775
|
+
continue;
|
|
1776
|
+
}
|
|
1777
|
+
if (members.length === 1) {
|
|
1778
|
+
bind(members[0]!, weight, band, key);
|
|
1779
|
+
} else if (input.withinGroupAllocation === undefined) {
|
|
1780
|
+
unresolved.push({
|
|
1781
|
+
key,
|
|
1782
|
+
group: target.group,
|
|
1783
|
+
reason: `'${key}' resolves to ${members.length} instruments (${members.join(', ')}) and the policy declares no withinGroupAllocation ('proportional-to-current' or 'equal') — how a group target splits is a goal, not a default.`,
|
|
1784
|
+
});
|
|
1785
|
+
groupTargets.push({
|
|
1786
|
+
key,
|
|
1787
|
+
group: target.group,
|
|
1788
|
+
targetWeight: weight,
|
|
1789
|
+
driftBand: band,
|
|
1790
|
+
members,
|
|
1791
|
+
});
|
|
1792
|
+
continue;
|
|
1793
|
+
} else {
|
|
1794
|
+
const current = members.map((id) => Math.abs(ownValue(input.currentWeights, id) ?? 0));
|
|
1795
|
+
const currentTotal = sum(current);
|
|
1796
|
+
const equal = input.withinGroupAllocation === 'equal' || currentTotal <= WEIGHT_TOLERANCE;
|
|
1797
|
+
if (
|
|
1798
|
+
input.withinGroupAllocation === 'proportional-to-current' &&
|
|
1799
|
+
currentTotal <= WEIGHT_TOLERANCE
|
|
1800
|
+
) {
|
|
1801
|
+
warnings.push(
|
|
1802
|
+
`'${key}' has no current holdings to split proportionally; its ${members.length} members are split equally.`,
|
|
1803
|
+
);
|
|
1804
|
+
}
|
|
1805
|
+
members.forEach((id, index) => {
|
|
1806
|
+
const share = equal ? 1 / members.length : current[index]! / currentTotal;
|
|
1807
|
+
bind(id, weight * share, band, key);
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
groupTargets.push({ key, group: target.group, targetWeight: weight, driftBand: band, members });
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
// Conflicts: an instrument bound by two different targets is two goals for one holding.
|
|
1814
|
+
const conflicted = new Set<string>();
|
|
1815
|
+
for (const [id, entry] of perInstrument) {
|
|
1816
|
+
if (entry.sources.length > 1) {
|
|
1817
|
+
conflicted.add(id);
|
|
1818
|
+
for (const source of entry.sources) {
|
|
1819
|
+
if (!unresolved.some((u) => u.key === source)) {
|
|
1820
|
+
const group = groupTargets.find((g) => g.key === source)!.group;
|
|
1821
|
+
unresolved.push({
|
|
1822
|
+
key: source,
|
|
1823
|
+
group,
|
|
1824
|
+
reason: `'${id}' is targeted by ${entry.sources.join(' and ')} — overlapping targets on one instrument conflict; restate them on one dimension.`,
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
perInstrument.delete(id);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
const covered = new Set(perInstrument.keys());
|
|
1833
|
+
const fullyDeclared = Math.abs(declaredWeightTotal - 1) <= WEIGHT_TOLERANCE;
|
|
1834
|
+
const instrumentTargets: InstrumentTarget[] = [];
|
|
1835
|
+
for (const id of universe) {
|
|
1836
|
+
const entry = perInstrument.get(id);
|
|
1837
|
+
if (entry !== undefined) {
|
|
1838
|
+
instrumentTargets.push({
|
|
1839
|
+
instrumentId: id,
|
|
1840
|
+
targetWeight: entry.weight,
|
|
1841
|
+
driftBand: entry.band,
|
|
1842
|
+
sourceGroups: entry.sources,
|
|
1843
|
+
implied: false,
|
|
1844
|
+
});
|
|
1845
|
+
continue;
|
|
1846
|
+
}
|
|
1847
|
+
if (covered.has(id) || conflicted.has(id)) continue;
|
|
1848
|
+
if (fullyDeclared) {
|
|
1849
|
+
instrumentTargets.push({
|
|
1850
|
+
instrumentId: id,
|
|
1851
|
+
targetWeight: 0,
|
|
1852
|
+
driftBand: input.defaultDriftBand ?? null,
|
|
1853
|
+
sourceGroups: [],
|
|
1854
|
+
implied: true,
|
|
1855
|
+
});
|
|
1856
|
+
} else if (!unresolved.some((u) => u.key === `instrumentId:${id}`)) {
|
|
1857
|
+
unresolved.push({
|
|
1858
|
+
key: `instrumentId:${id}`,
|
|
1859
|
+
group: { instrumentId: id },
|
|
1860
|
+
reason: `'${id}' is covered by no target and the declared targets sum to ${readable(declaredWeightTotal)} of NAV, not 1 — declare the remaining ${readable(1 - declaredWeightTotal)} (a cash target, or targets naming this holding).`,
|
|
1861
|
+
});
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
if (cashTarget === null && fullyDeclared) {
|
|
1865
|
+
cashTarget = { targetWeight: 0, driftBand: input.defaultDriftBand ?? null, implied: true };
|
|
1866
|
+
} else if (
|
|
1867
|
+
cashTarget === null &&
|
|
1868
|
+
declaredWeightTotal < 1 - WEIGHT_TOLERANCE &&
|
|
1869
|
+
universe.every((id) => perInstrument.has(id))
|
|
1870
|
+
) {
|
|
1871
|
+
unresolved.push({
|
|
1872
|
+
key: `assetClass:${CASH_ASSET_CLASS}`,
|
|
1873
|
+
group: { assetClass: CASH_ASSET_CLASS },
|
|
1874
|
+
reason: `the declared targets sum to ${readable(declaredWeightTotal)} of NAV and there is no cash target — declare { assetClass: 'cash' } for the remaining ${readable(1 - declaredWeightTotal)}, or targets that use it.`,
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
if (declaredWeightTotal > 1 + WEIGHT_TOLERANCE) {
|
|
1878
|
+
unresolved.push({
|
|
1879
|
+
key: 'targets',
|
|
1880
|
+
group: { assetClass: CASH_ASSET_CLASS },
|
|
1881
|
+
reason: `the declared targets sum to ${readable(declaredWeightTotal)} of NAV across dimensions — more than the whole portfolio; overlapping dimensions must not double-count.`,
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
instrumentTargets.sort((a, b) =>
|
|
1885
|
+
a.instrumentId < b.instrumentId ? -1 : a.instrumentId > b.instrumentId ? 1 : 0,
|
|
1886
|
+
);
|
|
1887
|
+
return { instrumentTargets, groupTargets, cashTarget, declaredWeightTotal, unresolved, warnings };
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/** The policy grammar's conventions, echoed by every consumer. */
|
|
1891
|
+
export const POLICY_CONVENTIONS_VERSION = CONVENTIONS_VERSION;
|