我正在尝试使用ubuntu13.04中的quantlib (1.2)来学习quantlib (1.3) & python绑定。作为第一步,我试图确定一个非常简单的债券的付款日期,如下所示,使用30/360欧洲日柜台
from QuantLib import *
faceValue = 100.0
doi = Date(31, August, 2000)
dom = Date(31, August, 2008)
coupons = [0.05]
dayCounter = Thirty360(Thirty360.European)
schedule = Schedule(doi, dom, Period(Semiannual),
India(),
Unadjusted, Unadjusted,
DateGeneration.Backward, False)以下是我的问题:
什么方法的时间表对象将给我付款日期?
我需要在哪里指定dayCounter对象,以便适当地计算日期?
使用Dimitri的演示文稿,我试着模仿C++代码,但是schedule.dates()返回错误作为没有这样的方法。
这种固定利率债券的付款日期是(使用oocalc)。
2001年2月28日;2001年8月31日
2002年2月28日;2002年8月31日
2003年2月28日;2003年8月31日
2004年2月29日;2004年8月31日
2005年2月28日;2005年8月31日
2006年2月28日;2006年8月31日
2007年2月28日;2007年8月31日
2008年2月29日;2008年8月31日
如何使用python & quantlib获得这种简单债券的付款日期?有人能帮忙吗?
问候
K
发布于 2014-01-15 13:37:50
如果您想查看刚才生成的计划,可以迭代它:
>>> for d in schedule: print d
...
August 31st, 2000
February 28th, 2001
August 31st, 2001
February 28th, 2002
August 31st, 2002
February 28th, 2003
August 31st, 2003
February 29th, 2004
August 31st, 2004
February 28th, 2005
August 31st, 2005
February 28th, 2006
August 31st, 2006
February 28th, 2007
August 31st, 2007
February 29th, 2008
August 31st, 2008或者打电话给list(schedule),如果你想存储它们的话。但是,你确定那是付款日期吗?它们是权责发生制计算的开始和结束日期;但其中一些日期是在周六或周日,债券将在下一个营业日支付。如果实例化键并检索优惠券,您可以看到效果:
>>> settlement_days = 3
>>> bond = FixedRateBond(settlement_days, faceValue, schedule, coupons, dayCounter)
>>> for c in bond.cashflows():
... print c.date()
...
February 28th, 2001
August 31st, 2001
February 28th, 2002
September 2nd, 2002
February 28th, 2003
September 1st, 2003
March 1st, 2004
August 31st, 2004
February 28th, 2005
August 31st, 2005
February 28th, 2006
August 31st, 2006
February 28th, 2007
August 31st, 2007
February 29th, 2008
September 1st, 2008
September 1st, 2008(也就是说,除非星期六和星期天不应该是印度历法的假日。如果您认为它们不应该,请使用QuantLib提交一个错误报告)。
https://stackoverflow.com/questions/21111986
复制相似问题