|
From: Brian S. <bri...@gm...> - 2023-10-19 13:43:30
|
I used this
EoniaTermStructure = ql.PiecewiseLogCubicDiscount(TodaysDate,
EoniaInstruments, TermStructureDayCounter)
But then I cant use this in SwapRateHelper as discount curve
When I ran the code,
ql.SwapRateHelper(
ql.QuoteHandle(ql.SimpleQuote(0.004240)),
ql.Period( 3, ql.Years),
Calendar,
ql.Annual,
ql.Unadjusted,
ql.Thirty360(ql.Thirty360.European),
ql.Euribor6M(),
ql.QuoteHandle(ql.SimpleQuote(0)),
ql.Period(0, ql.Days),
EoniaTermStructure
)
I get below error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.11/site-packages/QuantLib/QuantLib.py",
line 26589, in __init__
_QuantLib.SwapRateHelper_swiginit(self, _QuantLib.new_SwapRateHelper(*args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Wrong number or type of arguments for overloaded function
'new_SwapRateHelper'.
Possible C/C++ prototypes are:
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const
&,Natural,Pillar::Choice,Date,bool,ext::optional< bool >)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const
&,Natural,Pillar::Choice,Date,bool)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const
&,Natural,Pillar::Choice,Date)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const
&,Natural,Pillar::Choice)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const &,Natural)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &,Handle< YieldTermStructure > const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const
&,Period const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &,Handle< Quote > const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const &,Period
const &,Calendar const &,Frequency,BusinessDayConvention,DayCounter
const &,ext::shared_ptr< IborIndex > const &)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const
&,Natural,Pillar::Choice,Date,bool,ext::optional< bool >)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Natural,Pillar::Choice,Date,bool)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Natural,Pillar::Choice,Date)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Natural,Pillar::Choice)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Natural)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &,Period const &)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &,Handle< Quote > const &)
SwapRateHelper::SwapRateHelper(Rate,Period const &,Calendar const
&,Frequency,BusinessDayConvention,DayCounter const &,ext::shared_ptr<
IborIndex > const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &,Handle< YieldTermStructure > const
&,Pillar::Choice,Date,bool,ext::optional< bool >)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &,Handle< YieldTermStructure > const &,Pillar::Choice,Date,bool)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &,Handle< YieldTermStructure > const &,Pillar::Choice,Date)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &,Handle< YieldTermStructure > const &,Pillar::Choice)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &,Handle< YieldTermStructure > const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &,Period
const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &,Handle< Quote > const &)
SwapRateHelper::SwapRateHelper(Handle< Quote > const
&,ext::shared_ptr< SwapIndex > const &)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Pillar::Choice,Date,bool,ext::optional<
bool >)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Pillar::Choice,Date,bool)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Pillar::Choice,Date)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &,Pillar::Choice)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &,Handle<
YieldTermStructure > const &)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &,Period const &)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex >
const &,Handle< Quote > const &)
SwapRateHelper::SwapRateHelper(Rate,ext::shared_ptr< SwapIndex > const &)
On Thu, 19 Oct 2023 at 18:44, Trent Maetzold <tr...@ma...> wrote:
>
> The docs use PiecewiseYieldCurve as a placeholder for the plethora of actual piecewise constructors. Use ql.PiecewiseLogCubicDiscount and see if that works.
>
> Sent from Proton Mail for iOS
>
>
> On Thu, Oct 19, 2023 at 07:12, Brian Smith <bri...@gm...> wrote:
>
> Hi Luigi,
>
> Thanks for this reference.
>
> However in line number 194 ans onwards, following codes are written
>
> auto eoniaTermStructure =
> ext::make_shared<PiecewiseYieldCurve<Discount, Cubic>>(
> todaysDate, eoniaInstruments, termStructureDayCounter);
>
> eoniaTermStructure->enableExtrapolation();
>
> // This curve will be used for discounting cash flows
> RelinkableHandle<YieldTermStructure> discountingTermStructure;
> discountingTermStructure.linkTo(eoniaTermStructure);
>
> However I wonder how can I implement above code in python?
>
> In https://quantlib-python-docs.readthedocs.io/en/latest/termstructures/yield.html,
> there is one instruction which reads as,
>
> ql.PiecewiseYieldCurve(referenceDate, instruments, dayCounter, jumps,
> jumpDate, i=Interpolator(), bootstrap=bootstrap_type())
>
> However, with this I am getting below error
>
> ql.PiecewiseYieldCurve(todaysDate, eoniaInstruments, termStructureDayCounter)
>
> Traceback (most recent call last):
>
> File "<stdin>", line 1, in <module>
>
> AttributeError: module 'QuantLib' has no attribute 'PiecewiseYieldCurve'
>
> Any workaround will be very helpful.
>
> Thanks for your time.
>
> On Wed, 11 Oct 2023 at 19:21, Luigi Ballabio <lui...@gm...> wrote:
> >
> > To get started, a simpler version is also in the examples:
> >
> > https://github.com/lballabio/QuantLib/blob/master/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp
> >
> > Luigi
> >
> >
> > On Fri, Sep 29, 2023 at 6:57 PM Mike DelMedico <mik...@gm...> wrote:
> >>
> >> Hi there,
> >>
> >> I started here to get familiar with everything in the library:
> >>
> >> https://leanpub.com/quantlibpythoncookbook/
> >>
> >> Note that if you want to make the stairstepped front end of the curve you will have to do some tricks with zero coupon rate helpers, but it’s not crazy complicated once you get the ball rolling. There might be a more efficient way to do it but that would be best answered by someone else that knows the library better.
> >>
> >> Another helpful source for the front end would be this:
> >>
> >> https://www.cmegroup.com/market-data/files/cme-term-sofr-reference-rates-benchmark-methodology.pdf
> >>
> >> Hope that helps.
> >>
> >> -Mike
> >>
> >>
> >>
> >> On Fri, Sep 29, 2023 at 11:35 Brian Smith <bri...@gm...> wrote:
> >>>
> >>> Hi,
> >>>
> >>> Appreciate, if someone can provide some insight on below request.
> >>>
> >>> Thanks and regards,
> >>>
> >>> On Thu, 28 Sept 2023 at 01:51, Brian Smith <bri...@gm...> wrote:
> >>> >
> >>> > Hi,
> >>> >
> >>> > I am looking for some work-out examples on construction of SOFT curve
> >>> > given various market instruments (mostly OIS) either with Python or
> >>> > C++
> >>> >
> >>> > Could you please point some useful sources on construction of SOFR
> >>> > curve using QL?
> >>> >
> >>> > Many thanks for your time.
> >>>
> >>>
> >>> _______________________________________________
> >>> QuantLib-users mailing list
> >>> Qua...@li...
> >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
> >>
> >> _______________________________________________
> >> QuantLib-users mailing list
> >> Qua...@li...
> >> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
|