Skip to main content

QuantLibAddIn Python Wrapper Overview

The QuantLibAddIn Python Wrapper provides a Python interface to QuantLibAddIn, exposing the functionality of the QuantLib C++ analytics library through an object-oriented API that close mirrors the architecture used by Excel-based QuantLibXL.

Example : OIS MidCurves

import quantlib_addin as qla
from datetime import datetime, timedelta


def main():
    try:
        # Initialize the environment
        qla.initializeAddin()

        print("Begin example program.")
        print("QuantLibAddin version =", qla.qlAddinVersion(False))
        print("ObjectHandler version =", qla.ohVersion(False))

        evaluation_date = 46218
        evaluation_date_str = datetime(year=1899, month=12, day=30) + timedelta(days=evaluation_date)
        print(f"Evaluation Date = {evaluation_date_str}")

        qla.qlSettingsSetEvaluationDate( evaluation_date, False,)

        fixing_days = 2
        rate_factor = 100

        sofr_index = qla.qlOvernightIndex(ObjectId="ois_index",
                                          FamilyName="SOFR",
                                          FixingDays=fixing_days,
                                          Currency="USD",
                                          Calendar="TARGET",
                                          DayCounter="Act/Act",
                                          YieldCurve = "",
                                          Permanent=False,
                                          Trigger=False,
                                          Overwrite=False)

        ois_curve_rates = {
            '5D': 5.0,
            '1W': 5.0,
            '2W': 5.0,
            '1M': 5.0,
            '3M': 5.0,
            '6M': 5.0,
            '9M': 5.0,
            '1Y': 5.0,
            '18M': 5.0,
            '2Y': 5.0,
            '3Y': 5.0,
            '5Y': 5.0,
            '10Y': 5.0,
            '20Y': 5.0,
            '30Y': 5.0
        }

        rate_helpers = []

        for swap_tenor, rate in ois_curve_rates.items():

            ois_rate_helper = qla.qlOISRateHelper(
                ObjectId=swap_tenor,
                SettlDays=2,
                Tenor=swap_tenor,
                FixedRate=rate/rate_factor,
                ONIndex=sofr_index,
                DiscountingCurve="",
                TelescopicValueDates=False,
                PaymentLag=0,
                Permanent=False,
                Trigger=False,
                Overwrite=False,
            )

            rate_helpers.append(ois_rate_helper)

        piecewise_ois_curve = qla.qlPiecewiseYieldCurve(
            ObjectId="piecewise_yieldcurve",
            NDays=fixing_days,
            Calendar="TARGET",
            RateHelpers=rate_helpers,
            DayCounter="Actual/360",
            Jumps=[],
            JumpDates=[],
            TraitsID="Discount",
            InterpolatorID="LogLinear",
            Permanent=False,
            Trigger=False,
            Overwrite=False,
        )

        qla.qlYieldTermStructureEnableExtrapolation(ObjectId=piecewise_ois_curve,
                                                    ExtrapolationFlag=True,
                                                    Trigger=True)

        engine = qla.qlDiscountingSwapEngine(
            "piecewise_ois_curve",
            YieldCurve=piecewise_ois_curve,
            IncludeSettlDate = False,
            SettlementDate=None,
            NpvDate=None,
            Permanent=False,
            Trigger=False,
            Overwrite=False,
        )

        sofr_index_with_curve = qla.qlOvernightIndex(ObjectId="ois_index_with_curve",
                                                     FamilyName="SOFR",
                                                     FixingDays=fixing_days,
                                                     Currency="USD",
                                                     Calendar="TARGET",
                                                     DayCounter="Act/Act",
                                                     YieldCurve=piecewise_ois_curve,
                                                     Permanent=False, Trigger=False, Overwrite=False)

        forward_start = [
            '0D', '1M', '3M', '6M', '1Y', '3Y', '5Y',
            '7Y', '10Y', '15Y', '20Y', '25Y', '30Y'
        ]

        swap_tenor = ['1Y', '3Y', '5Y', '7Y', '10Y', '15Y', '20Y', '25Y', '30Y']

        # Store results: rates[start][tenor]
        rates = {}

        for start in forward_start:
            rates[start] = {}

            for tenor in swap_tenor:
                ticker = start + "x" + tenor

                ois_swap = qla.qlMakeOIS(
                    ObjectId=ticker,
                    SettlDays=2,
                    SwapTenor=tenor,
                    OvernightIndex=sofr_index_with_curve,
                    FixedRate=0.000001,
                    ForwardStart=start,
                    FixDayCounter="Act/Act",
                    Spread=0.0,
                    PaymentLag=0,
                    Permanent=False,
                    Trigger=False,
                    Overwrite=False
                )

                qla.qlInstrumentSetPricingEngine(ois_swap, engine, False)

                results = qla.qlAddinCalculate(ois_swap)
                rates[start][tenor] = results['results']['fairRate']

        # Print table
        column_width = 10

        header = f"{'Forward':>{column_width}}"
        for tenor in swap_tenor:
            header += f"{tenor:>{column_width}}"

        print(header)
        print("-" * len(header))

        for start in forward_start:
            row = f"{start:>{column_width}}"
            for tenor in swap_tenor:
                # Display as percentage
                rate = rates[start][tenor] * 100
                row += f"{rate:>{column_width}.4f}"
            print(row)

    except Exception as e:
        print("Error:", e)
        return 1

    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Metadata

Release files for quantlib-addin 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for quantlib-addin 0.1.2
File Actions
quantlib_addin-0.1.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for quantlib_addin-0.1.2-cp313-cp313-win_amd64.whl
quantlib_addin-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details for quantlib_addin-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_x86_64.whl CPython 3.13 CPython 3.13 macOS 15.0+ x86-64 Details for quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_x86_64.whl
quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_arm64.whl

Total release size: 158.7 MB

Release files / quantlib_addin-0.1.2-cp313-cp313-win_amd64.whl

Download URL quantlib_addin-0.1.2-cp313-cp313-win_amd64.whl
Size 53.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a8cee21f30d97f55c3b13e07311cf24f85b1969e0d59c86ab89acb0c8d3ef02e
BLAKE2b-256 checksum
How to use checksums
7c804c356fe83a5cccf592657dd524d464742bf745f530aee3cae4c20c44df09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / quantlib_addin-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL quantlib_addin-0.1.2-cp313-cp313-manylinux_2_28_x86_64.whl
Size 48.3 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
98d7f37a5540536d4cc3ab457b1b2166d1f3a8ae94983c17f6d7f235cdeb2b96
BLAKE2b-256 checksum
How to use checksums
c94496eaead1a3623b320ee4ada642fb90a22a5f0eac3bc9d6808692c568fc6f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_x86_64.whl

Download URL quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_x86_64.whl
Size 29.2 MB
Tags CPython 3.13 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
6a724828640993be45906d75227e85961f572b6d087c9f7372eadefcf0e0f4d1
BLAKE2b-256 checksum
How to use checksums
e0cfa5bc00f54254ed8f425f9e45a21d2857803d5d26aaf5cc3cc5e0f85dc286
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_arm64.whl

Download URL quantlib_addin-0.1.2-cp313-cp313-macosx_15_0_arm64.whl
Size 27.8 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
eb47c992b2628bca7312518a15480a482701ccd37717e5baa9a834053173ef26
BLAKE2b-256 checksum
How to use checksums
e129a5d3737705f8d0c98c6c9b928affb3a64264ad82a57e6fa154869f4bbf59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for quantlib-addin 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for quantlib_addin-0.1.2-cp313-cp313-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page