Skip to content
All library documents

QuantLib and ORE Support for BRL CDI Swap Valuation

Article Quant Q&A · Author: Gloomy

Summary

The document describes an attempt to value Brazilian real CDI swaps with QuantLib. The questioner tried building an overnight-indexed swap curve from futures and using observed discount factors, then discounting a zero-coupon swap, but reports that the results were far from expected. They suspect the difficulty may relate to the compounding conventions of DI futures, though they do not establish that as the cause.

The answer points out a practical limitation in the alternative Open Source Risk Engine: the cited BRL CDI swap instrument appears not to have Python bindings, so using it may require C++. For Python users, the suggested next step is to request bindings from the project. The exchange does not provide a valuation recipe, code, or numerical evidence, so it is useful mainly as guidance about tool availability rather than as a solution to CDI swap pricing.

Key ideas

  • The questioner reports unsuccessful curve-building and discounting attempts for BRL CDI swaps in QuantLib.
  • DI futures compounding is raised as a possible source of the valuation mismatch, but the document does not verify this explanation.
  • The cited ORE swap instrument is described as unavailable through Python bindings.
  • Using the instrument may require C++, or users can request Python support from the project.

Tags

Full text
# Find the right module for CDI DI BRL swaps valuation Quantlib


# Find the right module for CDI DI BRL swaps valuation Quantlib












I'm trying to find a way to price BRL CDI Swaps with Quantlib but I can't find any solutions so far - so I was wondering if anyone encountered this issue:

- I don't see any solution on Quantlib. I tried several ways

- create a OIS curve in Quantlib using the FRA Futures as OIS swap points using the OISRateHelper

- I used the actual discount factors (that I can find on BBG), create a curve and yield term structure

I always end up with the same result. I tried to create a ZCS (Zero coupon swap) and discount on the curves that I create but I'm always completely off. I guess it's because of the way DI Futures are coumpounded, Quantlib does not really have a method for this (that I know of). I'm hapy to share my code if needed but happy to have your thoughts on this or if you have an example of DI pricing via Quantlib (I searched everywhere already, no success)

- I tried to find alternatives online and I found ORE, that has installed something worth checking - https://www.opensourcerisk.org/docs/qle/class_quant_ext_1_1_b_r_l_cdi_swap.html . But the problem when I installed it (`pip install open-source-risk-engine`) I couldn't find this functionnality when I imported the module so I'm a bit lost here

Any idea ?

Thanks in advance,

## Answer by Xiarpedia (score 1)

https://quant.stackexchange.com/a/77407

I would like to preface by saying I have not worked with ORE previously. However, following the bindings to python from this link I can see there are none for that specific asset you are referring to, i.e. you can not call that instrument definition from Python and thus should use c++ (if someone is more familiar with ORE then please correct me if I am wrong). My best bet if you would like to have it in Python would be to create an issue in their repository.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.