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.1

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.1
File Actions
quantlib_addin-0.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for quantlib_addin-0.1.1-cp313-cp313-win_amd64.whl
quantlib_addin-0.1.1-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.1-cp313-cp313-manylinux_2_28_x86_64.whl
quantlib_addin-0.1.1-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.1-cp313-cp313-macosx_15_0_x86_64.whl
quantlib_addin-0.1.1-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details for quantlib_addin-0.1.1-cp313-cp313-macosx_15_0_arm64.whl

Total release size: 158.7 MB

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

Download URL quantlib_addin-0.1.1-cp313-cp313-win_amd64.whl
Size 53.4 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
9adaed8928ed678d1055450059f2720ea0af11bcbd3f9b7d09030b719de5f44b
BLAKE2b-256 checksum
How to use checksums
e38da047b7b0b47db8e277ac6c76127294aa2e49d516604407c7ab7303d0f61f
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 Oct 30, 2026.

Transparency log

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

Download URL quantlib_addin-0.1.1-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
6bef0d26572640ff252543cc3e7ff57cf9c88a07feff5f1f11131c8bb38e44ef
BLAKE2b-256 checksum
How to use checksums
66773575e0a68b926fddb1a29b6743f16605a5e645e3d705ba7ddad25b1fe0f6
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 Oct 30, 2026.

Transparency log

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

Download URL quantlib_addin-0.1.1-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
7e982ffcef711a591f7bf44c81309eaad60661abd9dcbda12a500c8d3f02e682
BLAKE2b-256 checksum
How to use checksums
9a1838b44e76b62c8947cd16af89a6ca3f0da4eaae5563ea588c2298cf18c278
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 Oct 30, 2026.

Transparency log

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

Download URL quantlib_addin-0.1.1-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
17de30963075eb81e4ef6d762c9c94638afea8885f2271bc9e5d04ed1897f3a8
BLAKE2b-256 checksum
How to use checksums
785d04424a467d5872d1491a0e9e0f491cdb99b7e27a0689741096707de466fb
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 Oct 30, 2026.

Transparency log

Security for quantlib-addin 0.1.1

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.1-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 Oct 30, 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