Monday, February 24, 2025

QuantLib, OIS Swaps and Market Conventions

      


M 917 536 3378

maksim_kozyarchuk@yahoo.com








In this article, I will explore the fields necessary to define OIS swaps, assess QuantLib’s capabilities in supporting various flavors of OIS swaps, and discuss the concept of Swap Templates and Universal Product Identifiers (UPIs). The goal is to demonstrate how these tools can reduce the number of required fields for representing swaps while aligning swap setups with prevailing market conventions.



Defining an OIS Swap

The number of fields required to represent an Overnight Indexed Swap (OIS) can vary significantly. At its simplest, only four core fields are necessary—index, notional, tenor, and fixed rate. On the other extreme, the Financial products Markup Language (FpML) defines hundreds of fields that can be used to define various nuances of an OIS swap.

While there is no definitive industry standard for representing OIS swaps, specifications from major vendors in clearing—such as ICE, CME, and SEF platforms like Tradeweb and Bloomberg —converge on approximately 15 core fields that define commonly traded OIS swaps:

  • direction: Indicates whether the swap position is Receive Fixed or Pay Fixed.

  • effective_date: Defaults to the current day plus the settlement day offset for the floating rate index if not provided.

  • maturity: Can be expressed as a tenor (e.g., 6 months, 1 year) or as a specific date.

  • notional: The principal amount of the swap. Required.

  • float_rate_index: Defines the rate index and sets conventions for optional fields.

  • roll_period: Applies to both fixed and floating legs. Defaults based on index conventions if not provided.

  • fixed_rate: The agreed-upon fixed interest rate. Required.

  • roll_type: Optional field that defaults to Standard; other common options for OIS swaps include IMM and EOM.

  • stub_type: Optional field with a default value of ShortInitial. Other valid options include ShortFinal, LongInitial, and LongFinal.

  • spread: An optional spread applied to the floating leg.

  • roll_conv: Also known as the business day convention. Valid options include Following, Modified Following, Preceding, Modified Preceding, and Unadjusted.

  • payment_lag: Optional field that defaults based on floating rate index conventions.

  • lookback_days: Optional, with defaults based on floating rate index conventions.

  • averaging_method: Optional, with defaults based on floating rate index conventions.

  • day_count: Optional, with defaults based on floating rate index conventions.




Using QuantLib for OIS Swap Definitions

QuantLib exposes all of these fields through its API and offers convenience functions for common OIS indices like ql.Sofr() and ql.Estr(). However, specifying all fields for every swap instance can be cumbersome. QuantLib does allow many of these fields to be optional by using default arguments, but its defaulting mechanism is not always transparent and can sometimes fall out of step with prevailing market conventions.

Please reach out if you would like to see code samples of how to map above mentioned fields to QuantLib




Leveraging Swap Templates and UPI Standards for Default Values

A more robust defaulting system can be developed by leveraging the AnnaDB product definition, which standardizes key swap fields into Universal Product Identifiers (UPIs). These UPIs provide a consistent framework for identifying financial products across global markets and help streamline swap creation while aligning with international standards. The Global Trade Repository (GTR) further exposes UPIs, offering additional data to establish market-aligned defaults for various fields. Swap templates built around UPIs and GTR, number of required input fields can be reduced, as many defaults—such as day count conventions, business day adjustments, and settlement calendars—are automatically applied. This approach minimizes manual configuration, ensuring consistency with market standards while still allowing flexibility for custom inputs when deviations are necessary



Implementation in Kupala-Nich

QuantLib In my implementation with Kupala-Nich, the platform accepts all the previously mentioned fields for defining and valuing OIS swaps. Additionally, it introduces a new field called “template,” which accepts values such as UPI, CurveName, and other relevant identifiers. These templates incorporate industry-standard defaults for optional fields, derived from AnnaDB and the Global Trade Repository (GTR). While the number of templates is somewhat arbitrary, each reflects a common configuration used in trading various OIS swap indices. To access the full list of available templates, visit the valuation section of https://kupala-nich.com and click on the "List Templates" button


No comments: