Posted by
Peter Caspers-4 on
URL: http://quantlib.414.s1.nabble.com/Changing-Second-Third-Fixing-on-Vanilla-Swap-tp15890p15891.html
Hi Khalid,
the InterestRateIndex class never takes fixings for future dates (i.e.
dates bigger than the evaluation date set in the settings) into
account. In derived classes like IborIndex or SwapIndex they are
estimated on a curve you can attach to the index, so if you want to
compute scenarios where future fixings are shifted, you probably have
to do appropriate shifts on the curve.
The evaluation date itself plays a special role (since fixings are
usually available only after a certain time of the day). With the
setting enforceTodaysHistoricFixing you can require that on the
evaluation date a fixing must be used, and if this is not available,
an exception is thrown. This is for example useful if you have an end
of day processing where you know that the fixing should be available.
The default value is false though, allowing to take a fixing into
account if available and otherwise estimate it on a curve.
Finally the forecastFixing method in InterestRateIndex has a flag
forecastTodaysFixing (defaulted to false) which if true enforces
estimation on a curve even if the fixing is available. This is for
example useful if you don't want to nail today's fixing during
sensitivities calculation.
Peter
On 20 September 2014 05:52, KK <
[hidden email]> wrote:
> This code example from:
>
>
https://github.com/alexpoly/quant-snippets-python-c/blob/master/amortizing%20swap%20valuation%20quantlib.py>
>
> from QuantLib import *
> import numpy as np
> from math import *
>
> todaysDate=Date(31,12,2013)
> startDate=todaysDate
> Settings.instance().evaluationDate=todaysDate;
> crvToday=FlatForward(todaysDate,0.0121,Actual365Fixed())
> forecastTermStructure = RelinkableYieldTermStructureHandle()
> index = GBPLibor(Period("6m"),forecastTermStructure)
> maturity = Date(31,12,2018);
> schedule = Schedule(startDate,
> maturity,Period("6m"),UnitedKingdom(),ModifiedFollowing,ModifiedFollowing,DateGeneration.Forward,
> False)
> nominals=[100.0]*10
> couponRates=[0.05]*10
> floatingleg=IborLeg(nominals,schedule,index,Actual365Fixed())
> fixedleg=FixedRateLeg(schedule,Actual365Fixed(),nominals,couponRates)
>
> index.addFixing(index.fixingDate(schedule[0]),0.01)
> #index.addFixing(index.fixingDate(schedule[1]),0.01)
>
> swap1=Swap(floatingleg,fixedleg)
> discountTermStructure = RelinkableYieldTermStructureHandle()
> swapEngine = DiscountingSwapEngine(discountTermStructure)
> swap1.setPricingEngine(swapEngine)
> discountTermStructure.linkTo(crvToday)
> forecastTermStructure.linkTo(crvToday)
> for x in floatingleg:
> print x.date(), x.amount()
>
>
> can show the floating cashflows on a vanilla swap. By including the line:
>
> index.addFixing(index.fixingDate(schedule[0]),0.01)
>
> I can change the first fixing to 1%
>
> How can I *also *change the second fixing to 1.5%?
>
> index.addFixing(index.fixingDate(schedule[1]),0.015)
>
> has no effect.
>
> Thanks
>
>
>
>
> --
> View this message in context:
http://quantlib.10058.n7.nabble.com/Changing-Second-Third-Fixing-on-Vanilla-Swap-tp15890.html> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Slashdot TV. Video for Nerds. Stuff that Matters.
>
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk> _______________________________________________
> QuantLib-users mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-users------------------------------------------------------------------------------
Slashdot TV. Video for Nerds. Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users