1
$\begingroup$

I'm new to quantlib. I am trying to construct a PiecewiseYieldCurve. I been looking at the implementation of FRA. It seems that the start date of the FRA must be an integer number of month from the valuation date. How do I implement an FRA with a start date that is shifted.

For example,

Valuation date: Jan 9, 2012

Start date of the first 3m FRA: Mar 19, 2012

Rate of the first 3m FRA: 0.01

Thanks

$\endgroup$
  • $\begingroup$ I don't think FRA must be an integer number of months from the valuation date. Are you sure you looked the code correctly? $\endgroup$ – SmallChess Jul 23 '15 at 1:25
  • $\begingroup$ The constructor for FraRateHelper's monthsToStart parameter are all integers. $\endgroup$ – user2770287 Jul 23 '15 at 13:25
2
$\begingroup$

FRARateHelper takes a number of constructors. You should take a look at the ones that take Period.

The definition for Period is:

class Period {
  public:
    Period()
    : length_(0), units_(Days) {}
    Period(Integer n, TimeUnit units)
    : length_(n), units_(units) {}
    explicit Period(Frequency f);
    Integer length() const { return length_; }
    TimeUnit units() const { return units_; }
    Frequency frequency() const;
    Period& operator+=(const Period&);
    Period& operator-=(const Period&);
    Period& operator/=(Integer);
    void normalize();
  private:
    Integer length_;
    TimeUnit units_;
};

Period encapsulates a time-frame, the frame can be specified by Days. In your example, you might want to do something like:

int days = Actual360(Mar 19, 2012 - Jan 9, 2012)
Period p = Period(days, Days)
FRARateHelper(0.01, p, ...)

The pseudo-code should give you enough information to complete your code. You'd decide a day-counting convention, and use it to count number of days, then use the Period class to start FRARateHelper.

$\endgroup$
  • $\begingroup$ I forgot to mention that I'm using the C# version instead of C++ and that feature isn't implemented in C#. So I implemented it myself. $\endgroup$ – user2770287 Jul 24 '15 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.