4
$\begingroup$

I have the following problem bootstrapping the JPY OIS Curve. The bootstrapping itself works when havin one set of data, e.g. for the date 2017-02-09. I have all my instruments and as said bootstrapping and receiving the OIS curve. If i extend the dataset to a second date 2017-02-10 I receive all the data into my bootstrapper which makes no sense with the error message:

more than one instrument with pillar February 10th, 2017

which results to the same maturities due to data from different dates as explained above. I have somehow to loop over the fdates but I have no idea how this could work in that context.Help would be appreciated.

import QuantLib as ql
import pandas as pd
import matplotlib.pyplot as plt

def Convert(Period):
    unit =[]
    if Period[-1:] == 'D':
        unit = ql.Days
    elif Period[-1:] == 'M':
        unit = ql.Months
    elif Period[-1:] == 'W':
        unit = ql.Weeks
    elif Period[-1:] == 'Y':
        unit = ql.Years
    period_object = ql.Period(int(Period[:-1]), unit)
    return period_object

date = ql.Date(9, ql.February, 2017)
ql.Settings.instance().evaluationDate = date

data = pd.read_csv('C:/Data_JPY_Playing.csv').fillna('')

data_selected = data[['fdate', 'ptype' ,'maturity','fixing','values']].to_records(index=False)  

Rate_Helper_Full_Disc = [] 

for fdate, ptype, maturity, fixing, values in data_selected:
    if row['ptype'] == 'Deposit':
        helper_disc = ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(row['values']/100)),
                                           Convert(row['maturity']), 
                                           int(row['fixing']),
                                           ql.Japan(), 
                                           ql.ModifiedFollowing, 
                                           False, 
                                           ql.Actual365Fixed())

        Rate_Helper_Full_Disc.append(helper_disc) 

disc_curve = ql.PiecewiseCubicZero(date, Rate_Helper_Full_Disc, ql.Actual365Fixed())
disc_curve.enableExtrapolation()
$\endgroup$

1 Answer 1

3
$\begingroup$

A curve is used to do calculations (e.g. discounting of cash flows) as of a given trade date. Bootstrapping a single curve for two different trade dates does not make sense. With the first set of data you should bootstrap an OIS curve for the 2017-02-09 trade date, with the second set of data you should bootstrap an OIS curve for the 2017-02-10 trade date.

$\endgroup$
2
  • $\begingroup$ Why not split your data file in 2, one file per trade date, and then run twice your code, once for date = ql.Date(9, ql.February, 2017), once for date = ql.Date(10, ql.February, 2017) ? That's how it would be done in a real life system. $\endgroup$ Feb 6, 2018 at 13:24
  • $\begingroup$ somehow you have to filter out your data = pd.read_csv('C:/Data_JPY_Playing.csv').fillna('') so that it keeps only the data indexed by date. I don't know how it is done in python but that's probably easy to do. $\endgroup$ Feb 6, 2018 at 13:31

Your Answer

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

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