Qauntlib Wrapper Overview

Overview

The QuantLib Wrapper library is a library that provides a simplified interface in Python to the Quantlib library. Functions provided in the library ustilize pydantic and pydantic data classes to provide a typed functions into QuantLib functions.

Quantlib Hanlde

Most wrapper objects will create a corresponding quantlib object, which is set as the handle property on the object.

import contracts as ct schedule = ct.Schedule(start_date='2000-01-01', end_date='2030-01-01', frequency= ct.Frequency.Annual, calendar= cl.Calendar.USGovernmentBond, convention=ct.Convention.Following, dateroll=ct.DateRoll.Forward) bond = ct.FixedRateBond(settlement_days=2,face_value=10000, day_count=ct.DayCount.Actual360, coupon=0.05,schedule=schedule) qbond = bond.handle

Copying Objects

The dataclasses in the wrapper library are designed to be immutable. That is, once you create an object, you cant change it. You can, however make a copy

from dataclasses import replace contract = replace(contract)

Contracts and Helpers

The quantlib library separates out objects that represent fixed income contracts, from observiations of those contracts, known as helpers. Helpers are used as data to the construction of term structures.

The wrapper library merges these classes. As such, there is no difference between a Fixed Income Contract, and a Fixed Income Contract Helper.