@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,2445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The journey operations (Stage 7A Decision 4): thin compositions of GREEN compute — a portfolio
|
|
3
|
+
* valued from its ledger, a P&L explained between two marks, a scenario set run against targets, a
|
|
4
|
+
* universe screened / ranked / scored, an event study, an options backtest, and the artifact read
|
|
5
|
+
* and compare doors. Every schema is authored over the direct function's own input shape (same
|
|
6
|
+
* field names, same defaults, same nulls — law C16); a wire-only restriction (no callbacks, no class
|
|
7
|
+
* instances, no iterables) is a NARROWER schema, never a different meaning. Nothing is aggregated
|
|
8
|
+
* here: each `structured` output is the direct result verbatim, and a report of several results
|
|
9
|
+
* keeps them side by side under one `assumptions`.
|
|
10
|
+
*/
|
|
11
|
+
import { compareAnalysisArtifacts, readAnalysisArtifact, readMarketSnapshot, readScenarioSet, } from '../../core/dist/artifacts/index.js';
|
|
12
|
+
import { OptionQuoteSchema, schema } from '../../core/dist/schema/index.js';
|
|
13
|
+
import { crossSectionalBacktest, fees, slippage } from '../../backtest/dist/index.js';
|
|
14
|
+
import { execution, impactModels, latencyModels, spreadModels, } from '../../backtest/dist/execution/index.js';
|
|
15
|
+
import { optionsBacktest } from '../../backtest/dist/options/index.js';
|
|
16
|
+
import { portfolioBacktest } from '../../backtest/dist/portfolio/index.js';
|
|
17
|
+
import { backtestRunArtifact } from '../../backtest/dist/artifacts.js';
|
|
18
|
+
import { ENVIRONMENT_EPISODE_IDS, agentBaselines, runAgentBench, } from '../../backtest/dist/environment/index.js';
|
|
19
|
+
import { monitorPortfolio, portfolioPnl, portfolioSnapshot, portfolioTimeline, proposePortfolioRebalance, readPortfolioLedgerSnapshot, } from '../../portfolio/dist/index.js';
|
|
20
|
+
import { discountedCashFlowFromStatements, discountedCashFlowSensitivityTable, } from '../../valuation/dist/index.js';
|
|
21
|
+
import { eventStudy, rankUniverse, scoreUniverse, screenUniverse } from '../../research/dist/index.js';
|
|
22
|
+
import { runScenarios, scenarioPortfolioBinding, scenarioTarget, scenarioTargetsFromPortfolio, } from '../../scenarios/dist/index.js';
|
|
23
|
+
import { defineOperation } from './operation.js';
|
|
24
|
+
import { capRows } from './operation-kit.js';
|
|
25
|
+
import { boundedPreview } from './preview.js';
|
|
26
|
+
// ── shared envelope schemas (closed at the level the direct read door re-validates) ───────────
|
|
27
|
+
const ASSUMPTIONS_SCHEMA = { type: 'object', description: 'Applied conventions' };
|
|
28
|
+
const DIAGNOSTICS_SCHEMA = { type: 'object', description: 'Engine, method, warnings' };
|
|
29
|
+
const epochMsOrDate = schema
|
|
30
|
+
.union([schema.number(), schema.string()])
|
|
31
|
+
.describe('Epoch ms, YYYY-MM-DD, or a zoned ISO datetime');
|
|
32
|
+
import { CurrencyPairQuoteSchema, MarketSnapshotSchema, PortfolioLedgerEnvelopeSchema, PortfolioStateSchema, ProvenanceSchema, } from './wire-schemas.js';
|
|
33
|
+
const ValuationMarkSchema = schema.object({
|
|
34
|
+
valuationDate: schema
|
|
35
|
+
.string()
|
|
36
|
+
.date()
|
|
37
|
+
.describe('Strict YYYY-MM-DD; the mark instant is 00:00 UTC'),
|
|
38
|
+
market: MarketSnapshotSchema,
|
|
39
|
+
currencyConversions: schema.array(CurrencyPairQuoteSchema).optional(),
|
|
40
|
+
});
|
|
41
|
+
const InstrumentClassificationSchema = schema
|
|
42
|
+
.record(schema.object({
|
|
43
|
+
underlying: schema.string().optional(),
|
|
44
|
+
assetClass: schema.string().optional(),
|
|
45
|
+
strategy: schema.string().optional(),
|
|
46
|
+
tags: schema.array(schema.string()).optional(),
|
|
47
|
+
}))
|
|
48
|
+
.describe('Identity metadata per instrument for grouping; unknown instruments group as unclassified');
|
|
49
|
+
const AnalysisArtifactSchema = schema
|
|
50
|
+
.object({
|
|
51
|
+
kind: schema.literal('totalfinance.analysis-artifact'),
|
|
52
|
+
schemaVersion: schema.number().integer(),
|
|
53
|
+
id: schema.string(),
|
|
54
|
+
artifactType: schema.string(),
|
|
55
|
+
producedBy: schema.object({
|
|
56
|
+
operation: schema.string(),
|
|
57
|
+
libraryVersion: schema.string().optional(),
|
|
58
|
+
}),
|
|
59
|
+
conventionsVersion: schema.string(),
|
|
60
|
+
inputs: schema.object({
|
|
61
|
+
inputsHash: schema.string(),
|
|
62
|
+
snapshotHash: schema.string().optional(),
|
|
63
|
+
parameters: schema.unknown().optional(),
|
|
64
|
+
}),
|
|
65
|
+
createdFrom: schema.array(schema.string()).optional(),
|
|
66
|
+
result: schema.record(schema.unknown()),
|
|
67
|
+
tables: schema.record(schema.record(schema.unknown())).optional(),
|
|
68
|
+
provenance: ProvenanceSchema.optional(),
|
|
69
|
+
})
|
|
70
|
+
.describe('A Gate B analysis artifact (totalfinance.analysis-artifact); hashes are re-verified by the read door');
|
|
71
|
+
const ScenarioSetSchema = schema
|
|
72
|
+
.object({
|
|
73
|
+
kind: schema.literal('totalfinance.scenario-set'),
|
|
74
|
+
schemaVersion: schema.number().integer(),
|
|
75
|
+
name: schema.string().nonempty(),
|
|
76
|
+
scenarios: schema
|
|
77
|
+
.array(schema.object({
|
|
78
|
+
name: schema.string().nonempty(),
|
|
79
|
+
shocks: schema.array(schema.object({
|
|
80
|
+
factor: schema.string(),
|
|
81
|
+
kind: schema.enum(['percent', 'absolute']),
|
|
82
|
+
value: schema.number(),
|
|
83
|
+
target: schema.string().optional(),
|
|
84
|
+
})),
|
|
85
|
+
overrides: schema
|
|
86
|
+
.array(schema.object({
|
|
87
|
+
factor: schema.string(),
|
|
88
|
+
value: schema.number(),
|
|
89
|
+
target: schema.string().optional(),
|
|
90
|
+
}))
|
|
91
|
+
.optional(),
|
|
92
|
+
}))
|
|
93
|
+
.min(1),
|
|
94
|
+
provenance: ProvenanceSchema.optional(),
|
|
95
|
+
})
|
|
96
|
+
.describe('A Gate B scenario set (totalfinance.scenario-set)');
|
|
97
|
+
/** A ledger envelope re-hydrates through the read door; a state is handed through as it is. */
|
|
98
|
+
function portfolioStateOf(portfolio) {
|
|
99
|
+
if (portfolio.kind === 'totalfinance.portfolio-ledger') {
|
|
100
|
+
return readPortfolioLedgerSnapshot({ snapshot: portfolio }).ledger.state;
|
|
101
|
+
}
|
|
102
|
+
return portfolio;
|
|
103
|
+
}
|
|
104
|
+
// ── portfolio ─────────────────────────────────────────────────────────────────────────────────
|
|
105
|
+
const PortfolioSnapshotInputSchema = schema.object({
|
|
106
|
+
portfolio: schema
|
|
107
|
+
.union([PortfolioLedgerEnvelopeSchema, PortfolioStateSchema])
|
|
108
|
+
.describe('A serialized ledger envelope (re-hydrated through readPortfolioLedgerSnapshot) or a PortfolioState'),
|
|
109
|
+
asOf: epochMsOrDate.describe('The valuation instant'),
|
|
110
|
+
market: MarketSnapshotSchema,
|
|
111
|
+
currencyConversions: schema
|
|
112
|
+
.array(CurrencyPairQuoteSchema)
|
|
113
|
+
.optional()
|
|
114
|
+
.describe('Quotes to the base currency — required exactly when the portfolio holds non-base currency'),
|
|
115
|
+
});
|
|
116
|
+
const PORTFOLIO_SNAPSHOT_OUTPUT = {
|
|
117
|
+
type: 'object',
|
|
118
|
+
properties: {
|
|
119
|
+
asOf: { type: 'number' },
|
|
120
|
+
baseCurrency: { type: 'string' },
|
|
121
|
+
netAssetValue: { type: 'number' },
|
|
122
|
+
cash: { type: 'array', items: { type: 'object' } },
|
|
123
|
+
totalCashBaseCurrencyValue: { type: 'number' },
|
|
124
|
+
positions: { type: 'array', items: { type: 'object' } },
|
|
125
|
+
totalPositionsBaseCurrencyValue: { type: 'number' },
|
|
126
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
127
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
128
|
+
},
|
|
129
|
+
required: [
|
|
130
|
+
'asOf',
|
|
131
|
+
'baseCurrency',
|
|
132
|
+
'netAssetValue',
|
|
133
|
+
'cash',
|
|
134
|
+
'totalCashBaseCurrencyValue',
|
|
135
|
+
'positions',
|
|
136
|
+
'totalPositionsBaseCurrencyValue',
|
|
137
|
+
'assumptions',
|
|
138
|
+
'diagnostics',
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
const portfolioSnapshotOperation = defineOperation({
|
|
142
|
+
id: 'totalfinance.portfolio.snapshot',
|
|
143
|
+
handleFields: ['portfolio', 'market'],
|
|
144
|
+
title: 'Value a portfolio at an instant',
|
|
145
|
+
description: 'Value every cash balance and position of a portfolio at one instant from a Gate B market snapshot: ' +
|
|
146
|
+
'net asset value in the base currency, per-account cash rows (settled and unsettled), per-position marks, ' +
|
|
147
|
+
'cost basis and unrealized P&L. Supply the portfolio as its serialized ledger envelope (re-hydrated ' +
|
|
148
|
+
'through readPortfolioLedgerSnapshot) or as a derived PortfolioState. The result is portfolioSnapshot(...) verbatim.',
|
|
149
|
+
inputSchema: PortfolioSnapshotInputSchema,
|
|
150
|
+
outputSchema: PORTFOLIO_SNAPSHOT_OUTPUT,
|
|
151
|
+
costClass: 'small',
|
|
152
|
+
run: (input) => {
|
|
153
|
+
const result = portfolioSnapshot({
|
|
154
|
+
portfolio: portfolioStateOf(input.portfolio),
|
|
155
|
+
asOf: input.asOf,
|
|
156
|
+
market: input.market,
|
|
157
|
+
...(input.currencyConversions !== undefined
|
|
158
|
+
? { currencyConversions: input.currencyConversions }
|
|
159
|
+
: {}),
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
summary: `NAV ${result.netAssetValue.toFixed(2)} ${result.baseCurrency} at ${new Date(result.asOf).toISOString()} (${result.positions.length} positions, ${result.cash.length} cash rows)`,
|
|
163
|
+
structured: result,
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
const PortfolioPnlInputSchema = schema.object({
|
|
168
|
+
ledger: PortfolioLedgerEnvelopeSchema,
|
|
169
|
+
from: ValuationMarkSchema.describe('The opening valuation mark'),
|
|
170
|
+
to: ValuationMarkSchema.describe('The closing valuation mark (strictly after `from`)'),
|
|
171
|
+
instrumentClassification: InstrumentClassificationSchema.optional(),
|
|
172
|
+
});
|
|
173
|
+
const PORTFOLIO_PNL_OUTPUT = {
|
|
174
|
+
type: 'object',
|
|
175
|
+
properties: {
|
|
176
|
+
baseCurrency: { type: 'string' },
|
|
177
|
+
from: { type: 'object' },
|
|
178
|
+
to: { type: 'object' },
|
|
179
|
+
netAssetValueChange: { type: 'number' },
|
|
180
|
+
externalFlows: { type: 'number' },
|
|
181
|
+
investmentReturn: { type: 'number' },
|
|
182
|
+
components: {
|
|
183
|
+
type: 'object',
|
|
184
|
+
description: 'realized, unrealized, income, costs, financing, FX, total',
|
|
185
|
+
},
|
|
186
|
+
residual: { type: 'number' },
|
|
187
|
+
byCurrency: { type: 'array', items: { type: 'object' } },
|
|
188
|
+
groupings: { type: 'array', items: { type: 'object' } },
|
|
189
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
190
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
191
|
+
},
|
|
192
|
+
required: [
|
|
193
|
+
'baseCurrency',
|
|
194
|
+
'from',
|
|
195
|
+
'to',
|
|
196
|
+
'netAssetValueChange',
|
|
197
|
+
'externalFlows',
|
|
198
|
+
'investmentReturn',
|
|
199
|
+
'components',
|
|
200
|
+
'residual',
|
|
201
|
+
'byCurrency',
|
|
202
|
+
'groupings',
|
|
203
|
+
'assumptions',
|
|
204
|
+
'diagnostics',
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
const portfolioExplainPnl = defineOperation({
|
|
208
|
+
id: 'totalfinance.portfolio.explain_pnl',
|
|
209
|
+
handleFields: ['ledger', 'from.market', 'to.market'],
|
|
210
|
+
title: 'Explain portfolio P&L between two marks',
|
|
211
|
+
description: 'Explain the change in net asset value between two dated valuation marks: external flows, investment return, ' +
|
|
212
|
+
'and the identity components (realized, unrealized, income, transaction costs, financing, foreign exchange) that ' +
|
|
213
|
+
'reconcile to it with a published residual, by currency and by grouping. The result is portfolioPnl(...) verbatim.',
|
|
214
|
+
inputSchema: PortfolioPnlInputSchema,
|
|
215
|
+
outputSchema: PORTFOLIO_PNL_OUTPUT,
|
|
216
|
+
costClass: 'small',
|
|
217
|
+
run: (input) => {
|
|
218
|
+
const { ledger } = readPortfolioLedgerSnapshot({ snapshot: input.ledger });
|
|
219
|
+
const result = portfolioPnl({
|
|
220
|
+
ledger,
|
|
221
|
+
from: input.from,
|
|
222
|
+
to: input.to,
|
|
223
|
+
...(input.instrumentClassification !== undefined
|
|
224
|
+
? { instrumentClassification: input.instrumentClassification }
|
|
225
|
+
: {}),
|
|
226
|
+
});
|
|
227
|
+
return {
|
|
228
|
+
summary: `NAV ${result.from.netAssetValue.toFixed(2)} → ${result.to.netAssetValue.toFixed(2)} ${result.baseCurrency} (${input.from.valuationDate} → ${input.to.valuationDate}): total P&L ${result.components.totalPnl.toFixed(2)}, external flows ${result.externalFlows.toFixed(2)}`,
|
|
229
|
+
structured: result,
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
});
|
|
233
|
+
// ── artifacts ─────────────────────────────────────────────────────────────────────────────────
|
|
234
|
+
const artifactRead = defineOperation({
|
|
235
|
+
id: 'totalfinance.artifact.read',
|
|
236
|
+
handleFields: ['artifact'],
|
|
237
|
+
title: 'Read an analysis artifact',
|
|
238
|
+
description: 'Validate a Gate B analysis artifact (its envelope, its recomputed inputs hash, and its content-hash identity) and ' +
|
|
239
|
+
'return its identity, type, producer, provenance warnings, table names, and a bounded preview of the stored result ' +
|
|
240
|
+
'— the one read door for any artifact over the wire. Migrations are not registered over the wire; a stored ' +
|
|
241
|
+
'older version is refused with the versions named.',
|
|
242
|
+
inputSchema: schema.object({ artifact: AnalysisArtifactSchema }),
|
|
243
|
+
outputSchema: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
id: { type: 'string' },
|
|
247
|
+
artifactType: { type: 'string' },
|
|
248
|
+
schemaVersion: { type: 'integer' },
|
|
249
|
+
producedBy: { type: 'object' },
|
|
250
|
+
conventionsVersion: { type: 'string' },
|
|
251
|
+
inputs: { type: 'object' },
|
|
252
|
+
createdFrom: { type: 'array', items: { type: 'string' } },
|
|
253
|
+
tables: { type: 'array', items: { type: 'string' } },
|
|
254
|
+
warnings: { type: 'array', items: { type: 'object' } },
|
|
255
|
+
preview: {
|
|
256
|
+
type: 'object',
|
|
257
|
+
description: 'Top-level keys; scalars inline, containers by size',
|
|
258
|
+
},
|
|
259
|
+
migrationsApplied: { type: 'array', items: { type: 'object' } },
|
|
260
|
+
},
|
|
261
|
+
required: [
|
|
262
|
+
'id',
|
|
263
|
+
'artifactType',
|
|
264
|
+
'schemaVersion',
|
|
265
|
+
'producedBy',
|
|
266
|
+
'conventionsVersion',
|
|
267
|
+
'inputs',
|
|
268
|
+
'createdFrom',
|
|
269
|
+
'tables',
|
|
270
|
+
'warnings',
|
|
271
|
+
'preview',
|
|
272
|
+
'migrationsApplied',
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
costClass: 'small',
|
|
276
|
+
run: (input) => {
|
|
277
|
+
const { artifact, migrationsApplied } = readAnalysisArtifact({ artifact: input.artifact });
|
|
278
|
+
return {
|
|
279
|
+
summary: `${artifact.artifactType} ${artifact.id} by ${artifact.producedBy.operation} (${Object.keys(artifact.result).length} result fields)`,
|
|
280
|
+
structured: {
|
|
281
|
+
id: artifact.id,
|
|
282
|
+
artifactType: artifact.artifactType,
|
|
283
|
+
schemaVersion: artifact.schemaVersion,
|
|
284
|
+
producedBy: artifact.producedBy,
|
|
285
|
+
conventionsVersion: artifact.conventionsVersion,
|
|
286
|
+
inputs: artifact.inputs,
|
|
287
|
+
createdFrom: artifact.createdFrom ?? [],
|
|
288
|
+
tables: Object.keys(artifact.tables ?? {}),
|
|
289
|
+
warnings: artifact.provenance?.warnings ?? [],
|
|
290
|
+
preview: boundedPreview(artifact.result),
|
|
291
|
+
migrationsApplied,
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
const artifactCompare = defineOperation({
|
|
297
|
+
id: 'totalfinance.artifact.compare',
|
|
298
|
+
handleFields: ['baseline', 'candidate'],
|
|
299
|
+
title: 'Compare two analysis artifacts',
|
|
300
|
+
description: 'Compare a baseline and a candidate artifact of the same type leaf by leaf: value differences with absolute and ' +
|
|
301
|
+
'relative deltas, added and removed paths, whether inputs and producers match, and — when a tolerance is supplied — ' +
|
|
302
|
+
'whether every numeric leaf is within it. The result is compareAnalysisArtifacts(...) verbatim.',
|
|
303
|
+
inputSchema: schema.object({
|
|
304
|
+
baseline: AnalysisArtifactSchema,
|
|
305
|
+
candidate: AnalysisArtifactSchema,
|
|
306
|
+
tolerance: schema
|
|
307
|
+
.object({
|
|
308
|
+
absolute: schema.number().nonnegative(),
|
|
309
|
+
relative: schema.number().nonnegative(),
|
|
310
|
+
})
|
|
311
|
+
.optional()
|
|
312
|
+
.describe('Two-sided: a leaf is within it when |Δ| ≤ absolute + relative·|baseline|'),
|
|
313
|
+
limits: schema
|
|
314
|
+
.object({
|
|
315
|
+
maximumDifferences: schema.number().integer().positive().optional(),
|
|
316
|
+
maximumLeaves: schema.number().integer().positive().optional(),
|
|
317
|
+
})
|
|
318
|
+
.optional(),
|
|
319
|
+
}),
|
|
320
|
+
outputSchema: {
|
|
321
|
+
type: 'object',
|
|
322
|
+
properties: {
|
|
323
|
+
artifactType: { type: 'string' },
|
|
324
|
+
identical: { type: 'boolean' },
|
|
325
|
+
artifactIds: { type: 'object' },
|
|
326
|
+
inputs: { type: 'object' },
|
|
327
|
+
producedBy: { type: 'object' },
|
|
328
|
+
result: { type: 'object' },
|
|
329
|
+
warningCounts: { type: 'object' },
|
|
330
|
+
withinTolerance: { type: ['boolean', 'null'] },
|
|
331
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
332
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
333
|
+
},
|
|
334
|
+
required: [
|
|
335
|
+
'artifactType',
|
|
336
|
+
'identical',
|
|
337
|
+
'artifactIds',
|
|
338
|
+
'inputs',
|
|
339
|
+
'producedBy',
|
|
340
|
+
'result',
|
|
341
|
+
'warningCounts',
|
|
342
|
+
'withinTolerance',
|
|
343
|
+
'assumptions',
|
|
344
|
+
'diagnostics',
|
|
345
|
+
],
|
|
346
|
+
},
|
|
347
|
+
costClass: 'medium',
|
|
348
|
+
run: (input) => {
|
|
349
|
+
const result = compareAnalysisArtifacts({
|
|
350
|
+
baseline: readAnalysisArtifact({ artifact: input.baseline }).artifact,
|
|
351
|
+
candidate: readAnalysisArtifact({ artifact: input.candidate }).artifact,
|
|
352
|
+
...(input.tolerance !== undefined ? { tolerance: input.tolerance } : {}),
|
|
353
|
+
...(input.limits !== undefined ? { limits: input.limits } : {}),
|
|
354
|
+
});
|
|
355
|
+
return {
|
|
356
|
+
summary: result.identical
|
|
357
|
+
? `${result.artifactType}: identical`
|
|
358
|
+
: `${result.artifactType}: ${result.result.differenceCount} differences over ${result.result.comparedLeafCount} leaves${result.withinTolerance === null ? '' : result.withinTolerance ? ' (within tolerance)' : ' (outside tolerance)'}`,
|
|
359
|
+
structured: result,
|
|
360
|
+
};
|
|
361
|
+
},
|
|
362
|
+
});
|
|
363
|
+
// ── portfolio.analyze (snapshot + timeline + monitor under one assumptions) ──────────────────
|
|
364
|
+
const TargetGroupSchema = schema
|
|
365
|
+
.object({
|
|
366
|
+
instrumentId: schema.string().optional(),
|
|
367
|
+
sleeveId: schema.string().optional(),
|
|
368
|
+
assetClass: schema.string().optional(),
|
|
369
|
+
currency: schema.string().optional(),
|
|
370
|
+
tag: schema.string().optional(),
|
|
371
|
+
underlying: schema.string().optional(),
|
|
372
|
+
strategy: schema.string().optional(),
|
|
373
|
+
})
|
|
374
|
+
.describe('Exactly one group key');
|
|
375
|
+
const AllocationTargetSchema = schema.object({
|
|
376
|
+
group: TargetGroupSchema,
|
|
377
|
+
weight: schema.number().optional(),
|
|
378
|
+
riskBudget: schema.number().optional(),
|
|
379
|
+
driftBand: schema.number().optional(),
|
|
380
|
+
});
|
|
381
|
+
const BenchmarkIdentitySchema = schema.object({
|
|
382
|
+
benchmarkId: schema.string().nonempty(),
|
|
383
|
+
asOf: epochMsOrDate.optional(),
|
|
384
|
+
constituents: schema
|
|
385
|
+
.array(schema.object({ instrumentId: schema.string(), weight: schema.number() }))
|
|
386
|
+
.optional(),
|
|
387
|
+
});
|
|
388
|
+
const InvestmentPolicySchema = schema.object({
|
|
389
|
+
targets: schema.array(AllocationTargetSchema).optional(),
|
|
390
|
+
model: schema
|
|
391
|
+
.record(schema.unknown())
|
|
392
|
+
.optional()
|
|
393
|
+
.describe('A model portfolio envelope (totalfinance.model-portfolio), validated by the policy grammar'),
|
|
394
|
+
withinGroupAllocation: schema.enum(['proportional-to-current', 'equal']).optional(),
|
|
395
|
+
driftBand: schema.number().optional(),
|
|
396
|
+
reviewCadenceDays: schema.number().optional(),
|
|
397
|
+
maximumTurnover: schema.number().optional(),
|
|
398
|
+
maximumEstimatedTransactionCost: schema.number().optional(),
|
|
399
|
+
minimumCash: schema.number().optional(),
|
|
400
|
+
minimumCashWeight: schema.number().optional(),
|
|
401
|
+
limits: schema
|
|
402
|
+
.object({
|
|
403
|
+
maximumPositionWeight: schema.number().optional(),
|
|
404
|
+
maximumGroupWeights: schema
|
|
405
|
+
.array(schema.object({ group: TargetGroupSchema, maximumWeight: schema.number() }))
|
|
406
|
+
.optional(),
|
|
407
|
+
maximumGrossLeverage: schema.number().optional(),
|
|
408
|
+
maximumDrawdown: schema.number().optional(),
|
|
409
|
+
maximumDailyLoss: schema.number().optional(),
|
|
410
|
+
maximumDaysToLiquidate: schema.number().optional(),
|
|
411
|
+
minimumSettledCash: schema.number().optional(),
|
|
412
|
+
})
|
|
413
|
+
.optional(),
|
|
414
|
+
allowedInstruments: schema.array(schema.string()).optional(),
|
|
415
|
+
restrictedInstruments: schema.array(schema.string()).optional(),
|
|
416
|
+
allowedAccounts: schema.array(schema.string()).optional(),
|
|
417
|
+
benchmark: BenchmarkIdentitySchema.optional(),
|
|
418
|
+
performanceObjective: schema.string().optional(),
|
|
419
|
+
contributionHandling: schema.enum(['invest-to-targets', 'hold-as-cash']).optional(),
|
|
420
|
+
withdrawalHandling: schema.enum(['raise-from-overweights', 'pro-rata']).optional(),
|
|
421
|
+
incomeReinvestment: schema.enum(['reinvest', 'hold-as-cash']).optional(),
|
|
422
|
+
lotSelectionObjective: schema.string().optional(),
|
|
423
|
+
});
|
|
424
|
+
const nullableNumber = schema.union([schema.number(), schema.null()]);
|
|
425
|
+
const MonitorStateSchema = schema.object({
|
|
426
|
+
schemaVersion: schema.number().integer(),
|
|
427
|
+
asOf: schema.number(),
|
|
428
|
+
netAssetValue: nullableNumber,
|
|
429
|
+
peakNetAssetValue: nullableNumber,
|
|
430
|
+
evaluationCount: schema.number().integer().nonnegative(),
|
|
431
|
+
rules: schema.record(schema.object({
|
|
432
|
+
active: schema.boolean(),
|
|
433
|
+
consecutiveBreaches: schema.number().integer().nonnegative(),
|
|
434
|
+
lastRaisedAtMs: nullableNumber,
|
|
435
|
+
acknowledged: schema.boolean(),
|
|
436
|
+
lastValue: nullableNumber,
|
|
437
|
+
})),
|
|
438
|
+
});
|
|
439
|
+
const MonitorRuleSchema = schema.object({
|
|
440
|
+
enabled: schema.boolean().optional(),
|
|
441
|
+
threshold: schema.number().optional(),
|
|
442
|
+
direction: schema.enum(['above', 'below']).optional(),
|
|
443
|
+
hysteresis: schema.object({ enter: schema.number(), exit: schema.number() }).optional(),
|
|
444
|
+
debounceEvaluations: schema.number().integer().positive().optional().describe('Default 1'),
|
|
445
|
+
cooldownMs: schema.number().nonnegative().optional().describe('Default 0'),
|
|
446
|
+
severity: schema.enum(['informational', 'warning', 'critical']).optional(),
|
|
447
|
+
});
|
|
448
|
+
const MonitorRequestSchema = schema
|
|
449
|
+
.object({
|
|
450
|
+
policy: InvestmentPolicySchema,
|
|
451
|
+
previousState: schema
|
|
452
|
+
.union([MonitorStateSchema, schema.null()])
|
|
453
|
+
.describe("The prior evaluation's state, or null for the first evaluation — required, exactly as monitorPortfolio requires it"),
|
|
454
|
+
rules: schema.record(MonitorRuleSchema).optional().describe('Per alert family'),
|
|
455
|
+
acknowledgments: schema.array(schema.string()).optional(),
|
|
456
|
+
averageDailyVolumes: schema.record(schema.number()).optional(),
|
|
457
|
+
marketStalenessLimitMs: schema.number().optional(),
|
|
458
|
+
unusualPnlThreshold: schema.number().optional(),
|
|
459
|
+
residualTolerance: schema.number().optional(),
|
|
460
|
+
optionExpirationWarningDays: schema.number().optional(),
|
|
461
|
+
assignmentRiskMoneyness: schema.number().optional(),
|
|
462
|
+
})
|
|
463
|
+
.describe('monitorPortfolio inputs beyond the shared portfolio / market / asOf / currencyConversions');
|
|
464
|
+
const PortfolioAnalyzeInputSchema = schema.object({
|
|
465
|
+
ledger: PortfolioLedgerEnvelopeSchema,
|
|
466
|
+
asOf: epochMsOrDate.describe('The valuation and monitoring instant'),
|
|
467
|
+
market: MarketSnapshotSchema,
|
|
468
|
+
currencyConversions: schema.array(CurrencyPairQuoteSchema).optional(),
|
|
469
|
+
instrumentClassification: InstrumentClassificationSchema.optional(),
|
|
470
|
+
marks: schema
|
|
471
|
+
.array(ValuationMarkSchema)
|
|
472
|
+
.min(2)
|
|
473
|
+
.optional()
|
|
474
|
+
.describe('At least two dated marks, strictly ascending — adds portfolioTimeline when supplied'),
|
|
475
|
+
monitor: MonitorRequestSchema.optional().describe('Adds monitorPortfolio when supplied'),
|
|
476
|
+
});
|
|
477
|
+
const portfolioAnalyze = defineOperation({
|
|
478
|
+
id: 'totalfinance.portfolio.analyze',
|
|
479
|
+
handleFields: ['ledger', 'market'],
|
|
480
|
+
title: 'Analyze a portfolio (snapshot, timeline, monitor)',
|
|
481
|
+
description: 'One report of up to three direct results: the valuation snapshot at `asOf` (always), the dated timeline with ' +
|
|
482
|
+
'P&L since each prior mark and drawdown (when `marks` are supplied), and the policy monitor with its alerts and ' +
|
|
483
|
+
'carried state (when `monitor` is supplied). Each result is the direct function verbatim; nothing is aggregated ' +
|
|
484
|
+
'across them, and one `assumptions` says which parts ran and why the others did not.',
|
|
485
|
+
inputSchema: PortfolioAnalyzeInputSchema,
|
|
486
|
+
outputSchema: {
|
|
487
|
+
type: 'object',
|
|
488
|
+
properties: {
|
|
489
|
+
snapshot: { type: 'object', description: 'portfolioSnapshot(...) verbatim' },
|
|
490
|
+
timeline: {
|
|
491
|
+
type: ['object', 'null'],
|
|
492
|
+
description: 'portfolioTimeline(...) verbatim, or null when no marks were supplied',
|
|
493
|
+
},
|
|
494
|
+
monitor: {
|
|
495
|
+
type: ['object', 'null'],
|
|
496
|
+
description: 'monitorPortfolio(...) verbatim, or null when no monitor request was supplied',
|
|
497
|
+
},
|
|
498
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
499
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
500
|
+
},
|
|
501
|
+
required: ['snapshot', 'timeline', 'monitor', 'assumptions', 'diagnostics'],
|
|
502
|
+
},
|
|
503
|
+
costClass: 'medium',
|
|
504
|
+
run: (input) => {
|
|
505
|
+
const { ledger } = readPortfolioLedgerSnapshot({ snapshot: input.ledger });
|
|
506
|
+
const shared = {
|
|
507
|
+
market: input.market,
|
|
508
|
+
asOf: input.asOf,
|
|
509
|
+
...(input.currencyConversions !== undefined
|
|
510
|
+
? { currencyConversions: input.currencyConversions }
|
|
511
|
+
: {}),
|
|
512
|
+
};
|
|
513
|
+
const classification = input.instrumentClassification !== undefined
|
|
514
|
+
? { instrumentClassification: input.instrumentClassification }
|
|
515
|
+
: {};
|
|
516
|
+
const snapshot = portfolioSnapshot({ portfolio: ledger.state, ...shared });
|
|
517
|
+
const timeline = input.marks !== undefined
|
|
518
|
+
? portfolioTimeline({ ledger, valuationMarks: input.marks, ...classification })
|
|
519
|
+
: null;
|
|
520
|
+
const monitor = input.monitor !== undefined
|
|
521
|
+
? monitorPortfolio({
|
|
522
|
+
portfolio: ledger.state,
|
|
523
|
+
...shared,
|
|
524
|
+
...classification,
|
|
525
|
+
...input.monitor,
|
|
526
|
+
})
|
|
527
|
+
: null;
|
|
528
|
+
const warnings = [
|
|
529
|
+
...snapshot.diagnostics.warnings,
|
|
530
|
+
...(timeline?.diagnostics.warnings ?? []),
|
|
531
|
+
...(monitor?.diagnostics.warnings ?? []),
|
|
532
|
+
];
|
|
533
|
+
return {
|
|
534
|
+
summary: `NAV ${snapshot.netAssetValue.toFixed(2)} ${snapshot.baseCurrency}${timeline ? `; ${timeline.rows.length} marks` : ''}${monitor ? `; ${monitor.alerts.length} alerts` : ''}`,
|
|
535
|
+
structured: {
|
|
536
|
+
snapshot,
|
|
537
|
+
timeline,
|
|
538
|
+
monitor,
|
|
539
|
+
assumptions: {
|
|
540
|
+
ledger: {
|
|
541
|
+
portfolioId: ledger.portfolioId ?? null,
|
|
542
|
+
baseCurrency: ledger.baseCurrency,
|
|
543
|
+
lotRelief: ledger.lotRelief,
|
|
544
|
+
eventCount: ledger.state.eventCount,
|
|
545
|
+
},
|
|
546
|
+
asOf: snapshot.asOf,
|
|
547
|
+
timeline: timeline
|
|
548
|
+
? `portfolioTimeline over ${input.marks.length} marks`
|
|
549
|
+
: 'omitted: no marks supplied',
|
|
550
|
+
monitor: monitor
|
|
551
|
+
? 'monitorPortfolio under the supplied policy'
|
|
552
|
+
: 'omitted: no monitor request supplied',
|
|
553
|
+
},
|
|
554
|
+
diagnostics: { warnings },
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
},
|
|
558
|
+
});
|
|
559
|
+
// ── Stage 4.7 slice 2 (FC9 Decision 5): the rebalance proposal over the wire ──────────────────
|
|
560
|
+
const RebalanceProposalInputSchema = schema.object({
|
|
561
|
+
ledger: PortfolioLedgerEnvelopeSchema,
|
|
562
|
+
asOf: epochMsOrDate.describe('The valuation instant the proposal is sized at'),
|
|
563
|
+
market: MarketSnapshotSchema,
|
|
564
|
+
currencyConversions: schema.array(CurrencyPairQuoteSchema).optional(),
|
|
565
|
+
policy: InvestmentPolicySchema.describe('Targets come from the policy (inline targets or a model)'),
|
|
566
|
+
instrumentClassification: InstrumentClassificationSchema.optional(),
|
|
567
|
+
scope: schema
|
|
568
|
+
.enum(['to-target', 'drift-only'])
|
|
569
|
+
.describe("'to-target' trades every target to weight; 'drift-only' trades only targets outside their band"),
|
|
570
|
+
externalFlow: schema
|
|
571
|
+
.object({ amount: schema.number(), currency: schema.string().nonempty() })
|
|
572
|
+
.optional()
|
|
573
|
+
.describe('A contribution (positive) or withdrawal (negative) the proposal sizes around'),
|
|
574
|
+
tradingAccountId: schema.string().optional(),
|
|
575
|
+
averageDailyVolumes: schema.record(schema.number()).optional(),
|
|
576
|
+
lotSizes: schema.record(schema.number()).optional(),
|
|
577
|
+
defaultLotSize: schema.number().positive().optional(),
|
|
578
|
+
minimumNotional: schema.number().nonnegative().optional(),
|
|
579
|
+
transactionCosts: schema
|
|
580
|
+
.object({
|
|
581
|
+
commissionPerTrade: schema.number().nonnegative().optional(),
|
|
582
|
+
commissionPerUnit: schema.number().nonnegative().optional(),
|
|
583
|
+
spreadBasisPoints: schema.number().nonnegative().optional(),
|
|
584
|
+
slippageBasisPoints: schema.number().nonnegative().optional(),
|
|
585
|
+
})
|
|
586
|
+
.optional(),
|
|
587
|
+
});
|
|
588
|
+
const portfolioRebalanceProposal = defineOperation({
|
|
589
|
+
id: 'totalfinance.portfolio.rebalance_proposal',
|
|
590
|
+
title: 'Propose a rebalance (a proposal, never an order)',
|
|
591
|
+
description: 'Fold the ledger snapshot to its state, mark it from the market snapshot, and propose the trades that take the ' +
|
|
592
|
+
'portfolio to the policy targets (or only the drifted ones) under the policy limits, lot sizes, minimum notional, ' +
|
|
593
|
+
'transaction-cost estimates, and an optional external flow. The result is proposePortfolioRebalance(...) verbatim: ' +
|
|
594
|
+
'weights before and after, the cash summary, the trades with their estimates, the objective, and every target it ' +
|
|
595
|
+
'could not resolve. Read-only by construction — it returns a proposal and places nothing. Opt-in (portfolioPack).',
|
|
596
|
+
inputSchema: RebalanceProposalInputSchema,
|
|
597
|
+
// B6: a proposal is the first step of a trade; proposing is a capability (held by default).
|
|
598
|
+
requiredCapabilities: ['trade:propose'],
|
|
599
|
+
outputSchema: {
|
|
600
|
+
type: 'object',
|
|
601
|
+
properties: {
|
|
602
|
+
asOf: { type: 'number' },
|
|
603
|
+
baseCurrency: { type: 'string' },
|
|
604
|
+
netAssetValue: { type: 'number' },
|
|
605
|
+
netAssetValueAfterFlow: { type: 'number' },
|
|
606
|
+
weights: { type: 'object' },
|
|
607
|
+
cash: { type: 'object' },
|
|
608
|
+
trades: { type: 'array', items: { type: 'object' } },
|
|
609
|
+
estimates: { type: 'object' },
|
|
610
|
+
objective: { type: 'object' },
|
|
611
|
+
unresolvedTargets: { type: 'array', items: { type: 'object' } },
|
|
612
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
613
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
614
|
+
},
|
|
615
|
+
required: [
|
|
616
|
+
'asOf',
|
|
617
|
+
'baseCurrency',
|
|
618
|
+
'netAssetValue',
|
|
619
|
+
'netAssetValueAfterFlow',
|
|
620
|
+
'weights',
|
|
621
|
+
'cash',
|
|
622
|
+
'trades',
|
|
623
|
+
'estimates',
|
|
624
|
+
'objective',
|
|
625
|
+
'unresolvedTargets',
|
|
626
|
+
'assumptions',
|
|
627
|
+
'diagnostics',
|
|
628
|
+
],
|
|
629
|
+
},
|
|
630
|
+
costClass: 'medium',
|
|
631
|
+
handleFields: ['ledger', 'market'],
|
|
632
|
+
run: (input) => {
|
|
633
|
+
const { ledger: envelope, ...rest } = input;
|
|
634
|
+
const { ledger } = readPortfolioLedgerSnapshot({ snapshot: envelope });
|
|
635
|
+
const result = proposePortfolioRebalance({
|
|
636
|
+
portfolio: ledger.state,
|
|
637
|
+
...rest,
|
|
638
|
+
});
|
|
639
|
+
return {
|
|
640
|
+
summary: `${result.trades.length} trade${result.trades.length === 1 ? '' : 's'} proposed on NAV ${result.netAssetValue.toFixed(2)} ${result.baseCurrency} (${input.scope})${result.unresolvedTargets.length > 0 ? `; ${result.unresolvedTargets.length} unresolved target${result.unresolvedTargets.length === 1 ? '' : 's'}` : ''}`,
|
|
641
|
+
structured: result,
|
|
642
|
+
};
|
|
643
|
+
},
|
|
644
|
+
});
|
|
645
|
+
// ── scenarios ─────────────────────────────────────────────────────────────────────────────────
|
|
646
|
+
const TargetTagsSchema = schema.array(schema.string()).optional();
|
|
647
|
+
const SpotTargetSchema = schema.object({
|
|
648
|
+
kind: schema.literal('spot'),
|
|
649
|
+
id: schema.string().nonempty(),
|
|
650
|
+
symbol: schema.string().nonempty(),
|
|
651
|
+
quantity: schema.number(),
|
|
652
|
+
currency: schema.string(),
|
|
653
|
+
strategy: schema.string().optional(),
|
|
654
|
+
account: schema.string().optional(),
|
|
655
|
+
book: schema.string().optional(),
|
|
656
|
+
tags: TargetTagsSchema,
|
|
657
|
+
});
|
|
658
|
+
/** Greeks in the one unit system (the options package's): per unit of the target. */
|
|
659
|
+
const TaylorSensitivitiesSchema = schema.object({
|
|
660
|
+
delta: schema.number().optional().describe('∂V/∂S per $1 of spot'),
|
|
661
|
+
gamma: schema.number().optional().describe('∂²V/∂S² per $1²'),
|
|
662
|
+
vega: schema
|
|
663
|
+
.number()
|
|
664
|
+
.optional()
|
|
665
|
+
.describe('∂V/∂σ per 1 volatility POINT (0.01), as option.greeks reports it'),
|
|
666
|
+
theta: schema.number().optional().describe('∂V/∂t per CALENDAR DAY, as option.greeks reports it'),
|
|
667
|
+
rho: schema.number().optional().describe('∂V/∂r per 1% rate (0.01), as option.greeks reports it'),
|
|
668
|
+
vanna: schema.number().optional().describe('∂Δ/∂σ per 1.00 σ per $'),
|
|
669
|
+
vomma: schema.number().optional().describe('∂²V/∂σ² per 1.00 σ²'),
|
|
670
|
+
charm: schema
|
|
671
|
+
.number()
|
|
672
|
+
.optional()
|
|
673
|
+
.describe('∂Δ/∂T per year of time-to-expiry (options-package sign)'),
|
|
674
|
+
veta: schema.number().optional().describe('∂vega/∂T per year, vega per 1.00 σ'),
|
|
675
|
+
vera: schema.number().optional().describe('∂²V/∂σ∂r per 1.00 σ per 1.00 rate'),
|
|
676
|
+
deltaRate: schema.number().optional().describe('∂Δ/∂r per $ per 1% rate'),
|
|
677
|
+
thetaRate: schema.number().optional().describe('∂Θ/∂r per calendar day per 1% rate'),
|
|
678
|
+
rhoConvexity: schema.number().optional().describe('∂²V/∂r² per (1%)²'),
|
|
679
|
+
thetaConvexity: schema.number().optional().describe('∂²V/∂t² per calendar day²'),
|
|
680
|
+
phi: schema.number().optional().describe('∂V/∂q per 1% dividend yield (dividend rho)'),
|
|
681
|
+
});
|
|
682
|
+
const TaylorFactorLevelSchema = schema.object({ subject: schema.string(), level: schema.number() });
|
|
683
|
+
const TaylorFactorsSchema = schema.object({
|
|
684
|
+
spot: TaylorFactorLevelSchema.optional(),
|
|
685
|
+
volatility: TaylorFactorLevelSchema.optional(),
|
|
686
|
+
riskFreeRate: TaylorFactorLevelSchema.optional(),
|
|
687
|
+
dividend: TaylorFactorLevelSchema.optional(),
|
|
688
|
+
valuationInstant: schema.object({ level: schema.number() }).optional(),
|
|
689
|
+
});
|
|
690
|
+
const TaylorTargetSchema = schema.object({
|
|
691
|
+
kind: schema.literal('taylor'),
|
|
692
|
+
id: schema.string().nonempty(),
|
|
693
|
+
quantity: schema.number(),
|
|
694
|
+
contractMultiplier: schema.number(),
|
|
695
|
+
currency: schema.string(),
|
|
696
|
+
underlying: schema.string().optional(),
|
|
697
|
+
strategy: schema.string().optional(),
|
|
698
|
+
account: schema.string().optional(),
|
|
699
|
+
book: schema.string().optional(),
|
|
700
|
+
tags: TargetTagsSchema,
|
|
701
|
+
baseValuePerUnit: schema.number(),
|
|
702
|
+
greeks: TaylorSensitivitiesSchema,
|
|
703
|
+
factors: TaylorFactorsSchema,
|
|
704
|
+
});
|
|
705
|
+
const TaylorBindingSchema = schema.object({
|
|
706
|
+
id: schema.string().nonempty(),
|
|
707
|
+
accountId: schema.string().nonempty(),
|
|
708
|
+
instrumentId: schema.string().nonempty(),
|
|
709
|
+
strategy: schema.string().optional(),
|
|
710
|
+
book: schema.string().optional(),
|
|
711
|
+
tags: TargetTagsSchema,
|
|
712
|
+
baseValuePerUnit: schema.number(),
|
|
713
|
+
greeks: TaylorSensitivitiesSchema,
|
|
714
|
+
factors: TaylorFactorsSchema,
|
|
715
|
+
});
|
|
716
|
+
const PortfolioTargetSchema = schema.object({
|
|
717
|
+
kind: schema.literal('portfolio'),
|
|
718
|
+
portfolio: schema
|
|
719
|
+
.union([PortfolioLedgerEnvelopeSchema, PortfolioStateSchema])
|
|
720
|
+
.describe('The ledger envelope or PortfolioState whose open positions become targets'),
|
|
721
|
+
bindings: schema
|
|
722
|
+
.array(TaylorBindingSchema)
|
|
723
|
+
.min(1)
|
|
724
|
+
.describe('Exactly one Taylor binding per open (accountId, instrumentId) position — the serializable binding kind'),
|
|
725
|
+
});
|
|
726
|
+
const ScenarioRunInputSchema = schema.object({
|
|
727
|
+
scenarioSet: ScenarioSetSchema,
|
|
728
|
+
market: MarketSnapshotSchema,
|
|
729
|
+
targets: schema
|
|
730
|
+
.array(schema.union([SpotTargetSchema, TaylorTargetSchema, PortfolioTargetSchema]))
|
|
731
|
+
.min(1)
|
|
732
|
+
.describe("Wire targets: kind 'spot' (scenarioTarget.spot), 'taylor' (scenarioTarget.taylor), or 'portfolio' (scenarioTargetsFromPortfolio with Taylor bindings). A custom pricer target is SDK-only."),
|
|
733
|
+
reportingCurrency: schema.string().optional(),
|
|
734
|
+
currencyConversions: schema.array(CurrencyPairQuoteSchema).optional(),
|
|
735
|
+
options: schema
|
|
736
|
+
.object({
|
|
737
|
+
failureMode: schema.enum(['fail-fast', 'collect']).optional(),
|
|
738
|
+
seed: schema.number().integer().nonnegative().optional(),
|
|
739
|
+
maximumValuationCells: schema.number().integer().positive().optional(),
|
|
740
|
+
maximumWorkUnits: schema.number().integer().positive().optional(),
|
|
741
|
+
})
|
|
742
|
+
.optional()
|
|
743
|
+
.describe('Execution options; market resolvers and factor handlers are SDK-only callbacks'),
|
|
744
|
+
});
|
|
745
|
+
const SCENARIO_RUN_OUTPUT = {
|
|
746
|
+
type: 'object',
|
|
747
|
+
properties: {
|
|
748
|
+
layout: { type: 'object', description: 'scenario-major cell layout and the index formula' },
|
|
749
|
+
scenarioAxis: { type: 'array', items: { type: 'object' } },
|
|
750
|
+
targetAxis: { type: 'array', items: { type: 'object' } },
|
|
751
|
+
base: { type: 'array', items: { type: 'object' } },
|
|
752
|
+
cells: { type: 'array', items: { type: 'object' } },
|
|
753
|
+
aggregates: { type: 'object' },
|
|
754
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
755
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
756
|
+
},
|
|
757
|
+
required: [
|
|
758
|
+
'layout',
|
|
759
|
+
'scenarioAxis',
|
|
760
|
+
'targetAxis',
|
|
761
|
+
'base',
|
|
762
|
+
'cells',
|
|
763
|
+
'aggregates',
|
|
764
|
+
'assumptions',
|
|
765
|
+
'diagnostics',
|
|
766
|
+
],
|
|
767
|
+
};
|
|
768
|
+
const scenarioRun = defineOperation({
|
|
769
|
+
id: 'totalfinance.scenario.run',
|
|
770
|
+
handleFields: ['scenarioSet', 'market'],
|
|
771
|
+
title: 'Run a scenario set against targets',
|
|
772
|
+
description: 'Revalue every target under every scenario of a Gate B scenario set against a Gate B market snapshot: a ' +
|
|
773
|
+
'scenario-major cell grid with base values, per-cell P&L in local and reporting currency, and per-scenario ' +
|
|
774
|
+
'aggregates. Targets are the serializable kinds — spot assets, Taylor (greeks) positions, and a portfolio bound ' +
|
|
775
|
+
'through Taylor bindings. The result is runScenarios(...) verbatim.',
|
|
776
|
+
inputSchema: ScenarioRunInputSchema,
|
|
777
|
+
outputSchema: SCENARIO_RUN_OUTPUT,
|
|
778
|
+
costClass: 'large',
|
|
779
|
+
run: (input) => {
|
|
780
|
+
const { scenarioSet } = readScenarioSet({ scenarioSet: input.scenarioSet });
|
|
781
|
+
const { snapshot } = readMarketSnapshot({ snapshot: input.market });
|
|
782
|
+
const targets = input.targets.flatMap((target) => {
|
|
783
|
+
if (target.kind === 'spot') {
|
|
784
|
+
const { kind: _kind, ...rest } = target;
|
|
785
|
+
return [scenarioTarget.spot(rest)];
|
|
786
|
+
}
|
|
787
|
+
if (target.kind === 'taylor') {
|
|
788
|
+
const { kind: _kind, ...rest } = target;
|
|
789
|
+
return [scenarioTarget.taylor(rest)];
|
|
790
|
+
}
|
|
791
|
+
const { kind: _kind, portfolio, bindings } = target;
|
|
792
|
+
return [
|
|
793
|
+
...scenarioTargetsFromPortfolio({
|
|
794
|
+
state: portfolioStateOf(portfolio),
|
|
795
|
+
bindings: bindings.map((binding) => scenarioPortfolioBinding.taylor(binding)),
|
|
796
|
+
}),
|
|
797
|
+
];
|
|
798
|
+
});
|
|
799
|
+
const result = runScenarios({
|
|
800
|
+
scenarioSet,
|
|
801
|
+
market: snapshot,
|
|
802
|
+
targets,
|
|
803
|
+
...(input.reportingCurrency !== undefined
|
|
804
|
+
? { reportingCurrency: input.reportingCurrency }
|
|
805
|
+
: {}),
|
|
806
|
+
...(input.currencyConversions !== undefined
|
|
807
|
+
? { currencyConversions: input.currencyConversions }
|
|
808
|
+
: {}),
|
|
809
|
+
...(input.options !== undefined ? { options: input.options } : {}),
|
|
810
|
+
});
|
|
811
|
+
return {
|
|
812
|
+
summary: `${result.layout.scenarioCount} scenarios × ${result.layout.targetCount} targets = ${result.layout.cellCount} cells`,
|
|
813
|
+
structured: result,
|
|
814
|
+
};
|
|
815
|
+
},
|
|
816
|
+
});
|
|
817
|
+
// ── research ──────────────────────────────────────────────────────────────────────────────────
|
|
818
|
+
const FieldDefinitionSchema = schema.object({
|
|
819
|
+
fieldName: schema.string().nonempty(),
|
|
820
|
+
kind: schema.enum(['numeric', 'category', 'text', 'boolean']),
|
|
821
|
+
unit: schema.string().optional(),
|
|
822
|
+
description: schema.string().optional(),
|
|
823
|
+
});
|
|
824
|
+
const ObservedValueSchema = schema.union([
|
|
825
|
+
schema.number(),
|
|
826
|
+
schema.string(),
|
|
827
|
+
schema.boolean(),
|
|
828
|
+
schema.null(),
|
|
829
|
+
]);
|
|
830
|
+
const UniverseObservationSchema = schema.object({
|
|
831
|
+
instrumentId: schema.string().nonempty(),
|
|
832
|
+
availableTimestampMs: schema.number(),
|
|
833
|
+
fields: schema
|
|
834
|
+
.record(ObservedValueSchema)
|
|
835
|
+
.describe('Declared fields only; null is a stated missing value'),
|
|
836
|
+
});
|
|
837
|
+
const UniverseSchema = {
|
|
838
|
+
universeId: schema.string().nonempty(),
|
|
839
|
+
asOf: schema
|
|
840
|
+
.number()
|
|
841
|
+
.describe('Epoch ms; the latest observation at or before it is used per instrument'),
|
|
842
|
+
observations: schema.array(UniverseObservationSchema),
|
|
843
|
+
fieldDefinitions: schema.array(FieldDefinitionSchema).min(1),
|
|
844
|
+
};
|
|
845
|
+
const MissingValuePolicySchema = schema.enum(['exclude', 'evaluate-as-false']);
|
|
846
|
+
const ScreenInputSchema = schema.object({
|
|
847
|
+
...UniverseSchema,
|
|
848
|
+
filter: schema
|
|
849
|
+
.record(schema.unknown())
|
|
850
|
+
.optional()
|
|
851
|
+
.describe('A ScreenFilter tree — { all: [...] } | { any: [...] } | { not: ... } | { field, operator, value } | ' +
|
|
852
|
+
"{ field, operator: 'between', from, to } | { field, operator: 'in' | 'notIn', values } | " +
|
|
853
|
+
"{ field, operator: 'isPresent' | 'isMissing' } — validated node by node by screenUniverse; omitted = every eligible row passes"),
|
|
854
|
+
missingValuePolicy: MissingValuePolicySchema,
|
|
855
|
+
orderBy: schema.array(schema.object({
|
|
856
|
+
field: schema.string(),
|
|
857
|
+
direction: schema.enum(['ascending', 'descending']),
|
|
858
|
+
})),
|
|
859
|
+
limit: schema.number().integer().nonnegative().optional(),
|
|
860
|
+
});
|
|
861
|
+
const RESEARCH_ROWS_OUTPUT = (rowDescription) => ({
|
|
862
|
+
type: 'object',
|
|
863
|
+
properties: {
|
|
864
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
865
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
866
|
+
rows: { type: 'array', items: { type: 'object' }, description: rowDescription },
|
|
867
|
+
},
|
|
868
|
+
required: ['assumptions', 'diagnostics', 'rows'],
|
|
869
|
+
});
|
|
870
|
+
const researchScreen = defineOperation({
|
|
871
|
+
id: 'totalfinance.research.screen',
|
|
872
|
+
title: 'Screen a universe',
|
|
873
|
+
description: 'Filter a point-in-time universe of instrument observations with a declarative filter tree, order the survivors, ' +
|
|
874
|
+
'and optionally limit them — a replayable screen by construction (no caller predicate crosses the wire). ' +
|
|
875
|
+
'The result is screenUniverse(...) verbatim.',
|
|
876
|
+
inputSchema: ScreenInputSchema,
|
|
877
|
+
outputSchema: RESEARCH_ROWS_OUTPUT('{ instrumentId, availableTimestampMs, fields }'),
|
|
878
|
+
costClass: 'medium',
|
|
879
|
+
run: (input) => {
|
|
880
|
+
const observations = capRows(input.observations, 'observations', 'totalfinance.research.screen');
|
|
881
|
+
const result = screenUniverse({ ...input, observations, filter: input.filter });
|
|
882
|
+
return {
|
|
883
|
+
summary: `${result.rows.length} of ${result.diagnostics.suppliedCount} instruments pass (${result.diagnostics.excludedCount} excluded)`,
|
|
884
|
+
structured: result,
|
|
885
|
+
};
|
|
886
|
+
},
|
|
887
|
+
});
|
|
888
|
+
const researchRank = defineOperation({
|
|
889
|
+
id: 'totalfinance.research.rank',
|
|
890
|
+
title: 'Rank a universe',
|
|
891
|
+
description: 'Rank a point-in-time universe by one declared numeric field with an explicit tie policy (competition, dense, ' +
|
|
892
|
+
'ordinal) and missing-value policy. The result is rankUniverse(...) verbatim.',
|
|
893
|
+
inputSchema: schema.object({
|
|
894
|
+
...UniverseSchema,
|
|
895
|
+
rankBy: schema.object({
|
|
896
|
+
field: schema.string(),
|
|
897
|
+
direction: schema.enum(['ascending', 'descending']),
|
|
898
|
+
}),
|
|
899
|
+
tiePolicy: schema.enum(['competition', 'dense', 'ordinal']),
|
|
900
|
+
missingValuePolicy: MissingValuePolicySchema,
|
|
901
|
+
}),
|
|
902
|
+
outputSchema: RESEARCH_ROWS_OUTPUT('{ instrumentId, value, rank }'),
|
|
903
|
+
costClass: 'medium',
|
|
904
|
+
run: (input) => {
|
|
905
|
+
const observations = capRows(input.observations, 'observations', 'totalfinance.research.rank');
|
|
906
|
+
const result = rankUniverse({ ...input, observations });
|
|
907
|
+
return {
|
|
908
|
+
summary: `${result.rows.length} instruments ranked by ${input.rankBy.field} ${input.rankBy.direction}`,
|
|
909
|
+
structured: result,
|
|
910
|
+
};
|
|
911
|
+
},
|
|
912
|
+
});
|
|
913
|
+
const researchScore = defineOperation({
|
|
914
|
+
id: 'totalfinance.research.score',
|
|
915
|
+
title: 'Score a universe',
|
|
916
|
+
description: 'Score a point-in-time universe as a weighted composite of standardized components (z-score or percentile rank, ' +
|
|
917
|
+
'higher- or lower-is-better) with an explicit missing-value policy. The result is scoreUniverse(...) verbatim.',
|
|
918
|
+
inputSchema: schema.object({
|
|
919
|
+
...UniverseSchema,
|
|
920
|
+
components: schema
|
|
921
|
+
.array(schema.object({
|
|
922
|
+
field: schema.string(),
|
|
923
|
+
weight: schema.number().positive(),
|
|
924
|
+
direction: schema.enum(['higher-is-better', 'lower-is-better']),
|
|
925
|
+
standardization: schema.enum(['z-score', 'percentile-rank']),
|
|
926
|
+
}))
|
|
927
|
+
.min(1),
|
|
928
|
+
missingValuePolicy: schema.enum(['exclude', 'renormalize-weights']),
|
|
929
|
+
}),
|
|
930
|
+
outputSchema: RESEARCH_ROWS_OUTPUT('{ instrumentId, score, componentsUsed }'),
|
|
931
|
+
costClass: 'medium',
|
|
932
|
+
run: (input) => {
|
|
933
|
+
const observations = capRows(input.observations, 'observations', 'totalfinance.research.score');
|
|
934
|
+
const result = scoreUniverse({ ...input, observations });
|
|
935
|
+
return {
|
|
936
|
+
summary: `${result.rows.length} instruments scored over ${input.components.length} components`,
|
|
937
|
+
structured: result,
|
|
938
|
+
};
|
|
939
|
+
},
|
|
940
|
+
});
|
|
941
|
+
const TradingSessionWindowSchema = schema.object({
|
|
942
|
+
startTradingSessionOffset: schema.number().integer(),
|
|
943
|
+
endTradingSessionOffset: schema.number().integer(),
|
|
944
|
+
});
|
|
945
|
+
const EventStudyInputSchema = schema.object({
|
|
946
|
+
events: schema.array(schema.object({
|
|
947
|
+
eventId: schema.string().nonempty(),
|
|
948
|
+
instrumentId: schema.string().nonempty(),
|
|
949
|
+
eventType: schema.string(),
|
|
950
|
+
announcedTimestampMs: schema.number(),
|
|
951
|
+
effectiveTimestampMs: schema.number().optional(),
|
|
952
|
+
metadata: schema.record(schema.unknown()).optional(),
|
|
953
|
+
})),
|
|
954
|
+
returnObservations: schema.array(schema.object({
|
|
955
|
+
instrumentId: schema.string().nonempty(),
|
|
956
|
+
tradingSessionDate: schema.string().date(),
|
|
957
|
+
simpleReturn: schema.number(),
|
|
958
|
+
})),
|
|
959
|
+
marketReturns: schema
|
|
960
|
+
.array(schema.object({ tradingSessionDate: schema.string().date(), simpleReturn: schema.number() }))
|
|
961
|
+
.optional()
|
|
962
|
+
.describe("Required by the 'market-adjusted' and 'market' models"),
|
|
963
|
+
eventWindow: TradingSessionWindowSchema,
|
|
964
|
+
estimationWindow: TradingSessionWindowSchema.optional().describe("Required by 'mean-adjusted' and 'market'; must end strictly before the event window starts"),
|
|
965
|
+
expectedReturnModel: schema
|
|
966
|
+
.union([
|
|
967
|
+
schema.object({ model: schema.literal('mean-adjusted') }),
|
|
968
|
+
schema.object({ model: schema.literal('market-adjusted') }),
|
|
969
|
+
schema.object({ model: schema.literal('market') }),
|
|
970
|
+
])
|
|
971
|
+
.describe("The serializable models; a 'custom' expected-return function is SDK-only"),
|
|
972
|
+
sessionPolicy: schema.enum(['announcement-session', 'next-session']).optional(),
|
|
973
|
+
overlappingEventPolicy: schema.enum(['reject', 'allow-contaminated']),
|
|
974
|
+
cumulativeConvention: schema.enum(['sum', 'compound']).optional(),
|
|
975
|
+
});
|
|
976
|
+
const researchEventStudy = defineOperation({
|
|
977
|
+
id: 'totalfinance.research.event_study',
|
|
978
|
+
title: 'Run an event study',
|
|
979
|
+
description: 'Measure abnormal returns around dated events under a declared expected-return model (mean-adjusted, ' +
|
|
980
|
+
'market-adjusted, or market model), with explicit session, overlap, and cumulation policies; per-event rows and ' +
|
|
981
|
+
'cumulative abnormal returns, and the average abnormal return by offset with t-statistics. ' +
|
|
982
|
+
'The result is eventStudy(...) verbatim.',
|
|
983
|
+
inputSchema: EventStudyInputSchema,
|
|
984
|
+
outputSchema: {
|
|
985
|
+
type: 'object',
|
|
986
|
+
properties: {
|
|
987
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
988
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
989
|
+
events: { type: 'array', items: { type: 'object' } },
|
|
990
|
+
averageAbnormalReturns: { type: 'array', items: { type: 'object' } },
|
|
991
|
+
},
|
|
992
|
+
required: ['assumptions', 'diagnostics', 'events', 'averageAbnormalReturns'],
|
|
993
|
+
},
|
|
994
|
+
costClass: 'medium',
|
|
995
|
+
run: (input) => {
|
|
996
|
+
const id = 'totalfinance.research.event_study';
|
|
997
|
+
const result = eventStudy({
|
|
998
|
+
...input,
|
|
999
|
+
events: capRows(input.events, 'events', id),
|
|
1000
|
+
returnObservations: capRows(input.returnObservations, 'returnObservations', id),
|
|
1001
|
+
...(input.marketReturns !== undefined
|
|
1002
|
+
? { marketReturns: capRows(input.marketReturns, 'marketReturns', id) }
|
|
1003
|
+
: {}),
|
|
1004
|
+
});
|
|
1005
|
+
return {
|
|
1006
|
+
summary: `${result.diagnostics.eventsIncluded} of ${result.diagnostics.eventsSupplied} events studied under ${result.assumptions.expectedReturnModel}`,
|
|
1007
|
+
structured: result,
|
|
1008
|
+
};
|
|
1009
|
+
},
|
|
1010
|
+
});
|
|
1011
|
+
// ── options backtest (opt-in backtest pack) ───────────────────────────────────────────────────
|
|
1012
|
+
// B7: a chain row is the core `OptionQuote`; its Greeks ride `greeks` (vendor-supplied or from
|
|
1013
|
+
// `options.chainGreeks`), never a bare `delta` beside the row.
|
|
1014
|
+
const ChainQuoteSchema = OptionQuoteSchema;
|
|
1015
|
+
const ChainSnapshotSchema = schema.object({
|
|
1016
|
+
asOf: epochMsOrDate,
|
|
1017
|
+
underlyingPrice: schema.number().positive(),
|
|
1018
|
+
quotes: schema.array(ChainQuoteSchema),
|
|
1019
|
+
});
|
|
1020
|
+
const CostModelSchema = schema
|
|
1021
|
+
.union([
|
|
1022
|
+
schema.object({ model: schema.literal('none') }),
|
|
1023
|
+
schema.object({ model: schema.literal('bps'), bps: schema.number().nonnegative() }),
|
|
1024
|
+
schema.object({
|
|
1025
|
+
model: schema.literal('perShare'),
|
|
1026
|
+
amountPerShare: schema.number().nonnegative(),
|
|
1027
|
+
}),
|
|
1028
|
+
schema.object({ model: schema.literal('fixed'), amount: schema.number().nonnegative() }),
|
|
1029
|
+
])
|
|
1030
|
+
.describe('A declarative commission model (fees.none / bps / perShare / fixed)');
|
|
1031
|
+
const SlippageModelSchema = schema
|
|
1032
|
+
.union([
|
|
1033
|
+
schema.object({ model: schema.literal('none') }),
|
|
1034
|
+
schema.object({ model: schema.literal('bps'), bps: schema.number().nonnegative() }),
|
|
1035
|
+
schema.object({ model: schema.literal('fixed'), perShare: schema.number().nonnegative() }),
|
|
1036
|
+
schema.object({ model: schema.literal('spread'), spread: schema.number().nonnegative() }),
|
|
1037
|
+
])
|
|
1038
|
+
.describe('A declarative slippage model (slippage.none / bps / fixed / spread)');
|
|
1039
|
+
function costModelOf(wire) {
|
|
1040
|
+
switch (wire.model) {
|
|
1041
|
+
case 'none':
|
|
1042
|
+
return fees.none();
|
|
1043
|
+
case 'bps':
|
|
1044
|
+
return fees.bps(wire.bps);
|
|
1045
|
+
case 'perShare':
|
|
1046
|
+
return fees.perShare(wire.amountPerShare);
|
|
1047
|
+
case 'fixed':
|
|
1048
|
+
return fees.fixed(wire.amount);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
function slippageModelOf(wire) {
|
|
1052
|
+
switch (wire.model) {
|
|
1053
|
+
case 'none':
|
|
1054
|
+
return slippage.none();
|
|
1055
|
+
case 'bps':
|
|
1056
|
+
return slippage.bps(wire.bps);
|
|
1057
|
+
case 'fixed':
|
|
1058
|
+
return slippage.fixed(wire.perShare);
|
|
1059
|
+
case 'spread':
|
|
1060
|
+
return slippage.spread(wire.spread);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
const EntryCommon = {
|
|
1064
|
+
id: schema.string().nonempty().optional().describe('Names the rule in trades and rows'),
|
|
1065
|
+
when: schema
|
|
1066
|
+
.enum(['flat', 'always'])
|
|
1067
|
+
.optional()
|
|
1068
|
+
.describe("'flat' (default) enters only when no position is open; a caller predicate is SDK-only"),
|
|
1069
|
+
daysToExpiry: schema.object({
|
|
1070
|
+
target: schema.number(),
|
|
1071
|
+
min: schema.number().optional(),
|
|
1072
|
+
max: schema.number().optional(),
|
|
1073
|
+
}),
|
|
1074
|
+
sizing: schema
|
|
1075
|
+
.union([
|
|
1076
|
+
schema.object({ quantity: schema.number().positive() }),
|
|
1077
|
+
schema.object({ maxMarginFraction: schema.number().positive() }),
|
|
1078
|
+
])
|
|
1079
|
+
.optional()
|
|
1080
|
+
.describe('Default { quantity: 1 }'),
|
|
1081
|
+
price: schema.enum(['bid', 'ask', 'mid', 'last', 'mark']).optional(),
|
|
1082
|
+
};
|
|
1083
|
+
const EntryRuleSchema = schema
|
|
1084
|
+
.union([
|
|
1085
|
+
schema.object({
|
|
1086
|
+
...EntryCommon,
|
|
1087
|
+
structure: schema.literal('ironCondor'),
|
|
1088
|
+
select: schema.object({ shortDelta: schema.number(), wingWidth: schema.number() }),
|
|
1089
|
+
}),
|
|
1090
|
+
schema.object({
|
|
1091
|
+
...EntryCommon,
|
|
1092
|
+
structure: schema.enum([
|
|
1093
|
+
'bullCallSpread',
|
|
1094
|
+
'bearCallSpread',
|
|
1095
|
+
'bullPutSpread',
|
|
1096
|
+
'bearPutSpread',
|
|
1097
|
+
]),
|
|
1098
|
+
select: schema.object({ shortDelta: schema.number(), width: schema.number() }),
|
|
1099
|
+
}),
|
|
1100
|
+
schema.object({
|
|
1101
|
+
...EntryCommon,
|
|
1102
|
+
structure: schema.literal('strangle'),
|
|
1103
|
+
select: schema.object({ shortDelta: schema.number() }),
|
|
1104
|
+
}),
|
|
1105
|
+
schema.object({
|
|
1106
|
+
...EntryCommon,
|
|
1107
|
+
structure: schema.literal('straddle'),
|
|
1108
|
+
select: schema.object({ strike: schema.number().optional() }).optional(),
|
|
1109
|
+
}),
|
|
1110
|
+
schema.object({
|
|
1111
|
+
...EntryCommon,
|
|
1112
|
+
structure: schema.literal('coveredCall'),
|
|
1113
|
+
select: schema.object({
|
|
1114
|
+
shortDelta: schema.number(),
|
|
1115
|
+
stockPrice: schema.number().optional(),
|
|
1116
|
+
}),
|
|
1117
|
+
}),
|
|
1118
|
+
schema.object({
|
|
1119
|
+
...EntryCommon,
|
|
1120
|
+
structure: schema.literal('protectivePut'),
|
|
1121
|
+
select: schema.object({
|
|
1122
|
+
shortDelta: schema.number(),
|
|
1123
|
+
stockPrice: schema.number().optional(),
|
|
1124
|
+
}),
|
|
1125
|
+
}),
|
|
1126
|
+
schema.object({
|
|
1127
|
+
...EntryCommon,
|
|
1128
|
+
structure: schema.enum([
|
|
1129
|
+
'calendarCallSpread',
|
|
1130
|
+
'calendarPutSpread',
|
|
1131
|
+
'diagonalCallSpread',
|
|
1132
|
+
'diagonalPutSpread',
|
|
1133
|
+
'doubleDiagonal',
|
|
1134
|
+
]),
|
|
1135
|
+
select: schema.object({
|
|
1136
|
+
shortDelta: schema.number(),
|
|
1137
|
+
nearDaysToExpiry: schema.object({
|
|
1138
|
+
target: schema.number(),
|
|
1139
|
+
min: schema.number().optional(),
|
|
1140
|
+
max: schema.number().optional(),
|
|
1141
|
+
}),
|
|
1142
|
+
farDaysToExpiry: schema.object({
|
|
1143
|
+
target: schema.number(),
|
|
1144
|
+
min: schema.number().optional(),
|
|
1145
|
+
max: schema.number().optional(),
|
|
1146
|
+
}),
|
|
1147
|
+
width: schema.number().positive().optional(),
|
|
1148
|
+
}),
|
|
1149
|
+
}),
|
|
1150
|
+
])
|
|
1151
|
+
.describe('The declarative entry structures; a `build` callback is SDK-only');
|
|
1152
|
+
const ExitTriggersSchema = schema.object({
|
|
1153
|
+
profitTarget: schema.number().optional().describe('Fraction of entry premium, e.g. 0.5'),
|
|
1154
|
+
stopLoss: schema.number().optional().describe('Multiple of entry premium, e.g. 2'),
|
|
1155
|
+
daysToExpiry: schema.number().optional().describe('Close at or below this DTE'),
|
|
1156
|
+
});
|
|
1157
|
+
const OptionsBacktestInputSchema = schema.object({
|
|
1158
|
+
chains: schema
|
|
1159
|
+
.array(ChainSnapshotSchema)
|
|
1160
|
+
.describe('Chain snapshots (any order; the engine sorts)'),
|
|
1161
|
+
marking: schema
|
|
1162
|
+
.object({
|
|
1163
|
+
volatility: schema.enum(['current-quote', 'entry']).optional(),
|
|
1164
|
+
missingMark: schema
|
|
1165
|
+
.enum(['refuse', 'entry-volatility', 'carry-last-volatility'])
|
|
1166
|
+
.optional(),
|
|
1167
|
+
maximumQuoteAgeMs: schema.number().nonnegative().optional(),
|
|
1168
|
+
})
|
|
1169
|
+
.optional()
|
|
1170
|
+
.describe('Default: re-mark from the current quote; refuse a missing mark'),
|
|
1171
|
+
initialCapital: schema.number().positive().optional().describe('Default 100,000'),
|
|
1172
|
+
riskFreeRate: schema
|
|
1173
|
+
.number()
|
|
1174
|
+
.describe('Continuously-compounded risk-free rate (decimal, e.g. 0.045) pricing every mark — REQUIRED; the engine never assumes a rate'),
|
|
1175
|
+
dividendYield: schema.number().optional().describe('Default 0'),
|
|
1176
|
+
entry: EntryRuleSchema.optional().describe('One rule; exactly one of entry and rules'),
|
|
1177
|
+
rules: schema
|
|
1178
|
+
.array(EntryRuleSchema)
|
|
1179
|
+
.min(1)
|
|
1180
|
+
.optional()
|
|
1181
|
+
.describe('Several rules, each a member of the book; exactly one of entry and rules'),
|
|
1182
|
+
exit: ExitTriggersSchema.describe('A `when` predicate is SDK-only'),
|
|
1183
|
+
roll: schema.object({ when: ExitTriggersSchema.optional() }).optional(),
|
|
1184
|
+
hedge: schema
|
|
1185
|
+
.object({
|
|
1186
|
+
deltaBand: schema.number().positive(),
|
|
1187
|
+
commission: CostModelSchema.optional(),
|
|
1188
|
+
slippage: SlippageModelSchema.optional(),
|
|
1189
|
+
})
|
|
1190
|
+
.optional(),
|
|
1191
|
+
commission: CostModelSchema.optional(),
|
|
1192
|
+
slippage: SlippageModelSchema.optional(),
|
|
1193
|
+
assignment: schema.enum(['model', 'none']).optional(),
|
|
1194
|
+
periodsPerYear: schema.number().positive().optional().describe('Default 252'),
|
|
1195
|
+
book: schema
|
|
1196
|
+
.object({
|
|
1197
|
+
maximumOpenPositions: schema.number().integer().positive().optional(),
|
|
1198
|
+
maximumPerUnderlying: schema.number().integer().positive().optional(),
|
|
1199
|
+
})
|
|
1200
|
+
.optional()
|
|
1201
|
+
.describe('Default: one open trade'),
|
|
1202
|
+
limits: schema
|
|
1203
|
+
.object({
|
|
1204
|
+
maximumMarginFraction: schema.number().positive().optional(),
|
|
1205
|
+
maximumNetDelta: schema.number().nonnegative().optional(),
|
|
1206
|
+
maximumNetVega: schema.number().nonnegative().optional(),
|
|
1207
|
+
maximumConcentration: schema.number().positive().optional(),
|
|
1208
|
+
scenarioLoss: schema
|
|
1209
|
+
.object({
|
|
1210
|
+
spotShocks: schema.array(schema.number()).min(1),
|
|
1211
|
+
volatilityShocks: schema.array(schema.number()).min(1),
|
|
1212
|
+
maximumLossFraction: schema.number().positive(),
|
|
1213
|
+
})
|
|
1214
|
+
.optional(),
|
|
1215
|
+
})
|
|
1216
|
+
.optional()
|
|
1217
|
+
.describe('Pre-trade limits on the post-trade book; a breach is a limitRejections row'),
|
|
1218
|
+
fillPolicy: schema
|
|
1219
|
+
.object({
|
|
1220
|
+
mode: schema.enum(['combo', 'legged']).optional(),
|
|
1221
|
+
partialFill: schema.enum(['reject', 'allow']).optional(),
|
|
1222
|
+
price: schema.enum(['bid', 'ask', 'mid', 'last', 'mark']).optional(),
|
|
1223
|
+
})
|
|
1224
|
+
.optional(),
|
|
1225
|
+
quoteFreshness: schema.object({ maximumQuoteAgeMs: schema.number().nonnegative() }).optional(),
|
|
1226
|
+
corporateActions: schema
|
|
1227
|
+
.array(schema.object({
|
|
1228
|
+
symbol: schema.string().nonempty(),
|
|
1229
|
+
effectiveDate: schema.string().date(),
|
|
1230
|
+
type: schema.enum([
|
|
1231
|
+
'split',
|
|
1232
|
+
'reverseSplit',
|
|
1233
|
+
'dividend',
|
|
1234
|
+
'symbolChange',
|
|
1235
|
+
'merger',
|
|
1236
|
+
'spinoff',
|
|
1237
|
+
'other',
|
|
1238
|
+
]),
|
|
1239
|
+
ratio: schema.number().positive().optional(),
|
|
1240
|
+
cash: schema.number().optional(),
|
|
1241
|
+
newSymbol: schema.string().optional(),
|
|
1242
|
+
details: schema.record(schema.unknown()).optional(),
|
|
1243
|
+
}))
|
|
1244
|
+
.optional(),
|
|
1245
|
+
dividends: schema
|
|
1246
|
+
.array(schema.object({
|
|
1247
|
+
underlying: schema.string().nonempty(),
|
|
1248
|
+
exDate: schema.string().date(),
|
|
1249
|
+
amount: schema.number().positive(),
|
|
1250
|
+
}))
|
|
1251
|
+
.optional(),
|
|
1252
|
+
baseCurrency: schema.string().nonempty().optional().describe("Default 'USD'"),
|
|
1253
|
+
});
|
|
1254
|
+
const backtestOptionsRun = defineOperation({
|
|
1255
|
+
id: 'totalfinance.backtest.options_run',
|
|
1256
|
+
title: 'Run an options backtest',
|
|
1257
|
+
description: 'Backtest a declarative options strategy over chain snapshots: structure selection by delta and DTE, exit and roll ' +
|
|
1258
|
+
'triggers, optional delta hedging, declarative commission and slippage, American assignment modelling, and the ' +
|
|
1259
|
+
'marking policy (current-quote or entry volatility; what a missing mark does). Several rules may hold several trades ' +
|
|
1260
|
+
'at once (book), pre-trade limits reject entries with rows, combo or legged fills, quote freshness, split lineage, ' +
|
|
1261
|
+
'dividend evidence, the surface summary, and the portfolio ledger the equity reconciles to. Equity points, trades ' +
|
|
1262
|
+
'with per-leg attribution and mark counts, settlements, and the standard performance summary. The result is ' +
|
|
1263
|
+
'optionsBacktest(...) verbatim. Opt-in (backtestPack): payloads and runtime are heavier than the default set.',
|
|
1264
|
+
inputSchema: OptionsBacktestInputSchema,
|
|
1265
|
+
outputSchema: {
|
|
1266
|
+
type: 'object',
|
|
1267
|
+
properties: {
|
|
1268
|
+
points: { type: 'array', items: { type: 'object' } },
|
|
1269
|
+
returns: { type: 'array', items: { type: 'number' } },
|
|
1270
|
+
trades: { type: 'array', items: { type: 'object' } },
|
|
1271
|
+
settlements: { type: 'array', items: { type: 'object' } },
|
|
1272
|
+
finalValue: { type: 'number' },
|
|
1273
|
+
performance: { type: 'object', description: 'The standard performance summary' },
|
|
1274
|
+
limitRejections: { type: 'array', items: { type: 'object' } },
|
|
1275
|
+
fillRejections: { type: 'array', items: { type: 'object' } },
|
|
1276
|
+
surface: { type: 'array', items: { type: 'object' } },
|
|
1277
|
+
ledger: { type: 'object', description: 'The portfolio ledger snapshot (events)' },
|
|
1278
|
+
timeline: {
|
|
1279
|
+
type: ['object', 'null'],
|
|
1280
|
+
description: 'The ledger timeline (null under two marks)',
|
|
1281
|
+
},
|
|
1282
|
+
runId: { type: 'string' },
|
|
1283
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
1284
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
1285
|
+
},
|
|
1286
|
+
required: [
|
|
1287
|
+
'points',
|
|
1288
|
+
'returns',
|
|
1289
|
+
'trades',
|
|
1290
|
+
'settlements',
|
|
1291
|
+
'finalValue',
|
|
1292
|
+
'performance',
|
|
1293
|
+
'limitRejections',
|
|
1294
|
+
'fillRejections',
|
|
1295
|
+
'surface',
|
|
1296
|
+
'ledger',
|
|
1297
|
+
'timeline',
|
|
1298
|
+
'runId',
|
|
1299
|
+
'assumptions',
|
|
1300
|
+
'diagnostics',
|
|
1301
|
+
],
|
|
1302
|
+
},
|
|
1303
|
+
costClass: 'job',
|
|
1304
|
+
run: (input) => {
|
|
1305
|
+
const id = 'totalfinance.backtest.options_run';
|
|
1306
|
+
const { chains, commission, slippage: slip, hedge, ...rest } = input;
|
|
1307
|
+
const result = optionsBacktest({
|
|
1308
|
+
...rest,
|
|
1309
|
+
chains: capRows(chains, 'chains', id),
|
|
1310
|
+
...(commission !== undefined ? { commission: costModelOf(commission) } : {}),
|
|
1311
|
+
...(slip !== undefined ? { slippage: slippageModelOf(slip) } : {}),
|
|
1312
|
+
...(hedge !== undefined
|
|
1313
|
+
? {
|
|
1314
|
+
hedge: {
|
|
1315
|
+
deltaBand: hedge.deltaBand,
|
|
1316
|
+
...(hedge.commission !== undefined
|
|
1317
|
+
? { commission: costModelOf(hedge.commission) }
|
|
1318
|
+
: {}),
|
|
1319
|
+
...(hedge.slippage !== undefined
|
|
1320
|
+
? { slippage: slippageModelOf(hedge.slippage) }
|
|
1321
|
+
: {}),
|
|
1322
|
+
},
|
|
1323
|
+
}
|
|
1324
|
+
: {}),
|
|
1325
|
+
});
|
|
1326
|
+
return {
|
|
1327
|
+
summary: `${result.trades.length} trades, final value ${result.finalValue.toFixed(2)} (${result.assumptions.marking.volatility} marking)`,
|
|
1328
|
+
structured: result,
|
|
1329
|
+
};
|
|
1330
|
+
},
|
|
1331
|
+
});
|
|
1332
|
+
// ── packs ─────────────────────────────────────────────────────────────────────────────────────
|
|
1333
|
+
export function portfolioPack() {
|
|
1334
|
+
return {
|
|
1335
|
+
name: 'portfolio',
|
|
1336
|
+
operations: [
|
|
1337
|
+
portfolioSnapshotOperation,
|
|
1338
|
+
portfolioExplainPnl,
|
|
1339
|
+
portfolioAnalyze,
|
|
1340
|
+
portfolioRebalanceProposal,
|
|
1341
|
+
],
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
export function scenarioPack() {
|
|
1345
|
+
return { name: 'scenario', operations: [scenarioRun] };
|
|
1346
|
+
}
|
|
1347
|
+
export function researchPack() {
|
|
1348
|
+
return {
|
|
1349
|
+
name: 'research',
|
|
1350
|
+
operations: [researchScreen, researchRank, researchScore, researchEventStudy],
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
export function artifactPack() {
|
|
1354
|
+
return { name: 'artifact', operations: [artifactRead, artifactCompare] };
|
|
1355
|
+
}
|
|
1356
|
+
// ── Stage 4.6 slice 3 (FC8 Decision 11): the cross-sectional backtest over the wire ─────────────
|
|
1357
|
+
const ReturnObservationSchema = schema.object({
|
|
1358
|
+
instrumentId: schema.string().nonempty(),
|
|
1359
|
+
tradingSessionDate: schema.string().date(),
|
|
1360
|
+
simpleReturn: schema.number(),
|
|
1361
|
+
});
|
|
1362
|
+
const UniverseMemberSchema = schema.object({
|
|
1363
|
+
instrumentId: schema.string().nonempty(),
|
|
1364
|
+
fromTimestampMs: schema.number(),
|
|
1365
|
+
toTimestampMs: schema.number().optional(),
|
|
1366
|
+
exitReason: schema.enum(['removed', 'delisted', 'merged', 'other']).optional(),
|
|
1367
|
+
delistingReturn: schema.number().optional(),
|
|
1368
|
+
});
|
|
1369
|
+
const ScoreComponentSchema = schema.object({
|
|
1370
|
+
field: schema.string(),
|
|
1371
|
+
weight: schema.number().positive(),
|
|
1372
|
+
direction: schema.enum(['higher-is-better', 'lower-is-better']),
|
|
1373
|
+
standardization: schema.enum(['z-score', 'percentile-rank']),
|
|
1374
|
+
});
|
|
1375
|
+
const FactorRecipeSchema = schema
|
|
1376
|
+
.object({
|
|
1377
|
+
recipeName: schema.string().nonempty(),
|
|
1378
|
+
recipeVersion: schema.number().integer().positive(),
|
|
1379
|
+
disclosure: schema.string(),
|
|
1380
|
+
direction: schema.enum(['higher-is-better', 'lower-is-better']),
|
|
1381
|
+
features: schema
|
|
1382
|
+
.array(schema.object({
|
|
1383
|
+
field: schema.string().nonempty(),
|
|
1384
|
+
transform: schema.enum(['raw', 'winsorize-then-z-score', 'percentile-rank']),
|
|
1385
|
+
weight: schema.number(),
|
|
1386
|
+
}))
|
|
1387
|
+
.min(1),
|
|
1388
|
+
lagTradingSessions: schema.number().integer().nonnegative(),
|
|
1389
|
+
neutralization: schema.enum(['none', 'sector', 'sector-and-size']),
|
|
1390
|
+
missingValuePolicy: schema.enum(['exclude', 'renormalize-weights']),
|
|
1391
|
+
})
|
|
1392
|
+
.describe('A versioned research FactorRecipe (canonical or caller-authored), validated by the engine');
|
|
1393
|
+
const CrossSectionalSignalSchema = schema
|
|
1394
|
+
.union([
|
|
1395
|
+
schema.object({ factorRecipe: FactorRecipeSchema }),
|
|
1396
|
+
schema.object({
|
|
1397
|
+
score: schema.object({
|
|
1398
|
+
components: schema.array(ScoreComponentSchema).min(1),
|
|
1399
|
+
missingValuePolicy: schema.enum(['exclude', 'renormalize-weights']),
|
|
1400
|
+
}),
|
|
1401
|
+
}),
|
|
1402
|
+
schema.object({
|
|
1403
|
+
screen: schema.object({
|
|
1404
|
+
filter: schema.record(schema.unknown()).optional(),
|
|
1405
|
+
orderBy: schema
|
|
1406
|
+
.array(schema.object({
|
|
1407
|
+
field: schema.string(),
|
|
1408
|
+
direction: schema.enum(['ascending', 'descending']),
|
|
1409
|
+
}))
|
|
1410
|
+
.min(1),
|
|
1411
|
+
missingValuePolicy: MissingValuePolicySchema,
|
|
1412
|
+
}),
|
|
1413
|
+
}),
|
|
1414
|
+
])
|
|
1415
|
+
.describe('The three declarative signal forms; a signal callback is SDK-only');
|
|
1416
|
+
const SideSelectionSchema = schema.union([
|
|
1417
|
+
schema.object({ topQuantile: schema.number().positive() }),
|
|
1418
|
+
schema.object({ count: schema.number().integer().positive() }),
|
|
1419
|
+
schema.object({ fraction: schema.number().positive() }),
|
|
1420
|
+
]);
|
|
1421
|
+
const ShortSideSelectionSchema = schema.union([
|
|
1422
|
+
schema.object({ bottomQuantile: schema.number().positive() }),
|
|
1423
|
+
schema.object({ count: schema.number().integer().positive() }),
|
|
1424
|
+
schema.object({ fraction: schema.number().positive() }),
|
|
1425
|
+
]);
|
|
1426
|
+
const PortfolioConstructionSchema = schema.object({
|
|
1427
|
+
method: schema
|
|
1428
|
+
.enum(['equal-weight', 'score-weight', 'inverse-volatility', 'risk-budget'])
|
|
1429
|
+
.describe("'supplied-weights' takes a caller function and is SDK-only"),
|
|
1430
|
+
long: SideSelectionSchema,
|
|
1431
|
+
short: ShortSideSelectionSchema.optional(),
|
|
1432
|
+
neutrality: schema.enum(['none', 'dollar', 'sector', 'beta', 'factor']).optional(),
|
|
1433
|
+
neutralizeAgainst: schema.object({ field: schema.string().nonempty() }).optional(),
|
|
1434
|
+
maximumPositions: schema.number().integer().positive().optional(),
|
|
1435
|
+
maximumPositionWeight: schema.number().positive().optional(),
|
|
1436
|
+
minimumPositionWeight: schema.number().nonnegative().optional(),
|
|
1437
|
+
maximumTurnover: schema.number().nonnegative().optional(),
|
|
1438
|
+
maximumParticipation: schema.number().positive().optional(),
|
|
1439
|
+
volatilityLookbackSessions: schema.number().integer().positive().optional(),
|
|
1440
|
+
});
|
|
1441
|
+
const DeclaredExecutionSchema = schema
|
|
1442
|
+
.object({
|
|
1443
|
+
label: schema.string().nonempty(),
|
|
1444
|
+
ambiguity: schema
|
|
1445
|
+
.enum(['optimistic', 'pessimistic', 'deterministic-path', 'reject'])
|
|
1446
|
+
.optional(),
|
|
1447
|
+
costs: schema
|
|
1448
|
+
.object({
|
|
1449
|
+
commission: CostModelSchema.optional(),
|
|
1450
|
+
slippage: SlippageModelSchema.optional(),
|
|
1451
|
+
spread: schema
|
|
1452
|
+
.union([
|
|
1453
|
+
schema.object({ model: schema.literal('none') }),
|
|
1454
|
+
schema.object({
|
|
1455
|
+
model: schema.literal('halfSpreadBps'),
|
|
1456
|
+
bps: schema.number().nonnegative(),
|
|
1457
|
+
}),
|
|
1458
|
+
])
|
|
1459
|
+
.optional(),
|
|
1460
|
+
marketImpact: schema
|
|
1461
|
+
.union([
|
|
1462
|
+
schema.object({ model: schema.literal('none') }),
|
|
1463
|
+
schema.object({
|
|
1464
|
+
model: schema.literal('squareRoot'),
|
|
1465
|
+
coefficient: schema.number().nonnegative(),
|
|
1466
|
+
}),
|
|
1467
|
+
])
|
|
1468
|
+
.optional(),
|
|
1469
|
+
latencySessions: schema.number().integer().nonnegative().optional(),
|
|
1470
|
+
participation: schema.number().positive().optional(),
|
|
1471
|
+
})
|
|
1472
|
+
.optional(),
|
|
1473
|
+
partialFills: schema.enum(['allow', 'reject']).optional(),
|
|
1474
|
+
timeInForce: schema
|
|
1475
|
+
.object({
|
|
1476
|
+
default: schema.enum(['day', 'gtc']),
|
|
1477
|
+
expireAtSessionClose: schema.boolean(),
|
|
1478
|
+
})
|
|
1479
|
+
.optional(),
|
|
1480
|
+
margin: schema
|
|
1481
|
+
.object({
|
|
1482
|
+
buyingPowerMultiplier: schema.number().positive(),
|
|
1483
|
+
initialMarginRate: schema.number().nonnegative(),
|
|
1484
|
+
maintenanceMarginRate: schema.number().nonnegative(),
|
|
1485
|
+
forcedLiquidation: schema.enum(['none', 'close-largest-loss', 'pro-rata']),
|
|
1486
|
+
})
|
|
1487
|
+
.optional(),
|
|
1488
|
+
})
|
|
1489
|
+
.describe("A declared execution policy over session bars (execution.declared): the label is the caller's claim; " +
|
|
1490
|
+
'a caller fill model, session rules, and quote/order-book observations are SDK-only');
|
|
1491
|
+
function executionPolicyOf(wire) {
|
|
1492
|
+
const costs = wire.costs;
|
|
1493
|
+
return execution.declared({
|
|
1494
|
+
label: wire.label,
|
|
1495
|
+
...(wire.ambiguity !== undefined ? { ambiguity: wire.ambiguity } : {}),
|
|
1496
|
+
...(costs !== undefined
|
|
1497
|
+
? {
|
|
1498
|
+
costs: {
|
|
1499
|
+
...(costs.commission !== undefined
|
|
1500
|
+
? { commission: costModelOf(costs.commission) }
|
|
1501
|
+
: {}),
|
|
1502
|
+
...(costs.slippage !== undefined ? { slippage: slippageModelOf(costs.slippage) } : {}),
|
|
1503
|
+
...(costs.spread !== undefined
|
|
1504
|
+
? {
|
|
1505
|
+
spread: costs.spread.model === 'none'
|
|
1506
|
+
? spreadModels.none()
|
|
1507
|
+
: spreadModels.halfSpreadBps(costs.spread.bps),
|
|
1508
|
+
}
|
|
1509
|
+
: {}),
|
|
1510
|
+
...(costs.marketImpact !== undefined
|
|
1511
|
+
? {
|
|
1512
|
+
marketImpact: costs.marketImpact.model === 'none'
|
|
1513
|
+
? impactModels.none()
|
|
1514
|
+
: impactModels.squareRoot({ coefficient: costs.marketImpact.coefficient }),
|
|
1515
|
+
}
|
|
1516
|
+
: {}),
|
|
1517
|
+
...(costs.latencySessions !== undefined
|
|
1518
|
+
? { latency: latencyModels.sessions(costs.latencySessions) }
|
|
1519
|
+
: {}),
|
|
1520
|
+
...(costs.participation !== undefined ? { participation: costs.participation } : {}),
|
|
1521
|
+
},
|
|
1522
|
+
}
|
|
1523
|
+
: {}),
|
|
1524
|
+
...(wire.partialFills !== undefined ? { partialFills: wire.partialFills } : {}),
|
|
1525
|
+
...(wire.timeInForce !== undefined ? { timeInForce: wire.timeInForce } : {}),
|
|
1526
|
+
...(wire.margin !== undefined ? { margin: wire.margin } : {}),
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
const CrossSectionalRunInputSchema = schema.object({
|
|
1530
|
+
dataset: schema.object({
|
|
1531
|
+
observations: schema.array(UniverseObservationSchema),
|
|
1532
|
+
fieldDefinitions: schema.array(FieldDefinitionSchema).min(1),
|
|
1533
|
+
returns: schema
|
|
1534
|
+
.array(ReturnObservationSchema)
|
|
1535
|
+
.describe('Per instrument per session; prices are return-index levels (base 100)'),
|
|
1536
|
+
benchmarkReturns: schema.array(ReturnObservationSchema).optional(),
|
|
1537
|
+
groups: schema.record(schema.string()).optional(),
|
|
1538
|
+
sizeField: schema.string().optional(),
|
|
1539
|
+
classification: schema.record(schema.record(schema.unknown())).optional(),
|
|
1540
|
+
averageDailyVolumes: schema.record(schema.number()).optional(),
|
|
1541
|
+
betas: schema.record(schema.number()).optional(),
|
|
1542
|
+
}),
|
|
1543
|
+
universeHistory: schema.object({
|
|
1544
|
+
universeId: schema.string().nonempty(),
|
|
1545
|
+
members: schema.array(UniverseMemberSchema).min(1),
|
|
1546
|
+
}),
|
|
1547
|
+
signal: CrossSectionalSignalSchema,
|
|
1548
|
+
rebalanceSchedule: schema.object({
|
|
1549
|
+
frequency: schema.enum(['daily', 'weekly', 'monthly', 'quarterly']),
|
|
1550
|
+
session: schema.enum(['open', 'close']),
|
|
1551
|
+
bufferBand: schema.number().nonnegative().optional(),
|
|
1552
|
+
}),
|
|
1553
|
+
portfolioConstruction: PortfolioConstructionSchema,
|
|
1554
|
+
execution: DeclaredExecutionSchema.optional().describe('Default: execution.simplified()'),
|
|
1555
|
+
transactionCostModel: schema
|
|
1556
|
+
.object({ commission: CostModelSchema.optional(), slippage: SlippageModelSchema.optional() })
|
|
1557
|
+
.optional(),
|
|
1558
|
+
initialCapital: schema.number().positive().optional().describe('Default 1,000,000'),
|
|
1559
|
+
baseCurrency: schema.string().nonempty().optional().describe("Default 'USD'"),
|
|
1560
|
+
window: schema
|
|
1561
|
+
.object({
|
|
1562
|
+
fromTimestampMs: schema.number().optional(),
|
|
1563
|
+
toTimestampMs: schema.number().optional(),
|
|
1564
|
+
})
|
|
1565
|
+
.optional(),
|
|
1566
|
+
periodsPerYear: schema.number().positive().optional().describe('Default 252'),
|
|
1567
|
+
riskFreeRate: schema.number().optional().describe('Per-period; default 0'),
|
|
1568
|
+
seed: schema
|
|
1569
|
+
.number()
|
|
1570
|
+
.integer()
|
|
1571
|
+
.nonnegative()
|
|
1572
|
+
.optional()
|
|
1573
|
+
.describe('Seeds only the bootstrap confidence intervals; absent = none'),
|
|
1574
|
+
});
|
|
1575
|
+
const backtestCrossSectionalRun = defineOperation({
|
|
1576
|
+
id: 'totalfinance.backtest.cross_sectional_run',
|
|
1577
|
+
title: 'Run a cross-sectional backtest',
|
|
1578
|
+
description: 'Backtest a point-in-time cross-sectional strategy: a returns dataset with declared features, a universe history ' +
|
|
1579
|
+
'with entries and exits, one declarative signal (a versioned factor recipe, a composite score, or a screen), a ' +
|
|
1580
|
+
'rebalance schedule, and a portfolio construction (quantile/count/fraction selection on each side; equal, score, ' +
|
|
1581
|
+
'inverse-volatility, or risk-budget weights; dollar/sector/beta/factor neutrality; position, weight, turnover, and ' +
|
|
1582
|
+
'participation caps — every trim a reported goal). Fills go through the execution policy into the portfolio ' +
|
|
1583
|
+
'ledger; the final value reconciles to the ledger NAV. Rebalances, holdings, fills, the ledger, the timeline, ' +
|
|
1584
|
+
'attribution, the benchmark block, and the performance summary — crossSectionalBacktest(...) verbatim. Opt-in ' +
|
|
1585
|
+
'(backtestPack): payloads and runtime are heavier than the default set; bulk row sets above the row cap travel by handle.',
|
|
1586
|
+
inputSchema: CrossSectionalRunInputSchema,
|
|
1587
|
+
outputSchema: {
|
|
1588
|
+
type: 'object',
|
|
1589
|
+
properties: {
|
|
1590
|
+
rebalances: { type: 'array', items: { type: 'object' } },
|
|
1591
|
+
holdings: { type: 'array', items: { type: 'object' } },
|
|
1592
|
+
points: { type: 'array', items: { type: 'object' } },
|
|
1593
|
+
returns: { type: 'array', items: { type: 'number' } },
|
|
1594
|
+
trades: { type: 'array', items: { type: 'object' } },
|
|
1595
|
+
fills: { type: 'array', items: { type: 'object' } },
|
|
1596
|
+
ledger: { type: 'object', description: 'The portfolio ledger snapshot (events)' },
|
|
1597
|
+
timeline: { type: 'object', description: 'The ledger timeline' },
|
|
1598
|
+
attribution: { type: 'object' },
|
|
1599
|
+
benchmark: { type: ['object', 'null'] },
|
|
1600
|
+
performance: { type: 'object', description: 'The standard performance summary' },
|
|
1601
|
+
performanceConfidence: { type: ['object', 'null'] },
|
|
1602
|
+
finalValue: { type: 'number' },
|
|
1603
|
+
runId: { type: 'string' },
|
|
1604
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
1605
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
1606
|
+
},
|
|
1607
|
+
required: [
|
|
1608
|
+
'rebalances',
|
|
1609
|
+
'holdings',
|
|
1610
|
+
'points',
|
|
1611
|
+
'returns',
|
|
1612
|
+
'trades',
|
|
1613
|
+
'fills',
|
|
1614
|
+
'ledger',
|
|
1615
|
+
'timeline',
|
|
1616
|
+
'attribution',
|
|
1617
|
+
'benchmark',
|
|
1618
|
+
'performance',
|
|
1619
|
+
'performanceConfidence',
|
|
1620
|
+
'finalValue',
|
|
1621
|
+
'runId',
|
|
1622
|
+
'assumptions',
|
|
1623
|
+
'diagnostics',
|
|
1624
|
+
],
|
|
1625
|
+
},
|
|
1626
|
+
costClass: 'job',
|
|
1627
|
+
handleFields: ['dataset'],
|
|
1628
|
+
run: (input) => {
|
|
1629
|
+
const id = 'totalfinance.backtest.cross_sectional_run';
|
|
1630
|
+
const { dataset, universeHistory, execution: executionWire, transactionCostModel, ...rest } = input;
|
|
1631
|
+
const result = crossSectionalBacktest({
|
|
1632
|
+
...rest,
|
|
1633
|
+
dataset: {
|
|
1634
|
+
...dataset,
|
|
1635
|
+
observations: capRows(dataset.observations, 'dataset.observations', id),
|
|
1636
|
+
returns: capRows(dataset.returns, 'dataset.returns', id),
|
|
1637
|
+
...(dataset.benchmarkReturns !== undefined
|
|
1638
|
+
? {
|
|
1639
|
+
benchmarkReturns: capRows(dataset.benchmarkReturns, 'dataset.benchmarkReturns', id),
|
|
1640
|
+
}
|
|
1641
|
+
: {}),
|
|
1642
|
+
},
|
|
1643
|
+
universeHistory: {
|
|
1644
|
+
...universeHistory,
|
|
1645
|
+
members: capRows(universeHistory.members, 'universeHistory.members', id),
|
|
1646
|
+
},
|
|
1647
|
+
...(executionWire !== undefined ? { execution: executionPolicyOf(executionWire) } : {}),
|
|
1648
|
+
...(transactionCostModel !== undefined
|
|
1649
|
+
? {
|
|
1650
|
+
transactionCostModel: {
|
|
1651
|
+
...(transactionCostModel.commission !== undefined
|
|
1652
|
+
? { commission: costModelOf(transactionCostModel.commission) }
|
|
1653
|
+
: {}),
|
|
1654
|
+
...(transactionCostModel.slippage !== undefined
|
|
1655
|
+
? { slippage: slippageModelOf(transactionCostModel.slippage) }
|
|
1656
|
+
: {}),
|
|
1657
|
+
},
|
|
1658
|
+
}
|
|
1659
|
+
: {}),
|
|
1660
|
+
});
|
|
1661
|
+
return {
|
|
1662
|
+
summary: `${result.diagnostics.rebalanceCount} rebalances over ${result.diagnostics.sessionCount} sessions, final value ${result.finalValue.toFixed(2)} (${result.assumptions.execution.realism} execution)`,
|
|
1663
|
+
structured: result,
|
|
1664
|
+
};
|
|
1665
|
+
},
|
|
1666
|
+
});
|
|
1667
|
+
// ── Stage 4.6 slice 6 (FC8 Decision 11): the portfolio backtest over the wire ──────────────────
|
|
1668
|
+
const BarSchema = schema.object({
|
|
1669
|
+
symbol: schema.string().nonempty(),
|
|
1670
|
+
timestampMs: schema.number(),
|
|
1671
|
+
open: schema.number(),
|
|
1672
|
+
high: schema.number(),
|
|
1673
|
+
low: schema.number(),
|
|
1674
|
+
close: schema.number(),
|
|
1675
|
+
volume: schema.number().optional(),
|
|
1676
|
+
vwap: schema.number().optional(),
|
|
1677
|
+
adjusted: schema.boolean().optional(),
|
|
1678
|
+
});
|
|
1679
|
+
const QuoteSchema = schema.object({
|
|
1680
|
+
symbol: schema.string().nonempty(),
|
|
1681
|
+
timestampMs: schema.number(),
|
|
1682
|
+
bid: schema.number(),
|
|
1683
|
+
ask: schema.number(),
|
|
1684
|
+
bidSize: schema.number().optional(),
|
|
1685
|
+
askSize: schema.number().optional(),
|
|
1686
|
+
exchange: schema.string().optional(),
|
|
1687
|
+
conditions: schema.array(schema.string()).optional(),
|
|
1688
|
+
});
|
|
1689
|
+
const TradeRowSchema = schema.object({
|
|
1690
|
+
symbol: schema.string().nonempty(),
|
|
1691
|
+
timestampMs: schema.number(),
|
|
1692
|
+
price: schema.number(),
|
|
1693
|
+
size: schema.number(),
|
|
1694
|
+
exchange: schema.string().optional(),
|
|
1695
|
+
conditions: schema.array(schema.string()).optional(),
|
|
1696
|
+
sequence: schema.number().optional(),
|
|
1697
|
+
});
|
|
1698
|
+
const OrderBookSchema = schema.object({
|
|
1699
|
+
symbol: schema.string().nonempty(),
|
|
1700
|
+
timestampMs: schema.number(),
|
|
1701
|
+
bids: schema.array(schema.object({
|
|
1702
|
+
price: schema.number(),
|
|
1703
|
+
size: schema.number(),
|
|
1704
|
+
exchange: schema.string().optional(),
|
|
1705
|
+
})),
|
|
1706
|
+
asks: schema.array(schema.object({
|
|
1707
|
+
price: schema.number(),
|
|
1708
|
+
size: schema.number(),
|
|
1709
|
+
exchange: schema.string().optional(),
|
|
1710
|
+
})),
|
|
1711
|
+
});
|
|
1712
|
+
const ContractTermsSchema = schema.union([
|
|
1713
|
+
schema.object({
|
|
1714
|
+
kind: schema.literal('option'),
|
|
1715
|
+
underlyingInstrumentId: schema.string().nonempty(),
|
|
1716
|
+
right: schema.enum(['call', 'put']),
|
|
1717
|
+
strikePricePerUnit: schema.number().positive(),
|
|
1718
|
+
expiryTimestampMs: schema.number(),
|
|
1719
|
+
}),
|
|
1720
|
+
schema.object({
|
|
1721
|
+
kind: schema.literal('future'),
|
|
1722
|
+
underlyingInstrumentId: schema.string().nonempty(),
|
|
1723
|
+
expiryTimestampMs: schema.number(),
|
|
1724
|
+
}),
|
|
1725
|
+
schema.object({
|
|
1726
|
+
kind: schema.literal('perpetual'),
|
|
1727
|
+
underlyingInstrumentId: schema.string().nonempty(),
|
|
1728
|
+
}),
|
|
1729
|
+
]);
|
|
1730
|
+
const InstrumentSpecificationSchema = schema
|
|
1731
|
+
.object({
|
|
1732
|
+
kind: schema
|
|
1733
|
+
.enum([
|
|
1734
|
+
'equity',
|
|
1735
|
+
'etf',
|
|
1736
|
+
'option',
|
|
1737
|
+
'future',
|
|
1738
|
+
'fx-forward',
|
|
1739
|
+
'crypto-spot',
|
|
1740
|
+
'crypto-perpetual',
|
|
1741
|
+
'bond',
|
|
1742
|
+
])
|
|
1743
|
+
.describe("A built-in kind; 'custom' brings its own adapter and is SDK-only"),
|
|
1744
|
+
currency: schema.string().nonempty(),
|
|
1745
|
+
contractMultiplier: schema.number().positive().optional(),
|
|
1746
|
+
contract: ContractTermsSchema.optional(),
|
|
1747
|
+
assetClass: schema
|
|
1748
|
+
.enum([
|
|
1749
|
+
'equity',
|
|
1750
|
+
'etf',
|
|
1751
|
+
'option',
|
|
1752
|
+
'future',
|
|
1753
|
+
'fx-forward',
|
|
1754
|
+
'crypto-spot',
|
|
1755
|
+
'crypto-perpetual',
|
|
1756
|
+
'bond',
|
|
1757
|
+
'cash',
|
|
1758
|
+
])
|
|
1759
|
+
.optional(),
|
|
1760
|
+
classification: schema
|
|
1761
|
+
.object({
|
|
1762
|
+
underlying: schema.string().optional(),
|
|
1763
|
+
assetClass: schema.string().optional(),
|
|
1764
|
+
strategy: schema.string().optional(),
|
|
1765
|
+
tags: schema.array(schema.string()).optional(),
|
|
1766
|
+
})
|
|
1767
|
+
.optional(),
|
|
1768
|
+
roll: schema
|
|
1769
|
+
.object({
|
|
1770
|
+
toInstrumentId: schema.string().nonempty(),
|
|
1771
|
+
sessionsBeforeExpiry: schema.number().integer().nonnegative(),
|
|
1772
|
+
})
|
|
1773
|
+
.optional(),
|
|
1774
|
+
coupon: schema
|
|
1775
|
+
.object({
|
|
1776
|
+
annualRate: schema.number(),
|
|
1777
|
+
paymentsPerYear: schema.number().integer().positive(),
|
|
1778
|
+
faceValuePerUnit: schema.number().positive().optional(),
|
|
1779
|
+
dayCount: schema.enum(['ACT/365F', '30/360']).optional(),
|
|
1780
|
+
issueDate: schema.string().date(),
|
|
1781
|
+
maturityDate: schema.string().date(),
|
|
1782
|
+
})
|
|
1783
|
+
.optional(),
|
|
1784
|
+
forward: schema
|
|
1785
|
+
.object({
|
|
1786
|
+
maturityTimestampMs: schema.number(),
|
|
1787
|
+
baseCurrency: schema.string().nonempty(),
|
|
1788
|
+
quoteCurrency: schema.string().nonempty(),
|
|
1789
|
+
contractRate: schema.number().positive(),
|
|
1790
|
+
})
|
|
1791
|
+
.optional(),
|
|
1792
|
+
})
|
|
1793
|
+
.describe('An instrument specification; the terms each kind needs are validated by the engine');
|
|
1794
|
+
const PortfolioAccountingSchema = schema.object({
|
|
1795
|
+
baseCurrency: schema.string().nonempty(),
|
|
1796
|
+
initialCash: schema
|
|
1797
|
+
.array(schema.object({ currency: schema.string().nonempty(), amount: schema.number().positive() }))
|
|
1798
|
+
.min(1),
|
|
1799
|
+
lotRelief: schema.enum(['fifo', 'lifo', 'highest-cost', 'specific-lot']).optional(),
|
|
1800
|
+
settlement: schema.record(schema.enum(['T+0', 'T+1', 'T+2'])).optional(),
|
|
1801
|
+
});
|
|
1802
|
+
const PortfolioMarketDataSchema = schema.object({
|
|
1803
|
+
bars: schema.array(BarSchema).optional(),
|
|
1804
|
+
quotes: schema.array(QuoteSchema).optional(),
|
|
1805
|
+
trades: schema.array(TradeRowSchema).optional(),
|
|
1806
|
+
orderBooks: schema.array(OrderBookSchema).optional(),
|
|
1807
|
+
optionChains: schema.array(ChainSnapshotSchema).optional(),
|
|
1808
|
+
fxRates: schema
|
|
1809
|
+
.array(schema.object({
|
|
1810
|
+
timestampMs: schema.number(),
|
|
1811
|
+
baseCurrency: schema.string().nonempty(),
|
|
1812
|
+
quoteCurrency: schema.string().nonempty(),
|
|
1813
|
+
quotePerBase: schema.number().positive(),
|
|
1814
|
+
}))
|
|
1815
|
+
.optional(),
|
|
1816
|
+
forwardRates: schema
|
|
1817
|
+
.array(schema.object({
|
|
1818
|
+
instrumentId: schema.string().nonempty(),
|
|
1819
|
+
timestampMs: schema.number(),
|
|
1820
|
+
forwardRate: schema.number().positive(),
|
|
1821
|
+
}))
|
|
1822
|
+
.optional(),
|
|
1823
|
+
fundingRates: schema
|
|
1824
|
+
.array(schema.object({
|
|
1825
|
+
instrumentId: schema.string().nonempty(),
|
|
1826
|
+
timestampMs: schema.number(),
|
|
1827
|
+
fundingRate: schema.number(),
|
|
1828
|
+
}))
|
|
1829
|
+
.optional(),
|
|
1830
|
+
corporateActions: schema
|
|
1831
|
+
.array(schema.object({
|
|
1832
|
+
symbol: schema.string().nonempty(),
|
|
1833
|
+
effectiveDate: schema.string().date(),
|
|
1834
|
+
type: schema.enum([
|
|
1835
|
+
'split',
|
|
1836
|
+
'reverseSplit',
|
|
1837
|
+
'dividend',
|
|
1838
|
+
'symbolChange',
|
|
1839
|
+
'merger',
|
|
1840
|
+
'spinoff',
|
|
1841
|
+
'other',
|
|
1842
|
+
]),
|
|
1843
|
+
ratio: schema.number().positive().optional(),
|
|
1844
|
+
cash: schema.number().optional(),
|
|
1845
|
+
newSymbol: schema.string().optional(),
|
|
1846
|
+
details: schema.record(schema.unknown()).optional(),
|
|
1847
|
+
}))
|
|
1848
|
+
.optional(),
|
|
1849
|
+
dividends: schema
|
|
1850
|
+
.array(schema.object({
|
|
1851
|
+
instrumentId: schema.string().nonempty(),
|
|
1852
|
+
exDate: schema.string().date(),
|
|
1853
|
+
amount: schema.number().positive(),
|
|
1854
|
+
payDate: schema.string().date().optional(),
|
|
1855
|
+
}))
|
|
1856
|
+
.optional(),
|
|
1857
|
+
coupons: schema
|
|
1858
|
+
.array(schema.object({
|
|
1859
|
+
instrumentId: schema.string().nonempty(),
|
|
1860
|
+
paymentDate: schema.string().date(),
|
|
1861
|
+
amountPerUnit: schema.number().positive(),
|
|
1862
|
+
}))
|
|
1863
|
+
.optional(),
|
|
1864
|
+
});
|
|
1865
|
+
const ExternalFlowsSchema = schema
|
|
1866
|
+
.array(schema.object({
|
|
1867
|
+
timestampMs: schema.number(),
|
|
1868
|
+
amount: schema.number(),
|
|
1869
|
+
currency: schema.string().nonempty(),
|
|
1870
|
+
}))
|
|
1871
|
+
.optional();
|
|
1872
|
+
const PortfolioCalendarSchema = schema.enum(['NYSE', 'CBOE', 'ALWAYS_OPEN']).optional();
|
|
1873
|
+
const BacktestWindowSchema = schema
|
|
1874
|
+
.object({
|
|
1875
|
+
fromTimestampMs: schema.number().optional(),
|
|
1876
|
+
toTimestampMs: schema.number().optional(),
|
|
1877
|
+
})
|
|
1878
|
+
.optional();
|
|
1879
|
+
const PortfolioRunInputSchema = schema.object({
|
|
1880
|
+
accounting: PortfolioAccountingSchema,
|
|
1881
|
+
instruments: schema.record(InstrumentSpecificationSchema),
|
|
1882
|
+
marketData: PortfolioMarketDataSchema,
|
|
1883
|
+
strategy: schema
|
|
1884
|
+
.object({
|
|
1885
|
+
model: schema.union([
|
|
1886
|
+
schema.record(schema.unknown()).describe('A ModelPortfolio artifact'),
|
|
1887
|
+
schema.array(AllocationTargetSchema).min(1),
|
|
1888
|
+
]),
|
|
1889
|
+
schedule: schema.object({
|
|
1890
|
+
frequency: schema.enum(['daily', 'weekly', 'monthly', 'quarterly']),
|
|
1891
|
+
}),
|
|
1892
|
+
policy: schema
|
|
1893
|
+
.record(schema.unknown())
|
|
1894
|
+
.optional()
|
|
1895
|
+
.describe('An InvestmentPolicy (limits, handling); targets come from the model'),
|
|
1896
|
+
scope: schema.enum(['to-target', 'drift-only']).optional(),
|
|
1897
|
+
})
|
|
1898
|
+
.describe('The declarative strategy; an onSession callback is SDK-only'),
|
|
1899
|
+
execution: DeclaredExecutionSchema.optional().describe('Default: execution.simplified()'),
|
|
1900
|
+
externalFlows: ExternalFlowsSchema,
|
|
1901
|
+
calendar: PortfolioCalendarSchema,
|
|
1902
|
+
window: BacktestWindowSchema,
|
|
1903
|
+
periodsPerYear: schema.number().positive().optional().describe('Default 252'),
|
|
1904
|
+
seed: schema.number().integer().nonnegative().optional(),
|
|
1905
|
+
});
|
|
1906
|
+
const backtestPortfolioRun = defineOperation({
|
|
1907
|
+
id: 'totalfinance.backtest.portfolio_run',
|
|
1908
|
+
title: 'Run a portfolio backtest',
|
|
1909
|
+
description: 'Backtest a multi-asset portfolio through the ledger: instruments with built-in adapters (equity, etf, option, ' +
|
|
1910
|
+
'future, fx-forward, crypto-spot, crypto-perpetual, bond), market data by row set, a model or inline targets on a ' +
|
|
1911
|
+
'rebalance schedule, an execution policy with settlement lags, external flows, a calendar, and the margin check with ' +
|
|
1912
|
+
'forced liquidation. Every fill, flow, lifecycle fact, and liquidation is a portfolio event; the equity is the ' +
|
|
1913
|
+
"ledger's net asset value. The result is portfolioBacktest(...) verbatim. Opt-in (backtestPack): payloads and " +
|
|
1914
|
+
'runtime are heavier than the default set; bulk row sets above the row cap travel by handle.',
|
|
1915
|
+
inputSchema: PortfolioRunInputSchema,
|
|
1916
|
+
outputSchema: {
|
|
1917
|
+
type: 'object',
|
|
1918
|
+
properties: {
|
|
1919
|
+
ledger: { type: 'object' },
|
|
1920
|
+
timeline: { type: ['object', 'null'] },
|
|
1921
|
+
pnl: { type: ['object', 'null'] },
|
|
1922
|
+
orders: { type: 'array', items: { type: 'object' } },
|
|
1923
|
+
fills: { type: 'array', items: { type: 'object' } },
|
|
1924
|
+
rejections: { type: 'array', items: { type: 'object' } },
|
|
1925
|
+
liquidations: { type: 'array', items: { type: 'object' } },
|
|
1926
|
+
events: { type: 'array', items: { type: 'object' } },
|
|
1927
|
+
valuationMarks: { type: 'array', items: { type: 'object' } },
|
|
1928
|
+
points: { type: 'array', items: { type: 'object' } },
|
|
1929
|
+
returns: { type: 'array', items: { type: 'number' } },
|
|
1930
|
+
performance: { type: 'object', description: 'The standard performance summary' },
|
|
1931
|
+
finalValue: { type: 'number' },
|
|
1932
|
+
runId: { type: 'string' },
|
|
1933
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
1934
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
1935
|
+
},
|
|
1936
|
+
required: [
|
|
1937
|
+
'ledger',
|
|
1938
|
+
'timeline',
|
|
1939
|
+
'pnl',
|
|
1940
|
+
'orders',
|
|
1941
|
+
'fills',
|
|
1942
|
+
'rejections',
|
|
1943
|
+
'liquidations',
|
|
1944
|
+
'events',
|
|
1945
|
+
'valuationMarks',
|
|
1946
|
+
'points',
|
|
1947
|
+
'returns',
|
|
1948
|
+
'performance',
|
|
1949
|
+
'finalValue',
|
|
1950
|
+
'runId',
|
|
1951
|
+
'assumptions',
|
|
1952
|
+
'diagnostics',
|
|
1953
|
+
],
|
|
1954
|
+
},
|
|
1955
|
+
costClass: 'job',
|
|
1956
|
+
handleFields: ['marketData'],
|
|
1957
|
+
run: (input) => {
|
|
1958
|
+
const id = 'totalfinance.backtest.portfolio_run';
|
|
1959
|
+
const { marketData, execution: executionWire, ...rest } = input;
|
|
1960
|
+
const capped = Object.fromEntries(Object.entries(marketData)
|
|
1961
|
+
.filter(([, rows]) => rows !== undefined)
|
|
1962
|
+
.map(([key, rows]) => [key, capRows(rows, `marketData.${key}`, id)]));
|
|
1963
|
+
const result = portfolioBacktest({
|
|
1964
|
+
...rest,
|
|
1965
|
+
marketData: capped,
|
|
1966
|
+
...(executionWire !== undefined ? { execution: executionPolicyOf(executionWire) } : {}),
|
|
1967
|
+
});
|
|
1968
|
+
return {
|
|
1969
|
+
summary: `${result.diagnostics.sessionCount} sessions, ${result.fills.length} fills, final value ${result.finalValue.toFixed(2)} (${result.assumptions.execution.realism} execution)`,
|
|
1970
|
+
structured: result,
|
|
1971
|
+
};
|
|
1972
|
+
},
|
|
1973
|
+
});
|
|
1974
|
+
// ── Stage 7B.1 slice 5 (AT4 Decision 10): the trading-agent environment over the wire ────────────
|
|
1975
|
+
const EnvironmentLimitsSchema = schema.object({
|
|
1976
|
+
maximumPositionWeight: schema.number().positive().max(1).optional(),
|
|
1977
|
+
maximumGrossLeverage: schema.number().positive().optional(),
|
|
1978
|
+
maximumDrawdown: schema.number().positive().max(1).optional(),
|
|
1979
|
+
maximumDailyLoss: schema.number().positive().max(1).optional(),
|
|
1980
|
+
maximumDaysToLiquidate: schema.number().positive().optional(),
|
|
1981
|
+
minimumSettledCash: schema.number().optional(),
|
|
1982
|
+
allowUndefinedRiskOptions: schema.boolean().optional(),
|
|
1983
|
+
maximumPositionNotional: schema.number().positive().optional(),
|
|
1984
|
+
onBreach: schema.enum(['terminate', 'reject-and-continue']).optional(),
|
|
1985
|
+
});
|
|
1986
|
+
const RewardCompositionSchema = schema
|
|
1987
|
+
.object({
|
|
1988
|
+
pnl: schema.number().optional(),
|
|
1989
|
+
drawdown: schema.number().optional(),
|
|
1990
|
+
turnover: schema.number().optional(),
|
|
1991
|
+
cost: schema.number().optional(),
|
|
1992
|
+
concentration: schema.number().optional(),
|
|
1993
|
+
leverage: schema.number().optional(),
|
|
1994
|
+
riskViolation: schema.number().optional(),
|
|
1995
|
+
benchmark: schema
|
|
1996
|
+
.object({ weight: schema.number(), instrumentId: schema.string().nonempty() })
|
|
1997
|
+
.optional(),
|
|
1998
|
+
})
|
|
1999
|
+
.describe('The declared reward composition; a goal callback is SDK-only');
|
|
2000
|
+
const FeatureRecipesSchema = schema.object({
|
|
2001
|
+
lookbackReturns: schema.array(schema.number().integer().positive()).min(1).optional(),
|
|
2002
|
+
realizedVolatility: schema
|
|
2003
|
+
.object({
|
|
2004
|
+
lookbacks: schema.array(schema.number().integer().positive()).min(1),
|
|
2005
|
+
annualization: schema
|
|
2006
|
+
.number()
|
|
2007
|
+
.positive()
|
|
2008
|
+
.describe('Bars per year scaling the per-bar σ (252 daily, 52 weekly, 12 monthly; 1 = per-bar). Required: the environment never assumes the bar frequency.'),
|
|
2009
|
+
})
|
|
2010
|
+
.optional(),
|
|
2011
|
+
drawdown: schema.boolean().optional(),
|
|
2012
|
+
});
|
|
2013
|
+
/** The environment definition over the wire: the portfolio request without a strategy, plus the episode blocks. */
|
|
2014
|
+
const EnvironmentDefinitionSchema = schema.object({
|
|
2015
|
+
accounting: PortfolioAccountingSchema,
|
|
2016
|
+
instruments: schema.record(InstrumentSpecificationSchema),
|
|
2017
|
+
marketData: PortfolioMarketDataSchema,
|
|
2018
|
+
execution: DeclaredExecutionSchema.optional().describe('Default: execution.simplified()'),
|
|
2019
|
+
externalFlows: ExternalFlowsSchema,
|
|
2020
|
+
calendar: PortfolioCalendarSchema,
|
|
2021
|
+
window: BacktestWindowSchema,
|
|
2022
|
+
periodsPerYear: schema.number().positive().optional().describe('Default 252'),
|
|
2023
|
+
seed: schema.number().integer().nonnegative().optional(),
|
|
2024
|
+
maximumSteps: schema.number().integer().positive().optional(),
|
|
2025
|
+
limits: EnvironmentLimitsSchema.optional(),
|
|
2026
|
+
reward: RewardCompositionSchema.optional(),
|
|
2027
|
+
features: FeatureRecipesSchema.optional(),
|
|
2028
|
+
});
|
|
2029
|
+
const BaselineSchema = schema.union([
|
|
2030
|
+
schema.object({ baseline: schema.literal('holdCash') }),
|
|
2031
|
+
schema.object({
|
|
2032
|
+
baseline: schema.literal('buyAndHold'),
|
|
2033
|
+
weights: schema.record(schema.number().nonnegative()).optional(),
|
|
2034
|
+
}),
|
|
2035
|
+
schema.object({
|
|
2036
|
+
baseline: schema.literal('periodicRebalance'),
|
|
2037
|
+
everySessions: schema.number().integer().positive(),
|
|
2038
|
+
weights: schema.record(schema.number().nonnegative()).optional(),
|
|
2039
|
+
}),
|
|
2040
|
+
schema.object({
|
|
2041
|
+
baseline: schema.literal('randomValidAction'),
|
|
2042
|
+
seed: schema.number().integer().nonnegative(),
|
|
2043
|
+
}),
|
|
2044
|
+
schema.object({
|
|
2045
|
+
baseline: schema.literal('riskParity'),
|
|
2046
|
+
lookback: schema.number().integer().positive(),
|
|
2047
|
+
everySessions: schema.number().integer().positive().optional(),
|
|
2048
|
+
}),
|
|
2049
|
+
schema.object({
|
|
2050
|
+
baseline: schema.literal('momentumCrossover'),
|
|
2051
|
+
fast: schema.number().integer().positive(),
|
|
2052
|
+
slow: schema.number().integer().positive(),
|
|
2053
|
+
}),
|
|
2054
|
+
]);
|
|
2055
|
+
const EnvironmentEpisodeInputSchema = schema.object({
|
|
2056
|
+
episode: schema
|
|
2057
|
+
.union([
|
|
2058
|
+
schema.enum(ENVIRONMENT_EPISODE_IDS),
|
|
2059
|
+
schema.object({ id: schema.string().nonempty(), definition: EnvironmentDefinitionSchema }),
|
|
2060
|
+
])
|
|
2061
|
+
.describe('A catalogue id, or a named declarative definition'),
|
|
2062
|
+
policy: BaselineSchema.describe('A maintained baseline; a TypeScript policy is SDK-only'),
|
|
2063
|
+
seed: schema.number().integer().nonnegative().optional().describe('Default 42'),
|
|
2064
|
+
artifact: schema
|
|
2065
|
+
.enum(['none', 'embed'])
|
|
2066
|
+
.optional()
|
|
2067
|
+
.describe("Default 'none'; 'embed' returns the recorded episode as an `environment` run artifact"),
|
|
2068
|
+
});
|
|
2069
|
+
function baselineOf(wire) {
|
|
2070
|
+
switch (wire.baseline) {
|
|
2071
|
+
case 'holdCash':
|
|
2072
|
+
return agentBaselines.holdCash();
|
|
2073
|
+
case 'buyAndHold':
|
|
2074
|
+
return agentBaselines.buyAndHold(wire.weights !== undefined ? { weights: wire.weights } : undefined);
|
|
2075
|
+
case 'periodicRebalance':
|
|
2076
|
+
return agentBaselines.periodicRebalance({
|
|
2077
|
+
everySessions: wire.everySessions,
|
|
2078
|
+
...(wire.weights !== undefined ? { weights: wire.weights } : {}),
|
|
2079
|
+
});
|
|
2080
|
+
case 'randomValidAction':
|
|
2081
|
+
return agentBaselines.randomValidAction(wire.seed);
|
|
2082
|
+
case 'riskParity':
|
|
2083
|
+
return agentBaselines.riskParity({
|
|
2084
|
+
lookback: wire.lookback,
|
|
2085
|
+
...(wire.everySessions !== undefined ? { everySessions: wire.everySessions } : {}),
|
|
2086
|
+
});
|
|
2087
|
+
case 'momentumCrossover':
|
|
2088
|
+
return agentBaselines.momentumCrossover({ fast: wire.fast, slow: wire.slow });
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
const backtestEnvironmentEpisode = defineOperation({
|
|
2092
|
+
id: 'totalfinance.backtest.environment_episode',
|
|
2093
|
+
title: 'Bench a baseline policy over one trading-environment episode',
|
|
2094
|
+
description: 'Run one of the six maintained baseline policies through the deterministic trading environment over a ' +
|
|
2095
|
+
"catalogue episode (or a named declarative definition) at a seed, and return Agent Bench's report for that " +
|
|
2096
|
+
'episode: operational conformance (look-ahead, replay equality, duplicate orders under the retry drive, ' +
|
|
2097
|
+
'external-order attempts, reconciliation; the mask and limit counts) apart from strategy quality (return, ' +
|
|
2098
|
+
'volatility, Sharpe, Sortino, drawdown, turnover, cost, exposure, violations) — no single score by design. ' +
|
|
2099
|
+
"With artifact: 'embed', the recorded episode travels as an `environment` run artifact that replays to its run " +
|
|
2100
|
+
'hash. Declarative inputs only: a TypeScript policy or a reward goal callback is SDK-only. Opt-in (backtestPack).',
|
|
2101
|
+
inputSchema: EnvironmentEpisodeInputSchema,
|
|
2102
|
+
outputSchema: {
|
|
2103
|
+
type: 'object',
|
|
2104
|
+
properties: {
|
|
2105
|
+
policy: { type: 'string' },
|
|
2106
|
+
episode: {
|
|
2107
|
+
type: 'object',
|
|
2108
|
+
description: 'The bench report for the one episode: operational and strategy blocks',
|
|
2109
|
+
},
|
|
2110
|
+
trace: {
|
|
2111
|
+
type: 'object',
|
|
2112
|
+
description: 'The recorded episode: runId, engineRunId, traceHash, steps, rewardTotal, terminated, truncated, reason',
|
|
2113
|
+
},
|
|
2114
|
+
artifact: {
|
|
2115
|
+
type: ['object', 'null'],
|
|
2116
|
+
description: "The `environment` run artifact when artifact is 'embed'",
|
|
2117
|
+
},
|
|
2118
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
2119
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
2120
|
+
},
|
|
2121
|
+
required: ['policy', 'episode', 'trace', 'artifact', 'assumptions', 'diagnostics'],
|
|
2122
|
+
},
|
|
2123
|
+
costClass: 'job',
|
|
2124
|
+
handleFields: ['episode.definition.marketData'],
|
|
2125
|
+
run: (input) => {
|
|
2126
|
+
const id = 'totalfinance.backtest.environment_episode';
|
|
2127
|
+
const policy = baselineOf(input.policy);
|
|
2128
|
+
const seed = input.seed ?? 42;
|
|
2129
|
+
const episode = typeof input.episode === 'string'
|
|
2130
|
+
? input.episode
|
|
2131
|
+
: (() => {
|
|
2132
|
+
const { execution: executionWire, marketData, ...rest } = input.episode.definition;
|
|
2133
|
+
const capped = Object.fromEntries(Object.entries(marketData)
|
|
2134
|
+
.filter(([, rows]) => rows !== undefined)
|
|
2135
|
+
.map(([key, rows]) => [
|
|
2136
|
+
key,
|
|
2137
|
+
capRows(rows, `episode.definition.marketData.${key}`, id),
|
|
2138
|
+
]));
|
|
2139
|
+
return {
|
|
2140
|
+
id: input.episode.id,
|
|
2141
|
+
definition: {
|
|
2142
|
+
...rest,
|
|
2143
|
+
marketData: capped,
|
|
2144
|
+
...(executionWire !== undefined
|
|
2145
|
+
? { execution: executionPolicyOf(executionWire) }
|
|
2146
|
+
: {}),
|
|
2147
|
+
},
|
|
2148
|
+
};
|
|
2149
|
+
})();
|
|
2150
|
+
const report = runAgentBench({ policy, episodes: [episode], seeds: [seed] });
|
|
2151
|
+
const row = report.episodes[0];
|
|
2152
|
+
const trace = report.traces[0];
|
|
2153
|
+
const artifact = input.artifact === 'embed'
|
|
2154
|
+
? backtestRunArtifact({ kind: 'environment', run: trace.episode, input: trace.input })
|
|
2155
|
+
: null;
|
|
2156
|
+
return {
|
|
2157
|
+
summary: `${row.id}@${seed} under ${report.policy}: operational ${row.operational.passes ? 'passes' : 'FAILS'} (look-ahead ${row.operational.lookAhead}, duplicates ${row.operational.duplicateOrders}), final value ${row.strategy.finalValue.toFixed(2)} over ${row.strategy.steps} steps`,
|
|
2158
|
+
structured: {
|
|
2159
|
+
policy: report.policy,
|
|
2160
|
+
episode: row,
|
|
2161
|
+
trace: {
|
|
2162
|
+
runId: trace.episode.runId,
|
|
2163
|
+
engineRunId: trace.episode.engineRunId,
|
|
2164
|
+
traceHash: trace.episode.traceHash,
|
|
2165
|
+
steps: trace.episode.steps,
|
|
2166
|
+
rewardTotal: trace.episode.rewardTotal,
|
|
2167
|
+
terminated: trace.episode.terminated,
|
|
2168
|
+
truncated: trace.episode.truncated,
|
|
2169
|
+
reason: trace.episode.reason,
|
|
2170
|
+
},
|
|
2171
|
+
artifact,
|
|
2172
|
+
assumptions: report.assumptions,
|
|
2173
|
+
diagnostics: report.diagnostics,
|
|
2174
|
+
},
|
|
2175
|
+
};
|
|
2176
|
+
},
|
|
2177
|
+
});
|
|
2178
|
+
/** The journey operations that join the opt-in backtest pack (`backtestPack()`). */
|
|
2179
|
+
export function backtestJourneyOperations() {
|
|
2180
|
+
return [
|
|
2181
|
+
backtestOptionsRun,
|
|
2182
|
+
backtestCrossSectionalRun,
|
|
2183
|
+
backtestPortfolioRun,
|
|
2184
|
+
backtestEnvironmentEpisode,
|
|
2185
|
+
];
|
|
2186
|
+
}
|
|
2187
|
+
// ── Stage 4.7 slice 2 (FC9 Decision 5): company valuation over the wire ───────────────────────
|
|
2188
|
+
const FundamentalPeriodSchema = schema.object({
|
|
2189
|
+
periodStartDate: schema.string().date().optional(),
|
|
2190
|
+
periodEndDate: schema.string().date(),
|
|
2191
|
+
fiscalYear: schema.number().integer(),
|
|
2192
|
+
fiscalQuarter: schema
|
|
2193
|
+
.union([schema.literal(1), schema.literal(2), schema.literal(3), schema.literal(4)])
|
|
2194
|
+
.optional(),
|
|
2195
|
+
periodType: schema.enum(['quarter', 'year', 'trailing-twelve-months']),
|
|
2196
|
+
filedTimestampMs: schema.number().optional(),
|
|
2197
|
+
availableTimestampMs: schema.number(),
|
|
2198
|
+
currency: schema.string().nonempty(),
|
|
2199
|
+
monetaryScale: schema.union([
|
|
2200
|
+
schema.literal(1),
|
|
2201
|
+
schema.literal(1_000),
|
|
2202
|
+
schema.literal(1_000_000),
|
|
2203
|
+
]),
|
|
2204
|
+
form: schema.string().optional(),
|
|
2205
|
+
});
|
|
2206
|
+
const IncomeStatementSchema = schema.object({
|
|
2207
|
+
period: FundamentalPeriodSchema,
|
|
2208
|
+
revenue: schema.number(),
|
|
2209
|
+
costOfRevenue: schema.number().optional(),
|
|
2210
|
+
grossProfit: schema.number().optional(),
|
|
2211
|
+
operatingExpenses: schema.number().optional(),
|
|
2212
|
+
operatingIncome: schema.number(),
|
|
2213
|
+
interestExpense: schema.number().optional(),
|
|
2214
|
+
incomeTaxExpense: schema.number().optional(),
|
|
2215
|
+
netIncome: schema.number(),
|
|
2216
|
+
incomeFromContinuingOperations: schema.number().optional(),
|
|
2217
|
+
sellingGeneralAdministrativeExpense: schema.number().optional(),
|
|
2218
|
+
dilutedSharesOutstanding: schema.number().optional(),
|
|
2219
|
+
metadata: schema.record(schema.unknown()).optional(),
|
|
2220
|
+
});
|
|
2221
|
+
const BalanceSheetSchema = schema.object({
|
|
2222
|
+
period: FundamentalPeriodSchema,
|
|
2223
|
+
cashAndCashEquivalents: schema.number(),
|
|
2224
|
+
shortTermInvestments: schema.number().optional(),
|
|
2225
|
+
accountsReceivable: schema.number().optional(),
|
|
2226
|
+
inventory: schema.number().optional(),
|
|
2227
|
+
currentAssets: schema.number().optional(),
|
|
2228
|
+
propertyPlantEquipmentNet: schema.number().optional(),
|
|
2229
|
+
otherAssets: schema.number().optional(),
|
|
2230
|
+
totalAssets: schema.number(),
|
|
2231
|
+
currentLiabilities: schema.number().optional(),
|
|
2232
|
+
accountsPayable: schema.number().optional(),
|
|
2233
|
+
shortTermDebt: schema.number().optional(),
|
|
2234
|
+
longTermDebt: schema.number().optional(),
|
|
2235
|
+
otherLiabilities: schema.number().optional(),
|
|
2236
|
+
totalDebt: schema.number().optional(),
|
|
2237
|
+
totalLiabilities: schema.number(),
|
|
2238
|
+
preferredEquity: schema.number().optional(),
|
|
2239
|
+
minorityInterest: schema.number().optional(),
|
|
2240
|
+
totalEquity: schema.number(),
|
|
2241
|
+
metadata: schema.record(schema.unknown()).optional(),
|
|
2242
|
+
});
|
|
2243
|
+
const CashFlowStatementSchema = schema.object({
|
|
2244
|
+
period: FundamentalPeriodSchema,
|
|
2245
|
+
operatingCashFlow: schema.number(),
|
|
2246
|
+
investingCashFlow: schema.number(),
|
|
2247
|
+
financingCashFlow: schema.number(),
|
|
2248
|
+
capitalExpenditure: schema.number().optional(),
|
|
2249
|
+
depreciationAndAmortization: schema.number().optional(),
|
|
2250
|
+
stockBasedCompensation: schema.number().optional(),
|
|
2251
|
+
acquisitions: schema.number().optional(),
|
|
2252
|
+
dividendsPaid: schema.number().optional(),
|
|
2253
|
+
shareRepurchases: schema.number().optional(),
|
|
2254
|
+
increaseInNetWorkingCapital: schema.number().optional(),
|
|
2255
|
+
netChangeInCash: schema.number().optional(),
|
|
2256
|
+
metadata: schema.record(schema.unknown()).optional(),
|
|
2257
|
+
});
|
|
2258
|
+
const FinancialStatementsSchema = schema
|
|
2259
|
+
.object({
|
|
2260
|
+
income: IncomeStatementSchema,
|
|
2261
|
+
balance: BalanceSheetSchema,
|
|
2262
|
+
cashFlow: CashFlowStatementSchema,
|
|
2263
|
+
})
|
|
2264
|
+
.describe('The typed historical base (one period of the three statements) the projection rolls forward');
|
|
2265
|
+
const AmountDriverSchema = schema.union([
|
|
2266
|
+
schema.object({ amount: schema.number() }),
|
|
2267
|
+
schema.object({ fractionOfRevenue: schema.number() }),
|
|
2268
|
+
]);
|
|
2269
|
+
const StatementProjectionPeriodSchema = schema.object({
|
|
2270
|
+
periodLabel: schema.string().nonempty(),
|
|
2271
|
+
revenue: schema.union([
|
|
2272
|
+
schema.object({ amount: schema.number() }),
|
|
2273
|
+
schema.object({ growthRate: schema.number() }),
|
|
2274
|
+
]),
|
|
2275
|
+
operatingMargin: schema.number(),
|
|
2276
|
+
taxRate: schema.number(),
|
|
2277
|
+
interestExpense: schema.number(),
|
|
2278
|
+
depreciationAndAmortization: AmountDriverSchema,
|
|
2279
|
+
capitalExpenditure: AmountDriverSchema,
|
|
2280
|
+
accountsReceivable: AmountDriverSchema,
|
|
2281
|
+
inventory: AmountDriverSchema,
|
|
2282
|
+
accountsPayable: AmountDriverSchema,
|
|
2283
|
+
netBorrowing: schema.number(),
|
|
2284
|
+
dividendsPaid: schema.number(),
|
|
2285
|
+
});
|
|
2286
|
+
const InterestCompoundingSchema = schema.union([
|
|
2287
|
+
schema.enum(['simple', 'continuous', 'annual', 'semiannual', 'quarterly', 'monthly']),
|
|
2288
|
+
schema.object({
|
|
2289
|
+
type: schema.literal('periodic'),
|
|
2290
|
+
periodsPerYear: schema.number().integer().positive(),
|
|
2291
|
+
}),
|
|
2292
|
+
]);
|
|
2293
|
+
const TerminalValueMethodSchema = schema.union([
|
|
2294
|
+
schema.object({
|
|
2295
|
+
method: schema.literal('perpetual-growth'),
|
|
2296
|
+
terminalCashFlow: schema.number(),
|
|
2297
|
+
perpetualGrowthRate: schema.number(),
|
|
2298
|
+
}),
|
|
2299
|
+
schema.object({
|
|
2300
|
+
method: schema.literal('exit-multiple'),
|
|
2301
|
+
terminalMetricAmount: schema.number(),
|
|
2302
|
+
exitMultiple: schema.number(),
|
|
2303
|
+
}),
|
|
2304
|
+
]);
|
|
2305
|
+
const ValuationConventionsSchema = schema
|
|
2306
|
+
.object({
|
|
2307
|
+
valuationBasis: schema.enum(['firm', 'equity']),
|
|
2308
|
+
valuationDate: schema.string().date(),
|
|
2309
|
+
currency: schema.string().nonempty(),
|
|
2310
|
+
annualDiscountRate: schema
|
|
2311
|
+
.number()
|
|
2312
|
+
.describe('REQUIRED and explicit — a discount rate is a goal, never a default (FC0)'),
|
|
2313
|
+
compounding: InterestCompoundingSchema,
|
|
2314
|
+
dayCount: schema.enum(['ACT/365F', 'ACT/360', '30/360']).optional(),
|
|
2315
|
+
terminalValueMethod: TerminalValueMethodSchema,
|
|
2316
|
+
enterpriseToEquityBridge: schema
|
|
2317
|
+
.object({
|
|
2318
|
+
cashAndCashEquivalents: schema.number(),
|
|
2319
|
+
totalDebt: schema.number(),
|
|
2320
|
+
preferredEquity: schema.number(),
|
|
2321
|
+
minorityInterest: schema.number(),
|
|
2322
|
+
nonOperatingAssets: schema.number(),
|
|
2323
|
+
})
|
|
2324
|
+
.optional(),
|
|
2325
|
+
dilutedSharesOutstanding: schema.number().positive().optional(),
|
|
2326
|
+
provenance: schema
|
|
2327
|
+
.object({
|
|
2328
|
+
forecastIdentity: schema.string().optional(),
|
|
2329
|
+
statementIdentity: schema.string().optional(),
|
|
2330
|
+
restatementIdentity: schema.string().optional(),
|
|
2331
|
+
source: schema.string().optional(),
|
|
2332
|
+
})
|
|
2333
|
+
.optional(),
|
|
2334
|
+
})
|
|
2335
|
+
.describe("discountedCashFlow's conventions, minus the projected flows the projection supplies");
|
|
2336
|
+
const SensitivityAxisSchema = schema.object({
|
|
2337
|
+
variable: schema.enum([
|
|
2338
|
+
'annual-discount-rate',
|
|
2339
|
+
'perpetual-growth-rate',
|
|
2340
|
+
'exit-multiple',
|
|
2341
|
+
]),
|
|
2342
|
+
values: schema.array(schema.number()).min(1),
|
|
2343
|
+
});
|
|
2344
|
+
const ValuationCompanyInputSchema = schema.object({
|
|
2345
|
+
projection: schema.object({
|
|
2346
|
+
baseStatements: FinancialStatementsSchema,
|
|
2347
|
+
periods: schema.array(StatementProjectionPeriodSchema).min(1),
|
|
2348
|
+
}),
|
|
2349
|
+
valuation: ValuationConventionsSchema,
|
|
2350
|
+
sensitivity: schema
|
|
2351
|
+
.object({ rowAxis: SensitivityAxisSchema, columnAxis: SensitivityAxisSchema })
|
|
2352
|
+
.optional()
|
|
2353
|
+
.describe('Adds discountedCashFlowSensitivityTable over the same flows when supplied'),
|
|
2354
|
+
});
|
|
2355
|
+
const valuationCompany = defineOperation({
|
|
2356
|
+
id: 'totalfinance.valuation.company',
|
|
2357
|
+
title: 'Value a company from its statements',
|
|
2358
|
+
description: 'Project the three statements from explicit drivers, take the free cash flows the valuation basis ' +
|
|
2359
|
+
'needs, and discount them under the stated conventions (basis, date, currency, the REQUIRED discount rate, ' +
|
|
2360
|
+
'compounding, day count, the terminal value method, the enterprise-to-equity bridge). The result is ' +
|
|
2361
|
+
'discountedCashFlowFromStatements(...) verbatim — the projection with its balance-sheet reconciliation, the ' +
|
|
2362
|
+
'cash flows used, and the valuation — plus discountedCashFlowSensitivityTable(...) over the same flows when a ' +
|
|
2363
|
+
'sensitivity request is supplied. Opt-in (valuationPack).',
|
|
2364
|
+
inputSchema: ValuationCompanyInputSchema,
|
|
2365
|
+
outputSchema: {
|
|
2366
|
+
type: 'object',
|
|
2367
|
+
properties: {
|
|
2368
|
+
projection: { type: 'object', description: 'projectFinancialStatements(...) verbatim' },
|
|
2369
|
+
cashFlowsUsed: { type: 'string', enum: ['freeCashFlowToFirm', 'freeCashFlowToEquity'] },
|
|
2370
|
+
valuation: { type: 'object', description: 'discountedCashFlow(...) verbatim' },
|
|
2371
|
+
sensitivity: {
|
|
2372
|
+
type: ['object', 'null'],
|
|
2373
|
+
description: 'discountedCashFlowSensitivityTable(...) verbatim, or null when not requested',
|
|
2374
|
+
},
|
|
2375
|
+
assumptions: ASSUMPTIONS_SCHEMA,
|
|
2376
|
+
diagnostics: DIAGNOSTICS_SCHEMA,
|
|
2377
|
+
},
|
|
2378
|
+
required: [
|
|
2379
|
+
'projection',
|
|
2380
|
+
'cashFlowsUsed',
|
|
2381
|
+
'valuation',
|
|
2382
|
+
'sensitivity',
|
|
2383
|
+
'assumptions',
|
|
2384
|
+
'diagnostics',
|
|
2385
|
+
],
|
|
2386
|
+
},
|
|
2387
|
+
costClass: 'medium',
|
|
2388
|
+
run: (input) => {
|
|
2389
|
+
const { sensitivity, ...request } = input;
|
|
2390
|
+
const result = discountedCashFlowFromStatements(request);
|
|
2391
|
+
// The sensitivity table discounts the SAME flows the composition used — rebuilt exactly as the
|
|
2392
|
+
// acceptance law rebuilds them (period index + 1 years, the basis's free cash flow).
|
|
2393
|
+
const table = sensitivity !== undefined
|
|
2394
|
+
? discountedCashFlowSensitivityTable({
|
|
2395
|
+
discountedCashFlowInput: {
|
|
2396
|
+
...request.valuation,
|
|
2397
|
+
projectedCashFlows: result.projection.statements.map((period, index) => ({
|
|
2398
|
+
timeYears: index + 1,
|
|
2399
|
+
amount: result.cashFlowsUsed === 'freeCashFlowToFirm'
|
|
2400
|
+
? period.freeCashFlowToFirm
|
|
2401
|
+
: period.freeCashFlowToEquity,
|
|
2402
|
+
})),
|
|
2403
|
+
},
|
|
2404
|
+
rowAxis: sensitivity.rowAxis,
|
|
2405
|
+
columnAxis: sensitivity.columnAxis,
|
|
2406
|
+
})
|
|
2407
|
+
: null;
|
|
2408
|
+
const value = result.valuation;
|
|
2409
|
+
const headline = 'enterpriseValue' in value
|
|
2410
|
+
? `enterprise value ${value.enterpriseValue.toFixed(2)}`
|
|
2411
|
+
: `equity value ${value.equityValue.toFixed(2)}`;
|
|
2412
|
+
return {
|
|
2413
|
+
summary: `${result.cashFlowsUsed} over ${result.assumptions.projectedPeriodCount} periods: ${headline} ${request.valuation.currency}${table ? `; ${table.rowValues.length}×${table.columnValues.length} sensitivity table` : ''}`,
|
|
2414
|
+
structured: {
|
|
2415
|
+
projection: result.projection,
|
|
2416
|
+
cashFlowsUsed: result.cashFlowsUsed,
|
|
2417
|
+
valuation: result.valuation,
|
|
2418
|
+
sensitivity: table,
|
|
2419
|
+
assumptions: {
|
|
2420
|
+
...result.assumptions,
|
|
2421
|
+
sensitivity: table ? table.assumptions : 'omitted: no sensitivity request supplied',
|
|
2422
|
+
},
|
|
2423
|
+
diagnostics: {
|
|
2424
|
+
warnings: [...result.diagnostics.warnings, ...(table?.diagnostics.warnings ?? [])],
|
|
2425
|
+
},
|
|
2426
|
+
},
|
|
2427
|
+
};
|
|
2428
|
+
},
|
|
2429
|
+
});
|
|
2430
|
+
/** The company-valuation journey pack — opt-in beside the ten domain packs and the other journey packs. */
|
|
2431
|
+
export function valuationPack() {
|
|
2432
|
+
return { name: 'valuation', operations: [valuationCompany] };
|
|
2433
|
+
}
|
|
2434
|
+
/**
|
|
2435
|
+
* The five journey packs — opt-in beside the ten domain packs (Decision 9 counts them apart from
|
|
2436
|
+
* the twenty-three defaults; Stage 4.7 slice 2 added the valuation pack): `createOperationRegistry({ packs: [...defaultPacks(), ...journeyPacks()] })`.
|
|
2437
|
+
*/
|
|
2438
|
+
export function journeyPacks() {
|
|
2439
|
+
return [portfolioPack(), scenarioPack(), researchPack(), artifactPack(), valuationPack()];
|
|
2440
|
+
}
|
|
2441
|
+
/** Every journey operation across the four journey packs, flattened. */
|
|
2442
|
+
export function journeyOperations() {
|
|
2443
|
+
return journeyPacks().flatMap((pack) => pack.operations);
|
|
2444
|
+
}
|
|
2445
|
+
//# sourceMappingURL=operations-journey.js.map
|