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