我想使用 QuantLib 为负债组合定价,这些负债被建模为确定性的未来现金流量。我现在将它们建模为一条带零息票的 FixedRateBonds,这似乎是一个非常不雅的解决方案。
问题 1:有没有办法创建一个只是“SimpleCashFlow”、“Redemption”等的“工具”并在折扣曲线上对其定价?
问题 2:是否可以从多个 SimpleCashFlow 构建一个“CashFlows”对象或工具并在曲线上对其进行定价?
提前谢谢了
有关我正在尝试执行的操作的示例,请参阅下面的代码。
from QuantLib import *
# set params
calc_date = Date(30, 3, 2017)
risk_free_rate = 0.01
discount_curve = YieldTermStructureHandle(
FlatForward(calc_date, risk_free_rate, ActualActual()))
bond_engine = DiscountingBondEngine(discount_curve)
# characteristics of the cash-flow that I am trying to NPV
paymentdate = Date(30, 3, 2018)
paymentamount = 1000
# this works: pricing a fixed rate bond with no coupons
schedule = Schedule(paymentdate-1, paymentdate, Period(Annual), TARGET(),
Unadjusted, Unadjusted, DateGeneration.Backward, False) …
Run Code Online (Sandbox Code Playgroud)