Re: addFixings example needed

Posted by Christian Bøhlke on
URL: http://quantlib.414.s1.nabble.com/addFixings-example-needed-tp6083p6087.html

Thanks everybody for the fast help!

It turned out that the figures I benchmarked against were wrong. Did som ad hoc calculations that convinced me on that. Now I am able to get figures from QuantLib, that are at least in the same ballpark as the (corrected) figures I want to replicate.

Best,

Christian

On Thu, Oct 20, 2011 at 6:09 PM, Luigi Ballabio <[hidden email]> wrote:

Does Bloomberg provide some cash-flow analysis?  In QuantLib, you can
extract the legs from the swap and ask each cashflow for its date and
amount (not discounted, mind you).  You might start checking that you
don't have big differences there.

Luigi



On Thu, <a href="tel:2011-10-20" value="+4520111020">2011-10-20 at 17:41 +0200, Christian Bøhlke wrote:
> Thanks Luigi, it works!
>
> My approach in pricing the swaps is as follows:
>       * Pull Euro-swap quotes from Bloomberg and build a Euroswap
>         curve using QLs Bootstrap+Cubic Spline curvebuilding
>         functionality
>       * Create a swap, for example
>               * Issue date: 1/4/2008
>               * Maturity date: 12/9/2034
>               * Nominal: 16,825,000 EUR
>               * Swap type: Fixed 4.415% against Euribor 6M ACT/360
>       * Set  Settings::instance().evaluationDate() to 10/19/2011
>       * Set discountingTermStructure.linkTo to the estimated
>         termstructure
>       * Set the Missing Euribor6M Actual/360 fixing for June 30th,
>         2011 to 1.788% using the .addFixing method
>       * Price the swap using the associated functions
>               * .NPV()
>               * .fixedLegNPV()
>               * .floatingLegNPV()
>
> My problem is that I get NPVs that are way off.
>
> I get
>
> NPV           | fixedNPV       | floatingNPV
> -------------------------------------------------------------
> 5,426,635.41 | 13,476,292.14  | -8,049,656.74
>
> where I would expect something like
>
> NPV           | fixedNPV       | floatingNPV
> -------------------------------------------------------------
> 4,624,679   | 21,463,334     | -16.838.654
>
>
> Can someone help me on what I am conceptually doing wrong?
>
> Thanks in advance,
>
> Christian Bohlke
>
>
>
> On Thu, Oct 20, 2011 at 4:06 PM, Luigi Ballabio
> <[hidden email]> wrote:
>
>
>         You can use the begin() and end() methods to extract iterators
>         from C++
>         containers such as std::vector.
>
>         vector<Date> dates;
>         vector<Real> fixings;
>
>         ... (fill the vectors)
>
>         index.addFixings(dates.begin(), dates.end(), fixings.begin());
>
>
>         Regards,
>                Luigi
>
>
>
>         On Thu, <a href="tel:2011-10-20" value="+4520111020">2011-10-20 at 15:50 +0200, Christian Bøhlke wrote:
>         > Hi
>         >
>         > I am trying to implement the
>         > swapexample included in
>         > the quantlib library on some "real"
>         > data.
>         >
>         > I can figure out how to manually
>         > add a fixing day to an index via
>         > addFixing. However, due to
>         > my limited knowledge of templated
>         > classes, I can not deduce how to
>         > approach the addFixings method.
>         >
>         > That is using template<class
>         > DateIterator, class ValueIterator>
>         > on the method
>         >
>         > void
>         > addFixings (DateIterator dBegin,
>         > DateIterator dEnd, ValueIterator
>         > vBegin)
>         >
>         > If someone could provide an example on how to approach the
>         addFixings
>         > method I would be very happy.
>         >
>         > Thanks in advance,
>         >
>         > Christian Bohlke
>
>         >
>         ------------------------------------------------------------------------------
>         > The demand for IT networking professionals continues to
>         grow, and the
>         > demand for specialized networking skills is growing even
>         more rapidly.
>         > Take a complimentary Learning@Ciosco Self-Assessment and
>         learn
>         > about Cisco certifications, training, and career
>         opportunities.
>         > http://p.sf.net/sfu/cisco-dev2dev
>         > _______________________________________________
>         QuantLib-users mailing list
>         [hidden email]
>         https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
>         --
>
>         It is better to know some of the questions than all of the
>         answers.
>         -- James Thurber
>
>
>

--

A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects.
-- Robert A. Heinlein




------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users