3
$\begingroup$
import QuantLib as ql
import pandas as pd

today = ql.Date().todaysDate()
calendar = ql.Canada()

# Load the CDOR swap rates data into a pandas DataFrame
cdor_data = pd.read_csv('cdor_swap_rates.csv')

# Convert the data into QuantLib objects
cdor_curve = ql.RelinkableYieldTermStructureHandle()
cdor_helpers = []
for i, row in cdor_data.iterrows():
    tenor = ql.Period(row['Term'])
    rate = row['Rate'] / 100.0
    helper = ql.SwapRateHelper(rate, tenor, calendar,
                               ql.Annual, ql.Unadjusted,
                               ql.Thirty360(ql.Thirty360.BondBasis), ql.Cdor, ql.Period('1D'),
                               cdor_curve)
    cdor_helpers.append(helper)

Hey guys, I can't figure out why my SwapRateHelper function is not working, throwing a TypeError: Wrong number or type of arguments for overloaded function 'new_SwapRateHelper'.

$\endgroup$

1 Answer 1

2
$\begingroup$

Looking at the declaration of the constructor you're using (https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/ratehelpers.i#L236) I see two reasons:

  1. you're passing ql.Cdor which is the name of the class. You need to pass ql.Cdor() which is an instance of the index.
  2. after the index, the next parameter is a QuoteHandle containing the spread. Even if the spread is 0, that's needed if you're passing the other parameters after this one.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.