pyquantlib 0.1.0__tar.gz

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 (349) hide show
  1. pyquantlib-0.1.0/.gitattributes +34 -0
  2. pyquantlib-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
  3. pyquantlib-0.1.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. pyquantlib-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  5. pyquantlib-0.1.0/.github/ISSUE_TEMPLATE/infrastructure.md +24 -0
  6. pyquantlib-0.1.0/.github/scripts/build-quantlib-windows.ps1 +51 -0
  7. pyquantlib-0.1.0/.github/workflows/linux.yml +100 -0
  8. pyquantlib-0.1.0/.github/workflows/macos.yml +87 -0
  9. pyquantlib-0.1.0/.github/workflows/wheels.yml +182 -0
  10. pyquantlib-0.1.0/.github/workflows/windows.yml +111 -0
  11. pyquantlib-0.1.0/.gitignore +130 -0
  12. pyquantlib-0.1.0/.readthedocs.yaml +19 -0
  13. pyquantlib-0.1.0/CMakeLists.txt +313 -0
  14. pyquantlib-0.1.0/CMakePresets.json +54 -0
  15. pyquantlib-0.1.0/CONTRIBUTING.md +509 -0
  16. pyquantlib-0.1.0/LICENSE +29 -0
  17. pyquantlib-0.1.0/PKG-INFO +243 -0
  18. pyquantlib-0.1.0/README.md +162 -0
  19. pyquantlib-0.1.0/SECURITY.md +27 -0
  20. pyquantlib-0.1.0/docs/_static/custom.css +152 -0
  21. pyquantlib-0.1.0/docs/_static/favicon.svg +4 -0
  22. pyquantlib-0.1.0/docs/_static/logo.svg +15 -0
  23. pyquantlib-0.1.0/docs/api/cashflows.md +194 -0
  24. pyquantlib-0.1.0/docs/api/core.md +153 -0
  25. pyquantlib-0.1.0/docs/api/currencies.md +87 -0
  26. pyquantlib-0.1.0/docs/api/experimental.md +67 -0
  27. pyquantlib-0.1.0/docs/api/extensions.md +101 -0
  28. pyquantlib-0.1.0/docs/api/index.md +80 -0
  29. pyquantlib-0.1.0/docs/api/indexes.md +136 -0
  30. pyquantlib-0.1.0/docs/api/instruments.md +530 -0
  31. pyquantlib-0.1.0/docs/api/math.md +315 -0
  32. pyquantlib-0.1.0/docs/api/models.md +287 -0
  33. pyquantlib-0.1.0/docs/api/pricingengines.md +528 -0
  34. pyquantlib-0.1.0/docs/api/processes.md +96 -0
  35. pyquantlib-0.1.0/docs/api/quotes.md +62 -0
  36. pyquantlib-0.1.0/docs/api/termstructures.md +529 -0
  37. pyquantlib-0.1.0/docs/api/time.md +168 -0
  38. pyquantlib-0.1.0/docs/architecture.md +247 -0
  39. pyquantlib-0.1.0/docs/building.md +291 -0
  40. pyquantlib-0.1.0/docs/changelog.md +167 -0
  41. pyquantlib-0.1.0/docs/conf.py +164 -0
  42. pyquantlib-0.1.0/docs/contributing.md +296 -0
  43. pyquantlib-0.1.0/docs/design/api-design.md +46 -0
  44. pyquantlib-0.1.0/docs/design/bridge-defaults.md +173 -0
  45. pyquantlib-0.1.0/docs/design/builder-pattern.md +163 -0
  46. pyquantlib-0.1.0/docs/design/cross-tu-holders.md +180 -0
  47. pyquantlib-0.1.0/docs/design/diamond-inheritance.md +320 -0
  48. pyquantlib-0.1.0/docs/design/enum-singletons.md +341 -0
  49. pyquantlib-0.1.0/docs/design/hidden-handles.md +123 -0
  50. pyquantlib-0.1.0/docs/design/index.md +23 -0
  51. pyquantlib-0.1.0/docs/design/interpolation.md +231 -0
  52. pyquantlib-0.1.0/docs/design/protected-members.md +280 -0
  53. pyquantlib-0.1.0/docs/design/python-subclassing.md +275 -0
  54. pyquantlib-0.1.0/docs/design/settings-singleton.md +174 -0
  55. pyquantlib-0.1.0/docs/examples/index.md +22 -0
  56. pyquantlib-0.1.0/docs/extending.md +240 -0
  57. pyquantlib-0.1.0/docs/handles.md +132 -0
  58. pyquantlib-0.1.0/docs/index.md +178 -0
  59. pyquantlib-0.1.0/docs/installation.md +53 -0
  60. pyquantlib-0.1.0/docs/internals.md +294 -0
  61. pyquantlib-0.1.0/docs/numpy.md +116 -0
  62. pyquantlib-0.1.0/docs/quickstart.md +219 -0
  63. pyquantlib-0.1.0/docs/requirements.txt +5 -0
  64. pyquantlib-0.1.0/docs/troubleshooting.md +249 -0
  65. pyquantlib-0.1.0/examples/README.md +17 -0
  66. pyquantlib-0.1.0/examples/bermudan_swaption.ipynb +839 -0
  67. pyquantlib-0.1.0/examples/bonds.ipynb +377 -0
  68. pyquantlib-0.1.0/examples/cds.ipynb +234 -0
  69. pyquantlib-0.1.0/examples/equity_option.ipynb +501 -0
  70. pyquantlib-0.1.0/examples/hello_pyquantlib.ipynb +295 -0
  71. pyquantlib-0.1.0/examples/modified_kirk_engine.ipynb +336 -0
  72. pyquantlib-0.1.0/examples/multicurve_bootstrapping.ipynb +203 -0
  73. pyquantlib-0.1.0/examples/numpy_interoperability.ipynb +499 -0
  74. pyquantlib-0.1.0/examples/replication.ipynb +359 -0
  75. pyquantlib-0.1.0/examples/svi_smile.ipynb +680 -0
  76. pyquantlib-0.1.0/extensions.json +8 -0
  77. pyquantlib-0.1.0/include/pyquantlib/binding_manager.h +202 -0
  78. pyquantlib-0.1.0/include/pyquantlib/interpolation_helper.h +120 -0
  79. pyquantlib-0.1.0/include/pyquantlib/null_utils.h +61 -0
  80. pyquantlib-0.1.0/include/pyquantlib/pyquantlib.h +313 -0
  81. pyquantlib-0.1.0/include/pyquantlib/trampolines.h +1080 -0
  82. pyquantlib-0.1.0/include/pyquantlib/version.h +16 -0
  83. pyquantlib-0.1.0/licenseheader.txt +11 -0
  84. pyquantlib-0.1.0/pyproject.toml +167 -0
  85. pyquantlib-0.1.0/pyquantlib/__init__.py +39 -0
  86. pyquantlib-0.1.0/pyquantlib/__init__.pyi +611 -0
  87. pyquantlib-0.1.0/pyquantlib/_pyquantlib/__init__.pyi +13854 -0
  88. pyquantlib-0.1.0/pyquantlib/_pyquantlib/base.pyi +1307 -0
  89. pyquantlib-0.1.0/pyquantlib/builders.py +317 -0
  90. pyquantlib-0.1.0/pyquantlib/extensions/__init__.py +42 -0
  91. pyquantlib-0.1.0/pyquantlib/extensions/modified_kirk_engine.py +186 -0
  92. pyquantlib-0.1.0/pyquantlib/extensions/svi_smile_section.py +229 -0
  93. pyquantlib-0.1.0/pyquantlib/py.typed +2 -0
  94. pyquantlib-0.1.0/pyquantlib/version.py +1 -0
  95. pyquantlib-0.1.0/pyquantlib/version.pyi +3 -0
  96. pyquantlib-0.1.0/requirements-dev.txt +30 -0
  97. pyquantlib-0.1.0/scripts/README.md +29 -0
  98. pyquantlib-0.1.0/scripts/build_docs.py +66 -0
  99. pyquantlib-0.1.0/scripts/clean.py +55 -0
  100. pyquantlib-0.1.0/scripts/rebuild.py +48 -0
  101. pyquantlib-0.1.0/scripts/stubgen.py +151 -0
  102. pyquantlib-0.1.0/scripts/test.py +38 -0
  103. pyquantlib-0.1.0/settings.json +11 -0
  104. pyquantlib-0.1.0/src/cashflows/all.cpp +38 -0
  105. pyquantlib-0.1.0/src/cashflows/coupon.cpp +50 -0
  106. pyquantlib-0.1.0/src/cashflows/couponpricer.cpp +44 -0
  107. pyquantlib-0.1.0/src/cashflows/duration.cpp +27 -0
  108. pyquantlib-0.1.0/src/cashflows/fixedratecoupon.cpp +124 -0
  109. pyquantlib-0.1.0/src/cashflows/floatingratecoupon.cpp +75 -0
  110. pyquantlib-0.1.0/src/cashflows/iborcoupon.cpp +185 -0
  111. pyquantlib-0.1.0/src/cashflows/overnightindexedcoupon.cpp +167 -0
  112. pyquantlib-0.1.0/src/cashflows/rateaveraging.cpp +30 -0
  113. pyquantlib-0.1.0/src/cashflows/simplecashflow.cpp +39 -0
  114. pyquantlib-0.1.0/src/core/all.cpp +43 -0
  115. pyquantlib-0.1.0/src/core/cashflow.cpp +39 -0
  116. pyquantlib-0.1.0/src/core/cdspricingmodel.cpp +26 -0
  117. pyquantlib-0.1.0/src/core/compounding.cpp +31 -0
  118. pyquantlib-0.1.0/src/core/constants.cpp +27 -0
  119. pyquantlib-0.1.0/src/core/currency.cpp +47 -0
  120. pyquantlib-0.1.0/src/core/default.cpp +26 -0
  121. pyquantlib-0.1.0/src/core/exchangerate.cpp +50 -0
  122. pyquantlib-0.1.0/src/core/exercise.cpp +48 -0
  123. pyquantlib-0.1.0/src/core/index.cpp +41 -0
  124. pyquantlib-0.1.0/src/core/instrument.cpp +41 -0
  125. pyquantlib-0.1.0/src/core/interestrate.cpp +125 -0
  126. pyquantlib-0.1.0/src/core/money.cpp +105 -0
  127. pyquantlib-0.1.0/src/core/option.cpp +67 -0
  128. pyquantlib-0.1.0/src/core/payoff.cpp +37 -0
  129. pyquantlib-0.1.0/src/core/pricingengine.cpp +51 -0
  130. pyquantlib-0.1.0/src/core/quote.cpp +38 -0
  131. pyquantlib-0.1.0/src/core/settings.cpp +59 -0
  132. pyquantlib-0.1.0/src/core/stochasticprocess.cpp +79 -0
  133. pyquantlib-0.1.0/src/core/termstructure.cpp +54 -0
  134. pyquantlib-0.1.0/src/core/timegrid.cpp +72 -0
  135. pyquantlib-0.1.0/src/currencies/all.cpp +20 -0
  136. pyquantlib-0.1.0/src/currencies/currencies.cpp +787 -0
  137. pyquantlib-0.1.0/src/currencies/exchangeratemanager.cpp +45 -0
  138. pyquantlib-0.1.0/src/experimental/all.cpp +21 -0
  139. pyquantlib-0.1.0/src/experimental/volatility/svismilesection.cpp +73 -0
  140. pyquantlib-0.1.0/src/indexes/all.cpp +27 -0
  141. pyquantlib-0.1.0/src/indexes/ibor/eonia.cpp +39 -0
  142. pyquantlib-0.1.0/src/indexes/ibor/estr.cpp +39 -0
  143. pyquantlib-0.1.0/src/indexes/ibor/euribor.cpp +116 -0
  144. pyquantlib-0.1.0/src/indexes/ibor/sofr.cpp +39 -0
  145. pyquantlib-0.1.0/src/indexes/ibor/sonia.cpp +39 -0
  146. pyquantlib-0.1.0/src/indexes/iborindex.cpp +118 -0
  147. pyquantlib-0.1.0/src/indexes/interestrateindex.cpp +64 -0
  148. pyquantlib-0.1.0/src/indexes/swapindex.cpp +111 -0
  149. pyquantlib-0.1.0/src/instruments/all.cpp +82 -0
  150. pyquantlib-0.1.0/src/instruments/asianoption.cpp +63 -0
  151. pyquantlib-0.1.0/src/instruments/assetswap.cpp +72 -0
  152. pyquantlib-0.1.0/src/instruments/averagetype.cpp +25 -0
  153. pyquantlib-0.1.0/src/instruments/barrieroption.cpp +49 -0
  154. pyquantlib-0.1.0/src/instruments/barriertype.cpp +27 -0
  155. pyquantlib-0.1.0/src/instruments/basketoption.cpp +106 -0
  156. pyquantlib-0.1.0/src/instruments/bond.cpp +178 -0
  157. pyquantlib-0.1.0/src/instruments/bonds/fixedratebond.cpp +74 -0
  158. pyquantlib-0.1.0/src/instruments/bonds/floatingratebond.cpp +78 -0
  159. pyquantlib-0.1.0/src/instruments/bonds/zerocouponbond.cpp +35 -0
  160. pyquantlib-0.1.0/src/instruments/capfloor.cpp +108 -0
  161. pyquantlib-0.1.0/src/instruments/claim.cpp +50 -0
  162. pyquantlib-0.1.0/src/instruments/compositeinstrument.cpp +37 -0
  163. pyquantlib-0.1.0/src/instruments/creditdefaultswap.cpp +161 -0
  164. pyquantlib-0.1.0/src/instruments/doublebarrieroption.cpp +47 -0
  165. pyquantlib-0.1.0/src/instruments/doublebarriertype.cpp +27 -0
  166. pyquantlib-0.1.0/src/instruments/fixedvsfloatingswap.cpp +111 -0
  167. pyquantlib-0.1.0/src/instruments/forwardrateagreement.cpp +92 -0
  168. pyquantlib-0.1.0/src/instruments/makecapfloor.cpp +99 -0
  169. pyquantlib-0.1.0/src/instruments/makeois.cpp +208 -0
  170. pyquantlib-0.1.0/src/instruments/makeswaption.cpp +88 -0
  171. pyquantlib-0.1.0/src/instruments/makevanillaswap.cpp +192 -0
  172. pyquantlib-0.1.0/src/instruments/multiassetoption.cpp +52 -0
  173. pyquantlib-0.1.0/src/instruments/oneassetoption.cpp +81 -0
  174. pyquantlib-0.1.0/src/instruments/overnightindexedswap.cpp +93 -0
  175. pyquantlib-0.1.0/src/instruments/payoffs.cpp +96 -0
  176. pyquantlib-0.1.0/src/instruments/swap.cpp +117 -0
  177. pyquantlib-0.1.0/src/instruments/swaption.cpp +109 -0
  178. pyquantlib-0.1.0/src/instruments/vanillaoption.cpp +31 -0
  179. pyquantlib-0.1.0/src/instruments/vanillaswap.cpp +44 -0
  180. pyquantlib-0.1.0/src/instruments/zerocouponswap.cpp +77 -0
  181. pyquantlib-0.1.0/src/main.cpp +58 -0
  182. pyquantlib-0.1.0/src/math/all.cpp +38 -0
  183. pyquantlib-0.1.0/src/math/array.cpp +217 -0
  184. pyquantlib-0.1.0/src/math/distributions/bivariatenormaldistribution.cpp +31 -0
  185. pyquantlib-0.1.0/src/math/distributions/normaldistribution.cpp +63 -0
  186. pyquantlib-0.1.0/src/math/interpolations/backwardflatinterpolation.cpp +26 -0
  187. pyquantlib-0.1.0/src/math/interpolations/cubicinterpolation.cpp +78 -0
  188. pyquantlib-0.1.0/src/math/interpolations/extrapolation.cpp +32 -0
  189. pyquantlib-0.1.0/src/math/interpolations/interpolation.cpp +52 -0
  190. pyquantlib-0.1.0/src/math/interpolations/linearinterpolation.cpp +25 -0
  191. pyquantlib-0.1.0/src/math/interpolations/loglinearinterpolation.cpp +25 -0
  192. pyquantlib-0.1.0/src/math/matrix.cpp +228 -0
  193. pyquantlib-0.1.0/src/math/optimization/constraint.cpp +49 -0
  194. pyquantlib-0.1.0/src/math/optimization/costfunction.cpp +33 -0
  195. pyquantlib-0.1.0/src/math/optimization/endcriteria.cpp +101 -0
  196. pyquantlib-0.1.0/src/math/optimization/levenbergmarquardt.cpp +30 -0
  197. pyquantlib-0.1.0/src/math/optimization/method.cpp +30 -0
  198. pyquantlib-0.1.0/src/math/optimization/problem.cpp +48 -0
  199. pyquantlib-0.1.0/src/math/rounding.cpp +79 -0
  200. pyquantlib-0.1.0/src/math/solvers1d/solvers1d.cpp +116 -0
  201. pyquantlib-0.1.0/src/methods/all.cpp +21 -0
  202. pyquantlib-0.1.0/src/methods/finitedifferences/solvers/fdmbackwardsolver.cpp +69 -0
  203. pyquantlib-0.1.0/src/models/all.cpp +46 -0
  204. pyquantlib-0.1.0/src/models/calibrationhelper.cpp +70 -0
  205. pyquantlib-0.1.0/src/models/equity/batesmodel.cpp +31 -0
  206. pyquantlib-0.1.0/src/models/equity/hestonmodel.cpp +44 -0
  207. pyquantlib-0.1.0/src/models/model.cpp +95 -0
  208. pyquantlib-0.1.0/src/models/parameter.cpp +49 -0
  209. pyquantlib-0.1.0/src/models/piecewisetimedependenthestonmodel.cpp +61 -0
  210. pyquantlib-0.1.0/src/models/shortrate/calibrationhelpers/swaptionhelper.cpp +215 -0
  211. pyquantlib-0.1.0/src/models/shortrate/onefactormodel.cpp +39 -0
  212. pyquantlib-0.1.0/src/models/shortrate/onefactormodels/blackkarasinski.cpp +43 -0
  213. pyquantlib-0.1.0/src/models/shortrate/onefactormodels/hullwhite.cpp +55 -0
  214. pyquantlib-0.1.0/src/models/shortrate/onefactormodels/vasicek.cpp +45 -0
  215. pyquantlib-0.1.0/src/models/shortrate/twofactormodel.cpp +28 -0
  216. pyquantlib-0.1.0/src/models/shortrate/twofactormodels/g2.cpp +66 -0
  217. pyquantlib-0.1.0/src/patterns/all.cpp +22 -0
  218. pyquantlib-0.1.0/src/patterns/lazyobject.cpp +42 -0
  219. pyquantlib-0.1.0/src/patterns/observable.cpp +65 -0
  220. pyquantlib-0.1.0/src/pricingengines/all.cpp +102 -0
  221. pyquantlib-0.1.0/src/pricingengines/asian/analytic_cont_geom_av_price.cpp +31 -0
  222. pyquantlib-0.1.0/src/pricingengines/asian/analytic_discr_geom_av_price.cpp +31 -0
  223. pyquantlib-0.1.0/src/pricingengines/asian/mc_discr_arith_av_price.cpp +71 -0
  224. pyquantlib-0.1.0/src/pricingengines/asian/turnbullwakemanasianengine.cpp +30 -0
  225. pyquantlib-0.1.0/src/pricingengines/barrier/analyticbarrierengine.cpp +30 -0
  226. pyquantlib-0.1.0/src/pricingengines/barrier/analyticdoublebarrierengine.cpp +31 -0
  227. pyquantlib-0.1.0/src/pricingengines/barrier/fdblackscholesbarrierengine.cpp +38 -0
  228. pyquantlib-0.1.0/src/pricingengines/basket/bjerksundstenslandspreadengine.cpp +31 -0
  229. pyquantlib-0.1.0/src/pricingengines/basket/denglizhoubasketengine.cpp +31 -0
  230. pyquantlib-0.1.0/src/pricingengines/basket/fd2dblackscholesvanillaengine.cpp +36 -0
  231. pyquantlib-0.1.0/src/pricingengines/basket/kirkengine.cpp +29 -0
  232. pyquantlib-0.1.0/src/pricingengines/basket/mceuropeanbasketengine.cpp +96 -0
  233. pyquantlib-0.1.0/src/pricingengines/basket/operatorsplittingspreadengine.cpp +31 -0
  234. pyquantlib-0.1.0/src/pricingengines/basket/spreadblackscholesvanillaengine.cpp +46 -0
  235. pyquantlib-0.1.0/src/pricingengines/basket/stulzengine.cpp +30 -0
  236. pyquantlib-0.1.0/src/pricingengines/blackformula.cpp +149 -0
  237. pyquantlib-0.1.0/src/pricingengines/bond/bondfunctions.cpp +177 -0
  238. pyquantlib-0.1.0/src/pricingengines/bond/discountingbondengine.cpp +46 -0
  239. pyquantlib-0.1.0/src/pricingengines/capfloor/bacheliercapfloorengine.cpp +64 -0
  240. pyquantlib-0.1.0/src/pricingengines/capfloor/blackcapfloorengine.cpp +68 -0
  241. pyquantlib-0.1.0/src/pricingengines/credit/isdacdsengine.cpp +89 -0
  242. pyquantlib-0.1.0/src/pricingengines/credit/midpointcdsengine.cpp +54 -0
  243. pyquantlib-0.1.0/src/pricingengines/genericmodelengine.cpp +37 -0
  244. pyquantlib-0.1.0/src/pricingengines/swap/discountingswapengine.cpp +52 -0
  245. pyquantlib-0.1.0/src/pricingengines/swaption/blackswaptionengine.cpp +117 -0
  246. pyquantlib-0.1.0/src/pricingengines/swaption/fdg2swaptionengine.cpp +36 -0
  247. pyquantlib-0.1.0/src/pricingengines/swaption/fdhullwhiteswaptionengine.cpp +35 -0
  248. pyquantlib-0.1.0/src/pricingengines/swaption/g2swaptionengine.cpp +30 -0
  249. pyquantlib-0.1.0/src/pricingengines/swaption/jamshidianswaptionengine.cpp +44 -0
  250. pyquantlib-0.1.0/src/pricingengines/swaption/treeswaptionengine.cpp +60 -0
  251. pyquantlib-0.1.0/src/pricingengines/vanilla/analyticeuropeanengine.cpp +43 -0
  252. pyquantlib-0.1.0/src/pricingengines/vanilla/analyticeuropeanvasicekengine.cpp +33 -0
  253. pyquantlib-0.1.0/src/pricingengines/vanilla/analytichestonengine.cpp +110 -0
  254. pyquantlib-0.1.0/src/pricingengines/vanilla/baroneadesiwhaleyengine.cpp +39 -0
  255. pyquantlib-0.1.0/src/pricingengines/vanilla/batesengine.cpp +34 -0
  256. pyquantlib-0.1.0/src/pricingengines/vanilla/binomialengine.cpp +83 -0
  257. pyquantlib-0.1.0/src/pricingengines/vanilla/bjerksundstenslandengine.cpp +31 -0
  258. pyquantlib-0.1.0/src/pricingengines/vanilla/fdblackscholesvanillaengine.cpp +62 -0
  259. pyquantlib-0.1.0/src/pricingengines/vanilla/integralengine.cpp +28 -0
  260. pyquantlib-0.1.0/src/pricingengines/vanilla/mcamericanengine.cpp +138 -0
  261. pyquantlib-0.1.0/src/pricingengines/vanilla/mceuropeanengine.cpp +112 -0
  262. pyquantlib-0.1.0/src/pricingengines/vanilla/qdfpamericanengine.cpp +86 -0
  263. pyquantlib-0.1.0/src/processes/all.cpp +28 -0
  264. pyquantlib-0.1.0/src/processes/batesprocess.cpp +76 -0
  265. pyquantlib-0.1.0/src/processes/blackscholesprocess.cpp +234 -0
  266. pyquantlib-0.1.0/src/processes/eulerdiscretization.cpp +27 -0
  267. pyquantlib-0.1.0/src/processes/hestonprocess.cpp +87 -0
  268. pyquantlib-0.1.0/src/processes/stochasticprocessarray.cpp +76 -0
  269. pyquantlib-0.1.0/src/quotes/all.cpp +21 -0
  270. pyquantlib-0.1.0/src/quotes/compositequote.cpp +59 -0
  271. pyquantlib-0.1.0/src/quotes/derivedquote.cpp +58 -0
  272. pyquantlib-0.1.0/src/quotes/simplequote.cpp +38 -0
  273. pyquantlib-0.1.0/src/submodules.cpp +19 -0
  274. pyquantlib-0.1.0/src/termstructures/all.cpp +107 -0
  275. pyquantlib-0.1.0/src/termstructures/credit/defaultprobabilityhelpers.cpp +227 -0
  276. pyquantlib-0.1.0/src/termstructures/credit/flathazardrate.cpp +66 -0
  277. pyquantlib-0.1.0/src/termstructures/credit/piecewisedefaultcurve.cpp +91 -0
  278. pyquantlib-0.1.0/src/termstructures/defaulttermstructure.cpp +70 -0
  279. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/blackconstantvol.cpp +74 -0
  280. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/blackvariancesurface.cpp +82 -0
  281. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/blackvoltermstructure.cpp +146 -0
  282. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/fixedlocalvolsurface.cpp +102 -0
  283. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/localconstantvol.cpp +70 -0
  284. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/localvolsurface.cpp +75 -0
  285. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/localvoltermstructure.cpp +73 -0
  286. pyquantlib-0.1.0/src/termstructures/volatility/equityfx/noexceptlocalvolsurface.cpp +85 -0
  287. pyquantlib-0.1.0/src/termstructures/volatility/sabrinterpolatedsmilesection.cpp +66 -0
  288. pyquantlib-0.1.0/src/termstructures/volatility/sabrsmilesection.cpp +67 -0
  289. pyquantlib-0.1.0/src/termstructures/volatility/smilesection.cpp +96 -0
  290. pyquantlib-0.1.0/src/termstructures/volatility/volatilitytype.cpp +28 -0
  291. pyquantlib-0.1.0/src/termstructures/voltermstructure.cpp +50 -0
  292. pyquantlib-0.1.0/src/termstructures/yield/bondhelpers.cpp +200 -0
  293. pyquantlib-0.1.0/src/termstructures/yield/discountcurve.cpp +60 -0
  294. pyquantlib-0.1.0/src/termstructures/yield/flatforward.cpp +92 -0
  295. pyquantlib-0.1.0/src/termstructures/yield/forwardcurve.cpp +60 -0
  296. pyquantlib-0.1.0/src/termstructures/yield/oisratehelper.cpp +271 -0
  297. pyquantlib-0.1.0/src/termstructures/yield/piecewiseyieldcurve.cpp +105 -0
  298. pyquantlib-0.1.0/src/termstructures/yield/ratehelpers.cpp +287 -0
  299. pyquantlib-0.1.0/src/termstructures/yield/zerocurve.cpp +69 -0
  300. pyquantlib-0.1.0/src/termstructures/yield/zerospreadedtermstructure.cpp +49 -0
  301. pyquantlib-0.1.0/src/termstructures/yieldtermstructure.cpp +110 -0
  302. pyquantlib-0.1.0/src/time/all.cpp +41 -0
  303. pyquantlib-0.1.0/src/time/businessdayconvention.cpp +43 -0
  304. pyquantlib-0.1.0/src/time/calendar.cpp +108 -0
  305. pyquantlib-0.1.0/src/time/calendars/calendars.cpp +678 -0
  306. pyquantlib-0.1.0/src/time/date.cpp +203 -0
  307. pyquantlib-0.1.0/src/time/dategenerationrule.cpp +53 -0
  308. pyquantlib-0.1.0/src/time/daycounter.cpp +61 -0
  309. pyquantlib-0.1.0/src/time/daycounters/daycounters.cpp +122 -0
  310. pyquantlib-0.1.0/src/time/frequency.cpp +39 -0
  311. pyquantlib-0.1.0/src/time/period.cpp +96 -0
  312. pyquantlib-0.1.0/src/time/schedule.cpp +154 -0
  313. pyquantlib-0.1.0/src/time/timeunit.cpp +35 -0
  314. pyquantlib-0.1.0/src/time/weekday.cpp +40 -0
  315. pyquantlib-0.1.0/src/utilities/all.cpp +20 -0
  316. pyquantlib-0.1.0/src/utilities/null.cpp +53 -0
  317. pyquantlib-0.1.0/src/utilities/observablevalue.cpp +40 -0
  318. pyquantlib-0.1.0/tests/conftest.py +174 -0
  319. pyquantlib-0.1.0/tests/test_cashflows.py +896 -0
  320. pyquantlib-0.1.0/tests/test_core.py +434 -0
  321. pyquantlib-0.1.0/tests/test_currencies.py +308 -0
  322. pyquantlib-0.1.0/tests/test_experimental_volatility.py +200 -0
  323. pyquantlib-0.1.0/tests/test_extensions.py +89 -0
  324. pyquantlib-0.1.0/tests/test_indexes.py +470 -0
  325. pyquantlib-0.1.0/tests/test_instruments.py +2481 -0
  326. pyquantlib-0.1.0/tests/test_instruments_bonds.py +329 -0
  327. pyquantlib-0.1.0/tests/test_math.py +1167 -0
  328. pyquantlib-0.1.0/tests/test_math_distributions.py +144 -0
  329. pyquantlib-0.1.0/tests/test_math_solvers1d.py +174 -0
  330. pyquantlib-0.1.0/tests/test_methods.py +330 -0
  331. pyquantlib-0.1.0/tests/test_models.py +96 -0
  332. pyquantlib-0.1.0/tests/test_models_shortrate.py +518 -0
  333. pyquantlib-0.1.0/tests/test_pricingengines.py +100 -0
  334. pyquantlib-0.1.0/tests/test_pricingengines_asian.py +174 -0
  335. pyquantlib-0.1.0/tests/test_pricingengines_barrier.py +139 -0
  336. pyquantlib-0.1.0/tests/test_pricingengines_basket.py +534 -0
  337. pyquantlib-0.1.0/tests/test_pricingengines_bond.py +251 -0
  338. pyquantlib-0.1.0/tests/test_pricingengines_capfloor.py +112 -0
  339. pyquantlib-0.1.0/tests/test_pricingengines_credit.py +242 -0
  340. pyquantlib-0.1.0/tests/test_pricingengines_swaption.py +327 -0
  341. pyquantlib-0.1.0/tests/test_pricingengines_vanilla.py +883 -0
  342. pyquantlib-0.1.0/tests/test_processes.py +658 -0
  343. pyquantlib-0.1.0/tests/test_quotes.py +348 -0
  344. pyquantlib-0.1.0/tests/test_termstructures.py +387 -0
  345. pyquantlib-0.1.0/tests/test_termstructures_credit.py +371 -0
  346. pyquantlib-0.1.0/tests/test_termstructures_volatility.py +1829 -0
  347. pyquantlib-0.1.0/tests/test_termstructures_yield.py +1039 -0
  348. pyquantlib-0.1.0/tests/test_time.py +1176 -0
  349. pyquantlib-0.1.0/tests/test_utilities.py +93 -0
