0
$\begingroup$

I am bootstrapping the shibor curve and fr007 curve using swap rates in China. I created my own index like following:

Shibor3M=IborIndex("Shibor3M",Period(3,Months),0,CNYCurrency(),
                    China(China.IB),Following,False,Actual360(),
                    discounting_curve)

and using to bootstrapping the spot rates. And code is:

today=Date(17,6,2019)
Settings.instance().evaluationDate = today
discounting_curve=RelinkableYieldTermStructureHandle()
forecasting_curve=RelinkableYieldTermStructureHandle()
quotes = [SimpleQuote(2.80763/100)]
#Shibor index
Shibor3M=IborIndex("Shibor-3M",Period(3,Months),0,
                   CNYCurrency(),China(China.IB), 
                   Following,False,Actual360(),
                   forecasting_curve)
depo_helper = [DepositRateHelper(
                   QuoteHandle(quotes[0]),Period(3,Months),0,China(China.IB),
                   Following,False,Actual360())]

swap_helpers = [ SwapRateHelper(QuoteHandle(SimpleQuote(rate/100.0)), Period(*tenor), China(China.IB),Quarterly,Following,Actual365Fixed(),Shibor3M())
        for tenor, rate in [((6,Months),2.985),((9,Months),3.0163),((1,Years),3.0475),((2,Years), 3.1638),
        ((3,Years), 3.2788),
        ((4,Years), 3.3813),
        ((5,Years), 3.4688),
        ((7,Years), 3.6175),((10,Years),3.765)] ]
rate_helpers=depo_helper+swap_helpers
curve1=PiecewiseCubicZero(today,rate_helpers,Actual360)
spots = []
tenors = []
for d in curve1.dates():
    yrs=Actual360.yearFraction(today,d)
    compounding=Simple
    freq=Quarterly
    zero_rate=curve1.zeroRate(yrs,compounding,freq)
    tenors.append(yrs)
eq_rate=zero_rate.equivalentRate(Actual360,compounding,freq,today,d).rate()
spots.append(100*eq_rate)
datatable={'Dates':curve1.dates(),'Tenors':tenors,'spots':spots}
df=pd.DataFrame.from_dict((datatable))

But I can not get the result. Can anyone give some help to me? Thanks.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.