quantark 0.1.0__py3-none-any.whl

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 (399) hide show
  1. quantark/__init__.py +3 -0
  2. quantark/_compat.py +150 -0
  3. quantark/asset/__init__.py +8 -0
  4. quantark/asset/bond/__init__.py +2 -0
  5. quantark/asset/bond/engine/__init__.py +44 -0
  6. quantark/asset/bond/engine/analytical/__init__.py +12 -0
  7. quantark/asset/bond/engine/analytical/black_engine.py +583 -0
  8. quantark/asset/bond/engine/analytical/bond_forward_engine.py +390 -0
  9. quantark/asset/bond/engine/analytical/bond_futures_engine.py +569 -0
  10. quantark/asset/bond/engine/convertible/__init__.py +12 -0
  11. quantark/asset/bond/engine/convertible/convertible_bond_engine.py +800 -0
  12. quantark/asset/bond/engine/discount/__init__.py +10 -0
  13. quantark/asset/bond/engine/discount/bond_discount_engine.py +517 -0
  14. quantark/asset/bond/engine/discount/frn_engine.py +913 -0
  15. quantark/asset/bond/engine/pde/__init__.py +14 -0
  16. quantark/asset/bond/engine/pde/convertible/__init__.py +21 -0
  17. quantark/asset/bond/engine/pde/convertible/jump_diffusion_engine.py +603 -0
  18. quantark/asset/bond/engine/pde/convertible/pde_params.py +59 -0
  19. quantark/asset/bond/engine/pde/convertible/tf_engine.py +546 -0
  20. quantark/asset/bond/engine/tree/__init__.py +14 -0
  21. quantark/asset/bond/engine/tree/convertible/__init__.py +21 -0
  22. quantark/asset/bond/engine/tree/convertible/binomial_engine.py +488 -0
  23. quantark/asset/bond/engine/tree/convertible/tree_params.py +72 -0
  24. quantark/asset/bond/engine/tree/convertible/trinomial_engine.py +1341 -0
  25. quantark/asset/bond/product/__init__.py +37 -0
  26. quantark/asset/bond/product/base_bond_product.py +114 -0
  27. quantark/asset/bond/product/convertible/__init__.py +16 -0
  28. quantark/asset/bond/product/convertible/convertible_bond.py +595 -0
  29. quantark/asset/bond/product/couponbond/__init__.py +12 -0
  30. quantark/asset/bond/product/couponbond/fixed_bond.py +285 -0
  31. quantark/asset/bond/product/couponbond/frn.py +538 -0
  32. quantark/asset/bond/product/forward/__init__.py +9 -0
  33. quantark/asset/bond/product/forward/base_bond_forward.py +92 -0
  34. quantark/asset/bond/product/forward/bond_forward.py +335 -0
  35. quantark/asset/bond/product/futures/__init__.py +8 -0
  36. quantark/asset/bond/product/futures/bond_futures.py +532 -0
  37. quantark/asset/bond/product/option/__init__.py +9 -0
  38. quantark/asset/bond/product/option/euro_short_term_bond_option.py +231 -0
  39. quantark/asset/bond/riskmeasures/__init__.py +13 -0
  40. quantark/asset/bond/riskmeasures/bond_greeks_calculator.py +484 -0
  41. quantark/asset/bond/schedule/__init__.py +21 -0
  42. quantark/asset/bond/schedule/cashflow.py +595 -0
  43. quantark/asset/equity/__init__.py +11 -0
  44. quantark/asset/equity/analysis/__init__.py +4 -0
  45. quantark/asset/equity/analysis/autocallable_path_analyzer.py +257 -0
  46. quantark/asset/equity/engine/__init__.py +84 -0
  47. quantark/asset/equity/engine/analytical/__init__.py +37 -0
  48. quantark/asset/equity/engine/analytical/american_option_engine.py +682 -0
  49. quantark/asset/equity/engine/analytical/asian_option_analytical_engine.py +1102 -0
  50. quantark/asset/equity/engine/analytical/barrier_analytical_engine.py +455 -0
  51. quantark/asset/equity/engine/analytical/black_scholes_engine.py +322 -0
  52. quantark/asset/equity/engine/analytical/deltaone_engine.py +340 -0
  53. quantark/asset/equity/engine/analytical/digital_option_engine.py +168 -0
  54. quantark/asset/equity/engine/analytical/double_barrier_option_engine.py +481 -0
  55. quantark/asset/equity/engine/analytical/double_sharkfin_option_analytical_engine.py +508 -0
  56. quantark/asset/equity/engine/analytical/one_touch_analytical_engine.py +302 -0
  57. quantark/asset/equity/engine/analytical/range_accrual_analytical_engine.py +396 -0
  58. quantark/asset/equity/engine/analytical/single_sharkfin_option_analytical_engine.py +229 -0
  59. quantark/asset/equity/engine/base_engine.py +137 -0
  60. quantark/asset/equity/engine/event_stats.py +85 -0
  61. quantark/asset/equity/engine/mc/__init__.py +31 -0
  62. quantark/asset/equity/engine/mc/american_option_mc_engine.py +485 -0
  63. quantark/asset/equity/engine/mc/asian_option_mc_engine.py +678 -0
  64. quantark/asset/equity/engine/mc/barrier_option_mc_engine.py +726 -0
  65. quantark/asset/equity/engine/mc/digital_option_mc_engine.py +419 -0
  66. quantark/asset/equity/engine/mc/double_sharkfin_option_mc_engine.py +676 -0
  67. quantark/asset/equity/engine/mc/euro_mc_engine.py +423 -0
  68. quantark/asset/equity/engine/mc/phoenix_mc_engine.py +1206 -0
  69. quantark/asset/equity/engine/mc/range_accrual_mc_engine.py +738 -0
  70. quantark/asset/equity/engine/mc/single_sharkfin_option_mc_engine.py +549 -0
  71. quantark/asset/equity/engine/mc/snowball_mc_engine.py +2250 -0
  72. quantark/asset/equity/engine/pde/__init__.py +36 -0
  73. quantark/asset/equity/engine/pde/american_pde_solver.py +211 -0
  74. quantark/asset/equity/engine/pde/barrier_pde_solver.py +692 -0
  75. quantark/asset/equity/engine/pde/base_pde_solver.py +994 -0
  76. quantark/asset/equity/engine/pde/double_barrier_pde_solver.py +510 -0
  77. quantark/asset/equity/engine/pde/double_one_touch_pde_solver.py +435 -0
  78. quantark/asset/equity/engine/pde/european_pde_solver.py +170 -0
  79. quantark/asset/equity/engine/pde/ko_reset_snowball_pde_solver.py +477 -0
  80. quantark/asset/equity/engine/pde/one_touch_pde_solver.py +439 -0
  81. quantark/asset/equity/engine/pde/phoenix_pde_solver.py +613 -0
  82. quantark/asset/equity/engine/pde/snowball_pde_solver.py +1810 -0
  83. quantark/asset/equity/engine/pde/spatial_grid.py +750 -0
  84. quantark/asset/equity/engine/pde/time_grid.py +308 -0
  85. quantark/asset/equity/engine/pde_engine.py +238 -0
  86. quantark/asset/equity/engine/quad/__init__.py +23 -0
  87. quantark/asset/equity/engine/quad/discrete_quad_engine.py +106 -0
  88. quantark/asset/equity/engine/quad/european_quad_engine.py +325 -0
  89. quantark/asset/equity/engine/quad/ko_reset_snowball_quad_engine.py +362 -0
  90. quantark/asset/equity/engine/quad/phoenix_quad_engine.py +614 -0
  91. quantark/asset/equity/engine/quad/quad_adapters.py +1260 -0
  92. quantark/asset/equity/engine/quad/quad_core.py +513 -0
  93. quantark/asset/equity/engine/quad/quad_math.py +219 -0
  94. quantark/asset/equity/engine/quad/snowball_quad_engine.py +1137 -0
  95. quantark/asset/equity/engine/validation/script/benchmark_check_american_analytical.py +117 -0
  96. quantark/asset/equity/engine/validation/script/benchmark_check_american_pde.py +114 -0
  97. quantark/asset/equity/engine/validation/script/benchmark_check_asian_analytical.py +440 -0
  98. quantark/asset/equity/engine/validation/script/benchmark_check_barrier_analytical.py +269 -0
  99. quantark/asset/equity/engine/validation/script/benchmark_check_barrier_pde_solver.py +636 -0
  100. quantark/asset/equity/engine/validation/script/benchmark_check_digital_option.py +256 -0
  101. quantark/asset/equity/engine/validation/script/benchmark_check_snowball_pde_solver.py +807 -0
  102. quantark/asset/equity/engine/validation/script/boundary_check_american_analytical.py +290 -0
  103. quantark/asset/equity/engine/validation/script/boundary_check_american_pde.py +242 -0
  104. quantark/asset/equity/engine/validation/script/boundary_check_asian_analytical.py +612 -0
  105. quantark/asset/equity/engine/validation/script/boundary_check_barrier_analytical.py +434 -0
  106. quantark/asset/equity/engine/validation/script/boundary_check_barrier_pde_solver.py +748 -0
  107. quantark/asset/equity/engine/validation/script/boundary_check_digital_option.py +575 -0
  108. quantark/asset/equity/engine/validation/script/boundary_check_snowball_pde_solver.py +1101 -0
  109. quantark/asset/equity/engine/validation/script/greeks_check_digital_option.py +349 -0
  110. quantark/asset/equity/engine/validation/script/mc_comparison_barrier_pde.py +270 -0
  111. quantark/asset/equity/engine/validation/script/quick_mc_compare.py +51 -0
  112. quantark/asset/equity/engine/validation/script/validation_stepdown_improved.py +97 -0
  113. quantark/asset/equity/param/__init__.py +24 -0
  114. quantark/asset/equity/param/engine_param_profiles.py +325 -0
  115. quantark/asset/equity/param/engine_params.py +728 -0
  116. quantark/asset/equity/process/__init__.py +7 -0
  117. quantark/asset/equity/process/bsm/__init__.py +7 -0
  118. quantark/asset/equity/process/bsm/bsm_process.py +108 -0
  119. quantark/asset/equity/process/bsm/qmc_brownian_bridge.py +401 -0
  120. quantark/asset/equity/process/bsm/qmc_path_generator.py +694 -0
  121. quantark/asset/equity/process/bsm/qmc_rqmc_driver.py +163 -0
  122. quantark/asset/equity/process/bsm/qmc_sobol.py +195 -0
  123. quantark/asset/equity/process/bsm/qmc_variance_reduction.py +292 -0
  124. quantark/asset/equity/product/__init__.py +8 -0
  125. quantark/asset/equity/product/base_equity_product.py +72 -0
  126. quantark/asset/equity/product/deltaone/__init__.py +22 -0
  127. quantark/asset/equity/product/deltaone/base_deltaone_product.py +147 -0
  128. quantark/asset/equity/product/deltaone/futures.py +485 -0
  129. quantark/asset/equity/product/deltaone/spot_instrument.py +118 -0
  130. quantark/asset/equity/product/option/__init__.py +104 -0
  131. quantark/asset/equity/product/option/american_option.py +114 -0
  132. quantark/asset/equity/product/option/asian_option.py +531 -0
  133. quantark/asset/equity/product/option/barrier_option.py +289 -0
  134. quantark/asset/equity/product/option/base_equity_option.py +659 -0
  135. quantark/asset/equity/product/option/digital_option.py +102 -0
  136. quantark/asset/equity/product/option/double_barrier_option.py +286 -0
  137. quantark/asset/equity/product/option/double_one_touch_option.py +310 -0
  138. quantark/asset/equity/product/option/double_sharkfin_option.py +466 -0
  139. quantark/asset/equity/product/option/european_vanilla_option.py +103 -0
  140. quantark/asset/equity/product/option/ko_reset_snowball_option.py +563 -0
  141. quantark/asset/equity/product/option/observation_schedule.py +530 -0
  142. quantark/asset/equity/product/option/one_touch_option.py +287 -0
  143. quantark/asset/equity/product/option/phoenix_config.py +116 -0
  144. quantark/asset/equity/product/option/phoenix_helpers.py +576 -0
  145. quantark/asset/equity/product/option/phoenix_option.py +1167 -0
  146. quantark/asset/equity/product/option/range_accrual_config.py +288 -0
  147. quantark/asset/equity/product/option/range_accrual_helpers.py +608 -0
  148. quantark/asset/equity/product/option/range_accrual_option.py +526 -0
  149. quantark/asset/equity/product/option/single_sharkfin_option.py +420 -0
  150. quantark/asset/equity/product/option/snowball_config.py +261 -0
  151. quantark/asset/equity/product/option/snowball_helpers.py +977 -0
  152. quantark/asset/equity/product/option/snowball_option.py +1242 -0
  153. quantark/asset/equity/report/__init__.py +15 -0
  154. quantark/asset/equity/report/autocallable_risk_report.py +2118 -0
  155. quantark/asset/equity/report/plotting.py +87 -0
  156. quantark/asset/equity/report/snowball_risk_comparison_report.py +2230 -0
  157. quantark/asset/equity/report/surfaces.py +123 -0
  158. quantark/asset/equity/report/term_structure.py +126 -0
  159. quantark/asset/equity/riskmeasures/__init__.py +7 -0
  160. quantark/asset/equity/riskmeasures/greeks_calculator.py +1204 -0
  161. quantark/asset/rate/__init__.py +58 -0
  162. quantark/asset/rate/engine/__init__.py +25 -0
  163. quantark/asset/rate/engine/cap_floor_engine.py +514 -0
  164. quantark/asset/rate/engine/fra_engine.py +286 -0
  165. quantark/asset/rate/engine/irs_discount_engine.py +891 -0
  166. quantark/asset/rate/engine/swaption_engine.py +587 -0
  167. quantark/asset/rate/product/__init__.py +67 -0
  168. quantark/asset/rate/product/cap_floor.py +550 -0
  169. quantark/asset/rate/product/fra.py +219 -0
  170. quantark/asset/rate/product/irs.py +1223 -0
  171. quantark/asset/rate/product/swaption.py +372 -0
  172. quantark/backtest/__init__.py +153 -0
  173. quantark/backtest/base.py +263 -0
  174. quantark/backtest/dashboard.py +874 -0
  175. quantark/backtest/equity/__init__.py +35 -0
  176. quantark/backtest/equity/config.py +118 -0
  177. quantark/backtest/equity/engine.py +408 -0
  178. quantark/backtest/equity/hedge_executor.py +374 -0
  179. quantark/backtest/equity/metrics.py +396 -0
  180. quantark/backtest/equity/results.py +232 -0
  181. quantark/backtest/equity/state.py +252 -0
  182. quantark/backtest/examples/__init__.py +4 -0
  183. quantark/backtest/examples/advanced_backtest.py +345 -0
  184. quantark/backtest/examples/basic_delta_hedge.py +246 -0
  185. quantark/backtest/examples/fi_dv01_hedge.py +267 -0
  186. quantark/backtest/fi/__init__.py +30 -0
  187. quantark/backtest/fi/config.py +114 -0
  188. quantark/backtest/fi/engine.py +378 -0
  189. quantark/backtest/fi/hedge_executor.py +254 -0
  190. quantark/backtest/fi/metrics.py +308 -0
  191. quantark/backtest/fi/results.py +193 -0
  192. quantark/backtest/fi/state.py +212 -0
  193. quantark/backtest/logger.py +393 -0
  194. quantark/backtest/otc/__init__.py +74 -0
  195. quantark/backtest/otc/_replay.py +637 -0
  196. quantark/backtest/otc/book_engine.py +587 -0
  197. quantark/backtest/otc/config.py +175 -0
  198. quantark/backtest/otc/dashboard.py +1006 -0
  199. quantark/backtest/otc/engine.py +420 -0
  200. quantark/backtest/otc/engine_factory.py +138 -0
  201. quantark/backtest/otc/market.py +216 -0
  202. quantark/backtest/otc/results.py +107 -0
  203. quantark/backtest/otc/state.py +166 -0
  204. quantark/backtest/report_generator.py +608 -0
  205. quantark/backtest/strategy/__init__.py +28 -0
  206. quantark/backtest/strategy/base_strategy.py +235 -0
  207. quantark/backtest/strategy/convexity_neutral_strategy.py +247 -0
  208. quantark/backtest/strategy/delta_neutral_strategy.py +283 -0
  209. quantark/backtest/strategy/dv01_neutral_strategy.py +283 -0
  210. quantark/backtest/transaction_costs.py +485 -0
  211. quantark/backtest/visualizer.py +1019 -0
  212. quantark/cashleg/__init__.py +31 -0
  213. quantark/cashleg/accrual_leg.py +120 -0
  214. quantark/cashleg/base.py +48 -0
  215. quantark/cashleg/base_amount.py +60 -0
  216. quantark/cashleg/deterministic_leg.py +39 -0
  217. quantark/cashleg/event_distribution.py +262 -0
  218. quantark/cashleg/fixed_payoff_leg.py +92 -0
  219. quantark/cashleg/leg_schedule.py +95 -0
  220. quantark/cashleg/leg_valuator.py +40 -0
  221. quantark/dynamicscenario/__init__.py +97 -0
  222. quantark/dynamicscenario/base.py +297 -0
  223. quantark/dynamicscenario/config.py +122 -0
  224. quantark/dynamicscenario/engine.py +703 -0
  225. quantark/dynamicscenario/equity/__init__.py +14 -0
  226. quantark/dynamicscenario/fi/__init__.py +24 -0
  227. quantark/dynamicscenario/fi/config.py +149 -0
  228. quantark/dynamicscenario/fi/engine.py +500 -0
  229. quantark/dynamicscenario/fi/results.py +503 -0
  230. quantark/dynamicscenario/path/__init__.py +17 -0
  231. quantark/dynamicscenario/path/day_path.py +397 -0
  232. quantark/dynamicscenario/path/fi_path_library.py +488 -0
  233. quantark/dynamicscenario/path/path_builder.py +726 -0
  234. quantark/dynamicscenario/path/path_library.py +620 -0
  235. quantark/dynamicscenario/report/__init__.py +12 -0
  236. quantark/dynamicscenario/report/dynamic_report.py +1175 -0
  237. quantark/dynamicscenario/report/visualizer.py +1586 -0
  238. quantark/dynamicscenario/results/__init__.py +19 -0
  239. quantark/dynamicscenario/results/dynamic_results.py +579 -0
  240. quantark/dynamicscenario/results/result_exporter.py +438 -0
  241. quantark/param/__init__.py +75 -0
  242. quantark/param/basis/__init__.py +19 -0
  243. quantark/param/basis/basis_yield.py +301 -0
  244. quantark/param/div/__init__.py +16 -0
  245. quantark/param/div/dividend_yield.py +123 -0
  246. quantark/param/index/__init__.py +52 -0
  247. quantark/param/index/rate_index.py +568 -0
  248. quantark/param/quote/__init__.py +7 -0
  249. quantark/param/quote/spot_quote.py +35 -0
  250. quantark/param/rrf/__init__.py +22 -0
  251. quantark/param/rrf/rate_curve.py +436 -0
  252. quantark/param/vol/__init__.py +6 -0
  253. quantark/param/vol/vol_surface.py +118 -0
  254. quantark/portfolio/__init__.py +61 -0
  255. quantark/portfolio/base.py +203 -0
  256. quantark/portfolio/equity/__init__.py +17 -0
  257. quantark/portfolio/equity/portfolio.py +391 -0
  258. quantark/portfolio/equity/position.py +368 -0
  259. quantark/portfolio/fi/__init__.py +14 -0
  260. quantark/portfolio/fi/portfolio.py +424 -0
  261. quantark/portfolio/fi/position.py +272 -0
  262. quantark/portfolio/portfolio_snapshot.py +221 -0
  263. quantark/portfolio/portfolio_storage.py +414 -0
  264. quantark/priceenv/__init__.py +7 -0
  265. quantark/priceenv/pricing_environment.py +196 -0
  266. quantark/rfq/__init__.py +32 -0
  267. quantark/rfq/builders.py +102 -0
  268. quantark/rfq/models.py +214 -0
  269. quantark/rfq/registry.py +611 -0
  270. quantark/rfq/service.py +237 -0
  271. quantark/simm/__init__.py +155 -0
  272. quantark/simm/calibration/__init__.py +206 -0
  273. quantark/simm/calibration/accessors.py +439 -0
  274. quantark/simm/calibration/commodity.py +156 -0
  275. quantark/simm/calibration/credit_non_qualifying.py +79 -0
  276. quantark/simm/calibration/credit_qualifying.py +130 -0
  277. quantark/simm/calibration/cross_risk.py +39 -0
  278. quantark/simm/calibration/equity.py +125 -0
  279. quantark/simm/calibration/fx.py +92 -0
  280. quantark/simm/calibration/ir.py +152 -0
  281. quantark/simm/calibration/version.py +33 -0
  282. quantark/simm/config.py +186 -0
  283. quantark/simm/crif/__init__.py +35 -0
  284. quantark/simm/crif/models.py +230 -0
  285. quantark/simm/crif/parser.py +585 -0
  286. quantark/simm/engines/__init__.py +62 -0
  287. quantark/simm/engines/aggregation/__init__.py +67 -0
  288. quantark/simm/engines/aggregation/addon.py +141 -0
  289. quantark/simm/engines/aggregation/bucket_aggregator.py +298 -0
  290. quantark/simm/engines/aggregation/concentration.py +349 -0
  291. quantark/simm/engines/aggregation/product_class_aggregator.py +183 -0
  292. quantark/simm/engines/aggregation/risk_class_aggregator.py +403 -0
  293. quantark/simm/engines/aggregation/simm_calculator.py +430 -0
  294. quantark/simm/engines/aggregation/weighted_sensitivity.py +272 -0
  295. quantark/simm/engines/base.py +231 -0
  296. quantark/simm/engines/classification/__init__.py +10 -0
  297. quantark/simm/engines/classification/bucket_mapper.py +347 -0
  298. quantark/simm/engines/factory.py +137 -0
  299. quantark/simm/engines/portfolio_adapter.py +336 -0
  300. quantark/simm/engines/result.py +176 -0
  301. quantark/simm/engines/risk_class/__init__.py +18 -0
  302. quantark/simm/engines/risk_class/equity_engine.py +263 -0
  303. quantark/simm/engines/risk_class/ir_engine.py +264 -0
  304. quantark/simm/report/__init__.py +17 -0
  305. quantark/simm/report/crif_export.py +284 -0
  306. quantark/simm/report/excel_generator.py +401 -0
  307. quantark/simm/report/html_generator.py +840 -0
  308. quantark/simm/results/__init__.py +38 -0
  309. quantark/simm/results/attribution.py +313 -0
  310. quantark/simm/results/simm_result.py +339 -0
  311. quantark/simm/results/whatif.py +268 -0
  312. quantark/simm/sensitivity.py +533 -0
  313. quantark/simm/taxonomy.py +416 -0
  314. quantark/stresstest/__init__.py +67 -0
  315. quantark/stresstest/base.py +116 -0
  316. quantark/stresstest/config.py +5 -0
  317. quantark/stresstest/engine.py +5 -0
  318. quantark/stresstest/equity/__init__.py +17 -0
  319. quantark/stresstest/equity/config.py +69 -0
  320. quantark/stresstest/equity/engine.py +272 -0
  321. quantark/stresstest/equity/report/__init__.py +7 -0
  322. quantark/stresstest/equity/report/report_generator.py +423 -0
  323. quantark/stresstest/equity/report/visualizer.py +328 -0
  324. quantark/stresstest/equity/results.py +145 -0
  325. quantark/stresstest/fi/__init__.py +15 -0
  326. quantark/stresstest/fi/config.py +59 -0
  327. quantark/stresstest/fi/engine.py +213 -0
  328. quantark/stresstest/fi/metrics.py +60 -0
  329. quantark/stresstest/fi/results.py +64 -0
  330. quantark/stresstest/report/__init__.py +12 -0
  331. quantark/stresstest/report/report_generator.py +5 -0
  332. quantark/stresstest/report/visualizer.py +5 -0
  333. quantark/stresstest/results/__init__.py +16 -0
  334. quantark/stresstest/results/result_aggregator.py +325 -0
  335. quantark/stresstest/results/result_exporter.py +286 -0
  336. quantark/stresstest/results/stress_results.py +5 -0
  337. quantark/stresstest/scenario/__init__.py +13 -0
  338. quantark/stresstest/scenario/scenario.py +242 -0
  339. quantark/stresstest/scenario/scenario_builder.py +376 -0
  340. quantark/stresstest/scenario/scenario_library.py +435 -0
  341. quantark/stresstest/scenario/scenario_storage.py +224 -0
  342. quantark/stresstest/stress/__init__.py +13 -0
  343. quantark/stresstest/stress/stress_applicator.py +590 -0
  344. quantark/stresstest/stress/stress_types.py +142 -0
  345. quantark/util/__init__.py +23 -0
  346. quantark/util/barrier_shift.py +44 -0
  347. quantark/util/calendar/__init__.py +27 -0
  348. quantark/util/calendar/business_calendar.py +584 -0
  349. quantark/util/calendar/day_counter.py +517 -0
  350. quantark/util/calendar/holidayfile/china.csv +1920 -0
  351. quantark/util/calendar/holidayfile/china_sse.csv +1462 -0
  352. quantark/util/enum/__init__.py +81 -0
  353. quantark/util/enum/bond_enums.py +112 -0
  354. quantark/util/enum/deltaone_enums.py +16 -0
  355. quantark/util/enum/engine_enums.py +137 -0
  356. quantark/util/enum/greeks_enums.py +29 -0
  357. quantark/util/enum/option_enums.py +221 -0
  358. quantark/util/exceptions.py +66 -0
  359. quantark/util/marketdata/__init__.py +39 -0
  360. quantark/util/marketdata/adapter/base_adapter.py +203 -0
  361. quantark/util/marketdata/adapter/mock_adapter.py +265 -0
  362. quantark/util/marketdata/converter.py +289 -0
  363. quantark/util/marketdata/example_usage.py +314 -0
  364. quantark/util/marketdata/generator/__init__.py +7 -0
  365. quantark/util/marketdata/generator/mock_generator.py +466 -0
  366. quantark/util/marketdata/models.py +358 -0
  367. quantark/util/marketdata/storage/__init__.py +7 -0
  368. quantark/util/marketdata/storage/parquet_storage.py +340 -0
  369. quantark/util/numerical/__init__.py +98 -0
  370. quantark/util/numerical/comparison.py +219 -0
  371. quantark/util/numerical/constants.py +98 -0
  372. quantark/util/numerical/formatting.py +380 -0
  373. quantark/util/numerical/pnl.py +17 -0
  374. quantark/util/numerical/safe_math.py +238 -0
  375. quantark/util/numerical/validation.py +315 -0
  376. quantark/var/__init__.py +39 -0
  377. quantark/var/attribution.py +398 -0
  378. quantark/var/backtest/__init__.py +7 -0
  379. quantark/var/backtest/var_backtester.py +309 -0
  380. quantark/var/base.py +63 -0
  381. quantark/var/config.py +219 -0
  382. quantark/var/engines/__init__.py +13 -0
  383. quantark/var/engines/historical.py +925 -0
  384. quantark/var/engines/monte_carlo.py +870 -0
  385. quantark/var/engines/parametric.py +1199 -0
  386. quantark/var/results/__init__.py +16 -0
  387. quantark/var/results/incremental_var_result.py +131 -0
  388. quantark/var/results/var_report.py +346 -0
  389. quantark/var/results/var_result.py +134 -0
  390. quantark/var/risk_factors/__init__.py +22 -0
  391. quantark/var/risk_factors/base.py +41 -0
  392. quantark/var/risk_factors/equity_factors.py +158 -0
  393. quantark/var/risk_factors/fi_factors.py +99 -0
  394. quantark-0.1.0.dist-info/METADATA +351 -0
  395. quantark-0.1.0.dist-info/RECORD +399 -0
  396. quantark-0.1.0.dist-info/WHEEL +4 -0
  397. quantark-0.1.0.dist-info/licenses/LICENSE +202 -0
  398. quantark-0.1.0.dist-info/licenses/NOTICE +2 -0
  399. quantark_compat.pth +1 -0
