繁体   English   中英

在Quantlib中计算固定腿普通香草IRS的现金流

[英]Calculate Cashflow Fixed Leg Plain Vanilla IRS in Quantlib

我正在尝试计算普通香草IRS固定支路的现金流量。 我不知何故收到以下错误消息,并且不知道问题出在哪里:

TypeError:在“ FixedRateLeg”方法中,类型为“ std :: vector <实数,std :: allocator <实>> const&”的参数3

该代码如下所示:

import QuantLib as ql

today = ql.Date(15, ql.December, 2015)
ql.Settings.instance().evaluationDate = today

#Input parameters
effective_date = ql.Date(1, ql.January, 2016)
termination_date = ql.Date(10, ql.January, 2018)
tenor_fixed = ql.Period(6, ql.Months)
calendar = ql.TARGET()
business_convention = ql.Following
termination_business_convention = ql.Following
date_generation = ql.DateGeneration.Forward
end_of_month = False
Notional = 10000.0
day_count_conv_fixed = ql.Thirty360()
Fixed_Rate = 0.02
Spread_On_Interest_Rate = 0.0

#Fixed Rate
fixed_schedule = ql.Schedule(effective_date, termination_date,
                          tenor_fixed, calendar, business_convention, termination_business_convention,
                          date_generation, end_of_month)

cfs= ql.FixedRateLeg(fixed_schedule,ql.Thirty360(),Notional,Fixed_Rate)
for c in cfs:
    print(c.date(), c.amount())

FixedRateLeg允许为不同的优惠券传递不同的名义,因此它采用名义的向量(Python中的列表),而不是一个向量。 通过[Notional]代替Notional将有效; 如果列表短于优惠券的数量,则列表中的最后一个概念将用于其余所有概念。 费率也是如此; 您必须通过[Fixed_Rate]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM