C ++ Quantlib Vanilla Swap:设置将来的修复日期和浮动腿的齿轮 [英] C++ Quantlib Vanilla Swap: setting future fixing dates and gearing for floating leg

查看:124
本文介绍了C ++ Quantlib Vanilla Swap:设置将来的修复日期和浮动腿的齿轮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户是否可以在Quantlib中更改浮动支腿的未来固定日期和资产负债率?

Is it possible for user to change the future fixing dates and gearing of the floating leg in Quantlib?

首先,当Quantlib计算浮动腿的NPV时,它将进入couponpricer.hpp来调用内联函数BlackIborCouponPricer::swapletPrice().在此函数内部,有一个名为gearing_的参数.在我的情况下,此参数会自动设置为1.如果需要将其更改为其他值,例如0.8,在哪里进行更改?

First, when Quantlib calculate the NPV for floating leg, it will go into couponpricer.hpp to call inline function BlackIborCouponPricer::swapletPrice(). Inside this function, there is a parameter called gearing_. This parameter is automatically setting to 1 in my case. If I need to change this to other value, say 0.8, where shall I make this change?

第二,我将来的所有固定日期都与浮动腿计划中生成的日期向量相同.即固定日期与应计期开始日期相同.是否可以将这些固定日期更改为与应计期开始日期不同的时间,例如,应经过正常工作日惯例调整的应计开始日期之前的2个工作日?另外,是否可以传递日期向量来存储这些固定日期?

Second, all my future fixing dates are the same as the date vector generated in floating leg schedule. i.e. fixing dates are the same as accrual period starting dates. Is it possible to change these fixing dates to be different from the accrual period starting dates, say 2 business days before accrual starting dates subject to normal business day convention adjustment? Alternatively, is it possible for me to pass a date vector to store these fixing dates?

非常感谢.

推荐答案

VanillaSwap并不把齿轮作为构造函数的参数(我想这个想法是为了保持简单).相反,您可以使用FixedLegIborLeg类分别创建固定支脚和浮动支脚,并将它们传递给Swap实例.您可以在test-suite/swap.cpp文件的SwapTest::testInArrears()中看到一个示例.

VanillaSwap doesn't take gearings as a constructor argument (I guess the idea was to keep it simple). Instead, you can create the fixed and floating legs separately using the FixedLeg and IborLeg classes and pass them to a Swap instance. You can see an example of that in SwapTest::testInArrears(), in the test-suite/swap.cpp file.

关于固定日期:构建要传递给IborLegIborIndex实例时,可以将多个固定日期传递给其构造函数.但是,如果您使用的是可用的索引,例如EuriborUSDLibor,它们已经使用了2个工作日(以及正确的日历和工作日惯例).

As for the fixing dates: when you build the IborIndex instance to be passed to IborLeg, you can pass a number of fixing days to its constructor. If you're using the available indexes such as Euribor or USDLibor, though, they already use 2 fixing days (as well as the correct calendar and business-day convention).

这篇关于C ++ Quantlib Vanilla Swap:设置将来的修复日期和浮动腿的齿轮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