Schedule Class constructors

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

Schedule Class constructors

Ramon Lozano
Hi,

     I am initializing a Schedule class using the following contructor:

    Schedule::Schedule(const std::vector<Date>& dates,
                       const Calendar& calendar,
                       BusinessDayConvention convention)
    : fullInterface_(false),
      tenor_(Period()), calendar_(calendar),
      convention_(convention),
      terminationDateConvention_(convention),
      rule_(DateGeneration::Forward), endOfMonth_(false),
      finalIsRegular_(true),
      dates_(dates) {}

However, when I pass it to the constructor of a VanillaSwap, i get the following exception: "full interface not available"

I notice that in the Schedule constructor above, fullInterface is set to false while in the other available Schedule constructor, fullInterface is set to true.
In the Schedule::isRegular(Size i) function, code below, I notice that there is an assert checking if fullInterface is true/false.

 bool Schedule::isRegular(Size i) const {
        QL_REQUIRE(fullInterface_, "full interface not available");
        QL_REQUIRE(i<=isRegular_.size() && i>0,
                   "index (" << i << ") must be in [1, " <<
                   isRegular_.size() <<"]");
        return isRegular_[i-1];
    }

My question is, is there a reason why fullInterface is set to false in one of the Schedule constructors?

thanks
ramon




------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Schedule Class constructors

Luigi Ballabio

Ramon,
        it was probably a mistake to leave that constructor here.  It was a way
to instantiate a schedule from a vector of dates, but the resulting
Schedule object doesn't have information such as frequency or
date-generation rule.  If you can use the other constructor, do it.
Otherwise, you try adding the other parameters (frequency, rule,
endOfMonth, possibly an isRegular vector) to the constructor you're
using so that you can fill all the data members; at which point, it can
set the boolean to true.  If you do that, send me a patch and I'll add
it to next version.

Thanks,
        Luigi



On Sat, 2011-09-17 at 21:32 +0800, Ramon Lozano wrote:

>      I am initializing a Schedule class using the following
> contructor:
>
>     Schedule::Schedule(const std::vector<Date>& dates,
>                        const Calendar& calendar,
>                        BusinessDayConvention convention)
>     : fullInterface_(false),
>       tenor_(Period()), calendar_(calendar),
>       convention_(convention),
>       terminationDateConvention_(convention),
>       rule_(DateGeneration::Forward), endOfMonth_(false),
>       finalIsRegular_(true),
>       dates_(dates) {}
>
> However, when I pass it to the constructor of a VanillaSwap, i get the
> following exception: "full interface not available"
>
> I notice that in the Schedule constructor above, fullInterface is set
> to false while in the other available Schedule constructor,
> fullInterface is set to true.
> In the Schedule::isRegular(Size i) function, code below, I notice that
> there is an assert checking if fullInterface is true/false.
>
>  bool Schedule::isRegular(Size i) const {
>         QL_REQUIRE(fullInterface_, "full interface not available");
>         QL_REQUIRE(i<=isRegular_.size() && i>0,
>                    "index (" << i << ") must be in [1, " <<
>                    isRegular_.size() <<"]");
>         return isRegular_[i-1];
>     }
>
> My question is, is there a reason why fullInterface is set to false in
> one of the Schedule constructors?
>
> thanks
> ramon
>
>
>
> ------------------------------------------------------------------------------
> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> http://p.sf.net/sfu/rim-devcon-copy2
> _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users

--

This gubblick contains many nonsklarkish English flutzpahs, but the
overall pluggandisp can be glorked from context.
-- David Moser



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users