简体   繁体   English

使用Quantlib Python进行引导

[英]Bootstrapping using Quantlib Python

I want to bootstrap a yield curve in Python using QuantLib library. 我想使用QuantLib库在Python中引导产量曲线。 I know that when doing bootstrapping using C++, there is a function for bootstrapping called PiecewiseYieldCurve in QuantLiab, but when I am using Python, there is no such function in Python QuantLib. 我知道使用C ++进行引导时,在QuantLiab中有一个名为PiecewiseYieldCurve的引导功能,但是当我使用Python时,Python QuantLib中没有这样的功能。 I wonder that if in Python QuantLib there is an alias of PiecewiseYieldCurve, so I have to call the alias function name in order to use PiecewiseYieldCurve function 我想知道是否在Python QuantLib中有一个PiecewiseYieldCurve的别名,所以我必须调用别名函数名称才能使用PiecewiseYieldCurve函数

Should I creating my own function to bootstrap the yield curve? 我是否应该创建自己的函数来引导收益曲线?

Thanks! 谢谢!

PiecewiseYieldCurve is a class template, so it can't be exported to Python as such. PiecewiseYieldCurve是一个类模板,因此不能这样导出到Python。 By default, we're exporting to Python a particular instantiation of it; 默认情况下,我们正在将特定的实例导出到Python。 it's exported as PiecewiseFlatForward and it correspond to PiecewiseYieldCurve<ForwardRate,BackwardFlat> . 它导出为PiecewiseFlatForward ,并且对应于PiecewiseYieldCurve<ForwardRate,BackwardFlat>

If you need another instantiation, you can edit QuantLib-SWIG/SWIG/piecewiseyieldcurve.i , add it (it you look at the end of the file, you'll find a few examples of how to do it) and regenerate and recompile the Python wrappers. 如果需要其他实例化,则可以编辑QuantLib-SWIG/SWIG/piecewiseyieldcurve.i ,将其添加(查看文件末尾,您会找到一些方法的示例),然后重新生成并重新编译Python包装器。

Finally, an example of bootstrap is available in QuantLib-SWIG/Python/examples/swap.py . 最后,在QuantLib-SWIG/Python/examples/swap.py提供了一个引导QuantLib-SWIG/Python/examples/swap.py

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

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