def lsqQ(para):
    ois = OIS(trim_start = startdate, trim_end = enddate)
    Affine = VasicekAffine(x, para, datelist)
    myCDS = CDS(ois.interpolationois(), datelist, Affine.calQ(), recovery)
    diff = np.subtract(brz_cds,myCDS.MTM())
    return diff
def lsqR(para):
    ois = OIS(trim_start = startdate, trim_end = enddate)
    Affine = VasicekAffine(x, para, datelist)
    diff = np.subtract(ois.interpolationois(),Affine.calR())
    return diff
示例#3
0
def lsqR(para):
    ois = OIS(trim_start = startdate, trim_end = enddate)
    Affine = VasicekAffine(x, para, datelist)
    diff = np.subtract(ois.interpolationois(),Affine.calR())
    return diff
示例#4
0
def lsqQ(para):
    ois = OIS(trim_start = startdate, trim_end = enddate)
    Affine = VasicekAffine(x, para, datelist)
    myCDS = CDS(ois.interpolationois(), datelist, Affine.calQ(), recovery)
    diff = np.subtract(brz_cds,myCDS.MTM())
示例#5
0
# for i in a:
#     print(i)
# print(a)
start = datetime.datetime(2005, 1, 10)
end = datetime.datetime(2010, 1, 10)
test_current_day = datetime.datetime(2009, 3, 5)
test_end_day = datetime.datetime(2037, 9, 10)
start_temp = start
end_temp = start_temp + relativedelta(years=30)
trim_start = "2005-01-10"
trim_end = "2010-01-10"
#a=Quandl.get("USTREASURY/YIELD", authtoken="Lqsxas8ieaKqpztgYHxk", trim_start=trim_start, trim_end=trim_end)
#print(a)

testois = OIS()
print('discounted factor', testois.interpolationois())

a = testois.get_OIS_daily(test_current_day, test_end_day)
#print(a)

#test single:24+i to 28+i
# a=testois.interpolationois()
# ndays=(end_temp-start_temp).days
# d_series=np.arange(0,ndays,1)
# plt.plot(d_series,a)
# plt.show()
# a=(end-start).days
# t=[]
# t=np.arange(0,a,1)
# ndate=[29,89,179,364,729,1094,1824,2554,3649,7329,10949]
# print(t)