@@ -0,0 +1,130 @@
1
+ """
2
+ Credit Qualifying Calibration Parameters for SIMM v2.6
3
+
4
+ This module contains all Credit Qualifying (CreditQ) calibration parameters as
5
+ specified in ISDA SIMM v2.6, effective December 2, 2023.
6
+
7
+ References:
8
+ - ISDA SIMM Methodology, Version 2.6, Section 2.2 (Credit Qualifying Risk)
9
+ """
10
+
11
+ import numpy as np
12
+
13
+
14
+ # ============================================================================
15
+ # RISK WEIGHTS
16
+ # ============================================================================
17
+
18
+ # Credit Qualifying risk weights by bucket (12 buckets + residual)
19
+ # Source: ISDA SIMM v2.6, Table CQ-1
20
+ CREDIT_QUALIFYING_RISK_WEIGHTS = {
21
+ 1: 45, # Sovereign
22
+ 2: 47, # Local authority
23
+ 3: 69, # Financial institution - Senior Unsecured
24
+ 4: 66, # Covered bond
25
+ 5: 64, # Financial institution - Senior Structured Finance
26
+ 6: 75, # Corporate - Senior Unsecured
27
+ 7: 59, # Sovereign entity
28
+ 8: 68, # Corporate - Senior Secured
29
+ 9: 60, # Asset backed
30
+ 10: 78, # Residential mortgage backed
31
+ 11: 70, # Commercial mortgage backed
32
+ 12: 62, # Other structured finance
33
+ "Residual": 100
34
+ }
35
+
36
+
37
+ # ============================================================================
38
+ # INTRA-BUCKET CORRELATIONS
39
+ # ============================================================================
40
+
41
+ # Credit Qualifying intra-bucket correlations
42
+ # Same issuer correlation vs different issuer correlation
43
+ # Source: ISDA SIMM v2.6, Section 2.2.1
44
+ CREDIT_QUALIFYING_INTRA_BUCKET_CORRELATIONS = {
45
+ # Same issuer, different risk factor
46
+ "same_issuer": 0.99,
47
+ # Different issuer, same bucket
48
+ 1: 0.10, # Sovereign
49
+ 2: 0.10, # Local authority
50
+ 3: 0.13, # Financial institution - Senior Unsecured
51
+ 4: 0.13, # Covered bond
52
+ 5: 0.13, # Financial institution - Senior Structured Finance
53
+ 6: 0.14, # Corporate - Senior Unsecured
54
+ 7: 0.10, # Sovereign entity
55
+ 8: 0.14, # Corporate - Senior Secured
56
+ 9: 0.21, # Asset backed
57
+ 10: 0.18, # Residential mortgage backed
58
+ 11: 0.18, # Commercial mortgage backed
59
+ 12: 0.21, # Other structured finance
60
+ "Residual": 0.21
61
+ }
62
+
63
+
64
+ # ============================================================================
65
+ # INTER-BUCKET CORRELATIONS
66
+ # ============================================================================
67
+
68
+ # Credit Qualifying inter-bucket correlation matrix (12x12)
69
+ # Source: ISDA SIMM v2.6, Table CQ-2
70
+ CREDIT_QUALIFYING_INTER_BUCKET_CORRELATIONS = np.array([
71
+ # 1 2 3 4 5 6 7 8 9 10 11 12
72
+ [0.00, 0.40, 0.25, 0.25, 0.25, 0.20, 0.40, 0.20, 0.08, 0.12, 0.12, 0.08], # 1 Sovereign
73
+ [0.40, 0.00, 0.25, 0.25, 0.25, 0.20, 0.40, 0.20, 0.08, 0.12, 0.12, 0.08], # 2 Local authority
74
+ [0.25, 0.25, 0.00, 0.31, 0.31, 0.34, 0.25, 0.34, 0.14, 0.15, 0.15, 0.14], # 3 FI Senior Unsecured
75
+ [0.25, 0.25, 0.31, 0.00, 0.31, 0.25, 0.25, 0.25, 0.12, 0.12, 0.12, 0.12], # 4 Covered bond
76
+ [0.25, 0.25, 0.31, 0.31, 0.00, 0.25, 0.25, 0.25, 0.12, 0.12, 0.12, 0.12], # 5 FI Senior SF
77
+ [0.20, 0.20, 0.34, 0.25, 0.25, 0.00, 0.20, 0.49, 0.16, 0.15, 0.15, 0.16], # 6 Corporate Senior Unsec
78
+ [0.40, 0.40, 0.25, 0.25, 0.25, 0.20, 0.00, 0.20, 0.08, 0.12, 0.12, 0.08], # 7 Sovereign entity
79
+ [0.20, 0.20, 0.34, 0.25, 0.25, 0.49, 0.20, 0.00, 0.16, 0.15, 0.15, 0.16], # 8 Corporate Senior Sec
80
+ [0.08, 0.08, 0.14, 0.12, 0.12, 0.16, 0.08, 0.16, 0.00, 0.43, 0.43, 0.43], # 9 Asset backed
81
+ [0.12, 0.12, 0.15, 0.12, 0.12, 0.15, 0.12, 0.15, 0.43, 0.00, 0.58, 0.43], # 10 RMBS
82
+ [0.12, 0.12, 0.15, 0.12, 0.12, 0.15, 0.12, 0.15, 0.43, 0.58, 0.00, 0.43], # 11 CMBS
83
+ [0.08, 0.08, 0.14, 0.12, 0.12, 0.16, 0.08, 0.16, 0.43, 0.43, 0.43, 0.00], # 12 Other SF
84
+ ])
85
+
86
+ # Labels for Credit Qualifying buckets
87
+ CREDIT_QUALIFYING_BUCKET_LABELS = [
88
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
89
+ ]
90
+
91
+
92
+ # ============================================================================
93
+ # VEGA RISK WEIGHTS AND BASE CORRELATION
94
+ # ============================================================================
95
+
96
+ # Credit Qualifying Vega Risk Weight (VRW)
97
+ CREDIT_QUALIFYING_VRW = 0.76
98
+
99
+ # Credit Qualifying base correlation risk weight
100
+ CREDIT_QUALIFYING_BASE_CORRELATION_RISK_WEIGHT = 10
101
+
102
+ # Credit Qualifying base correlation inter-index correlation (29%)
103
+ CREDIT_QUALIFYING_BASE_CORRELATION_INTER_INDEX_CORRELATION = 0.29
104
+
105
+
106
+ # ============================================================================
107
+ # CONCENTRATION THRESHOLDS
108
+ # ============================================================================
109
+
110
+ # Credit Qualifying delta concentration thresholds (USD million)
111
+ # Source: ISDA SIMM v2.6, Section 2.2.3
112
+ CREDIT_QUALIFYING_DELTA_CONCENTRATION_THRESHOLDS = {
113
+ 1: 300, # Sovereign
114
+ 2: 300, # Local authority
115
+ 3: 150, # Financial institution - Senior Unsecured
116
+ 4: 300, # Covered bond
117
+ 5: 150, # Financial institution - Senior Structured Finance
118
+ 6: 200, # Corporate - Senior Unsecured
119
+ 7: 300, # Sovereign entity
120
+ 8: 200, # Corporate - Senior Secured
121
+ 9: 40, # Asset backed
122
+ 10: 40, # Residential mortgage backed
123
+ 11: 40, # Commercial mortgage backed
124
+ 12: 40, # Other structured finance
125
+ "Residual": 20
126
+ }
127
+
128
+ # Credit Qualifying vega concentration threshold (USD million)
129
+ # Source: ISDA SIMM v2.6, Section 2.2.4
130
+ CREDIT_QUALIFYING_VEGA_CONCENTRATION_THRESHOLD = 360
@@ -0,0 +1,39 @@
1
+ """
2
+ Cross-Risk-Class Calibration Parameters for SIMM v2.6
3
+
4
+ This module contains inter-risk-class correlation parameters (ψ) as specified
5
+ in ISDA SIMM v2.6, effective December 2, 2023.
6
+
7
+ References:
8
+ - ISDA SIMM Methodology, Version 2.6, Section 1.4.2 (Inter-Risk-Class Correlations)
9
+ """
10
+
11
+ import numpy as np
12
+
13
+
14
+ # ============================================================================
15
+ # INTER-RISK-CLASS CORRELATIONS (ψ)
16
+ # ============================================================================
17
+
18
+ # Inter-risk-class correlation matrix (6x6)
19
+ # Risk classes: IR, CreditQ, CreditNQ, Equity, Commodity, FX
20
+ # Source: ISDA SIMM v2.6, Table Global-1
21
+ INTER_RISK_CLASS_CORRELATIONS = np.array([
22
+ # IR CreditQ CreditNQ Equity Comm FX
23
+ [1.00, 0.04, 0.04, 0.07, 0.37, 0.14], # IR
24
+ [0.04, 1.00, 0.54, 0.70, 0.27, 0.37], # CreditQ
25
+ [0.04, 0.54, 1.00, 0.46, 0.24, 0.15], # CreditNQ
26
+ [0.07, 0.70, 0.46, 1.00, 0.35, 0.39], # Equity
27
+ [0.37, 0.27, 0.24, 0.35, 1.00, 0.35], # Commodity
28
+ [0.14, 0.37, 0.15, 0.39, 0.35, 1.00], # FX
29
+ ])
30
+
31
+ # Labels for risk classes in the correlation matrix
32
+ INTER_RISK_CLASS_CORRELATION_LABELS = [
33
+ "IR",
34
+ "CreditQ",
35
+ "CreditNQ",
36
+ "Equity",
37
+ "Commodity",
38
+ "FX"
39
+ ]
@@ -0,0 +1,125 @@
1
+ """
2
+ Equity Calibration Parameters for SIMM v2.6
3
+
4
+ This module contains all Equity calibration parameters as specified in
5
+ ISDA SIMM v2.6, effective December 2, 2023.
6
+
7
+ References:
8
+ - ISDA SIMM Methodology, Version 2.6, Section 2.4 (Equity Risk)
9
+ """
10
+
11
+ import numpy as np
12
+
13
+
14
+ # ============================================================================
15
+ # RISK WEIGHTS
16
+ # ============================================================================
17
+
18
+ # Equity risk weights by bucket (12 buckets + residual)
19
+ # Source: ISDA SIMM v2.6, Table EQ-1
20
+ EQUITY_RISK_WEIGHTS = {
21
+ 1: 30, # Emerging Markets Large Cap
22
+ 2: 33, # Emerging Markets Large Cap
23
+ 3: 36, # Emerging Markets Large Cap
24
+ 4: 29, # Emerging Markets Large Cap
25
+ 5: 26, # Developed Markets Large Cap
26
+ 6: 25, # Developed Markets Large Cap
27
+ 7: 34, # Developed Markets Large Cap
28
+ 8: 28, # Developed Markets Large Cap
29
+ 9: 36, # Emerging Markets Small Cap
30
+ 10: 50, # Developed Markets Small Cap
31
+ 11: 19, # Indexes - Emerging Markets
32
+ 12: 19, # Indexes - Developed Markets
33
+ "Residual": 50
34
+ }
35
+
36
+
37
+ # ============================================================================
38
+ # INTRA-BUCKET CORRELATIONS
39
+ # ============================================================================
40
+
41
+ # Equity intra-bucket correlations by bucket
42
+ # Source: ISDA SIMM v2.6, Section 2.4.1
43
+ EQUITY_INTRA_BUCKET_CORRELATIONS = {
44
+ 1: 0.18, # Emerging Markets Large Cap
45
+ 2: 0.20, # Emerging Markets Large Cap
46
+ 3: 0.28, # Emerging Markets Large Cap
47
+ 4: 0.24, # Emerging Markets Large Cap
48
+ 5: 0.25, # Developed Markets Large Cap
49
+ 6: 0.36, # Developed Markets Large Cap
50
+ 7: 0.35, # Developed Markets Large Cap
51
+ 8: 0.37, # Developed Markets Large Cap
52
+ 9: 0.23, # Emerging Markets Small Cap
53
+ 10: 0.27, # Developed Markets Small Cap
54
+ 11: 0.45, # Indexes - Emerging Markets
55
+ 12: 0.45, # Indexes - Developed Markets
56
+ "Residual": 0.00
57
+ }
58
+
59
+
60
+ # ============================================================================
61
+ # INTER-BUCKET CORRELATIONS
62
+ # ============================================================================
63
+
64
+ # Equity inter-bucket correlation matrix (12x12)
65
+ # Source: ISDA SIMM v2.6, Table EQ-2
66
+ EQUITY_INTER_BUCKET_CORRELATIONS = np.array([
67
+ # 1 2 3 4 5 6 7 8 9 10 11 12
68
+ [0.00, 0.18, 0.19, 0.19, 0.14, 0.16, 0.15, 0.16, 0.18, 0.12, 0.19, 0.19], # 1 EM Large
69
+ [0.18, 0.00, 0.22, 0.21, 0.15, 0.18, 0.17, 0.19, 0.20, 0.14, 0.21, 0.21], # 2 EM Large
70
+ [0.19, 0.22, 0.00, 0.23, 0.16, 0.19, 0.18, 0.20, 0.21, 0.15, 0.23, 0.23], # 3 EM Large
71
+ [0.19, 0.21, 0.23, 0.00, 0.16, 0.18, 0.18, 0.19, 0.20, 0.14, 0.23, 0.23], # 4 EM Large
72
+ [0.14, 0.15, 0.16, 0.16, 0.00, 0.32, 0.30, 0.33, 0.11, 0.24, 0.16, 0.16], # 5 DM Large
73
+ [0.16, 0.18, 0.19, 0.18, 0.32, 0.00, 0.35, 0.37, 0.13, 0.27, 0.18, 0.18], # 6 DM Large
74
+ [0.15, 0.17, 0.18, 0.18, 0.30, 0.35, 0.00, 0.36, 0.12, 0.26, 0.18, 0.18], # 7 DM Large
75
+ [0.16, 0.19, 0.20, 0.19, 0.33, 0.37, 0.36, 0.00, 0.13, 0.28, 0.19, 0.19], # 8 DM Large
76
+ [0.18, 0.20, 0.21, 0.20, 0.11, 0.13, 0.12, 0.13, 0.00, 0.12, 0.21, 0.21], # 9 EM Small
77
+ [0.12, 0.14, 0.15, 0.14, 0.24, 0.27, 0.26, 0.28, 0.12, 0.00, 0.14, 0.14], # 10 DM Small
78
+ [0.19, 0.21, 0.23, 0.23, 0.16, 0.18, 0.18, 0.19, 0.21, 0.14, 0.00, 0.45], # 11 Index EM
79
+ [0.19, 0.21, 0.23, 0.23, 0.16, 0.18, 0.18, 0.19, 0.21, 0.14, 0.45, 0.00], # 12 Index DM
80
+ ])
81
+
82
+ # Labels for Equity buckets
83
+ EQUITY_BUCKET_LABELS = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
84
+
85
+
86
+ # ============================================================================
87
+ # HISTORICAL VOLATILITY RATIOS AND VEGA RISK WEIGHTS
88
+ # ============================================================================
89
+
90
+ # Equity Historical Volatility Ratio (HVR)
91
+ EQUITY_HVR = 0.60
92
+
93
+ # Equity Vega Risk Weight (VRW)
94
+ # Special case for bucket 12 (indexes)
95
+ EQUITY_VRW = {
96
+ 12: 0.96, # Indexes - Developed Markets
97
+ "default": 0.45
98
+ }
99
+
100
+
101
+ # ============================================================================
102
+ # CONCENTRATION THRESHOLDS
103
+ # ============================================================================
104
+
105
+ # Equity delta concentration thresholds (USD million / %)
106
+ # Source: ISDA SIMM v2.6, Section 2.4.3
107
+ EQUITY_DELTA_CONCENTRATION_THRESHOLDS = {
108
+ (1, 2, 3, 4): 3, # EM Large Cap
109
+ (5, 6, 7, 8): 12, # DM Large Cap
110
+ 9: 0.64, # EM Small Cap
111
+ 10: 0.37, # DM Small Cap
112
+ (11, 12): 810, # Indexes
113
+ "Residual": 0.37
114
+ }
115
+
116
+ # Equity vega concentration thresholds (USD million / %)
117
+ # Source: ISDA SIMM v2.6, Section 2.4.4
118
+ EQUITY_VEGA_CONCENTRATION_THRESHOLDS = {
119
+ (1, 2, 3, 4): 3, # EM Large Cap
120
+ (5, 6, 7, 8): 12, # DM Large Cap
121
+ 9: 0.64, # EM Small Cap
122
+ 10: 0.37, # DM Small Cap
123
+ (11, 12): 810, # Indexes
124
+ "Residual": 0.37
125
+ }
@@ -0,0 +1,92 @@
1
+ """
2
+ Foreign Exchange Calibration Parameters for SIMM v2.6
3
+
4
+ This module contains all Foreign Exchange (FX) calibration parameters as
5
+ specified in ISDA SIMM v2.6, effective December 2, 2023.
6
+
7
+ References:
8
+ - ISDA SIMM Methodology, Version 2.6, Section 2.6 (Foreign Exchange Risk)
9
+ """
10
+
11
+ import numpy as np
12
+
13
+
14
+ # ============================================================================
15
+ # VOLATILITY GROUPS
16
+ # ============================================================================
17
+
18
+ # FX volatility groups for calculation currency
19
+ # Group 1: Regular volatility calculation currencies
20
+ # Group 2: High volatility calculation currencies
21
+ FX_VOLATILITY_GROUPS = {
22
+ "regular": 1, # Regular volatility calculation currencies (AUD, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HKD, HUF, ILS, ISK, JPY, KRW, MXN, NOK, NZD, PLN, SEK, SGD, THB, TRY, TWD, USD, ZAR)
23
+ "high": 2 # High volatility calculation currencies (all others)
24
+ }
25
+
26
+
27
+ # ============================================================================
28
+ # RISK WEIGHTS
29
+ # ============================================================================
30
+
31
+ # FX risk weights by volatility group pair (2x2 matrix)
32
+ # Rows: Calculation currency volatility group
33
+ # Columns: Underlying currency volatility group
34
+ # Source: ISDA SIMM v2.6, Table FX-1
35
+ FX_RISK_WEIGHTS = np.array([
36
+ # Regular Ccy High Vol Ccy
37
+ [15, 18], # Regular calc currency
38
+ [18, 21] # High vol calc currency
39
+ ])
40
+
41
+ # Labels for FX volatility groups
42
+ FX_VOLATILITY_GROUP_LABELS = ["regular", "high"]
43
+
44
+
45
+ # ============================================================================
46
+ # CORRELATIONS
47
+ # ============================================================================
48
+
49
+ # FX correlations by volatility group (2x2 matrix)
50
+ # Correlation between currency pairs by volatility group
51
+ # Source: ISDA SIMM v2.6, Table FX-2
52
+ FX_CORRELATIONS = np.array([
53
+ # Regular Ccy High Vol Ccy
54
+ [0.46, 0.38], # Regular calc currency
55
+ [0.38, 0.38] # High vol calc currency
56
+ ])
57
+
58
+ # FX vega/curvature correlation (50%)
59
+ # Correlation between vega and curvature risk
60
+ FX_VEGA_CURVATURE_CORRELATION = 0.50
61
+
62
+
63
+ # ============================================================================
64
+ # HISTORICAL VOLATILITY RATIOS AND VEGA RISK WEIGHTS
65
+ # ============================================================================
66
+
67
+ # FX Historical Volatility Ratio (HVR)
68
+ FX_HVR = 0.57
69
+
70
+ # FX Vega Risk Weight (VRW)
71
+ FX_VRW = 0.48
72
+
73
+
74
+ # ============================================================================
75
+ # CONCENTRATION THRESHOLDS
76
+ # ============================================================================
77
+
78
+ # FX delta concentration thresholds by category (USD million)
79
+ # Source: ISDA SIMM v2.6, Section 2.6.3
80
+ FX_DELTA_CONCENTRATION_THRESHOLDS = {
81
+ "regular": 100, # Regular volatility currencies
82
+ "high": 50 # High volatility currencies
83
+ }
84
+
85
+ # FX vega concentration thresholds by category pair (USD million)
86
+ # Source: ISDA SIMM v2.6, Section 2.6.4
87
+ FX_VEGA_CONCENTRATION_THRESHOLDS = {
88
+ ("regular", "regular"): 100,
89
+ ("regular", "high"): 100,
90
+ ("high", "regular"): 100,
91
+ ("high", "high"): 50
92
+ }
@@ -0,0 +1,152 @@
1
+ """
2
+ Interest Rate Calibration Parameters for SIMM v2.6
3
+
4
+ This module contains all Interest Rate (IR) calibration parameters as specified
5
+ in ISDA SIMM v2.6, effective December 2, 2023.
6
+
7
+ References:
8
+ - ISDA SIMM Methodology, Version 2.6, Section 2.1 (Interest Rate Risk)
9
+ """
10
+
11
+ import numpy as np
12
+
13
+
14
+ # ============================================================================
15
+ # RISK WEIGHTS
16
+ # ============================================================================
17
+
18
+ # IR risk weights by (tenor_label, currency_group)
19
+ # Currency groups: 'regular', 'low', 'high'
20
+ IR_RISK_WEIGHTS = {
21
+ # Regular volatility currencies (USD, EUR, GBP)
22
+ ("2w", "regular"): 109,
23
+ ("1m", "regular"): 105,
24
+ ("3m", "regular"): 90,
25
+ ("6m", "regular"): 71,
26
+ ("1yr", "regular"): 66,
27
+ ("2yr", "regular"): 66,
28
+ ("3yr", "regular"): 64,
29
+ ("5yr", "regular"): 60,
30
+ ("10yr", "regular"): 60,
31
+ ("15yr", "regular"): 61,
32
+ ("20yr", "regular"): 61,
33
+ ("30yr", "regular"): 67,
34
+
35
+ # Low volatility currencies (JPY)
36
+ ("2w", "low"): 15,
37
+ ("1m", "low"): 18,
38
+ ("3m", "low"): 9,
39
+ ("6m", "low"): 11,
40
+ ("1yr", "low"): 13,
41
+ ("2yr", "low"): 15,
42
+ ("3yr", "low"): 19,
43
+ ("5yr", "low"): 23,
44
+ ("10yr", "low"): 23,
45
+ ("15yr", "low"): 22,
46
+ ("20yr", "low"): 22,
47
+ ("30yr", "low"): 23,
48
+
49
+ # High volatility currencies
50
+ ("2w", "high"): 163,
51
+ ("1m", "high"): 109,
52
+ ("3m", "high"): 87,
53
+ ("6m", "high"): 89,
54
+ ("1yr", "high"): 102,
55
+ ("2yr", "high"): 96,
56
+ ("3yr", "high"): 101,
57
+ ("5yr", "high"): 97,
58
+ ("10yr", "high"): 97,
59
+ ("15yr", "high"): 102,
60
+ ("20yr", "high"): 106,
61
+ ("30yr", "high"): 101,
62
+ }
63
+
64
+ # Labels for IR tenors
65
+ IR_TENOR_LABELS = [
66
+ "2w", "1m", "3m", "6m", "1yr", "2yr",
67
+ "3yr", "5yr", "10yr", "15yr", "20yr", "30yr"
68
+ ]
69
+
70
+
71
+ # ============================================================================
72
+ # CORRELATIONS
73
+ # ============================================================================
74
+
75
+ # IR tenor correlation matrix (12x12)
76
+ # Source: ISDA SIMM v2.6, Table IR-1
77
+ IR_TENOR_CORRELATIONS = np.array([
78
+ # 2w 1m 3m 6m 1yr 2yr 3yr 5yr 10yr 15yr 20yr 30yr
79
+ [1.00, 0.77, 0.67, 0.59, 0.48, 0.39, 0.34, 0.30, 0.25, 0.23, 0.21, 0.20], # 2w
80
+ [0.77, 1.00, 0.84, 0.74, 0.56, 0.43, 0.36, 0.31, 0.26, 0.21, 0.19, 0.19], # 1m
81
+ [0.67, 0.84, 1.00, 0.87, 0.62, 0.47, 0.39, 0.33, 0.27, 0.22, 0.20, 0.19], # 3m
82
+ [0.59, 0.74, 0.87, 1.00, 0.72, 0.54, 0.44, 0.36, 0.29, 0.23, 0.21, 0.20], # 6m
83
+ [0.48, 0.56, 0.62, 0.72, 1.00, 0.79, 0.65, 0.50, 0.38, 0.30, 0.27, 0.25], # 1yr
84
+ [0.39, 0.43, 0.47, 0.54, 0.79, 1.00, 0.87, 0.69, 0.50, 0.39, 0.34, 0.31], # 2yr
85
+ [0.34, 0.36, 0.39, 0.44, 0.65, 0.87, 1.00, 0.85, 0.62, 0.48, 0.42, 0.38], # 3yr
86
+ [0.30, 0.31, 0.33, 0.36, 0.50, 0.69, 0.85, 1.00, 0.79, 0.62, 0.54, 0.48], # 5yr
87
+ [0.25, 0.26, 0.27, 0.29, 0.38, 0.50, 0.62, 0.79, 1.00, 0.86, 0.75, 0.66], # 10yr
88
+ [0.23, 0.21, 0.22, 0.23, 0.30, 0.39, 0.48, 0.62, 0.86, 1.00, 0.92, 0.81], # 15yr
89
+ [0.21, 0.19, 0.20, 0.21, 0.27, 0.34, 0.42, 0.54, 0.75, 0.92, 1.00, 0.89], # 20yr
90
+ [0.20, 0.19, 0.19, 0.20, 0.25, 0.31, 0.38, 0.48, 0.66, 0.81, 0.89, 1.00], # 30yr
91
+ ])
92
+
93
+ # IR sub-curve correlation (99.3%)
94
+ # Correlation between tenor curves on same currency
95
+ IR_SUB_CURVE_CORRELATION = 0.993
96
+
97
+ # IR inflation correlation (24%)
98
+ # Correlation between inflation and nominal curves
99
+ IR_INFLATION_CORRELATION = 0.24
100
+
101
+ # IR cross-currency basis correlation (4%)
102
+ # Correlation between basis swaps across currencies
103
+ IR_CROSS_CURRENCY_BASIS_CORRELATION = 0.04
104
+
105
+ # IR inter-currency correlation (32%)
106
+ # Correlation between interest rates across different currencies
107
+ IR_INTER_CURRENCY_CORRELATION = 0.32
108
+
109
+
110
+ # ============================================================================
111
+ # ADDITIONAL RISK WEIGHTS
112
+ # ============================================================================
113
+
114
+ # IR inflation risk weight
115
+ IR_INFLATION_RISK_WEIGHT = 61
116
+
117
+ # IR cross-currency basis risk weight
118
+ IR_CROSS_CURRENCY_BASIS_RISK_WEIGHT = 21
119
+
120
+
121
+ # ============================================================================
122
+ # HISTORICAL VOLATILITY RATIOS AND VEGA RISK WEIGHTS
123
+ # ============================================================================
124
+
125
+ # IR Historical Volatility Ratio (HVR)
126
+ IR_HVR = 0.47
127
+
128
+ # IR Vega Risk Weight (VRW)
129
+ IR_VRW = 0.23
130
+
131
+
132
+ # ============================================================================
133
+ # CONCENTRATION THRESHOLDS
134
+ # ============================================================================
135
+
136
+ # IR delta concentration thresholds (USD million / basis point)
137
+ # Source: ISDA SIMM v2.6, Section 2.1.3
138
+ IR_DELTA_CONCENTRATION_THRESHOLDS = {
139
+ "high": 30, # High volatility currencies
140
+ "regular_well_traded": 330, # USD, EUR, GBP
141
+ "regular_less_traded": 130, # AUD, CAD, CHF, NZD, SEK, NOK, DKK
142
+ "low": 61, # JPY
143
+ }
144
+
145
+ # IR vega concentration thresholds (USD million / bp)
146
+ # Source: ISDA SIMM v2.6, Section 2.1.4
147
+ IR_VEGA_CONCENTRATION_THRESHOLDS = {
148
+ "high": 30, # High volatility currencies
149
+ "regular_well_traded": 330, # USD, EUR, GBP
150
+ "regular_less_traded": 130, # AUD, CAD, CHF, NZD, SEK, NOK, DKK
151
+ "low": 61, # JPY
152
+ }
@@ -0,0 +1,33 @@
1
+ """
2
+ SIMM Calibration Version Information
3
+
4
+ This module contains version information for the SIMM (Standard Initial Margin Model)
5
+ implementation. SIMM is a methodology for calculating initial margin for non-cleared
6
+ derivatives as specified by ISDA.
7
+ """
8
+
9
+ from dataclasses import dataclass
10
+ from datetime import date
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class SIMMVersion:
15
+ """SIMM version information.
16
+
17
+ This class tracks the version of SIMM calibration parameters implemented.
18
+ All parameters in the calibration module follow the ISDA SIMM v2.6 specification.
19
+
20
+ Attributes:
21
+ version: The current SIMM version (v2.6)
22
+ base_version: The base SIMM version this builds from
23
+ effective_date: Date when v2.6 became effective (December 2, 2023)
24
+ publication_date: Date when v2.6 was published (August 16, 2023)
25
+ """
26
+ version: str = "2.6"
27
+ base_version: str = "2.5.6"
28
+ effective_date: date = date(2023, 12, 2)
29
+ publication_date: date = date(2023, 8, 16)
30
+
31
+
32
+ # The current version of SIMM calibration parameters
33
+ CURRENT_VERSION = SIMMVersion()