@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,1608 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `crossSectionalBacktest` (Stage 4.6, FC8 Decision 4) — the loop, and only the loop.
|
|
3
|
+
*
|
|
4
|
+
* At every rebalance session: universe membership and exits (research), eligibility (research),
|
|
5
|
+
* the signal (a research verb or the caller's callback), selection and weights (here, from the
|
|
6
|
+
* research quantiles), weights → quantities (the portfolio allocator), orders → fills (the
|
|
7
|
+
* execution policy's fill model), fills → events (the portfolio bridge), events → state (the FC7
|
|
8
|
+
* reducer). Between rebalances every session marks the ledger. At the end the timeline, the P&L,
|
|
9
|
+
* and the performance summary are the portfolio and performance packages' own numbers, and the
|
|
10
|
+
* reported final value must equal the ledger's NAV or the run refuses.
|
|
11
|
+
*
|
|
12
|
+
* Prices are return-index levels (base 100 at each instrument's first session in the dataset):
|
|
13
|
+
* the dataset is returns, as research vocabulary is, and the assumptions say so. Session instants
|
|
14
|
+
* are a stated convention (14:30 UTC open, 21:00 UTC close) so availability instants compare.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
CONVENTIONS_VERSION,
|
|
19
|
+
ErrorCode,
|
|
20
|
+
InputError,
|
|
21
|
+
isoDateToEpochMs,
|
|
22
|
+
type EpochMs,
|
|
23
|
+
type QuantWarning,
|
|
24
|
+
warning,
|
|
25
|
+
WarningCode,
|
|
26
|
+
} from '@totalfinance/core';
|
|
27
|
+
import { contentHash, createMarketSnapshot } from '@totalfinance/core/artifacts';
|
|
28
|
+
import { analyze } from '@totalfinance/performance';
|
|
29
|
+
import {
|
|
30
|
+
type PortfolioEventEnvelope,
|
|
31
|
+
type PortfolioState,
|
|
32
|
+
type PortfolioValuationMark,
|
|
33
|
+
PORTFOLIO_EVENT_SCHEMA_VERSION,
|
|
34
|
+
allocatePortfolio,
|
|
35
|
+
applyPortfolioEvents,
|
|
36
|
+
createPortfolioLedger,
|
|
37
|
+
portfolioEventsFromFill,
|
|
38
|
+
portfolioSnapshot,
|
|
39
|
+
portfolioTimeline,
|
|
40
|
+
type NormalizedFill,
|
|
41
|
+
} from '@totalfinance/portfolio';
|
|
42
|
+
import {
|
|
43
|
+
type FactorEntry,
|
|
44
|
+
type FactorRecipe,
|
|
45
|
+
type FieldDefinition,
|
|
46
|
+
type UniverseObservation,
|
|
47
|
+
compositeFactorScore,
|
|
48
|
+
eligibleObservationsAt,
|
|
49
|
+
factorSpreadReturn,
|
|
50
|
+
formQuantilePortfolios,
|
|
51
|
+
informationCoefficient,
|
|
52
|
+
neutralizeFactor,
|
|
53
|
+
screenUniverse,
|
|
54
|
+
scoreUniverse,
|
|
55
|
+
standardizeFactor,
|
|
56
|
+
universeMembershipAt,
|
|
57
|
+
winsorizeFactor,
|
|
58
|
+
} from '@totalfinance/research';
|
|
59
|
+
import { covariance, riskParity } from '@totalfinance/risk';
|
|
60
|
+
import { type CostModel, type SlippageModel } from '../costs.js';
|
|
61
|
+
import { describeExecutionPolicy, execution as executionPolicies } from '../execution/policy.js';
|
|
62
|
+
import { normalizedFillFromDecision } from '../execution/normalized.js';
|
|
63
|
+
import type { ExecutionPolicy, OrderIntent } from '../execution/types.js';
|
|
64
|
+
import { monteCarloResample } from '../tearsheet.js';
|
|
65
|
+
import type { EquityPoint, Trade } from '../types.js';
|
|
66
|
+
import { equityToReturns } from '../vectorized.js';
|
|
67
|
+
import type {
|
|
68
|
+
AttributionRow,
|
|
69
|
+
BenchmarkComparison,
|
|
70
|
+
CrossSectionalAssumptions,
|
|
71
|
+
CrossSectionalBacktestRequest,
|
|
72
|
+
CrossSectionalBacktestResult,
|
|
73
|
+
CrossSectionalDiagnostics,
|
|
74
|
+
HoldingRow,
|
|
75
|
+
RebalanceGoal,
|
|
76
|
+
RebalanceRow,
|
|
77
|
+
SignalRow,
|
|
78
|
+
} from './types.js';
|
|
79
|
+
import { requireCrossSectionalBacktestRequest } from './validate.js';
|
|
80
|
+
|
|
81
|
+
// ---------------------------------------------------------------------------------------------------
|
|
82
|
+
// Constants and small helpers
|
|
83
|
+
// ---------------------------------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
const FUNCTION_NAME = 'crossSectionalBacktest';
|
|
86
|
+
const ACCOUNT_ID = 'main';
|
|
87
|
+
const OPEN_UTC_HOUR = 14.5;
|
|
88
|
+
const CLOSE_UTC_HOUR = 21;
|
|
89
|
+
const SESSION_INSTANT_CONVENTION =
|
|
90
|
+
'session instants are the session date at 14:30 UTC (open) or 21:00 UTC (close); availability and universe instants compare against them; each session is marked at 00:00 UTC of the following calendar day (the ledger values a mark dated D strictly before 00:00 UTC of D), so a mark holds every fill of its session';
|
|
91
|
+
const PRICING_CONVENTION =
|
|
92
|
+
'return-index levels: each instrument starts at 100 on its first session in the dataset and compounds its simple returns; quantities are index units';
|
|
93
|
+
const SHORT_BOOK_SIZING =
|
|
94
|
+
'the short book is sized by the same allocator with negative target weights (rounded toward zero to the lot size)';
|
|
95
|
+
const DECAY_HORIZONS = [1, 2, 3, 4] as const;
|
|
96
|
+
const DEFAULT_LOOKBACK = 63;
|
|
97
|
+
const RECONCILIATION_TOLERANCE = 1e-9;
|
|
98
|
+
const WINSOR_PERCENTILES = { lowerPercentile: 1, upperPercentile: 99 } as const;
|
|
99
|
+
|
|
100
|
+
const compareIds = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);
|
|
101
|
+
|
|
102
|
+
/** The engine's session-instant convention — shared with the out-of-sample verbs so a window cuts where the engine does. */
|
|
103
|
+
export function sessionInstant(date: string, session: 'open' | 'close'): EpochMs {
|
|
104
|
+
return isoDateToEpochMs(date) + (session === 'open' ? OPEN_UTC_HOUR : CLOSE_UTC_HOUR) * 3_600_000;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isoWeek(date: string): string {
|
|
108
|
+
const d = new Date(isoDateToEpochMs(date));
|
|
109
|
+
const day = (d.getUTCDay() + 6) % 7; // Monday = 0
|
|
110
|
+
d.setUTCDate(d.getUTCDate() - day + 3); // Thursday of this week decides the ISO year
|
|
111
|
+
const isoYear = d.getUTCFullYear();
|
|
112
|
+
const firstThursday = new Date(Date.UTC(isoYear, 0, 4));
|
|
113
|
+
const week =
|
|
114
|
+
1 +
|
|
115
|
+
Math.round(
|
|
116
|
+
((d.getTime() - firstThursday.getTime()) / 86_400_000 -
|
|
117
|
+
3 +
|
|
118
|
+
((firstThursday.getUTCDay() + 6) % 7)) /
|
|
119
|
+
7,
|
|
120
|
+
);
|
|
121
|
+
return `${isoYear}-W${week}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function periodKey(date: string, frequency: 'daily' | 'weekly' | 'monthly' | 'quarterly'): string {
|
|
125
|
+
switch (frequency) {
|
|
126
|
+
case 'daily':
|
|
127
|
+
return date;
|
|
128
|
+
case 'weekly':
|
|
129
|
+
return isoWeek(date);
|
|
130
|
+
case 'monthly':
|
|
131
|
+
return date.slice(0, 7);
|
|
132
|
+
case 'quarterly':
|
|
133
|
+
return `${date.slice(0, 4)}-Q${Math.floor((Number(date.slice(5, 7)) - 1) / 3) + 1}`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function mean(values: readonly number[]): number | null {
|
|
138
|
+
if (values.length === 0) return null;
|
|
139
|
+
return values.reduce((s, v) => s + v, 0) / values.length;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function sampleStandardDeviation(values: readonly number[]): number | null {
|
|
143
|
+
if (values.length < 2) return null;
|
|
144
|
+
const m = mean(values) as number;
|
|
145
|
+
const variance = values.reduce((s, v) => s + (v - m) ** 2, 0) / (values.length - 1);
|
|
146
|
+
return Math.sqrt(variance);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
interface SessionIndex {
|
|
150
|
+
dates: string[];
|
|
151
|
+
instants: EpochMs[];
|
|
152
|
+
/** The mark for each session: the following calendar day (YYYY-MM-DD) and its 00:00 UTC instant. */
|
|
153
|
+
markDates: string[];
|
|
154
|
+
markInstants: EpochMs[];
|
|
155
|
+
position: Map<string, number>;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function nextCalendarDate(date: string): string {
|
|
159
|
+
return new Date(isoDateToEpochMs(date) + 86_400_000).toISOString().slice(0, 10);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// ---------------------------------------------------------------------------------------------------
|
|
163
|
+
// The engine
|
|
164
|
+
// ---------------------------------------------------------------------------------------------------
|
|
165
|
+
|
|
166
|
+
export function crossSectionalBacktest(
|
|
167
|
+
request: CrossSectionalBacktestRequest,
|
|
168
|
+
): CrossSectionalBacktestResult {
|
|
169
|
+
const definitions = requireCrossSectionalBacktestRequest(FUNCTION_NAME, 'request', request);
|
|
170
|
+
const { dataset, universeHistory, signal, rebalanceSchedule, portfolioConstruction } = request;
|
|
171
|
+
const policy: ExecutionPolicy = request.execution ?? executionPolicies.simplified();
|
|
172
|
+
const commission: CostModel = request.transactionCostModel?.commission ?? policy.costs.commission;
|
|
173
|
+
const slippage: SlippageModel = request.transactionCostModel?.slippage ?? policy.costs.slippage;
|
|
174
|
+
const initialCapital = request.initialCapital ?? 1_000_000;
|
|
175
|
+
const baseCurrency = request.baseCurrency ?? 'USD';
|
|
176
|
+
const periodsPerYear = request.periodsPerYear ?? 252;
|
|
177
|
+
const riskFreeRate = request.riskFreeRate ?? 0;
|
|
178
|
+
const lookback = portfolioConstruction.volatilityLookbackSessions ?? DEFAULT_LOOKBACK;
|
|
179
|
+
const warnings: QuantWarning[] = [];
|
|
180
|
+
|
|
181
|
+
// ---- sessions and the return index ------------------------------------------------------------
|
|
182
|
+
const allDates = [...new Set(dataset.returns.map((r) => r.tradingSessionDate))].sort();
|
|
183
|
+
const from = request.window?.fromTimestampMs;
|
|
184
|
+
const to = request.window?.toTimestampMs;
|
|
185
|
+
const dates = allDates.filter((date) => {
|
|
186
|
+
const instant = sessionInstant(date, rebalanceSchedule.session);
|
|
187
|
+
return (from === undefined || instant >= from) && (to === undefined || instant <= to);
|
|
188
|
+
});
|
|
189
|
+
if (dates.length < 2) {
|
|
190
|
+
throw new InputError(
|
|
191
|
+
`${FUNCTION_NAME}: the dataset carries ${dates.length} session${dates.length === 1 ? '' : 's'} inside the window; a run needs at least two.`,
|
|
192
|
+
{
|
|
193
|
+
code: ErrorCode.InputOutOfRange,
|
|
194
|
+
context: { function: FUNCTION_NAME, field: 'dataset.returns' },
|
|
195
|
+
},
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
const sessions: SessionIndex = {
|
|
199
|
+
dates,
|
|
200
|
+
instants: dates.map((date) => sessionInstant(date, rebalanceSchedule.session)),
|
|
201
|
+
markDates: dates.map(nextCalendarDate),
|
|
202
|
+
markInstants: dates.map((date) => isoDateToEpochMs(nextCalendarDate(date))),
|
|
203
|
+
position: new Map(dates.map((date, index) => [date, index])),
|
|
204
|
+
};
|
|
205
|
+
const returnsByInstrument = new Map<string, Map<string, number>>();
|
|
206
|
+
for (const row of dataset.returns) {
|
|
207
|
+
let byDate = returnsByInstrument.get(row.instrumentId);
|
|
208
|
+
if (byDate === undefined) {
|
|
209
|
+
byDate = new Map();
|
|
210
|
+
returnsByInstrument.set(row.instrumentId, byDate);
|
|
211
|
+
}
|
|
212
|
+
if (byDate.has(row.tradingSessionDate)) {
|
|
213
|
+
throw new InputError(
|
|
214
|
+
`${FUNCTION_NAME}: dataset.returns carries two rows for '${row.instrumentId}' on ${row.tradingSessionDate} — one return per instrument per session.`,
|
|
215
|
+
{
|
|
216
|
+
code: ErrorCode.InputOutOfRange,
|
|
217
|
+
context: { function: FUNCTION_NAME, field: 'dataset.returns' },
|
|
218
|
+
},
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
byDate.set(row.tradingSessionDate, row.simpleReturn);
|
|
222
|
+
}
|
|
223
|
+
const knownInstruments = new Set(universeHistory.members.map((m) => m.instrumentId));
|
|
224
|
+
for (const instrumentId of returnsByInstrument.keys()) {
|
|
225
|
+
if (!knownInstruments.has(instrumentId)) {
|
|
226
|
+
throw new InputError(
|
|
227
|
+
`${FUNCTION_NAME}: dataset.returns names '${instrumentId}', which the universe history never lists — every instrument in the dataset belongs to a membership interval (add it to universeHistory.members, or drop its rows).`,
|
|
228
|
+
{
|
|
229
|
+
code: ErrorCode.BacktestUniverseMembershipUnknown,
|
|
230
|
+
context: { function: FUNCTION_NAME, instrumentId },
|
|
231
|
+
},
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
// price level per instrument per session index (base 100 at the first session in the dataset)
|
|
236
|
+
const levels = new Map<string, Float64Array>();
|
|
237
|
+
const returnsBySession = new Map<string, Float64Array>();
|
|
238
|
+
for (const [instrumentId, byDate] of returnsByInstrument) {
|
|
239
|
+
const level = new Float64Array(sessions.dates.length);
|
|
240
|
+
const perSession = new Float64Array(sessions.dates.length).fill(Number.NaN);
|
|
241
|
+
let current = Number.NaN;
|
|
242
|
+
sessions.dates.forEach((date, index) => {
|
|
243
|
+
const r = byDate.get(date);
|
|
244
|
+
if (r !== undefined) {
|
|
245
|
+
perSession[index] = r;
|
|
246
|
+
current = Number.isNaN(current) ? 100 : current * (1 + r);
|
|
247
|
+
}
|
|
248
|
+
level[index] = current;
|
|
249
|
+
});
|
|
250
|
+
levels.set(instrumentId, level);
|
|
251
|
+
returnsBySession.set(instrumentId, perSession);
|
|
252
|
+
}
|
|
253
|
+
const priceAt = (instrumentId: string, index: number): number | null => {
|
|
254
|
+
const level = levels.get(instrumentId);
|
|
255
|
+
if (level === undefined) return null;
|
|
256
|
+
const value =
|
|
257
|
+
rebalanceSchedule.session === 'open'
|
|
258
|
+
? index > 0
|
|
259
|
+
? level[index - 1]!
|
|
260
|
+
: Number.NaN
|
|
261
|
+
: level[index]!;
|
|
262
|
+
return Number.isFinite(value) ? value : null;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// ---- schedule ----------------------------------------------------------------------------------
|
|
266
|
+
const rebalanceIndices: number[] = [];
|
|
267
|
+
let previousKey: string | null = null;
|
|
268
|
+
sessions.dates.forEach((date, index) => {
|
|
269
|
+
const key = periodKey(date, rebalanceSchedule.frequency);
|
|
270
|
+
if (key !== previousKey) rebalanceIndices.push(index);
|
|
271
|
+
previousKey = key;
|
|
272
|
+
});
|
|
273
|
+
const isRebalance = new Set(rebalanceIndices);
|
|
274
|
+
|
|
275
|
+
// ---- identity ----------------------------------------------------------------------------------
|
|
276
|
+
const signalIdentity: CrossSectionalAssumptions['signal'] =
|
|
277
|
+
'factorRecipe' in signal
|
|
278
|
+
? {
|
|
279
|
+
kind: 'factor-recipe',
|
|
280
|
+
recipeName: signal.factorRecipe.recipeName,
|
|
281
|
+
recipeVersion: signal.factorRecipe.recipeVersion,
|
|
282
|
+
direction: signal.factorRecipe.direction,
|
|
283
|
+
lagTradingSessions: signal.factorRecipe.lagTradingSessions,
|
|
284
|
+
neutralization: signal.factorRecipe.neutralization,
|
|
285
|
+
}
|
|
286
|
+
: 'score' in signal
|
|
287
|
+
? {
|
|
288
|
+
kind: 'score',
|
|
289
|
+
components: signal.score.components.length,
|
|
290
|
+
missingValuePolicy: signal.score.missingValuePolicy,
|
|
291
|
+
}
|
|
292
|
+
: 'screen' in signal
|
|
293
|
+
? {
|
|
294
|
+
kind: 'screen',
|
|
295
|
+
orderBy: signal.screen.orderBy.map((k) => `${k.field} ${k.direction}`),
|
|
296
|
+
missingValuePolicy: signal.screen.missingValuePolicy,
|
|
297
|
+
}
|
|
298
|
+
: { kind: 'callback', replayable: false };
|
|
299
|
+
const replayable = !('callback' in signal) && portfolioConstruction.method !== 'supplied-weights';
|
|
300
|
+
const runId = contentHash({
|
|
301
|
+
universeId: universeHistory.universeId,
|
|
302
|
+
// Assumptions are a readable summary, not an identity: a component count cannot distinguish
|
|
303
|
+
// opposite rankings or changed thresholds. Hash the complete declarative signal.
|
|
304
|
+
signal: 'callback' in signal ? { kind: 'callback', replayable: false } : signal,
|
|
305
|
+
rebalanceSchedule,
|
|
306
|
+
portfolioConstruction: {
|
|
307
|
+
...portfolioConstruction,
|
|
308
|
+
suppliedWeights: portfolioConstruction.suppliedWeights !== undefined ? 'callback' : undefined,
|
|
309
|
+
},
|
|
310
|
+
initialCapital,
|
|
311
|
+
baseCurrency,
|
|
312
|
+
sessions: [sessions.dates[0], sessions.dates[sessions.dates.length - 1], sessions.dates.length],
|
|
313
|
+
execution: {
|
|
314
|
+
...describeExecutionPolicy(policy),
|
|
315
|
+
sessions: policy.sessions ?? null,
|
|
316
|
+
borrow: policy.costs.borrow ?? null,
|
|
317
|
+
},
|
|
318
|
+
transactionCosts: { commission: commission.label, slippage: slippage.label },
|
|
319
|
+
periodsPerYear,
|
|
320
|
+
riskFreeRate: request.riskFreeRate ?? 0,
|
|
321
|
+
seed: request.seed ?? null,
|
|
322
|
+
});
|
|
323
|
+
const sourceId = `backtest:cross-sectional:${runId}`;
|
|
324
|
+
|
|
325
|
+
// ---- state ---------------------------------------------------------------------------------------
|
|
326
|
+
const events: PortfolioEventEnvelope[] = [];
|
|
327
|
+
const fills: NormalizedFill[] = [];
|
|
328
|
+
const trades: Trade[] = [];
|
|
329
|
+
const marks: PortfolioValuationMark[] = [];
|
|
330
|
+
const rebalances: RebalanceRow[] = [];
|
|
331
|
+
const holdings: HoldingRow[] = [];
|
|
332
|
+
const attributionInputs: Array<{
|
|
333
|
+
rebalanceIndex: number;
|
|
334
|
+
sessionIndex: number;
|
|
335
|
+
sessionDate: string;
|
|
336
|
+
scores: SignalRow[];
|
|
337
|
+
selection: Set<string>;
|
|
338
|
+
eligibleCount: number;
|
|
339
|
+
memberCount: number;
|
|
340
|
+
}> = [];
|
|
341
|
+
let state: PortfolioState | undefined;
|
|
342
|
+
let fillSequence = 0;
|
|
343
|
+
let rejectedFills = 0;
|
|
344
|
+
let exitCount = 0;
|
|
345
|
+
let delistingCount = 0;
|
|
346
|
+
let previousRebalanceInstant: EpochMs | undefined;
|
|
347
|
+
let previousSelection = new Set<string>();
|
|
348
|
+
|
|
349
|
+
const fold = (batch: PortfolioEventEnvelope[]): void => {
|
|
350
|
+
if (batch.length === 0) return;
|
|
351
|
+
state = applyPortfolioEvents({
|
|
352
|
+
...(state === undefined ? { portfolio: { baseCurrency } } : { previousState: state }),
|
|
353
|
+
events: batch,
|
|
354
|
+
});
|
|
355
|
+
events.push(...batch);
|
|
356
|
+
};
|
|
357
|
+
const heldQuantities = (): Map<string, number> => {
|
|
358
|
+
const out = new Map<string, number>();
|
|
359
|
+
const positions = state?.accounts[ACCOUNT_ID]?.positions ?? {};
|
|
360
|
+
for (const [instrumentId, position] of Object.entries(positions)) {
|
|
361
|
+
if (position.quantity !== 0) out.set(instrumentId, position.quantity);
|
|
362
|
+
}
|
|
363
|
+
return out;
|
|
364
|
+
};
|
|
365
|
+
const marketAt = (index: number): ReturnType<typeof createMarketSnapshot> => {
|
|
366
|
+
const spots: Record<string, { price: number; currency: string }> = {};
|
|
367
|
+
for (const instrumentId of levels.keys()) {
|
|
368
|
+
const price = priceAt(instrumentId, index);
|
|
369
|
+
if (price !== null) spots[instrumentId] = { price, currency: baseCurrency };
|
|
370
|
+
}
|
|
371
|
+
return createMarketSnapshot({ asOf: sessions.markInstants[index]!, observations: { spots } });
|
|
372
|
+
};
|
|
373
|
+
const netAssetValueAt = (index: number): number =>
|
|
374
|
+
portfolioSnapshot({
|
|
375
|
+
portfolio: state as PortfolioState,
|
|
376
|
+
asOf: sessions.markInstants[index]!,
|
|
377
|
+
market: marketAt(index),
|
|
378
|
+
}).netAssetValue;
|
|
379
|
+
|
|
380
|
+
// The opening deposit at the first session.
|
|
381
|
+
fold([
|
|
382
|
+
{
|
|
383
|
+
eventId: `${runId}:deposit`,
|
|
384
|
+
schemaVersion: PORTFOLIO_EVENT_SCHEMA_VERSION,
|
|
385
|
+
eventType: 'cash.deposit',
|
|
386
|
+
sourceId,
|
|
387
|
+
accountId: ACCOUNT_ID,
|
|
388
|
+
effectiveTimestampMs: sessions.instants[0]!,
|
|
389
|
+
recordedTimestampMs: sessions.instants[0]!,
|
|
390
|
+
event: { eventType: 'cash.deposit', amount: initialCapital, currency: baseCurrency },
|
|
391
|
+
provenance: {},
|
|
392
|
+
},
|
|
393
|
+
]);
|
|
394
|
+
|
|
395
|
+
/** Fill one signed trade at a session through the policy's fill model; returns the fill or null. */
|
|
396
|
+
const executeTrade = (trade: {
|
|
397
|
+
index: number;
|
|
398
|
+
instrumentId: string;
|
|
399
|
+
side: 'buy' | 'sell';
|
|
400
|
+
quantity: number;
|
|
401
|
+
referencePrice: number;
|
|
402
|
+
goals: RebalanceGoal[];
|
|
403
|
+
}): NormalizedFill | null => {
|
|
404
|
+
const { index, instrumentId, side, quantity, referencePrice, goals } = trade;
|
|
405
|
+
const asOf = sessions.instants[index]!;
|
|
406
|
+
const order: OrderIntent = {
|
|
407
|
+
orderId: `${runId}:${index}:${instrumentId}`,
|
|
408
|
+
instrumentId,
|
|
409
|
+
side,
|
|
410
|
+
quantity,
|
|
411
|
+
type: 'market',
|
|
412
|
+
submittedTimestampMs: asOf,
|
|
413
|
+
};
|
|
414
|
+
const volume = dataset.averageDailyVolumes?.[instrumentId];
|
|
415
|
+
const decision = policy.fill.fill({
|
|
416
|
+
order,
|
|
417
|
+
observation: {
|
|
418
|
+
kind: 'bar',
|
|
419
|
+
bar: {
|
|
420
|
+
symbol: instrumentId,
|
|
421
|
+
timestampMs: asOf,
|
|
422
|
+
open: referencePrice,
|
|
423
|
+
high: referencePrice,
|
|
424
|
+
low: referencePrice,
|
|
425
|
+
close: referencePrice,
|
|
426
|
+
...(volume !== undefined ? { volume } : {}),
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
context: {
|
|
430
|
+
asOf,
|
|
431
|
+
...(policy.costs.participation !== undefined
|
|
432
|
+
? { participation: policy.costs.participation }
|
|
433
|
+
: {}),
|
|
434
|
+
partialFills: policy.partialFills,
|
|
435
|
+
staleQuotes: policy.staleQuotes,
|
|
436
|
+
lockedCrossed: policy.lockedCrossed,
|
|
437
|
+
...(policy.sessions !== undefined ? { sessions: policy.sessions } : {}),
|
|
438
|
+
queue: policy.queue,
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
if (decision.outcome !== 'filled') {
|
|
442
|
+
rejectedFills += 1;
|
|
443
|
+
goals.push({
|
|
444
|
+
goal: `fill ${instrumentId}`,
|
|
445
|
+
status: 'violated',
|
|
446
|
+
detail: `unfilled: ${decision.reason}${decision.detail !== undefined ? ` (${decision.detail})` : ''}`,
|
|
447
|
+
});
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
// costs and price adjustments: slippage moves the price; spread and impact move it further by side
|
|
451
|
+
let price = slippage.fill({
|
|
452
|
+
referencePrice: decision.pricePerUnit,
|
|
453
|
+
side,
|
|
454
|
+
quantity: decision.quantity,
|
|
455
|
+
});
|
|
456
|
+
const direction = side === 'buy' ? 1 : -1;
|
|
457
|
+
if (policy.costs.spread !== undefined)
|
|
458
|
+
price +=
|
|
459
|
+
direction * policy.costs.spread.halfSpread({ referencePrice: decision.pricePerUnit, side });
|
|
460
|
+
if (policy.costs.marketImpact !== undefined) {
|
|
461
|
+
price *=
|
|
462
|
+
1 +
|
|
463
|
+
direction *
|
|
464
|
+
policy.costs.marketImpact.impact({
|
|
465
|
+
quantity: decision.quantity,
|
|
466
|
+
referencePrice: decision.pricePerUnit,
|
|
467
|
+
...(volume !== undefined ? { averageDailyVolume: volume } : {}),
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
const commissionAmount = commission.commission({ quantity: decision.quantity, price });
|
|
471
|
+
fillSequence += 1;
|
|
472
|
+
const fill = normalizedFillFromDecision({
|
|
473
|
+
decision: { ...decision, pricePerUnit: price },
|
|
474
|
+
order,
|
|
475
|
+
accountId: ACCOUNT_ID,
|
|
476
|
+
currency: baseCurrency,
|
|
477
|
+
filledTimestampMs: asOf,
|
|
478
|
+
fillId: `${runId}:fill:${fillSequence}`,
|
|
479
|
+
...(commissionAmount > 0 ? { costs: { commission: commissionAmount } } : {}),
|
|
480
|
+
});
|
|
481
|
+
fills.push(fill);
|
|
482
|
+
trades.push({
|
|
483
|
+
symbol: instrumentId,
|
|
484
|
+
timestampMs: asOf,
|
|
485
|
+
side,
|
|
486
|
+
quantity: fill.quantity,
|
|
487
|
+
price,
|
|
488
|
+
commission: commissionAmount,
|
|
489
|
+
slippage: Math.abs(price - decision.pricePerUnit) * fill.quantity,
|
|
490
|
+
// Cross-sectional universes are share-like instruments sized by weight; a unit moves its
|
|
491
|
+
// price in cash, and the fill above carries no contract terms.
|
|
492
|
+
multiplier: 1,
|
|
493
|
+
});
|
|
494
|
+
fold(portfolioEventsFromFill({ fill, sourceId, recordedTimestampMs: asOf }));
|
|
495
|
+
return fill;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// ---- the loop ------------------------------------------------------------------------------------
|
|
499
|
+
let rebalanceIndex = -1;
|
|
500
|
+
for (let index = 0; index < sessions.dates.length; index += 1) {
|
|
501
|
+
const date = sessions.dates[index]!;
|
|
502
|
+
const asOf = sessions.instants[index]!;
|
|
503
|
+
if (isRebalance.has(index)) {
|
|
504
|
+
rebalanceIndex += 1;
|
|
505
|
+
const goals: RebalanceGoal[] = [];
|
|
506
|
+
const rowExits: RebalanceRow['exits'] = [];
|
|
507
|
+
const held = heldQuantities();
|
|
508
|
+
// 1. membership and exits
|
|
509
|
+
const membership = universeMembershipAt({
|
|
510
|
+
universeHistory,
|
|
511
|
+
asOf,
|
|
512
|
+
...(previousRebalanceInstant !== undefined
|
|
513
|
+
? { previousAsOf: previousRebalanceInstant }
|
|
514
|
+
: {}),
|
|
515
|
+
});
|
|
516
|
+
const members = new Set(membership.instrumentIds);
|
|
517
|
+
const exitInfo = new Map(membership.exits.map((exit) => [exit.instrumentId, exit]));
|
|
518
|
+
for (const [instrumentId, quantity] of [...held].sort((a, b) => compareIds(a[0], b[0]))) {
|
|
519
|
+
if (members.has(instrumentId)) continue;
|
|
520
|
+
const exit = exitInfo.get(instrumentId);
|
|
521
|
+
const lastPrice = priceAt(instrumentId, index);
|
|
522
|
+
let exitPrice: number | null = lastPrice;
|
|
523
|
+
let reason: 'delisted' | 'removed' = 'removed';
|
|
524
|
+
if (exit?.exitReason === 'delisted') {
|
|
525
|
+
reason = 'delisted';
|
|
526
|
+
if (exit.delistingReturn === null) {
|
|
527
|
+
throw new InputError(
|
|
528
|
+
`${FUNCTION_NAME}: '${instrumentId}' was delisted at ${exit.exitTimestampMs} while the strategy held ${quantity} units, and the universe history carries no delistingReturn for it — the exit value cannot be assumed. Add delistingReturn to that member (−1 for a total loss).`,
|
|
529
|
+
{
|
|
530
|
+
code: ErrorCode.BacktestDelistingReturnMissing,
|
|
531
|
+
context: { function: FUNCTION_NAME, instrumentId },
|
|
532
|
+
},
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
delistingCount += 1;
|
|
536
|
+
const base = lastPrice ?? levels.get(instrumentId)?.[index - 1] ?? null;
|
|
537
|
+
exitPrice = base === null ? null : base * (1 + exit.delistingReturn);
|
|
538
|
+
}
|
|
539
|
+
if (exitPrice === null) {
|
|
540
|
+
throw new InputError(
|
|
541
|
+
`${FUNCTION_NAME}: '${instrumentId}' left the universe on ${date} while held, but the dataset has no price level for it at that session — supply its returns through the exit session.`,
|
|
542
|
+
{
|
|
543
|
+
code: ErrorCode.InputOutOfRange,
|
|
544
|
+
context: { function: FUNCTION_NAME, instrumentId, field: 'dataset.returns' },
|
|
545
|
+
},
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
exitCount += 1;
|
|
549
|
+
executeTrade({
|
|
550
|
+
index,
|
|
551
|
+
instrumentId,
|
|
552
|
+
side: quantity > 0 ? 'sell' : 'buy',
|
|
553
|
+
quantity: Math.abs(quantity),
|
|
554
|
+
referencePrice: exitPrice,
|
|
555
|
+
goals,
|
|
556
|
+
});
|
|
557
|
+
rowExits.push({ instrumentId, reason, exitPrice });
|
|
558
|
+
}
|
|
559
|
+
// the exits changed the book; everything after reads the post-exit holdings
|
|
560
|
+
const heldAfterExits = heldQuantities();
|
|
561
|
+
// 2. eligibility
|
|
562
|
+
const lagSessions = 'factorRecipe' in signal ? signal.factorRecipe.lagTradingSessions : 0;
|
|
563
|
+
const eligible = eligibleObservationsAt({
|
|
564
|
+
observations: dataset.observations,
|
|
565
|
+
fieldDefinitions: dataset.fieldDefinitions,
|
|
566
|
+
asOf,
|
|
567
|
+
universeHistory,
|
|
568
|
+
...(lagSessions > 0
|
|
569
|
+
? { lag: { tradingSessions: lagSessions, sessionTimestamps: sessions.instants } }
|
|
570
|
+
: {}),
|
|
571
|
+
});
|
|
572
|
+
// 3. the signal
|
|
573
|
+
const scores = signalScores(signal, eligible.observations, definitions, dataset, {
|
|
574
|
+
asOf,
|
|
575
|
+
sessionDate: date,
|
|
576
|
+
members: membership.instrumentIds,
|
|
577
|
+
held: [...heldAfterExits.keys()].sort(compareIds),
|
|
578
|
+
universeId: universeHistory.universeId,
|
|
579
|
+
});
|
|
580
|
+
// a name must have a price to be traded at this session
|
|
581
|
+
const scored = scores.filter(
|
|
582
|
+
(row) => priceAt(row.instrumentId, index) !== null && members.has(row.instrumentId),
|
|
583
|
+
);
|
|
584
|
+
// 4. selection
|
|
585
|
+
const selection = selectSides(
|
|
586
|
+
scored,
|
|
587
|
+
portfolioConstruction,
|
|
588
|
+
rebalanceSchedule.bufferBand ?? 0,
|
|
589
|
+
heldAfterExits,
|
|
590
|
+
goals,
|
|
591
|
+
);
|
|
592
|
+
// 5. weights
|
|
593
|
+
const trailing = (instrumentId: string): number[] => {
|
|
594
|
+
const perSession = returnsBySession.get(instrumentId);
|
|
595
|
+
if (perSession === undefined) return [];
|
|
596
|
+
const out: number[] = [];
|
|
597
|
+
for (let i = Math.max(0, index - lookback); i < index; i += 1) {
|
|
598
|
+
const r = perSession[i]!;
|
|
599
|
+
if (Number.isFinite(r)) out.push(r);
|
|
600
|
+
}
|
|
601
|
+
return out;
|
|
602
|
+
};
|
|
603
|
+
let weights = targetWeights(
|
|
604
|
+
selection,
|
|
605
|
+
portfolioConstruction,
|
|
606
|
+
dataset,
|
|
607
|
+
trailing,
|
|
608
|
+
goals,
|
|
609
|
+
{ asOf, sessionDate: date },
|
|
610
|
+
definitions,
|
|
611
|
+
eligible.observations,
|
|
612
|
+
lookback,
|
|
613
|
+
warnings,
|
|
614
|
+
);
|
|
615
|
+
// 6. constraints
|
|
616
|
+
weights = applyConstraints(weights, selection, portfolioConstruction, goals);
|
|
617
|
+
// turnover cap: blend toward the current book in weight space
|
|
618
|
+
const navBefore = netAssetValueAt(index);
|
|
619
|
+
const currentWeights = new Map<string, number>();
|
|
620
|
+
for (const [instrumentId, quantity] of heldAfterExits) {
|
|
621
|
+
const price = priceAt(instrumentId, index);
|
|
622
|
+
if (price !== null && navBefore > 0)
|
|
623
|
+
currentWeights.set(instrumentId, (quantity * price) / navBefore);
|
|
624
|
+
}
|
|
625
|
+
if (portfolioConstruction.maximumTurnover !== undefined) {
|
|
626
|
+
let estimated = 0;
|
|
627
|
+
for (const id of new Set([...weights.keys(), ...currentWeights.keys()])) {
|
|
628
|
+
estimated += Math.abs((weights.get(id) ?? 0) - (currentWeights.get(id) ?? 0));
|
|
629
|
+
}
|
|
630
|
+
if (estimated > portfolioConstruction.maximumTurnover) {
|
|
631
|
+
const scale = portfolioConstruction.maximumTurnover / estimated;
|
|
632
|
+
const blended = new Map<string, number>();
|
|
633
|
+
for (const id of new Set([...weights.keys(), ...currentWeights.keys()])) {
|
|
634
|
+
const current = currentWeights.get(id) ?? 0;
|
|
635
|
+
const target = weights.get(id) ?? 0;
|
|
636
|
+
const w = current + (target - current) * scale;
|
|
637
|
+
if (Math.abs(w) > 1e-12) blended.set(id, w);
|
|
638
|
+
}
|
|
639
|
+
weights = blended;
|
|
640
|
+
goals.push({
|
|
641
|
+
goal: 'maximumTurnover',
|
|
642
|
+
status: 'capped',
|
|
643
|
+
detail: `estimated turnover ${estimated.toFixed(4)} scaled to ${portfolioConstruction.maximumTurnover}`,
|
|
644
|
+
});
|
|
645
|
+
} else {
|
|
646
|
+
goals.push({
|
|
647
|
+
goal: 'maximumTurnover',
|
|
648
|
+
status: 'satisfied',
|
|
649
|
+
detail: `estimated turnover ${estimated.toFixed(4)}`,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
// 7. weights → quantities through the allocator
|
|
654
|
+
const prices: Record<string, { price: number; currency: string }> = {};
|
|
655
|
+
const currentHoldings: Record<string, number> = {};
|
|
656
|
+
for (const id of new Set([...weights.keys(), ...heldAfterExits.keys()])) {
|
|
657
|
+
const price = priceAt(id, index);
|
|
658
|
+
if (price !== null) prices[id] = { price, currency: baseCurrency };
|
|
659
|
+
}
|
|
660
|
+
for (const [id, quantity] of heldAfterExits) currentHoldings[id] = quantity;
|
|
661
|
+
const signedSum = [...weights.values()].reduce((s, w) => s + w, 0);
|
|
662
|
+
const targets = [...weights.entries()]
|
|
663
|
+
.sort((a, b) => compareIds(a[0], b[0]))
|
|
664
|
+
.map(([instrumentId, weight]) => ({ group: { instrumentId }, weight }));
|
|
665
|
+
const cashTarget = 1 - signedSum;
|
|
666
|
+
const allocation = allocatePortfolio({
|
|
667
|
+
policy: { targets: [...targets, { group: { assetClass: 'cash' }, weight: cashTarget }] },
|
|
668
|
+
asOf,
|
|
669
|
+
baseCurrency,
|
|
670
|
+
netAssetValue: navBefore,
|
|
671
|
+
prices,
|
|
672
|
+
currentHoldings,
|
|
673
|
+
defaultLotSize: 1,
|
|
674
|
+
});
|
|
675
|
+
if (!allocation.feasible) {
|
|
676
|
+
goals.push({
|
|
677
|
+
goal: 'allocation feasibility',
|
|
678
|
+
status: 'violated',
|
|
679
|
+
detail:
|
|
680
|
+
allocation.unresolved.length > 0
|
|
681
|
+
? `unresolved: ${allocation.unresolved.map((u) => JSON.stringify(u)).join('; ')}`
|
|
682
|
+
: (allocation.diagnostics.warnings[0] ?? 'infeasible'),
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
// participation cap per name in units
|
|
686
|
+
const participation = portfolioConstruction.maximumParticipation;
|
|
687
|
+
let costsThisRebalance = 0;
|
|
688
|
+
for (const trade of allocation.trades) {
|
|
689
|
+
let quantity = trade.quantity;
|
|
690
|
+
const adv = dataset.averageDailyVolumes?.[trade.instrumentId];
|
|
691
|
+
if (participation !== undefined && adv !== undefined && quantity > participation * adv) {
|
|
692
|
+
goals.push({
|
|
693
|
+
goal: `maximumParticipation ${trade.instrumentId}`,
|
|
694
|
+
status: 'capped',
|
|
695
|
+
detail: `${quantity} → ${participation * adv} units (${participation} × ADV ${adv})`,
|
|
696
|
+
});
|
|
697
|
+
quantity = participation * adv;
|
|
698
|
+
}
|
|
699
|
+
if (!(quantity > 0)) continue;
|
|
700
|
+
const price = prices[trade.instrumentId]!.price;
|
|
701
|
+
const fill = executeTrade({
|
|
702
|
+
index,
|
|
703
|
+
instrumentId: trade.instrumentId,
|
|
704
|
+
side: trade.side,
|
|
705
|
+
quantity,
|
|
706
|
+
referencePrice: price,
|
|
707
|
+
goals,
|
|
708
|
+
});
|
|
709
|
+
if (fill !== null) costsThisRebalance += fill.costs?.commission ?? 0;
|
|
710
|
+
}
|
|
711
|
+
// 8. rows
|
|
712
|
+
const after = heldQuantities();
|
|
713
|
+
const ranks = new Map(scored.map((row, i) => [row.instrumentId, i + 1]));
|
|
714
|
+
const scoreOf = new Map(scored.map((row) => [row.instrumentId, row.score]));
|
|
715
|
+
const selectedNow = new Set([
|
|
716
|
+
...selection.long.map((r) => r.instrumentId),
|
|
717
|
+
...selection.short.map((r) => r.instrumentId),
|
|
718
|
+
]);
|
|
719
|
+
for (const [instrumentId, quantity] of [...after].sort((a, b) => compareIds(a[0], b[0]))) {
|
|
720
|
+
const price = priceAt(instrumentId, index) ?? 0;
|
|
721
|
+
const navNow = navBefore; // weights are stated against the pre-trade NAV the allocator sized to
|
|
722
|
+
holdings.push({
|
|
723
|
+
rebalanceIndex,
|
|
724
|
+
instrumentId,
|
|
725
|
+
side: quantity > 0 ? 'long' : 'short',
|
|
726
|
+
weight: navNow > 0 ? (quantity * price) / navNow : 0,
|
|
727
|
+
quantity,
|
|
728
|
+
score: scoreOf.get(instrumentId) ?? null,
|
|
729
|
+
rank: ranks.get(instrumentId) ?? null,
|
|
730
|
+
reason: selectedNow.has(instrumentId)
|
|
731
|
+
? previousSelection.has(instrumentId) && selection.retained.has(instrumentId)
|
|
732
|
+
? 'retained-in-buffer'
|
|
733
|
+
: 'selected'
|
|
734
|
+
: 'exited',
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
for (const exit of rowExits) {
|
|
738
|
+
holdings.push({
|
|
739
|
+
rebalanceIndex,
|
|
740
|
+
instrumentId: exit.instrumentId,
|
|
741
|
+
side: 'long',
|
|
742
|
+
weight: 0,
|
|
743
|
+
quantity: 0,
|
|
744
|
+
score: null,
|
|
745
|
+
rank: null,
|
|
746
|
+
reason: exit.reason,
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
rebalances.push({
|
|
750
|
+
rebalanceIndex,
|
|
751
|
+
sessionDate: date,
|
|
752
|
+
asOf,
|
|
753
|
+
memberCount: membership.instrumentIds.length,
|
|
754
|
+
eligibleCount: eligible.observations.length,
|
|
755
|
+
scoredCount: scored.length,
|
|
756
|
+
longCount: selection.long.length,
|
|
757
|
+
shortCount: selection.short.length,
|
|
758
|
+
turnover: allocation.turnover,
|
|
759
|
+
costs: costsThisRebalance,
|
|
760
|
+
netAssetValue: netAssetValueAt(index),
|
|
761
|
+
goals,
|
|
762
|
+
exits: rowExits,
|
|
763
|
+
});
|
|
764
|
+
attributionInputs.push({
|
|
765
|
+
rebalanceIndex,
|
|
766
|
+
sessionIndex: index,
|
|
767
|
+
sessionDate: date,
|
|
768
|
+
scores: scored,
|
|
769
|
+
selection: selectedNow,
|
|
770
|
+
eligibleCount: eligible.observations.length,
|
|
771
|
+
memberCount: membership.instrumentIds.length,
|
|
772
|
+
});
|
|
773
|
+
previousSelection = selectedNow;
|
|
774
|
+
previousRebalanceInstant = asOf;
|
|
775
|
+
}
|
|
776
|
+
// every session marks the ledger
|
|
777
|
+
marks.push({ valuationDate: sessions.markDates[index]!, market: marketAt(index) });
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// ---- the ledger's own reports ---------------------------------------------------------------------
|
|
781
|
+
const ledger = createPortfolioLedger({ portfolioId: runId, baseCurrency, events });
|
|
782
|
+
const timeline = portfolioTimeline({
|
|
783
|
+
ledger,
|
|
784
|
+
valuationMarks: marks,
|
|
785
|
+
...(dataset.classification !== undefined
|
|
786
|
+
? { instrumentClassification: { ...dataset.classification } }
|
|
787
|
+
: {}),
|
|
788
|
+
});
|
|
789
|
+
const navs = timeline.rows.map((row) => row.netAssetValue);
|
|
790
|
+
const points: EquityPoint[] = timeline.rows.map((row, index) => ({
|
|
791
|
+
timestampMs: sessions.instants[index]!,
|
|
792
|
+
equity: row.netAssetValue,
|
|
793
|
+
}));
|
|
794
|
+
const returns = equityToReturns(navs);
|
|
795
|
+
const finalValue = navs[navs.length - 1]!;
|
|
796
|
+
const reconciliationResidual = netAssetValueAt(sessions.dates.length - 1) - finalValue;
|
|
797
|
+
if (!(Math.abs(reconciliationResidual) <= RECONCILIATION_TOLERANCE)) {
|
|
798
|
+
throw new InputError(
|
|
799
|
+
`${FUNCTION_NAME}: the ledger's net asset value at the last session (${netAssetValueAt(sessions.dates.length - 1)}) differs from the timeline's final value (${finalValue}) by ${reconciliationResidual} — an engine invariant failed; nothing was published.`,
|
|
800
|
+
{
|
|
801
|
+
code: ErrorCode.BacktestLedgerReconciliationFailed,
|
|
802
|
+
context: { function: FUNCTION_NAME, residual: reconciliationResidual },
|
|
803
|
+
},
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
// ---- benchmark ------------------------------------------------------------------------------------
|
|
808
|
+
let benchmark: BenchmarkComparison | null = null;
|
|
809
|
+
let benchmarkReturns: number[] | undefined;
|
|
810
|
+
if (dataset.benchmarkReturns !== undefined) {
|
|
811
|
+
const byDate = new Map(
|
|
812
|
+
dataset.benchmarkReturns.map((r) => [r.tradingSessionDate, r.simpleReturn]),
|
|
813
|
+
);
|
|
814
|
+
let missing = 0;
|
|
815
|
+
// the timeline's first row is the opening mark; returns run between consecutive marks
|
|
816
|
+
benchmarkReturns = sessions.dates.slice(1).map((date) => {
|
|
817
|
+
const r = byDate.get(date);
|
|
818
|
+
if (r === undefined) missing += 1;
|
|
819
|
+
return r ?? 0;
|
|
820
|
+
});
|
|
821
|
+
if (missing > 0) {
|
|
822
|
+
warnings.push(
|
|
823
|
+
warning(
|
|
824
|
+
WarningCode.BacktestDataMissing,
|
|
825
|
+
`${missing} benchmark session${missing === 1 ? '' : 's'} had no return and counted as 0`,
|
|
826
|
+
'warn',
|
|
827
|
+
{ missing },
|
|
828
|
+
),
|
|
829
|
+
);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
const performance = analyze(
|
|
833
|
+
{ equity: navs },
|
|
834
|
+
{
|
|
835
|
+
periodsPerYear,
|
|
836
|
+
riskFreeRate,
|
|
837
|
+
...(benchmarkReturns !== undefined ? { benchmark: benchmarkReturns } : {}),
|
|
838
|
+
},
|
|
839
|
+
);
|
|
840
|
+
if (dataset.benchmarkReturns !== undefined && benchmarkReturns !== undefined) {
|
|
841
|
+
const active = returns.map((r, i) => r - (benchmarkReturns as number[])[i]!);
|
|
842
|
+
benchmark = {
|
|
843
|
+
instrumentId: dataset.benchmarkReturns[0]!.instrumentId,
|
|
844
|
+
returns: benchmarkReturns,
|
|
845
|
+
activeReturn: mean(active),
|
|
846
|
+
trackingError: performance.trackingError ?? null,
|
|
847
|
+
informationRatio: performance.informationRatio ?? null,
|
|
848
|
+
beta: performance.beta ?? null,
|
|
849
|
+
alpha: performance.alpha ?? null,
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// ---- attribution ------------------------------------------------------------------------------------
|
|
854
|
+
const perRebalance: AttributionRow[] = [];
|
|
855
|
+
const decaySamples = new Map<number, number[]>(DECAY_HORIZONS.map((h) => [h, []]));
|
|
856
|
+
const forwardReturn = (
|
|
857
|
+
instrumentId: string,
|
|
858
|
+
fromSession: number,
|
|
859
|
+
toSession: number,
|
|
860
|
+
): number | null => {
|
|
861
|
+
const perSession = returnsBySession.get(instrumentId);
|
|
862
|
+
if (perSession === undefined) return null;
|
|
863
|
+
let compounded = 1;
|
|
864
|
+
let seen = 0;
|
|
865
|
+
for (let i = fromSession + 1; i <= toSession && i < perSession.length; i += 1) {
|
|
866
|
+
const r = perSession[i]!;
|
|
867
|
+
if (!Number.isFinite(r)) continue;
|
|
868
|
+
compounded *= 1 + r;
|
|
869
|
+
seen += 1;
|
|
870
|
+
}
|
|
871
|
+
return seen === 0 ? null : compounded - 1;
|
|
872
|
+
};
|
|
873
|
+
attributionInputs.forEach((input, k) => {
|
|
874
|
+
const next = attributionInputs[k + 1];
|
|
875
|
+
const endSession = next !== undefined ? next.sessionIndex : sessions.dates.length - 1;
|
|
876
|
+
const factorEntries: FactorEntry[] = input.scores.map((row) => ({
|
|
877
|
+
instrumentId: row.instrumentId,
|
|
878
|
+
value: row.score,
|
|
879
|
+
}));
|
|
880
|
+
const forward: FactorEntry[] = input.scores.map((row) => ({
|
|
881
|
+
instrumentId: row.instrumentId,
|
|
882
|
+
value: forwardReturn(row.instrumentId, input.sessionIndex, endSession),
|
|
883
|
+
}));
|
|
884
|
+
let ic: number | null = null;
|
|
885
|
+
let rankIc: number | null = null;
|
|
886
|
+
let spread: number | null = null;
|
|
887
|
+
if (factorEntries.length >= 3 && next !== undefined) {
|
|
888
|
+
const coefficient = informationCoefficient({ factorEntries, forwardReturns: forward });
|
|
889
|
+
ic = coefficient.informationCoefficient;
|
|
890
|
+
rankIc = coefficient.rankInformationCoefficient;
|
|
891
|
+
const valued = forward.filter((e) => e.value !== null).length;
|
|
892
|
+
if (valued >= 4) {
|
|
893
|
+
const quantiles = Math.min(5, Math.floor(valued / 2));
|
|
894
|
+
if (quantiles >= 2) {
|
|
895
|
+
spread = factorSpreadReturn({
|
|
896
|
+
entries: factorEntries,
|
|
897
|
+
forwardReturns: forward,
|
|
898
|
+
quantileCount: quantiles,
|
|
899
|
+
direction: 'descending',
|
|
900
|
+
}).spreadReturn;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
const previous = k > 0 ? attributionInputs[k - 1]!.selection : null;
|
|
905
|
+
const selectionTurnover =
|
|
906
|
+
previous === null || input.selection.size === 0
|
|
907
|
+
? null
|
|
908
|
+
: [...input.selection].filter((id) => !previous.has(id)).length / input.selection.size;
|
|
909
|
+
perRebalance.push({
|
|
910
|
+
rebalanceIndex: input.rebalanceIndex,
|
|
911
|
+
sessionDate: input.sessionDate,
|
|
912
|
+
informationCoefficient: ic,
|
|
913
|
+
rankInformationCoefficient: rankIc,
|
|
914
|
+
spreadReturn: spread,
|
|
915
|
+
selectionTurnover,
|
|
916
|
+
breadth: input.scores.length,
|
|
917
|
+
coverage: input.memberCount > 0 ? input.eligibleCount / input.memberCount : 0,
|
|
918
|
+
});
|
|
919
|
+
for (const horizon of DECAY_HORIZONS) {
|
|
920
|
+
const target = attributionInputs[k + horizon];
|
|
921
|
+
if (target === undefined || factorEntries.length < 3) continue;
|
|
922
|
+
const fwd: FactorEntry[] = input.scores.map((row) => ({
|
|
923
|
+
instrumentId: row.instrumentId,
|
|
924
|
+
value: forwardReturn(row.instrumentId, input.sessionIndex, target.sessionIndex),
|
|
925
|
+
}));
|
|
926
|
+
const c = informationCoefficient({
|
|
927
|
+
factorEntries,
|
|
928
|
+
forwardReturns: fwd,
|
|
929
|
+
}).rankInformationCoefficient;
|
|
930
|
+
if (c !== null) decaySamples.get(horizon)!.push(c);
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
const attribution = {
|
|
934
|
+
perRebalance,
|
|
935
|
+
decay: DECAY_HORIZONS.map((horizon) => {
|
|
936
|
+
const samples = decaySamples.get(horizon)!;
|
|
937
|
+
return {
|
|
938
|
+
horizonRebalances: horizon,
|
|
939
|
+
meanRankInformationCoefficient: mean(samples),
|
|
940
|
+
samples: samples.length,
|
|
941
|
+
};
|
|
942
|
+
}),
|
|
943
|
+
meanInformationCoefficient: mean(
|
|
944
|
+
perRebalance.map((r) => r.informationCoefficient).filter((v): v is number => v !== null),
|
|
945
|
+
),
|
|
946
|
+
meanRankInformationCoefficient: mean(
|
|
947
|
+
perRebalance.map((r) => r.rankInformationCoefficient).filter((v): v is number => v !== null),
|
|
948
|
+
),
|
|
949
|
+
meanSpreadReturn: mean(
|
|
950
|
+
perRebalance.map((r) => r.spreadReturn).filter((v): v is number => v !== null),
|
|
951
|
+
),
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
// ---- confidence ---------------------------------------------------------------------------------------
|
|
955
|
+
let performanceConfidence: CrossSectionalBacktestResult['performanceConfidence'] = null;
|
|
956
|
+
if (request.seed !== undefined && returns.length >= 2) {
|
|
957
|
+
const resample = monteCarloResample(returns, { iterations: 1_000, seed: request.seed });
|
|
958
|
+
performanceConfidence = {
|
|
959
|
+
iterations: resample.iterations,
|
|
960
|
+
seed: resample.seed,
|
|
961
|
+
meanTotalReturn: resample.meanTotalReturn,
|
|
962
|
+
standardDeviation: resample.standardDeviation,
|
|
963
|
+
confidenceInterval95: resample.confidenceInterval95,
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
const cappedGoalCount = rebalances.reduce(
|
|
968
|
+
(s, r) => s + r.goals.filter((g) => g.status === 'capped').length,
|
|
969
|
+
0,
|
|
970
|
+
);
|
|
971
|
+
const violatedGoalCount = rebalances.reduce(
|
|
972
|
+
(s, r) => s + r.goals.filter((g) => g.status === 'violated').length,
|
|
973
|
+
0,
|
|
974
|
+
);
|
|
975
|
+
const assumptions: CrossSectionalAssumptions = {
|
|
976
|
+
conventionsVersion: CONVENTIONS_VERSION,
|
|
977
|
+
universeId: universeHistory.universeId,
|
|
978
|
+
signal: signalIdentity,
|
|
979
|
+
rebalanceSchedule: {
|
|
980
|
+
frequency: rebalanceSchedule.frequency,
|
|
981
|
+
session: rebalanceSchedule.session,
|
|
982
|
+
bufferBand: rebalanceSchedule.bufferBand ?? null,
|
|
983
|
+
},
|
|
984
|
+
sessionInstantConvention: SESSION_INSTANT_CONVENTION,
|
|
985
|
+
pricing: PRICING_CONVENTION,
|
|
986
|
+
portfolioConstruction: {
|
|
987
|
+
method: portfolioConstruction.method,
|
|
988
|
+
long: portfolioConstruction.long,
|
|
989
|
+
short: portfolioConstruction.short ?? null,
|
|
990
|
+
neutrality: portfolioConstruction.neutrality ?? 'none',
|
|
991
|
+
maximumPositions: portfolioConstruction.maximumPositions ?? null,
|
|
992
|
+
maximumPositionWeight: portfolioConstruction.maximumPositionWeight ?? null,
|
|
993
|
+
minimumPositionWeight: portfolioConstruction.minimumPositionWeight ?? null,
|
|
994
|
+
maximumTurnover: portfolioConstruction.maximumTurnover ?? null,
|
|
995
|
+
maximumParticipation: portfolioConstruction.maximumParticipation ?? null,
|
|
996
|
+
volatilityLookbackSessions: lookback,
|
|
997
|
+
shortBookSizing: SHORT_BOOK_SIZING,
|
|
998
|
+
},
|
|
999
|
+
execution: describeExecutionPolicy(policy),
|
|
1000
|
+
costs: { commission: commission.label, slippage: slippage.label },
|
|
1001
|
+
initialCapital,
|
|
1002
|
+
baseCurrency,
|
|
1003
|
+
periodsPerYear,
|
|
1004
|
+
riskFreeRate,
|
|
1005
|
+
seed: request.seed ?? null,
|
|
1006
|
+
window: { fromTimestampMs: from ?? null, toTimestampMs: to ?? null },
|
|
1007
|
+
ledger: { sourceId, accountId: ACCOUNT_ID, lotRelief: ledger.lotRelief },
|
|
1008
|
+
replayable,
|
|
1009
|
+
};
|
|
1010
|
+
const diagnostics: CrossSectionalDiagnostics = {
|
|
1011
|
+
warnings,
|
|
1012
|
+
sessionCount: sessions.dates.length,
|
|
1013
|
+
rebalanceCount: rebalances.length,
|
|
1014
|
+
fillCount: fills.length,
|
|
1015
|
+
rejectedFillCount: rejectedFills,
|
|
1016
|
+
exitCount,
|
|
1017
|
+
delistingCount,
|
|
1018
|
+
cappedGoalCount,
|
|
1019
|
+
violatedGoalCount,
|
|
1020
|
+
reconciliationResidual,
|
|
1021
|
+
};
|
|
1022
|
+
return {
|
|
1023
|
+
rebalances,
|
|
1024
|
+
holdings,
|
|
1025
|
+
points,
|
|
1026
|
+
returns,
|
|
1027
|
+
trades,
|
|
1028
|
+
fills,
|
|
1029
|
+
ledger: ledger.toJSON(),
|
|
1030
|
+
timeline,
|
|
1031
|
+
attribution,
|
|
1032
|
+
benchmark,
|
|
1033
|
+
performance,
|
|
1034
|
+
performanceConfidence,
|
|
1035
|
+
finalValue,
|
|
1036
|
+
runId,
|
|
1037
|
+
assumptions,
|
|
1038
|
+
diagnostics,
|
|
1039
|
+
};
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1043
|
+
// The signal → scores (every ranking is a research call)
|
|
1044
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1045
|
+
|
|
1046
|
+
function fieldEntries(observations: readonly UniverseObservation[], field: string): FactorEntry[] {
|
|
1047
|
+
return observations.map((o) => {
|
|
1048
|
+
const value = o.fields[field];
|
|
1049
|
+
return {
|
|
1050
|
+
instrumentId: o.instrumentId,
|
|
1051
|
+
value: typeof value === 'number' && Number.isFinite(value) ? value : null,
|
|
1052
|
+
};
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
function recipeScores(
|
|
1057
|
+
recipe: FactorRecipe,
|
|
1058
|
+
observations: readonly UniverseObservation[],
|
|
1059
|
+
dataset: CrossSectionalBacktestRequest['dataset'],
|
|
1060
|
+
): SignalRow[] {
|
|
1061
|
+
if (observations.length === 0) return [];
|
|
1062
|
+
const components = recipe.features.map((feature) => {
|
|
1063
|
+
let entries = fieldEntries(observations, feature.field);
|
|
1064
|
+
if (feature.transform === 'winsorize-then-z-score') {
|
|
1065
|
+
entries = winsorizeFactor({
|
|
1066
|
+
entries,
|
|
1067
|
+
method: { type: 'percentile', ...WINSOR_PERCENTILES },
|
|
1068
|
+
}).entries;
|
|
1069
|
+
entries = standardizeFactor({ entries, method: 'z-score' }).entries;
|
|
1070
|
+
} else if (feature.transform === 'percentile-rank') {
|
|
1071
|
+
entries = standardizeFactor({ entries, method: 'percentile-rank' }).entries;
|
|
1072
|
+
}
|
|
1073
|
+
if (recipe.neutralization !== 'none') {
|
|
1074
|
+
const groups = observations
|
|
1075
|
+
.filter((o) => dataset.groups?.[o.instrumentId] !== undefined)
|
|
1076
|
+
.map((o) => ({ instrumentId: o.instrumentId, group: dataset.groups![o.instrumentId]! }));
|
|
1077
|
+
const exposures =
|
|
1078
|
+
recipe.neutralization === 'sector-and-size' && dataset.sizeField !== undefined
|
|
1079
|
+
? observations
|
|
1080
|
+
.filter((o) => typeof o.fields[dataset.sizeField!] === 'number')
|
|
1081
|
+
.map((o) => ({
|
|
1082
|
+
instrumentId: o.instrumentId,
|
|
1083
|
+
exposures: [o.fields[dataset.sizeField!] as number],
|
|
1084
|
+
}))
|
|
1085
|
+
: undefined;
|
|
1086
|
+
entries = neutralizeFactor({
|
|
1087
|
+
entries,
|
|
1088
|
+
groups,
|
|
1089
|
+
...(exposures !== undefined ? { exposures } : {}),
|
|
1090
|
+
}).entries;
|
|
1091
|
+
}
|
|
1092
|
+
return { label: feature.field, entries, weight: feature.weight, direction: recipe.direction };
|
|
1093
|
+
});
|
|
1094
|
+
const composite = compositeFactorScore({
|
|
1095
|
+
components,
|
|
1096
|
+
missingValuePolicy: recipe.missingValuePolicy,
|
|
1097
|
+
});
|
|
1098
|
+
return composite.entries
|
|
1099
|
+
.filter((e): e is { instrumentId: string; value: number } => e.value !== null)
|
|
1100
|
+
.map((e) => ({ instrumentId: e.instrumentId, score: e.value }));
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
function signalScores(
|
|
1104
|
+
signal: CrossSectionalBacktestRequest['signal'],
|
|
1105
|
+
eligible: readonly UniverseObservation[],
|
|
1106
|
+
definitions: Map<string, FieldDefinition>,
|
|
1107
|
+
dataset: CrossSectionalBacktestRequest['dataset'],
|
|
1108
|
+
context: {
|
|
1109
|
+
asOf: EpochMs;
|
|
1110
|
+
sessionDate: string;
|
|
1111
|
+
members: readonly string[];
|
|
1112
|
+
held: readonly string[];
|
|
1113
|
+
universeId: string;
|
|
1114
|
+
},
|
|
1115
|
+
): SignalRow[] {
|
|
1116
|
+
let rows: SignalRow[];
|
|
1117
|
+
if ('factorRecipe' in signal) rows = recipeScores(signal.factorRecipe, eligible, dataset);
|
|
1118
|
+
else if ('score' in signal) {
|
|
1119
|
+
if (eligible.length === 0) return [];
|
|
1120
|
+
rows = scoreUniverse({
|
|
1121
|
+
universeId: context.universeId,
|
|
1122
|
+
asOf: context.asOf,
|
|
1123
|
+
observations: eligible,
|
|
1124
|
+
fieldDefinitions: [...definitions.values()],
|
|
1125
|
+
components: signal.score.components,
|
|
1126
|
+
missingValuePolicy: signal.score.missingValuePolicy,
|
|
1127
|
+
}).rows.map((r) => ({ instrumentId: r.instrumentId, score: r.score }));
|
|
1128
|
+
} else if ('screen' in signal) {
|
|
1129
|
+
if (eligible.length === 0) return [];
|
|
1130
|
+
const screened = screenUniverse({
|
|
1131
|
+
universeId: context.universeId,
|
|
1132
|
+
asOf: context.asOf,
|
|
1133
|
+
observations: eligible,
|
|
1134
|
+
fieldDefinitions: [...definitions.values()],
|
|
1135
|
+
...(signal.screen.filter !== undefined ? { filter: signal.screen.filter } : {}),
|
|
1136
|
+
missingValuePolicy: signal.screen.missingValuePolicy,
|
|
1137
|
+
orderBy: [...signal.screen.orderBy],
|
|
1138
|
+
});
|
|
1139
|
+
// the screen's order is the ranking: the first row is the best
|
|
1140
|
+
rows = screened.rows.map((r, i) => ({
|
|
1141
|
+
instrumentId: r.instrumentId,
|
|
1142
|
+
score: screened.rows.length - i,
|
|
1143
|
+
}));
|
|
1144
|
+
} else {
|
|
1145
|
+
const produced = signal.callback({
|
|
1146
|
+
asOf: context.asOf,
|
|
1147
|
+
sessionDate: context.sessionDate,
|
|
1148
|
+
eligible,
|
|
1149
|
+
fieldDefinitions: [...definitions.values()],
|
|
1150
|
+
members: context.members,
|
|
1151
|
+
held: context.held,
|
|
1152
|
+
});
|
|
1153
|
+
if (!Array.isArray(produced)) {
|
|
1154
|
+
throw new InputError(
|
|
1155
|
+
`${FUNCTION_NAME}: signal.callback must return an array of { instrumentId, score }.`,
|
|
1156
|
+
{
|
|
1157
|
+
code: ErrorCode.InputWrongType,
|
|
1158
|
+
context: { function: FUNCTION_NAME, field: 'signal.callback' },
|
|
1159
|
+
},
|
|
1160
|
+
);
|
|
1161
|
+
}
|
|
1162
|
+
const seen = new Set<string>();
|
|
1163
|
+
rows = produced.map((row, i) => {
|
|
1164
|
+
if (
|
|
1165
|
+
typeof row?.instrumentId !== 'string' ||
|
|
1166
|
+
row.instrumentId.length === 0 ||
|
|
1167
|
+
typeof row.score !== 'number' ||
|
|
1168
|
+
!Number.isFinite(row.score)
|
|
1169
|
+
) {
|
|
1170
|
+
throw new InputError(
|
|
1171
|
+
`${FUNCTION_NAME}: signal.callback returned a malformed row at index ${i} — each row is { instrumentId: string, score: finite number }.`,
|
|
1172
|
+
{
|
|
1173
|
+
code: ErrorCode.InputWrongType,
|
|
1174
|
+
context: { function: FUNCTION_NAME, field: 'signal.callback' },
|
|
1175
|
+
},
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
if (seen.has(row.instrumentId)) {
|
|
1179
|
+
throw new InputError(
|
|
1180
|
+
`${FUNCTION_NAME}: signal.callback returned '${row.instrumentId}' twice.`,
|
|
1181
|
+
{
|
|
1182
|
+
code: ErrorCode.InputOutOfRange,
|
|
1183
|
+
context: { function: FUNCTION_NAME, field: 'signal.callback' },
|
|
1184
|
+
},
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
seen.add(row.instrumentId);
|
|
1188
|
+
return { instrumentId: row.instrumentId, score: row.score };
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
// higher is better, ties by instrumentId — the same final key research uses
|
|
1192
|
+
return [...rows].sort((a, b) => b.score - a.score || compareIds(a.instrumentId, b.instrumentId));
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1196
|
+
// Selection and weights
|
|
1197
|
+
// ---------------------------------------------------------------------------------------------------
|
|
1198
|
+
|
|
1199
|
+
interface Selection {
|
|
1200
|
+
long: SignalRow[];
|
|
1201
|
+
short: SignalRow[];
|
|
1202
|
+
retained: Set<string>;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function sideCount(
|
|
1206
|
+
spec: { topQuantile?: number; bottomQuantile?: number; count?: number; fraction?: number },
|
|
1207
|
+
universeSize: number,
|
|
1208
|
+
): number {
|
|
1209
|
+
if (spec.count !== undefined) return Math.min(spec.count, universeSize);
|
|
1210
|
+
const fraction = spec.topQuantile ?? spec.bottomQuantile ?? spec.fraction ?? 0;
|
|
1211
|
+
return Math.max(0, Math.floor(universeSize * fraction + 1e-12));
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
function selectSides(
|
|
1215
|
+
scored: SignalRow[],
|
|
1216
|
+
construction: CrossSectionalBacktestRequest['portfolioConstruction'],
|
|
1217
|
+
bufferBand: number,
|
|
1218
|
+
held: Map<string, number>,
|
|
1219
|
+
goals: RebalanceGoal[],
|
|
1220
|
+
): Selection {
|
|
1221
|
+
const retained = new Set<string>();
|
|
1222
|
+
const n = scored.length;
|
|
1223
|
+
const longCount = sideCount(construction.long, n);
|
|
1224
|
+
const shortCount = construction.short !== undefined ? sideCount(construction.short, n) : 0;
|
|
1225
|
+
// quantile selections use the research partition so the law is the same one formQuantilePortfolios proves
|
|
1226
|
+
let long: SignalRow[];
|
|
1227
|
+
let short: SignalRow[] = [];
|
|
1228
|
+
if ('topQuantile' in construction.long && n >= 2) {
|
|
1229
|
+
const quantiles = Math.max(2, Math.round(1 / construction.long.topQuantile));
|
|
1230
|
+
if (n >= quantiles) {
|
|
1231
|
+
const partition = formQuantilePortfolios({
|
|
1232
|
+
entries: scored.map((r) => ({ instrumentId: r.instrumentId, value: r.score })),
|
|
1233
|
+
quantileCount: quantiles,
|
|
1234
|
+
direction: 'descending',
|
|
1235
|
+
});
|
|
1236
|
+
const top = new Set(partition.portfolios[0]!.instrumentIds);
|
|
1237
|
+
long = scored.filter((r) => top.has(r.instrumentId));
|
|
1238
|
+
} else long = scored.slice(0, longCount);
|
|
1239
|
+
} else long = scored.slice(0, longCount);
|
|
1240
|
+
if (construction.short !== undefined) {
|
|
1241
|
+
if ('bottomQuantile' in construction.short && n >= 2) {
|
|
1242
|
+
const quantiles = Math.max(2, Math.round(1 / construction.short.bottomQuantile));
|
|
1243
|
+
if (n >= quantiles) {
|
|
1244
|
+
const partition = formQuantilePortfolios({
|
|
1245
|
+
entries: scored.map((r) => ({ instrumentId: r.instrumentId, value: r.score })),
|
|
1246
|
+
quantileCount: quantiles,
|
|
1247
|
+
direction: 'descending',
|
|
1248
|
+
});
|
|
1249
|
+
const bottom = new Set(
|
|
1250
|
+
partition.portfolios[partition.portfolios.length - 1]!.instrumentIds,
|
|
1251
|
+
);
|
|
1252
|
+
short = scored.filter((r) => bottom.has(r.instrumentId));
|
|
1253
|
+
} else short = scored.slice(Math.max(0, n - shortCount));
|
|
1254
|
+
} else short = scored.slice(Math.max(0, n - shortCount));
|
|
1255
|
+
}
|
|
1256
|
+
// buffer band: a held long stays while its rank is within (1 + band) × the long threshold; shorts mirrored
|
|
1257
|
+
if (bufferBand > 0 && long.length > 0) {
|
|
1258
|
+
const threshold = long.length;
|
|
1259
|
+
const limit = Math.floor(threshold * (1 + bufferBand));
|
|
1260
|
+
const longIds = new Set(long.map((r) => r.instrumentId));
|
|
1261
|
+
scored.forEach((row, i) => {
|
|
1262
|
+
const rank = i + 1;
|
|
1263
|
+
if (
|
|
1264
|
+
rank > threshold &&
|
|
1265
|
+
rank <= limit &&
|
|
1266
|
+
(held.get(row.instrumentId) ?? 0) > 0 &&
|
|
1267
|
+
!longIds.has(row.instrumentId)
|
|
1268
|
+
) {
|
|
1269
|
+
long.push(row);
|
|
1270
|
+
retained.add(row.instrumentId);
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
if (bufferBand > 0 && short.length > 0) {
|
|
1275
|
+
const threshold = short.length;
|
|
1276
|
+
const limit = Math.floor(threshold * (1 + bufferBand));
|
|
1277
|
+
const shortIds = new Set(short.map((r) => r.instrumentId));
|
|
1278
|
+
scored.forEach((row, i) => {
|
|
1279
|
+
const rankFromBottom = n - i;
|
|
1280
|
+
if (
|
|
1281
|
+
rankFromBottom > threshold &&
|
|
1282
|
+
rankFromBottom <= limit &&
|
|
1283
|
+
(held.get(row.instrumentId) ?? 0) < 0 &&
|
|
1284
|
+
!shortIds.has(row.instrumentId)
|
|
1285
|
+
) {
|
|
1286
|
+
short.push(row);
|
|
1287
|
+
retained.add(row.instrumentId);
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
// a name cannot be on both sides
|
|
1292
|
+
const longIds = new Set(long.map((r) => r.instrumentId));
|
|
1293
|
+
short = short.filter((r) => !longIds.has(r.instrumentId));
|
|
1294
|
+
if (
|
|
1295
|
+
construction.maximumPositions !== undefined &&
|
|
1296
|
+
long.length + short.length > construction.maximumPositions
|
|
1297
|
+
) {
|
|
1298
|
+
const total = long.length + short.length;
|
|
1299
|
+
const keepLong = Math.round((construction.maximumPositions * long.length) / total);
|
|
1300
|
+
long = long.slice(0, keepLong);
|
|
1301
|
+
short = short.slice(Math.max(0, short.length - (construction.maximumPositions - keepLong)));
|
|
1302
|
+
goals.push({
|
|
1303
|
+
goal: 'maximumPositions',
|
|
1304
|
+
status: 'capped',
|
|
1305
|
+
detail: `${total} → ${long.length + short.length}`,
|
|
1306
|
+
});
|
|
1307
|
+
}
|
|
1308
|
+
if (long.length === 0)
|
|
1309
|
+
goals.push({
|
|
1310
|
+
goal: 'long selection',
|
|
1311
|
+
status: 'violated',
|
|
1312
|
+
detail: `no name qualified from ${n} scored`,
|
|
1313
|
+
});
|
|
1314
|
+
if (construction.short !== undefined && short.length === 0)
|
|
1315
|
+
goals.push({
|
|
1316
|
+
goal: 'short selection',
|
|
1317
|
+
status: 'violated',
|
|
1318
|
+
detail: `no name qualified from ${n} scored`,
|
|
1319
|
+
});
|
|
1320
|
+
return { long, short, retained };
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
function targetWeights(
|
|
1324
|
+
selection: Selection,
|
|
1325
|
+
construction: CrossSectionalBacktestRequest['portfolioConstruction'],
|
|
1326
|
+
dataset: CrossSectionalBacktestRequest['dataset'],
|
|
1327
|
+
trailing: (instrumentId: string) => number[],
|
|
1328
|
+
goals: RebalanceGoal[],
|
|
1329
|
+
instant: { asOf: EpochMs; sessionDate: string },
|
|
1330
|
+
definitions: Map<string, FieldDefinition>,
|
|
1331
|
+
eligible: readonly UniverseObservation[],
|
|
1332
|
+
lookback: number,
|
|
1333
|
+
warnings: QuantWarning[],
|
|
1334
|
+
): Map<string, number> {
|
|
1335
|
+
const weights = new Map<string, number>();
|
|
1336
|
+
const sides: Array<{ rows: SignalRow[]; sign: 1 | -1 }> = [{ rows: selection.long, sign: 1 }];
|
|
1337
|
+
if (selection.short.length > 0) sides.push({ rows: selection.short, sign: -1 });
|
|
1338
|
+
if (construction.method === 'supplied-weights') {
|
|
1339
|
+
const trailingReturns: Record<string, number[]> = {};
|
|
1340
|
+
for (const row of [...selection.long, ...selection.short])
|
|
1341
|
+
trailingReturns[row.instrumentId] = trailing(row.instrumentId);
|
|
1342
|
+
const supplied = construction.suppliedWeights!({
|
|
1343
|
+
asOf: instant.asOf,
|
|
1344
|
+
sessionDate: instant.sessionDate,
|
|
1345
|
+
long: selection.long,
|
|
1346
|
+
short: selection.short,
|
|
1347
|
+
trailingReturns,
|
|
1348
|
+
});
|
|
1349
|
+
for (const [instrumentId, weight] of Object.entries(supplied ?? {})) {
|
|
1350
|
+
if (typeof weight !== 'number' || !Number.isFinite(weight)) {
|
|
1351
|
+
throw new InputError(
|
|
1352
|
+
`${FUNCTION_NAME}: portfolioConstruction.suppliedWeights returned a non-finite weight for '${instrumentId}'.`,
|
|
1353
|
+
{
|
|
1354
|
+
code: ErrorCode.InputNotFinite,
|
|
1355
|
+
context: { function: FUNCTION_NAME, field: 'portfolioConstruction.suppliedWeights' },
|
|
1356
|
+
},
|
|
1357
|
+
);
|
|
1358
|
+
}
|
|
1359
|
+
if (weight !== 0) weights.set(instrumentId, weight);
|
|
1360
|
+
}
|
|
1361
|
+
return neutralize(weights, selection, construction, dataset, goals, definitions, eligible);
|
|
1362
|
+
}
|
|
1363
|
+
for (const side of sides) {
|
|
1364
|
+
const n = side.rows.length;
|
|
1365
|
+
if (n === 0) continue;
|
|
1366
|
+
let raw: number[];
|
|
1367
|
+
switch (construction.method) {
|
|
1368
|
+
case 'equal-weight':
|
|
1369
|
+
raw = side.rows.map(() => 1);
|
|
1370
|
+
break;
|
|
1371
|
+
case 'score-weight': {
|
|
1372
|
+
const scores = side.rows.map((r) => r.score);
|
|
1373
|
+
const lo = Math.min(...scores);
|
|
1374
|
+
const hi = Math.max(...scores);
|
|
1375
|
+
const span = hi - lo;
|
|
1376
|
+
// conviction: distance from the side's worst score plus one average step, so every name keeps a positive weight
|
|
1377
|
+
raw = scores.map((s) => (side.sign === 1 ? s - lo : hi - s) + (span > 0 ? span / n : 1));
|
|
1378
|
+
break;
|
|
1379
|
+
}
|
|
1380
|
+
case 'inverse-volatility': {
|
|
1381
|
+
raw = side.rows.map((r) => {
|
|
1382
|
+
const sigma = sampleStandardDeviation(trailing(r.instrumentId));
|
|
1383
|
+
return sigma !== null && sigma > 0 ? 1 / sigma : Number.NaN;
|
|
1384
|
+
});
|
|
1385
|
+
if (raw.some((v) => !Number.isFinite(v))) {
|
|
1386
|
+
const fallback = raw.filter((v) => Number.isFinite(v));
|
|
1387
|
+
const fill =
|
|
1388
|
+
fallback.length > 0 ? fallback.reduce((s, v) => s + v, 0) / fallback.length : 1;
|
|
1389
|
+
raw = raw.map((v) => (Number.isFinite(v) ? v : fill));
|
|
1390
|
+
goals.push({
|
|
1391
|
+
goal: `inverse-volatility (${side.sign === 1 ? 'long' : 'short'})`,
|
|
1392
|
+
status: 'capped',
|
|
1393
|
+
detail: `names without ${lookback}-session history took the side's mean inverse volatility`,
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
break;
|
|
1397
|
+
}
|
|
1398
|
+
case 'risk-budget': {
|
|
1399
|
+
const series = side.rows.map((r) => trailing(r.instrumentId));
|
|
1400
|
+
const length = Math.min(...series.map((s) => s.length));
|
|
1401
|
+
if (length < 3 || n < 2) {
|
|
1402
|
+
raw = side.rows.map(() => 1);
|
|
1403
|
+
goals.push({
|
|
1404
|
+
goal: `risk-budget (${side.sign === 1 ? 'long' : 'short'})`,
|
|
1405
|
+
status: 'capped',
|
|
1406
|
+
detail: `fewer than 3 common trailing sessions (${length}); equal weights used`,
|
|
1407
|
+
});
|
|
1408
|
+
break;
|
|
1409
|
+
}
|
|
1410
|
+
const rows: number[][] = [];
|
|
1411
|
+
for (let t = 0; t < length; t += 1) rows.push(series.map((s) => s[s.length - length + t]!));
|
|
1412
|
+
const cov = covariance({ returns: rows, assets: side.rows.map((r) => r.instrumentId) });
|
|
1413
|
+
const parity = riskParity(cov.value.covariance, { budget: 1 });
|
|
1414
|
+
raw = parity.value.weights;
|
|
1415
|
+
for (const w of parity.diagnostics.warnings) warnings.push(w);
|
|
1416
|
+
break;
|
|
1417
|
+
}
|
|
1418
|
+
default:
|
|
1419
|
+
raw = side.rows.map(() => 1);
|
|
1420
|
+
}
|
|
1421
|
+
const total = raw.reduce((s, v) => s + v, 0);
|
|
1422
|
+
side.rows.forEach((row, i) => {
|
|
1423
|
+
const w = (side.sign * (raw[i] ?? 0)) / (total > 0 ? total : 1);
|
|
1424
|
+
if (w !== 0) weights.set(row.instrumentId, w);
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
return neutralize(weights, selection, construction, dataset, goals, definitions, eligible);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
function neutralize(
|
|
1431
|
+
weights: Map<string, number>,
|
|
1432
|
+
selection: Selection,
|
|
1433
|
+
construction: CrossSectionalBacktestRequest['portfolioConstruction'],
|
|
1434
|
+
dataset: CrossSectionalBacktestRequest['dataset'],
|
|
1435
|
+
goals: RebalanceGoal[],
|
|
1436
|
+
definitions: Map<string, FieldDefinition>,
|
|
1437
|
+
eligible: readonly UniverseObservation[],
|
|
1438
|
+
): Map<string, number> {
|
|
1439
|
+
const neutrality = construction.neutrality ?? 'none';
|
|
1440
|
+
if (neutrality === 'none' || selection.short.length === 0) return weights;
|
|
1441
|
+
const longGross = [...weights.values()].filter((w) => w > 0).reduce((s, w) => s + w, 0);
|
|
1442
|
+
const shortGross = [...weights.values()].filter((w) => w < 0).reduce((s, w) => s - w, 0);
|
|
1443
|
+
const out = new Map(weights);
|
|
1444
|
+
if (neutrality === 'dollar') {
|
|
1445
|
+
if (shortGross > 0) {
|
|
1446
|
+
const scale = longGross / shortGross;
|
|
1447
|
+
for (const [id, w] of out) if (w < 0) out.set(id, w * scale);
|
|
1448
|
+
goals.push({
|
|
1449
|
+
goal: 'dollar neutrality',
|
|
1450
|
+
status: 'satisfied',
|
|
1451
|
+
detail: `short book scaled by ${scale.toFixed(6)} to the long gross ${longGross.toFixed(6)}`,
|
|
1452
|
+
});
|
|
1453
|
+
} else
|
|
1454
|
+
goals.push({
|
|
1455
|
+
goal: 'dollar neutrality',
|
|
1456
|
+
status: 'violated',
|
|
1457
|
+
detail: 'no short weights to scale',
|
|
1458
|
+
});
|
|
1459
|
+
return out;
|
|
1460
|
+
}
|
|
1461
|
+
if (neutrality === 'sector') {
|
|
1462
|
+
const groups = dataset.groups ?? {};
|
|
1463
|
+
const byGroup = new Map<string, { long: number; short: number }>();
|
|
1464
|
+
for (const [id, w] of out) {
|
|
1465
|
+
const g = groups[id] ?? '(ungrouped)';
|
|
1466
|
+
const entry = byGroup.get(g) ?? { long: 0, short: 0 };
|
|
1467
|
+
if (w > 0) entry.long += w;
|
|
1468
|
+
else entry.short -= w;
|
|
1469
|
+
byGroup.set(g, entry);
|
|
1470
|
+
}
|
|
1471
|
+
let violated = 0;
|
|
1472
|
+
for (const [g, entry] of byGroup) {
|
|
1473
|
+
if (entry.long > 0 && entry.short > 0) {
|
|
1474
|
+
const scale = entry.long / entry.short;
|
|
1475
|
+
for (const [id, w] of out)
|
|
1476
|
+
if (w < 0 && (groups[id] ?? '(ungrouped)') === g) out.set(id, w * scale);
|
|
1477
|
+
} else violated += 1;
|
|
1478
|
+
}
|
|
1479
|
+
goals.push({
|
|
1480
|
+
goal: 'sector neutrality',
|
|
1481
|
+
status: violated === 0 ? 'satisfied' : 'violated',
|
|
1482
|
+
detail:
|
|
1483
|
+
violated === 0
|
|
1484
|
+
? `${byGroup.size} groups balanced`
|
|
1485
|
+
: `${violated} of ${byGroup.size} groups have one side only`,
|
|
1486
|
+
});
|
|
1487
|
+
return out;
|
|
1488
|
+
}
|
|
1489
|
+
if (neutrality === 'beta') {
|
|
1490
|
+
const betas = dataset.betas ?? {};
|
|
1491
|
+
let longBeta = 0;
|
|
1492
|
+
let shortBeta = 0;
|
|
1493
|
+
let missing = 0;
|
|
1494
|
+
for (const [id, w] of out) {
|
|
1495
|
+
const beta = betas[id];
|
|
1496
|
+
if (beta === undefined) {
|
|
1497
|
+
missing += 1;
|
|
1498
|
+
continue;
|
|
1499
|
+
}
|
|
1500
|
+
if (w > 0) longBeta += w * beta;
|
|
1501
|
+
else shortBeta -= w * beta;
|
|
1502
|
+
}
|
|
1503
|
+
if (missing > 0 || shortBeta <= 0) {
|
|
1504
|
+
goals.push({
|
|
1505
|
+
goal: 'beta neutrality',
|
|
1506
|
+
status: 'violated',
|
|
1507
|
+
detail:
|
|
1508
|
+
missing > 0
|
|
1509
|
+
? `${missing} selected names have no beta`
|
|
1510
|
+
: 'the short book carries no beta to offset',
|
|
1511
|
+
});
|
|
1512
|
+
return out;
|
|
1513
|
+
}
|
|
1514
|
+
const scale = longBeta / shortBeta;
|
|
1515
|
+
for (const [id, w] of out) if (w < 0) out.set(id, w * scale);
|
|
1516
|
+
goals.push({
|
|
1517
|
+
goal: 'beta neutrality',
|
|
1518
|
+
status: 'satisfied',
|
|
1519
|
+
detail: `short book scaled by ${scale.toFixed(6)}; weighted beta 0`,
|
|
1520
|
+
});
|
|
1521
|
+
return out;
|
|
1522
|
+
}
|
|
1523
|
+
// factor: residualize the weight vector against the named exposure
|
|
1524
|
+
const field = construction.neutralizeAgainst!.field;
|
|
1525
|
+
if (!definitions.has(field)) return out;
|
|
1526
|
+
const exposureOf = new Map(eligible.map((o) => [o.instrumentId, o.fields[field]]));
|
|
1527
|
+
const entries: FactorEntry[] = [...out.entries()].map(([id, w]) => ({
|
|
1528
|
+
instrumentId: id,
|
|
1529
|
+
value: w,
|
|
1530
|
+
}));
|
|
1531
|
+
const exposures = entries
|
|
1532
|
+
.filter((e) => typeof exposureOf.get(e.instrumentId) === 'number')
|
|
1533
|
+
.map((e) => ({
|
|
1534
|
+
instrumentId: e.instrumentId,
|
|
1535
|
+
exposures: [exposureOf.get(e.instrumentId) as number],
|
|
1536
|
+
}));
|
|
1537
|
+
if (exposures.length < 3) {
|
|
1538
|
+
goals.push({
|
|
1539
|
+
goal: 'factor neutrality',
|
|
1540
|
+
status: 'violated',
|
|
1541
|
+
detail: `only ${exposures.length} selected names carry '${field}'`,
|
|
1542
|
+
});
|
|
1543
|
+
return out;
|
|
1544
|
+
}
|
|
1545
|
+
const residual = neutralizeFactor({ entries, exposures });
|
|
1546
|
+
for (const e of residual.entries) if (e.value !== null) out.set(e.instrumentId, e.value);
|
|
1547
|
+
goals.push({
|
|
1548
|
+
goal: 'factor neutrality',
|
|
1549
|
+
status: 'satisfied',
|
|
1550
|
+
detail: `weights residualized against '${field}' over ${exposures.length} names`,
|
|
1551
|
+
});
|
|
1552
|
+
return out;
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1555
|
+
function applyConstraints(
|
|
1556
|
+
weights: Map<string, number>,
|
|
1557
|
+
selection: Selection,
|
|
1558
|
+
construction: CrossSectionalBacktestRequest['portfolioConstruction'],
|
|
1559
|
+
goals: RebalanceGoal[],
|
|
1560
|
+
): Map<string, number> {
|
|
1561
|
+
const out = new Map(weights);
|
|
1562
|
+
const cap = construction.maximumPositionWeight;
|
|
1563
|
+
if (cap !== undefined) {
|
|
1564
|
+
let capped = 0;
|
|
1565
|
+
for (const sign of [1, -1] as const) {
|
|
1566
|
+
// cap and redistribute the excess pro rata to the side's uncapped names, iterating to a fixed point
|
|
1567
|
+
for (let iteration = 0; iteration < 50; iteration += 1) {
|
|
1568
|
+
const side = [...out.entries()].filter(([, w]) => Math.sign(w) === sign);
|
|
1569
|
+
const over = side.filter(([, w]) => Math.abs(w) > cap + 1e-12);
|
|
1570
|
+
if (over.length === 0) break;
|
|
1571
|
+
let excess = 0;
|
|
1572
|
+
for (const [id, w] of over) {
|
|
1573
|
+
excess += Math.abs(w) - cap;
|
|
1574
|
+
out.set(id, sign * cap);
|
|
1575
|
+
capped += 1;
|
|
1576
|
+
}
|
|
1577
|
+
const under = side.filter(([, w]) => Math.abs(w) < cap - 1e-12);
|
|
1578
|
+
const underTotal = under.reduce((s, [, w]) => s + Math.abs(w), 0);
|
|
1579
|
+
if (under.length === 0 || underTotal === 0) break;
|
|
1580
|
+
for (const [id, w] of under) out.set(id, w + sign * excess * (Math.abs(w) / underTotal));
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
if (capped > 0)
|
|
1584
|
+
goals.push({
|
|
1585
|
+
goal: 'maximumPositionWeight',
|
|
1586
|
+
status: 'capped',
|
|
1587
|
+
detail: `${capped} weight${capped === 1 ? '' : 's'} capped at ${cap}; excess redistributed pro rata`,
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
const floor = construction.minimumPositionWeight;
|
|
1591
|
+
if (floor !== undefined && floor > 0) {
|
|
1592
|
+
let dropped = 0;
|
|
1593
|
+
for (const [id, w] of [...out.entries()]) {
|
|
1594
|
+
if (Math.abs(w) < floor) {
|
|
1595
|
+
out.delete(id);
|
|
1596
|
+
dropped += 1;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1599
|
+
if (dropped > 0)
|
|
1600
|
+
goals.push({
|
|
1601
|
+
goal: 'minimumPositionWeight',
|
|
1602
|
+
status: 'capped',
|
|
1603
|
+
detail: `${dropped} name${dropped === 1 ? '' : 's'} below ${floor} dropped`,
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
void selection;
|
|
1607
|
+
return out;
|
|
1608
|
+
}
|