Hi,
I have an LIBOR index that is linked to a flat forward-curve. Although this is unrealistic, I just want it to test QuantLib's implementation. My fixed rate is 0.10, so I expect if I put a breakpoint inside QuantLib, I would see it. However, the rate I get is 0.100459737, please take a look at my screenshot. My suspicion is that QuantLib calculates the forward rate by dividing two discount factors in IborIndex::forecastFixing, and thus causing some floating errors. Am I right? My code and screenshot are here: RelinkableHandle<YieldTermStructure> termStructure; termStructure.linkTo(flatRate(t_, 0.10, Actual360())); <Create a swap>
std::cout << swap->NPV() << std::endl; ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hello, the discrepancy seems rather large to be due to a floating-point error. It might be due to a day-count mismatch, or some other convention instead. What is the underlying index, and what are the coupon dates for the case above? Luigi On Tue, Apr 12, 2016 at 4:54 PM Ted Wong <[hidden email]> wrote:
------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Luigi, I don't know what exactly causing it. I've attached the full-source code. On Wed, Apr 13, 2016 at 1:36 AM, Luigi Ballabio <[hidden email]> wrote:
------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users test.cpp (2K) Download Attachment |
Ok, I see. It's conventions. When you instantiate the flat curve, the 10% rate you're passing is assumed by default to be continuously compounded. The Libor fixing, instead, is simply compounded. The discrepancy you see comes from the different compounding. For instance, for the fixing at August 10, 2015: accounting for holidays and weekends, the start and end dates for the underlying deposit are August 12 and September 14, and the corresponding accrual time is T = 0.09166667 for the act/360 day counter. According to the curve, the compound factor over that period is exp(0.10*T), while for the Libor rate R the compound factor is (1 + R*T). Equating the two factors, you get R = 0.1004. The problem is that there's currently no way to get the curve you actually want. You could instantiate a FlatForward with the Simple convention, but that won't work either: it will calculate the compound factor as the ratio of two discounts, so it would be (1+r*T2)/(1+r*T1) and not (1+r*(T2-T1)). To get a constant Euribor rate, you'd need to derive a new term structure class, which might not be worth the effort. Hope this helps, Luigi On Tue, Apr 12, 2016 at 5:40 PM Ted Wong <[hidden email]> wrote:
------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |