[Quantlib-users] nanoql: a stateless library derived from QuantLib 1.44, and checked against it
|
From: <gan...@na...> - 2026-11-16 07:21:58
|
<p data-line="26" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Hello all,</p><p data-line="28" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">I'd like to share nanoql (<a href="https://nanoql.org/" data-href="https://nanoql.org" style="color: rgb(0, 105, 204); text-decoration: none;">https://nanoql.org</a>), an open-source library derived from QuantLib 1.44. It keeps QuantLib's classes, names and mathematics, and changes the design around them: instruments, curves and models are immutable values, pricers are functions of them, and the evaluation date is an argument rather than a global setting. There are no observers, handles or lazy objects. It is written in C#, and Python, C, C++ and Excel reach it through one C interface over a native build.</p><p data-line="34" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">It is checked against QuantLib itself: 3,348,122 outputs recorded from QuantLib 1.44, each matched within a relative 1e-10 except 0.14% held to documented looser tolerances, and QuantLib's own test suite ported at its tolerances. Where nanoql's results differ from QuantLib's, mostly where it fixes a defect, each difference is listed with its own test:</p><ul data-line="39" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 0.7em; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><li data-line="39" class="code-line" dir="auto">how it is checked:<span> </span><a href="https://nanoql.org/docs/checking.html" data-href="https://nanoql.org/docs/checking.html" style="color: rgb(0, 105, 204); text-decoration: none;">https://nanoql.org/docs/checking.html</a></li><li data-line="40" class="code-line" dir="auto">the figures:<span> </span><a href="https://nanoql.org/validation/index.html" data-href="https://nanoql.org/validation/index.html" style="color: rgb(0, 105, 204); text-decoration: none;">https://nanoql.org/validation/index.html</a></li><li data-line="41" class="code-line" dir="auto">every divergence:<span> </span><a href="https://nanoql.org/docs/divergences.html" data-href="https://nanoql.org/docs/divergences.html" style="color: rgb(0, 105, 204); text-decoration: none;">https://nanoql.org/docs/divergences.html</a></li></ul><p data-line="43" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">None of this would exist without QuantLib and the people who have built it over two decades. nanoql isn't affiliated with or endorsed by the QuantLib project, and it carries QuantLib's licence and notices.</p><p data-line="46" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">If you use QuantLib-Python,<span> </span><code style="font-family: Consolas, "Courier New", monospace; color: rgb(59, 59, 59); background-color: rgba(0, 0, 0, 0.12); padding: 1px 3px; border-radius: 4px; font-size: 1em; line-height: 1.357em;">pip install nanoql</code><span> </span>(Windows, Linux and Apple silicon Macs) and the migration guide,<span> </span><a href="https://nanoql.org/docs/migration/from-quantlib-python.html" data-href="https://nanoql.org/docs/migration/from-quantlib-python.html" style="color: rgb(0, 105, 204); text-decoration: none;">https://nanoql.org/docs/migration/from-quantlib-python.html</a>, are the quickest way in. I'd be glad of any feedback, above all on results that differ from what you'd expect:<span> </span><a href="https://github.com/nanoql-dev/nanoql/discussions" data-href="https://github.com/nanoql-dev/nanoql/discussions" style="color: rgb(0, 105, 204); text-decoration: none;">https://github.com/nanoql-dev/nanoql/discussions</a></p><p data-line="50" class="code-line" dir="auto" style="margin-top: 0px; margin-bottom: 16px; color: rgb(32, 32, 32); font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", system-ui, Ubuntu, "Droid Sans", sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;">Best regards, Gang Ning</p><div><br></div> |