Royal Wedding Bank Holiday?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Royal Wedding Bank Holiday?

Whit Armstrong
Is there a reason why the 'Royal Wedding Bank Holiday' is not an
Exchange holiday?

http://www.year-planner-calendar.wanadoo.co.uk/2011-public-holidays.htm

https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/time/calendars/unitedkingdom.cpp#L120

I'm generating some historical discount curves for USDLibor swaps, and
I'm getting stuck here:
today: May 2nd, 2011
settlement: May 4th, 2011
fixingDate: April 29th, 2011
terminate called after throwing an instance of 'QuantLib::Error'
  what():  1st iteration: failed at 1st alive instrument, maturity May
4th, 2012, reference date May 4th, 2011: 2nd leg: Missing USDLibor3M
Actual/360 fixing for April 29th, 2011

I realize this could be due to other calendar issues, but QL seems to
be looking for a fixing on 29-April, which both bbg and the website
referenced earlier indicate was a holiday.

(small code to reproduce below)

-Whit


#include <iostream>
#include <vector>
#include <ql/quantlib.hpp>
using namespace QuantLib;

int main() {
    Date todaysDate(2, May, 2011);
    Settings::instance().evaluationDate() = todaysDate;

    Integer fixingDays = 2;
    Calendar usuk_calendar =
JointCalendar(UnitedKingdom(UnitedKingdom::Exchange),

UnitedStates(UnitedStates::Settlement),
                                           JoinHolidays);

    Date settlementDate = usuk_calendar.advance(todaysDate, fixingDays, Days);
    settlementDate = usuk_calendar.adjust(settlementDate);

    Frequency swFixedLegFrequency = Semiannual;
    BusinessDayConvention swFixedLegConvention = ModifiedFollowing;
    DayCounter swFixedLegDayCounter = Thirty360(Thirty360::USA);
    boost::shared_ptr<IborIndex> swFloatingLegIndex(new
USDLibor(Period(3, Months)));
    double tolerance = 1.0e-15;

    Rate s2y = 0.037125;
    boost::shared_ptr<Quote> s2yRate(new SimpleQuote(s2y));
    boost::shared_ptr<SwapRateHelper> helper(new
SwapRateHelper(Handle<Quote>(s2yRate),
                                                                2*Years,
                                                                usuk_calendar,

swFixedLegFrequency,

swFixedLegConvention,

swFixedLegDayCounter,

swFloatingLegIndex));
    std::cout << "today: " << todaysDate << std::endl;
    std::cout << "settlement: " << settlementDate << std::endl;
    std::cout << "fixingDate: " <<
swFloatingLegIndex->fixingDate(settlementDate) << std::endl;

    swFloatingLegIndex->addFixing(Date(28, April, 2011),.273/100);
    std::vector<boost::shared_ptr<RateHelper> > rateHelpers(1);
    rateHelpers[0] = helper;
    PiecewiseYieldCurve<Discount,LogLinear> yc(settlementDate,
rateHelpers,swFixedLegDayCounter,tolerance);
    yc.recalculate();
}

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Royal Wedding Bank Holiday?

Luigi Ballabio
Hi Whit,
    it wasn't an holiday because I didn't know and nobody told me so
far---thanks for the heads-up.
I've added it in the release branch and will be fixed in QuantLib 1.4
(out this month, I hope).

Luigi


On Thu, Feb 6, 2014 at 7:53 PM, Whit Armstrong <[hidden email]> wrote:

> Is there a reason why the 'Royal Wedding Bank Holiday' is not an
> Exchange holiday?
>
> http://www.year-planner-calendar.wanadoo.co.uk/2011-public-holidays.htm
>
> https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/time/calendars/unitedkingdom.cpp#L120
>
> I'm generating some historical discount curves for USDLibor swaps, and
> I'm getting stuck here:
> today: May 2nd, 2011
> settlement: May 4th, 2011
> fixingDate: April 29th, 2011
> terminate called after throwing an instance of 'QuantLib::Error'
>   what():  1st iteration: failed at 1st alive instrument, maturity May
> 4th, 2012, reference date May 4th, 2011: 2nd leg: Missing USDLibor3M
> Actual/360 fixing for April 29th, 2011
>
> I realize this could be due to other calendar issues, but QL seems to
> be looking for a fixing on 29-April, which both bbg and the website
> referenced earlier indicate was a holiday.
>
> (small code to reproduce below)
>
> -Whit
>
>
> #include <iostream>
> #include <vector>
> #include <ql/quantlib.hpp>
> using namespace QuantLib;
>
> int main() {
>     Date todaysDate(2, May, 2011);
>     Settings::instance().evaluationDate() = todaysDate;
>
>     Integer fixingDays = 2;
>     Calendar usuk_calendar =
> JointCalendar(UnitedKingdom(UnitedKingdom::Exchange),
>
> UnitedStates(UnitedStates::Settlement),
>                                            JoinHolidays);
>
>     Date settlementDate = usuk_calendar.advance(todaysDate, fixingDays, Days);
>     settlementDate = usuk_calendar.adjust(settlementDate);
>
>     Frequency swFixedLegFrequency = Semiannual;
>     BusinessDayConvention swFixedLegConvention = ModifiedFollowing;
>     DayCounter swFixedLegDayCounter = Thirty360(Thirty360::USA);
>     boost::shared_ptr<IborIndex> swFloatingLegIndex(new
> USDLibor(Period(3, Months)));
>     double tolerance = 1.0e-15;
>
>     Rate s2y = 0.037125;
>     boost::shared_ptr<Quote> s2yRate(new SimpleQuote(s2y));
>     boost::shared_ptr<SwapRateHelper> helper(new
> SwapRateHelper(Handle<Quote>(s2yRate),
>                                                                 2*Years,
>                                                                 usuk_calendar,
>
> swFixedLegFrequency,
>
> swFixedLegConvention,
>
> swFixedLegDayCounter,
>
> swFloatingLegIndex));
>     std::cout << "today: " << todaysDate << std::endl;
>     std::cout << "settlement: " << settlementDate << std::endl;
>     std::cout << "fixingDate: " <<
> swFloatingLegIndex->fixingDate(settlementDate) << std::endl;
>
>     swFloatingLegIndex->addFixing(Date(28, April, 2011),.273/100);
>     std::vector<boost::shared_ptr<RateHelper> > rateHelpers(1);
>     rateHelpers[0] = helper;
>     PiecewiseYieldCurve<Discount,LogLinear> yc(settlementDate,
> rateHelpers,swFixedLegDayCounter,tolerance);
>     yc.recalculate();
> }
>
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users