0
我在嘗試計算普通香草國稅局固定腿的現金流量。不知怎的,我receibing以下錯誤消息,不知道是哪裏的問題:在Quantlib中計算現金流固定腿普通香草IRS
TypeError: in method 'FixedRateLeg', argument 3 of type 'std::vector< Real,std::allocator< Real > > const &'
的代碼如下所示:
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())
嗨路易吉,非常感謝您的快速回答!不知何故,我錯過了它被定義爲矢量。 – MCM
嗨路易吉,很抱歉再次問,但我怎樣才能得到現金流的現值?從swapengine清除npv,但我怎樣才能獲得pv? – MCM
優惠券可以給你他們的金額,但他們沒有折扣信息。您可以改爲使用「CashFlows」類的方法。 –