@@ -0,0 +1,34 @@
1
+ # Auto detect text files and normalize to LF in repo
2
+ * text=auto eol=lf
3
+
4
+ # Source code
5
+ *.cpp text eol=lf
6
+ *.h text eol=lf
7
+ *.hpp text eol=lf
8
+ *.py text eol=lf
9
+ *.pyi text eol=lf
10
+
11
+ # Config/build files
12
+ *.yml text eol=lf
13
+ *.yaml text eol=lf
14
+ *.json text eol=lf
15
+ *.toml text eol=lf
16
+ *.cmake text eol=lf
17
+ *.txt text eol=lf
18
+ *.md text eol=lf
19
+ *.rst text eol=lf
20
+ CMakeLists.txt text eol=lf
21
+
22
+ # Shell scripts
23
+ *.sh text eol=lf
24
+
25
+ # Windows scripts (keep CRLF)
26
+ *.bat text eol=crlf
27
+ *.cmd text eol=crlf
28
+ *.ps1 text eol=crlf
29
+
30
+ # Binary files
31
+ *.png binary
32
+ *.jpg binary
33
+ *.ico binary
34
+ *.whl binary
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug or unexpected behavior
4
+ title: '[BUG] '
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Description
10
+ <!-- Brief description of the bug -->
11
+
12
+ ## Environment
13
+ - **OS**: <!-- e.g., macOS 14, Ubuntu 24.04, Windows 11 -->
14
+ - **Python**: <!-- e.g., 3.11.5 -->
15
+ - **QuantLib**: <!-- e.g., 1.40 (Homebrew) or 1.38 (source) -->
16
+ - **PyQuantLib**: <!-- e.g., 0.1.0 or commit hash -->
17
+
18
+ ## Steps to Reproduce
19
+ ```python
20
+ # Minimal code to reproduce
21
+ ```
22
+
23
+ ## Expected Behavior
24
+ <!-- What should happen -->
25
+
26
+ ## Actual Behavior
27
+ <!-- What happens instead -->
28
+
29
+ ## Error/Traceback
30
+ ```
31
+ <!-- Paste error message or traceback if applicable -->
32
+ ```
33
+
34
+ ## Additional Context
35
+ <!-- Any other relevant info -->
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: QuantLib Documentation
4
+ url: https://www.quantlib.org/docs.shtml
5
+ about: Official QuantLib documentation
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest a new feature or enhancement
4
+ title: '[FEAT] '
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Summary
10
+ <!-- One-line description of the feature -->
11
+
12
+ ## Motivation
13
+ <!-- Why is this needed? What problem does it solve? -->
14
+
15
+ ## Proposed Solution
16
+ <!-- How should it work? -->
17
+
18
+ ## Alternatives Considered
19
+ <!-- Other approaches you've thought about -->
20
+
21
+ ## Additional Context
22
+ <!-- Examples, references, related issues -->
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: Infrastructure Task
3
+ about: CI, tooling, documentation, or project setup work
4
+ title: '[INFRA] '
5
+ labels: infrastructure
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Task
10
+ <!-- What needs to be done -->
11
+
12
+ ## Category
13
+ <!-- Check one -->
14
+ - [ ] CI/CD
15
+ - [ ] Documentation
16
+ - [ ] Tooling
17
+ - [ ] Project structure
18
+ - [ ] Release prep
19
+
20
+ ## Details
21
+ <!-- Steps, requirements, or acceptance criteria -->
22
+
23
+ ## Related
24
+ <!-- Links to related issues, docs, or references -->
@@ -0,0 +1,51 @@
1
+ # Build QuantLib and Boost dependencies for Windows wheel builds.
2
+ # Called by cibuildwheel via CIBW_BEFORE_ALL_WINDOWS.
3
+ #
4
+ # Expects environment variables:
5
+ # BOOST_VERSION (e.g. "1.86.0")
6
+ # QUANTLIB_VERSION (e.g. "1.40")
7
+
8
+ $ErrorActionPreference = 'Stop'
9
+
10
+ # --- Boost headers ---
11
+ $BOOST_VERSION_UNDERSCORE = $env:BOOST_VERSION -replace '\.', '_'
12
+ Write-Host "Downloading Boost $env:BOOST_VERSION headers..."
13
+ Invoke-WebRequest -Uri "https://archives.boost.io/release/$env:BOOST_VERSION/source/boost_${BOOST_VERSION_UNDERSCORE}.zip" -OutFile boost.zip
14
+ Write-Host "Extracting Boost headers..."
15
+ 7z x boost.zip -oC:/boost-temp -y | Out-Null
16
+ New-Item -ItemType Directory -Path C:/boost/include -Force | Out-Null
17
+ Move-Item "C:/boost-temp/boost_${BOOST_VERSION_UNDERSCORE}/boost" "C:/boost/include/boost"
18
+ Remove-Item -Recurse -Force C:/boost-temp, boost.zip
19
+ Write-Host "Boost headers installed to C:/boost/include"
20
+
21
+ # --- QuantLib ---
22
+ Write-Host "Downloading QuantLib $env:QUANTLIB_VERSION..."
23
+ Invoke-WebRequest -Uri "https://github.com/lballabio/QuantLib/releases/download/v$env:QUANTLIB_VERSION/QuantLib-$env:QUANTLIB_VERSION.tar.gz" -OutFile QuantLib.tar.gz
24
+ tar xzf QuantLib.tar.gz
25
+ Push-Location "QuantLib-$env:QUANTLIB_VERSION"
26
+ New-Item -ItemType Directory -Path build -Force | Out-Null
27
+ Push-Location build
28
+
29
+ Write-Host "Configuring QuantLib..."
30
+ cmake .. -G "Visual Studio 17 2022" -A x64 `
31
+ -DCMAKE_BUILD_TYPE=Release `
32
+ -DCMAKE_INSTALL_PREFIX=C:/quantlib `
33
+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL `
34
+ -DQL_USE_STD_SHARED_PTR=ON `
35
+ -DQL_USE_STD_OPTIONAL=ON `
36
+ -DQL_USE_STD_ANY=ON `
37
+ -DQL_BUILD_EXAMPLES=OFF `
38
+ -DQL_BUILD_TEST_SUITE=OFF `
39
+ -DQL_BUILD_BENCHMARK=OFF `
40
+ -DBoost_INCLUDE_DIR=C:/boost/include
41
+
42
+ Write-Host "Building QuantLib..."
43
+ cmake --build . --config Release --parallel
44
+
45
+ Write-Host "Installing QuantLib..."
46
+ cmake --install . --config Release
47
+
48
+ Pop-Location
49
+ Pop-Location
50
+ Remove-Item -Recurse -Force "QuantLib-$env:QUANTLIB_VERSION", QuantLib.tar.gz
51
+ Write-Host "QuantLib installed to C:/quantlib"
@@ -0,0 +1,100 @@
1
+ # PyQuantLib: Python bindings for QuantLib
2
+ # Copyright (c) 2025 Yassine Idyiahia
3
+ #
4
+ # QuantLib is Copyright (c) 2000-2025 The QuantLib Authors
5
+ # QuantLib is free software under a modified BSD license.
6
+ # See http://quantlib.org/ for more information.
7
+ #
8
+ # Source: https://github.com/quantales/pyquantlib
9
+ # Licensed under the BSD 3-Clause License. See LICENSE file for details.
10
+
11
+ name: Linux build
12
+
13
+ on:
14
+ workflow_dispatch:
15
+
16
+ env:
17
+ QUANTLIB_VERSION: "1.40"
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: ${{ matrix.python-version }}
34
+ cache: 'pip'
35
+
36
+ - name: Install system dependencies
37
+ run: |
38
+ sudo apt-get update
39
+ sudo apt-get install -y libboost-all-dev cmake ninja-build
40
+
41
+ - name: Cache QuantLib
42
+ id: cache-quantlib
43
+ uses: actions/cache@v4
44
+ with:
45
+ path: /home/runner/quantlib-install
46
+ key: quantlib-${{ env.QUANTLIB_VERSION }}-static-ubuntu-latest-v1
47
+ restore-keys: |
48
+ quantlib-${{ env.QUANTLIB_VERSION }}-static-ubuntu-latest-
49
+
50
+ - name: Build QuantLib from source
51
+ if: steps.cache-quantlib.outputs.cache-hit != 'true'
52
+ run: |
53
+ wget https://github.com/lballabio/QuantLib/releases/download/v${{ env.QUANTLIB_VERSION }}/QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
54
+ tar xzf QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
55
+ cd QuantLib-${{ env.QUANTLIB_VERSION }}
56
+ mkdir -p build && cd build
57
+ cmake .. -G Ninja \
58
+ -DCMAKE_BUILD_TYPE=Release \
59
+ -DCMAKE_INSTALL_PREFIX=/home/runner/quantlib-install \
60
+ -DBUILD_SHARED_LIBS=OFF \
61
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
62
+ -DQL_USE_STD_SHARED_PTR=ON \
63
+ -DQL_USE_STD_OPTIONAL=ON \
64
+ -DQL_USE_STD_ANY=ON \
65
+ -DQL_BUILD_EXAMPLES=OFF \
66
+ -DQL_BUILD_TEST_SUITE=OFF \
67
+ -DQL_BUILD_BENCHMARK=OFF
68
+ ninja
69
+ ninja install
70
+
71
+ - name: Verify QuantLib configuration
72
+ run: |
73
+ echo "Checking QuantLib config.hpp for std:: flags..."
74
+ grep -E "QL_USE_STD_(SHARED_PTR|OPTIONAL|ANY)" /home/runner/quantlib-install/include/ql/config.hpp || echo "Flags not found in config.hpp"
75
+
76
+ - name: Install Python build dependencies
77
+ run: |
78
+ python -m pip install --upgrade pip
79
+
80
+ - name: Build package with dev dependencies
81
+ run: |
82
+ pip install -e .[dev] -v
83
+ env:
84
+ QuantLib_ROOT: /home/runner/quantlib-install
85
+ LD_LIBRARY_PATH: /home/runner/quantlib-install/lib
86
+
87
+ - name: Run tests with coverage
88
+ run: |
89
+ pytest --cov=tests --cov-report=xml --cov-report=term-missing
90
+ env:
91
+ LD_LIBRARY_PATH: /home/runner/quantlib-install/lib
92
+
93
+ - name: Upload coverage to Codecov
94
+ uses: codecov/codecov-action@v4
95
+ with:
96
+ files: ./coverage.xml
97
+ fail_ci_if_error: false
98
+ verbose: true
99
+ env:
100
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,87 @@
1
+ # PyQuantLib: Python bindings for QuantLib
2
+ # Copyright (c) 2025 Yassine Idyiahia
3
+ #
4
+ # QuantLib is Copyright (c) 2000-2025 The QuantLib Authors
5
+ # QuantLib is free software under a modified BSD license.
6
+ # See http://quantlib.org/ for more information.
7
+ #
8
+ # Source: https://github.com/quantales/pyquantlib
9
+ # Licensed under the BSD 3-Clause License. See LICENSE file for details.
10
+
11
+ name: macOS build
12
+
13
+ on:
14
+ workflow_dispatch:
15
+
16
+ env:
17
+ QUANTLIB_VERSION: "1.40"
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: macos-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v5
32
+ with:
33
+ python-version: ${{ matrix.python-version }}
34
+ cache: 'pip'
35
+
36
+ - name: Install system dependencies
37
+ run: |
38
+ brew install boost ninja
39
+
40
+ - name: Cache QuantLib
41
+ id: cache-quantlib
42
+ uses: actions/cache@v4
43
+ with:
44
+ path: /Users/runner/quantlib-install
45
+ key: quantlib-${{ env.QUANTLIB_VERSION }}-static-macos-latest-v1
46
+ restore-keys: |
47
+ quantlib-${{ env.QUANTLIB_VERSION }}-static-macos-latest-
48
+
49
+ - name: Build QuantLib from source
50
+ if: steps.cache-quantlib.outputs.cache-hit != 'true'
51
+ run: |
52
+ curl -L -o QuantLib.tar.gz https://github.com/lballabio/QuantLib/releases/download/v${{ env.QUANTLIB_VERSION }}/QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
53
+ tar xzf QuantLib.tar.gz
54
+ cd QuantLib-${{ env.QUANTLIB_VERSION }}
55
+ mkdir -p build && cd build
56
+ cmake .. -G Ninja \
57
+ -DCMAKE_BUILD_TYPE=Release \
58
+ -DCMAKE_INSTALL_PREFIX=/Users/runner/quantlib-install \
59
+ -DBUILD_SHARED_LIBS=OFF \
60
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
61
+ -DQL_USE_STD_SHARED_PTR=ON \
62
+ -DQL_USE_STD_OPTIONAL=ON \
63
+ -DQL_USE_STD_ANY=ON \
64
+ -DQL_BUILD_EXAMPLES=OFF \
65
+ -DQL_BUILD_TEST_SUITE=OFF \
66
+ -DQL_BUILD_BENCHMARK=OFF
67
+ ninja
68
+ ninja install
69
+
70
+ - name: Verify QuantLib configuration
71
+ run: |
72
+ echo "Checking QuantLib config.hpp for std:: flags..."
73
+ grep -E "QL_USE_STD_(SHARED_PTR|OPTIONAL|ANY)" /Users/runner/quantlib-install/include/ql/config.hpp || echo "Flags not found in config.hpp"
74
+
75
+ - name: Install Python build dependencies
76
+ run: |
77
+ python -m pip install --upgrade pip
78
+
79
+ - name: Build package with dev dependencies
80
+ run: |
81
+ pip install -e .[dev] -v
82
+ env:
83
+ QuantLib_ROOT: /Users/runner/quantlib-install
84
+
85
+ - name: Run tests
86
+ run: |
87
+ pytest -v
@@ -0,0 +1,182 @@
1
+ # PyQuantLib: Python bindings for QuantLib
2
+ # Copyright (c) 2025 Yassine Idyiahia
3
+ #
4
+ # Build wheels for multiple platforms using cibuildwheel.
5
+ # QuantLib is built from source during the wheel build process.
6
+
7
+ name: Build wheels
8
+
9
+ on:
10
+ workflow_dispatch:
11
+ pull_request:
12
+ paths:
13
+ - "src/**"
14
+ - "include/**"
15
+ - "CMakeLists.txt"
16
+ - "pyproject.toml"
17
+ - ".github/workflows/wheels.yml"
18
+ release:
19
+ types: [published]
20
+
21
+ env:
22
+ QUANTLIB_VERSION: "1.40"
23
+ BOOST_VERSION: "1.86.0"
24
+
25
+ jobs:
26
+ build_wheels:
27
+ name: Build wheels on ${{ matrix.os }}
28
+ runs-on: ${{ matrix.os }}
29
+ strategy:
30
+ fail-fast: false
31
+ matrix:
32
+ os: [ubuntu-latest, windows-latest, macos-14]
33
+
34
+ steps:
35
+ - uses: actions/checkout@v4
36
+
37
+ - name: Build wheels
38
+ uses: pypa/cibuildwheel@v2.21
39
+ env:
40
+ # Build for CPython only (no PyPy)
41
+ CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
42
+ CIBW_SKIP: "*-musllinux_*"
43
+ CIBW_BUILD_VERBOSITY: 1
44
+
45
+ # macOS: ARM only (macos-14)
46
+ CIBW_ARCHS_MACOS: "arm64"
47
+ CIBW_ARCHS_LINUX: "x86_64"
48
+ CIBW_ARCHS_WINDOWS: "AMD64"
49
+
50
+ # Environment variables for build
51
+ CIBW_ENVIRONMENT: >
52
+ QUANTLIB_VERSION=${{ env.QUANTLIB_VERSION }}
53
+ BOOST_VERSION=${{ env.BOOST_VERSION }}
54
+
55
+ # Linux: Build QuantLib in manylinux container
56
+ # Note: CIBW_ENVIRONMENT is NOT available during before_all,
57
+ # so we use ${{ env.* }} (evaluated by GitHub Actions before cibuildwheel runs).
58
+ CIBW_BEFORE_ALL_LINUX: |
59
+ set -ex
60
+ yum install -y wget tar gzip
61
+
62
+ # Install Boost headers
63
+ BOOST_UNDERSCORE=$(echo ${{ env.BOOST_VERSION }} | tr '.' '_')
64
+ wget -q https://archives.boost.io/release/${{ env.BOOST_VERSION }}/source/boost_${BOOST_UNDERSCORE}.tar.gz
65
+ tar xzf boost_${BOOST_UNDERSCORE}.tar.gz
66
+ mkdir -p /usr/local/include
67
+ cp -r boost_${BOOST_UNDERSCORE}/boost /usr/local/include/
68
+ rm -rf boost_${BOOST_UNDERSCORE}*
69
+
70
+ # Build QuantLib
71
+ wget -q https://github.com/lballabio/QuantLib/releases/download/v${{ env.QUANTLIB_VERSION }}/QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
72
+ tar xzf QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
73
+ cd QuantLib-${{ env.QUANTLIB_VERSION }}
74
+ mkdir -p build && cd build
75
+ cmake .. \
76
+ -DCMAKE_BUILD_TYPE=Release \
77
+ -DCMAKE_INSTALL_PREFIX=/usr/local \
78
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
79
+ -DCMAKE_POLICY_DEFAULT_CMP0167=OLD \
80
+ -DBUILD_SHARED_LIBS=OFF \
81
+ -DQL_USE_STD_SHARED_PTR=ON \
82
+ -DQL_USE_STD_OPTIONAL=ON \
83
+ -DQL_USE_STD_ANY=ON \
84
+ -DQL_BUILD_EXAMPLES=OFF \
85
+ -DQL_BUILD_TEST_SUITE=OFF \
86
+ -DQL_BUILD_BENCHMARK=OFF
87
+ cmake --build . --parallel $(nproc)
88
+ cmake --install .
89
+ cd ../..
90
+ rm -rf QuantLib-${{ env.QUANTLIB_VERSION }}*
91
+
92
+ CIBW_ENVIRONMENT_LINUX: >
93
+ QuantLib_ROOT=/usr/local
94
+ Boost_INCLUDE_DIR=/usr/local/include
95
+
96
+ # macOS: Build QuantLib
97
+ CIBW_BEFORE_ALL_MACOS: |
98
+ set -ex
99
+ brew install boost cmake
100
+
101
+ # Build QuantLib
102
+ curl -sL -o QuantLib.tar.gz https://github.com/lballabio/QuantLib/releases/download/v${{ env.QUANTLIB_VERSION }}/QuantLib-${{ env.QUANTLIB_VERSION }}.tar.gz
103
+ tar xzf QuantLib.tar.gz
104
+ cd QuantLib-${{ env.QUANTLIB_VERSION }}
105
+ mkdir -p build && cd build
106
+ cmake .. \
107
+ -DCMAKE_BUILD_TYPE=Release \
108
+ -DCMAKE_INSTALL_PREFIX=/tmp/quantlib \
109
+ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
110
+ -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
111
+ -DBUILD_SHARED_LIBS=OFF \
112
+ -DQL_USE_STD_SHARED_PTR=ON \
113
+ -DQL_USE_STD_OPTIONAL=ON \
114
+ -DQL_USE_STD_ANY=ON \
115
+ -DQL_BUILD_EXAMPLES=OFF \
116
+ -DQL_BUILD_TEST_SUITE=OFF \
117
+ -DQL_BUILD_BENCHMARK=OFF
118
+ cmake --build . --parallel $(sysctl -n hw.ncpu)
119
+ cmake --install .
120
+ cd ../..
121
+ rm -rf QuantLib-${{ env.QUANTLIB_VERSION }}*
122
+
123
+ CIBW_ENVIRONMENT_MACOS: >
124
+ QuantLib_ROOT=/tmp/quantlib
125
+
126
+ # Windows: Build QuantLib (PowerShell script, since cibuildwheel uses cmd on Windows)
127
+ CIBW_BEFORE_ALL_WINDOWS: "powershell -ExecutionPolicy Bypass -File {project}/.github/scripts/build-quantlib-windows.ps1"
128
+
129
+ CIBW_ENVIRONMENT_WINDOWS: >
130
+ QuantLib_ROOT=C:/quantlib
131
+ Boost_INCLUDE_DIR=C:/boost/include
132
+
133
+ # Run tests
134
+ CIBW_TEST_REQUIRES: pytest numpy
135
+ CIBW_TEST_COMMAND: pytest {project}/tests -v --ignore={project}/tests/test_pricingengines_vanilla.py
136
+
137
+ - uses: actions/upload-artifact@v4
138
+ with:
139
+ name: wheels-${{ matrix.os }}
140
+ path: ./wheelhouse/*.whl
141
+
142
+ build_sdist:
143
+ name: Build source distribution
144
+ runs-on: ubuntu-latest
145
+ steps:
146
+ - uses: actions/checkout@v4
147
+
148
+ - name: Build sdist
149
+ run: pipx run build --sdist
150
+
151
+ - uses: actions/upload-artifact@v4
152
+ with:
153
+ name: sdist
154
+ path: dist/*.tar.gz
155
+
156
+ upload_pypi:
157
+ name: Upload to PyPI
158
+ needs: [build_wheels, build_sdist]
159
+ runs-on: ubuntu-latest
160
+ if: github.event_name == 'release' && github.event.action == 'published'
161
+
162
+ environment:
163
+ name: pypi
164
+ url: https://pypi.org/p/pyquantlib
165
+
166
+ permissions:
167
+ id-token: write # Required for trusted publishing
168
+
169
+ steps:
170
+ - uses: actions/download-artifact@v4
171
+ with:
172
+ pattern: wheels-*
173
+ path: dist
174
+ merge-multiple: true
175
+
176
+ - uses: actions/download-artifact@v4
177
+ with:
178
+ name: sdist
179
+ path: dist
180
+
181
+ - name: Publish to PyPI
182
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,111 @@
1
+ # PyQuantLib: Python bindings for QuantLib
2
+ # Copyright (c) 2025 Yassine Idyiahia
3
+ #
4
+ # QuantLib is Copyright (c) 2000-2025 The QuantLib Authors
5
+ # QuantLib is free software under a modified BSD license.
6
+ # See http://quantlib.org/ for more information.
7
+ #
8
+ # Source: https://github.com/quantales/pyquantlib
9
+ # Licensed under the BSD 3-Clause License. See LICENSE file for details.
10
+
11
+ name: Windows build
12
+
13
+ on:
14
+ workflow_dispatch:
15
+
16
+ env:
17
+ QUANTLIB_VERSION: "1.40"
18
+ BOOST_VERSION: "1.86.0"
19
+ BOOST_VERSION_UNDERSCORE: "1_86_0"
20
+
21
+ jobs:
22
+ build:
23
+ runs-on: windows-latest
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Set up Python ${{ matrix.python-version }}
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: ${{ matrix.python-version }}
36
+ cache: 'pip'
37
+
38
+ - name: Cache Boost headers
39
+ id: cache-boost
40
+ uses: actions/cache@v4
41
+ with:
42
+ path: C:/boost
43
+ key: boost-headers-${{ env.BOOST_VERSION }}-windows-v1
44
+
45
+ - name: Download Boost headers
46
+ if: steps.cache-boost.outputs.cache-hit != 'true'
47
+ run: |
48
+ Write-Host "Downloading Boost $env:BOOST_VERSION headers..."
49
+ $url = "https://archives.boost.io/release/$env:BOOST_VERSION/source/boost_$env:BOOST_VERSION_UNDERSCORE.zip"
50
+ Invoke-WebRequest -Uri $url -OutFile boost.zip
51
+ Write-Host "Extracting Boost headers..."
52
+ Expand-Archive -Path boost.zip -DestinationPath C:/boost-temp
53
+ mkdir C:/boost/include -Force
54
+ Move-Item "C:/boost-temp/boost_$env:BOOST_VERSION_UNDERSCORE/boost" "C:/boost/include/boost"
55
+ Remove-Item -Recurse -Force C:/boost-temp, boost.zip
56
+ Write-Host "Boost headers installed to C:/boost/include"
57
+
58
+ - name: Cache QuantLib
59
+ id: cache-quantlib
60
+ uses: actions/cache@v4
61
+ with:
62
+ path: C:/quantlib-install
63
+ key: quantlib-${{ env.QUANTLIB_VERSION }}-std-windows-v3
64
+ restore-keys: |
65
+ quantlib-${{ env.QUANTLIB_VERSION }}-std-windows-
66
+
67
+ - name: Build QuantLib from source
68
+ if: steps.cache-quantlib.outputs.cache-hit != 'true'
69
+ run: |
70
+ Write-Host "Downloading QuantLib $env:QUANTLIB_VERSION..."
71
+ Invoke-WebRequest -Uri "https://github.com/lballabio/QuantLib/releases/download/v$env:QUANTLIB_VERSION/QuantLib-$env:QUANTLIB_VERSION.tar.gz" -OutFile QuantLib.tar.gz
72
+ tar xzf QuantLib.tar.gz
73
+ cd "QuantLib-$env:QUANTLIB_VERSION"
74
+ mkdir build -Force | Out-Null
75
+ cd build
76
+ Write-Host "Configuring QuantLib with std:: flags..."
77
+ cmake .. -G "Visual Studio 17 2022" -A x64 `
78
+ -DCMAKE_BUILD_TYPE=Release `
79
+ -DCMAKE_INSTALL_PREFIX=C:/quantlib-install `
80
+ -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL `
81
+ -DQL_USE_STD_SHARED_PTR=ON `
82
+ -DQL_USE_STD_OPTIONAL=ON `
83
+ -DQL_USE_STD_ANY=ON `
84
+ -DQL_BUILD_EXAMPLES=OFF `
85
+ -DQL_BUILD_TEST_SUITE=OFF `
86
+ -DQL_BUILD_BENCHMARK=OFF `
87
+ -DBoost_INCLUDE_DIR=C:/boost/include
88
+ Write-Host "Building QuantLib..."
89
+ cmake --build . --config Release --parallel
90
+ Write-Host "Installing QuantLib..."
91
+ cmake --install . --config Release
92
+
93
+ - name: Verify QuantLib configuration
94
+ run: |
95
+ Write-Host "Checking QuantLib config.hpp for std:: flags..."
96
+ Get-Content "C:\quantlib-install\include\ql\config.hpp" | Select-String -Pattern "QL_USE_STD"
97
+
98
+ - name: Install Python build dependencies
99
+ run: |
100
+ python -m pip install --upgrade pip
101
+
102
+ - name: Build package with dev dependencies
103
+ run: |
104
+ pip install -e .[dev] -v
105
+ env:
106
+ QuantLib_ROOT: C:/quantlib-install
107
+ Boost_INCLUDE_DIR: C:/boost/include
108
+
109
+ - name: Run tests
110
+ run: |
111
+ pytest -v