[QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

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

[QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)

Sending again in hopes it was simply forgotten…

 

Thanks,

Dale Smith, Ph.D.

Senior Financial Quantitative Analyst

Risk & Compliance

Fiserv.

107 Technology Park

Norcross, GA 30092

Office: 678-375-5315

Mobile: 678-982-6599

Mail: [hidden email]

www.fiserv.com

 

From: Smith, Dale
Sent: Thursday, March 29, 2012 10:43 AM
To: [hidden email]
Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

 

Hello,

 

I’m trying to tie out a QuantLib program with Bloomberg’s SWPM screen. I have the deposit, futures, and swap rates as in the Swap example project, and created an IborIndex using the joint UK and US calendars to pick up both sets of holidays.

 

boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure));

 

forecastingTermStructure is linked to

 

        boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(

            //new PiecewiseYieldCurve<Discount, Linear>(

                     new PiecewiseYieldCurve<ZeroYield, Linear>(

                                       settlementDate, depoFutSwapInstruments,

                                       termStructureDayCounter,

                                       tolerance));

 

My problem is the fixings used in the floating leg that Bloomberg uses are not the same as what QuantLib uses. I did do a clearFixing() on the IborIndex object and added the fixings I see on the SWPM Resets tab. I’ve also confirmed by calculations in Excel that the difference in cashflows on the floating leg is due entirely to the fixings.

 

Bloomberg uses Piecewise Linear (Simple) for the interpolation. I changed that to Piecewise Linear (Continuous) but the fixings still don’t match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear> in my own code after confirming with Bloomberg they are interpolating the term structure, not the discount factors or the market rates.

 

I’ve used Google to search for answers to this, and looked at the examples and unit tests in the QuantLib code. Is there anywhere I’ve missed in my searches?

 

Thanks,

Dale Smith, Ph.D.

Senior Financial Quantitative Analyst

Risk & Compliance

Fiserv.

107 Technology Park

Norcross, GA 30092

Office: 678-375-5315

Mobile: 678-982-6599

Mail: [hidden email]

www.fiserv.com

 


------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Luigi Ballabio
Sorry, I had saved your post but I didn't have time to follow through.
Do you have a set of inputs that reproduces the problem? (Evaluation
date, input rates, conventions you're using...)

Luigi


On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:

> Sending again in hopes it was simply forgotten…
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
> From: Smith, Dale
> Sent: Thursday, March 29, 2012 10:43 AM
> To: [hidden email]
> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>
>
>
> Hello,
>
>
>
> I’m trying to tie out a QuantLib program with Bloomberg’s SWPM screen. I
> have the deposit, futures, and swap rates as in the Swap example project,
> and created an IborIndex using the joint UK and US calendars to pick up both
> sets of holidays.
>
>
>
> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
> forecastingTermStructure));
>
>
>
> forecastingTermStructure is linked to
>
>
>
>         boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
>
>             //new PiecewiseYieldCurve<Discount, Linear>(
>
>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>
>                                        settlementDate,
> depoFutSwapInstruments,
>
>                                        termStructureDayCounter,
>
>                                        tolerance));
>
>
>
> My problem is the fixings used in the floating leg that Bloomberg uses are
> not the same as what QuantLib uses. I did do a clearFixing() on the
> IborIndex object and added the fixings I see on the SWPM Resets tab. I’ve
> also confirmed by calculations in Excel that the difference in cashflows on
> the floating leg is due entirely to the fixings.
>
>
>
> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I changed
> that to Piecewise Linear (Continuous) but the fixings still don’t match. I
> also changed to PiecewiseYieldCurve<ZeroYield, Linear> in my own code after
> confirming with Bloomberg they are interpolating the term structure, not the
> discount factors or the market rates.
>
>
>
> I’ve used Google to search for answers to this, and looked at the examples
> and unit tests in the QuantLib code. Is there anywhere I’ve missed in my
> searches?
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
>
> ------------------------------------------------------------------------------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)
Thanks for responding.

I can put this together for you tomorrow my time.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 4:16 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Sorry, I had saved your post but I didn't have time to follow through.
Do you have a set of inputs that reproduces the problem? (Evaluation date, input rates, conventions you're using...)

Luigi


On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:

> Sending again in hopes it was simply forgotten...
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
> From: Smith, Dale
> Sent: Thursday, March 29, 2012 10:43 AM
> To: [hidden email]
> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>
>
>
> Hello,
>
>
>
> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
> I have the deposit, futures, and swap rates as in the Swap example
> project, and created an IborIndex using the joint UK and US calendars
> to pick up both sets of holidays.
>
>
>
> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
> forecastingTermStructure));
>
>
>
> forecastingTermStructure is linked to
>
>
>
>         boost::shared_ptr<YieldTermStructure>
> depoFutSwapTermStructure(
>
>             //new PiecewiseYieldCurve<Discount, Linear>(
>
>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>
>                                        settlementDate,
> depoFutSwapInstruments,
>
>                                        termStructureDayCounter,
>
>                                        tolerance));
>
>
>
> My problem is the fixings used in the floating leg that Bloomberg uses
> are not the same as what QuantLib uses. I did do a clearFixing() on
> the IborIndex object and added the fixings I see on the SWPM Resets
> tab. I've also confirmed by calculations in Excel that the difference
> in cashflows on the floating leg is due entirely to the fixings.
>
>
>
> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
> changed that to Piecewise Linear (Continuous) but the fixings still
> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
> in my own code after confirming with Bloomberg they are interpolating
> the term structure, not the discount factors or the market rates.
>
>
>
> I've used Google to search for answers to this, and looked at the
> examples and unit tests in the QuantLib code. Is there anywhere I've
> missed in my searches?
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
>
> ----------------------------------------------------------------------
> --------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure 
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Luigi Ballabio
Ok, thanks.  I probably won't be able to follow through this week
(I'll be on vacation starting Wednesday) but hopefully someone can
pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg uses
>> are not the same as what QuantLib uses. I did do a clearFixing() on
>> the IborIndex object and added the fixings I see on the SWPM Resets
>> tab. I've also confirmed by calculations in Excel that the difference
>> in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ----------------------------------------------------------------------
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)
In reply to this post by Luigi Ballabio
Below is the code, ready to compile. I'm using VS 2010 and QuantLib 1.1. I also tried 1.2 with the same results.

/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */

/*!
 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
 Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl
 Copyright (C) 2004 Ferdinando Ametrano

 This file is part of QuantLib, a free-software/open-source library
 for financial quantitative analysts and developers - http://quantlib.org/

 QuantLib is free software: you can redistribute it and/or modify it
 under the terms of the QuantLib license.  You should have received a
 copy of the license along with this program; if not, please email
 <[hidden email]>. The license is also available online at
 <http://quantlib.org/license.shtml>.

 This program is distributed in the hope that it will be useful, but WITHOUT
 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 FOR A PARTICULAR PURPOSE.  See the license for more details.
*/

/*  This example shows how to set up a Term Structure and then price a simple
    swap.
*/

// the only header you need to use QuantLib
#include <ql/quantlib.hpp>

#include <ql/termstructures/yield/piecewiseyieldcurve.hpp>

#ifdef BOOST_MSVC
/* Uncomment the following lines to unmask floating-point
   exceptions. Warning: unpredictable results can arise...

   See http://www.wilmott.com/messageview.cfm?catid=10&threadid=9481
   Is there anyone with a definitive word about this?
*/
// #include <float.h>
// namespace { unsigned int u = _controlfp(_EM_INEXACT, _MCW_EM); }
#endif

#include <boost/timer.hpp>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>

using namespace QuantLib;
using namespace std;

#if defined(QL_ENABLE_SESSIONS)
namespace QuantLib {

    Integer sessionId() { return 0; }

}
#endif


int main(int, char* []) {

    try {

        boost::timer timer;
        std::cout << std::endl;

        /*********************
         ***  MARKET DATA  ***
         *********************/
                // http://comments.gmane.org/gmane.comp.finance.quantlib.user/6922
                //Calendar calendar = UnitedStates();
                JointCalendar usdgbpCalendar = JointCalendar(UnitedStates(), UnitedKingdom());

                // Use UK calendar since the BBA specified USD Libor follows UK calendar.
        //Calendar calendar = UnitedKingdom(); // TARGET();
        Date settlementDate(26, March, 2012);
        // must be a business day
        settlementDate = usdgbpCalendar.adjust(settlementDate);

        Integer fixingDays = 2;
        Date todaysDate = usdgbpCalendar.advance(settlementDate, -fixingDays, Days);
        // nothing to do with Date::todaysDate
        Settings::instance().evaluationDate() = todaysDate;

        todaysDate = Settings::instance().evaluationDate();
        std::cout << "Today: " << todaysDate.weekday()
                  << ", " << todaysDate << std::endl;

        std::cout << "Settlement date: " << settlementDate.weekday()
                  << ", " << settlementDate << std::endl;

                // ***
                // Quotes from the deal pricing.
                // ***

                // Bloomberg interpolates the term structure, not the market rates.
                // Below is the term structure from the Curves tab in SWPM.
                Real d1dQuote = 0.002;
                Real d1wQuote = 0.0022;
                Real d2wQuote = 0.0023;
                Real d3wQuote = 0.0023;
                Real d1mQuote = 0.0024;
                Real d2mQuote = 0.0036;
                Real d3mQuote = 0.005;
                Real fut1Quote = 99.5;
                Real fut2Quote = 99.511;
                Real fut3Quote = 99.482;
                Real fut4Quote = 99.439;
                Real fut5Quote = 99.391;
                Real fut6Quote = 99.324;
                Real fut7Quote = 99.242;
                Real fut8Quote = 99.14;
                Real fut9Quote = 99.039;
                Real fut10Quote = 98.909;
                Real fut11Quote = 98.759;
                Real fut12Quote = 98.579;
                Real s4yQuote = 0.0110528;
                Real s5yQuote = 0.0139183;
                Real s6yQuote = 0.0166578;
                Real s7yQuote = 0.0190752;
                Real s8yQuote = 0.0211655;
                Real s9yQuote = 0.0228908;
                Real s10yQuote = 0.0243784;
                Real s11yQuote = 0.0258135;
                Real s12yQuote = 0.0267813;
                Real s15yQuote = 0.0291646;
                Real s20yQuote = 0.0310002;
                Real s25yQuote = 0.0318074;
                Real s30yQuote = 0.0322509;
                Real s40yQuote = 0.0320802;
                Real s50yQuote = 0.0309723;

                /********************
         ***    QUOTES    ***
         ********************/

        // SimpleQuote stores a value which can be manually changed;
        // other Quote subclasses could read the value from a database
        // or some kind of data feed.

                boost::shared_ptr<Quote> d1dRate(new SimpleQuote(d1dQuote));
                boost::shared_ptr<Quote> d1wRate(new SimpleQuote(d1wQuote));
                boost::shared_ptr<Quote> d2wRate(new SimpleQuote(d2wQuote));
                boost::shared_ptr<Quote> d3wRate(new SimpleQuote(d3wQuote));
                boost::shared_ptr<Quote> d1mRate(new SimpleQuote(d1mQuote));
                boost::shared_ptr<Quote> d2mRate(new SimpleQuote(d2mQuote));
                boost::shared_ptr<Quote> d3mRate(new SimpleQuote(d3mQuote));
                boost::shared_ptr<Quote> fut1Price(new SimpleQuote(fut1Quote));
                boost::shared_ptr<Quote> fut2Price(new SimpleQuote(fut2Quote));
                boost::shared_ptr<Quote> fut3Price(new SimpleQuote(fut3Quote));
                boost::shared_ptr<Quote> fut4Price(new SimpleQuote(fut4Quote));
                boost::shared_ptr<Quote> fut5Price(new SimpleQuote(fut5Quote));
                boost::shared_ptr<Quote> fut6Price(new SimpleQuote(fut6Quote));
                boost::shared_ptr<Quote> fut7Price(new SimpleQuote(fut7Quote));
                boost::shared_ptr<Quote> fut8Price(new SimpleQuote(fut8Quote));
                boost::shared_ptr<Quote> fut9Price(new SimpleQuote(fut9Quote));
                boost::shared_ptr<Quote> fut10Price(new SimpleQuote(fut10Quote));
                boost::shared_ptr<Quote> fut11Price(new SimpleQuote(fut11Quote));
                boost::shared_ptr<Quote> fut12Price(new SimpleQuote(fut12Quote));
                boost::shared_ptr<Quote> s4yRate(new SimpleQuote(s4yQuote));
                boost::shared_ptr<Quote> s5yRate(new SimpleQuote(s5yQuote));
                boost::shared_ptr<Quote> s6yRate(new SimpleQuote(s6yQuote));
                boost::shared_ptr<Quote> s7yRate(new SimpleQuote(s7yQuote));
                boost::shared_ptr<Quote> s8yRate(new SimpleQuote(s8yQuote));
                boost::shared_ptr<Quote> s9yRate(new SimpleQuote(s9yQuote));
                boost::shared_ptr<Quote> s10yRate(new SimpleQuote(s10yQuote));
                boost::shared_ptr<Quote> s11yRate(new SimpleQuote(s11yQuote));
                boost::shared_ptr<Quote> s12yRate(new SimpleQuote(s12yQuote));
                boost::shared_ptr<Quote> s15yRate(new SimpleQuote(s15yQuote));
                boost::shared_ptr<Quote> s20yRate(new SimpleQuote(s20yQuote));
                boost::shared_ptr<Quote> s25yRate(new SimpleQuote(s25yQuote));
                boost::shared_ptr<Quote> s30yRate(new SimpleQuote(s30yQuote));
                boost::shared_ptr<Quote> s40yRate(new SimpleQuote(s40yQuote));
                boost::shared_ptr<Quote> s50yRate(new SimpleQuote(s50yQuote));

        /*********************
         ***  RATE HELPERS ***
         *********************/

        // RateHelpers are built from the above quotes together with
        // other instrument dependant infos.  Quotes are passed in
        // relinkable handles which could be relinked to some other
        // data source later.

        // deposits
        DayCounter depositDayCounter = Actual360();

                boost::shared_ptr<RateHelper> d1d(new DepositRateHelper(Handle<Quote>(d1dRate), 1*Days, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d1w(new DepositRateHelper(Handle<Quote>(d1wRate), 1*Weeks, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d2w(new DepositRateHelper(Handle<Quote>(d2wRate), 2*Weeks, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d3w(new DepositRateHelper(Handle<Quote>(d3wRate), 3*Weeks, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d1m(new DepositRateHelper(Handle<Quote>(d1mRate), 1*Months, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d2m(new DepositRateHelper(Handle<Quote>(d2mRate), 2*Months, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                boost::shared_ptr<RateHelper> d3m(new DepositRateHelper(Handle<Quote>(d3mRate), 3*Months, fixingDays, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));

                // setup futures
        // Rate convexityAdjustment = 0.0;
        Integer futMonths = 3;
        Date imm = IMM::nextDate(settlementDate);
                boost::shared_ptr<RateHelper> fut1(new FuturesRateHelper(Handle<Quote>(fut1Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut2(new FuturesRateHelper(Handle<Quote>(fut2Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut3(new FuturesRateHelper(Handle<Quote>(fut3Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut4(new FuturesRateHelper(Handle<Quote>(fut4Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut5(new FuturesRateHelper(Handle<Quote>(fut5Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut6(new FuturesRateHelper(Handle<Quote>(fut6Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut7(new FuturesRateHelper(Handle<Quote>(fut7Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut8(new FuturesRateHelper(Handle<Quote>(fut8Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut9(new FuturesRateHelper(Handle<Quote>(fut9Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut10(new FuturesRateHelper(Handle<Quote>(fut10Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut11(new FuturesRateHelper(Handle<Quote>(fut11Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));
                imm = IMM::nextDate(imm + 1);
                boost::shared_ptr<RateHelper> fut12(new FuturesRateHelper(Handle<Quote>(fut12Price), imm, futMonths, usdgbpCalendar, ModifiedFollowing, true, depositDayCounter));

        // setup swaps
        Frequency swFixedLegFrequency = Annual;
        BusinessDayConvention swFixedLegConvention = ModifiedFollowing;
        DayCounter swFixedLegDayCounter = Thirty360();
        boost::shared_ptr<IborIndex> swFloatingLegIndex(new USDLibor(Period(3, Months)));

                boost::shared_ptr<RateHelper> s4y(new SwapRateHelper(Handle<Quote>(s4yRate), 4*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s5y(new SwapRateHelper(Handle<Quote>(s5yRate), 5*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s6y(new SwapRateHelper(Handle<Quote>(s6yRate), 6*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s7y(new SwapRateHelper(Handle<Quote>(s7yRate), 7*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s8y(new SwapRateHelper(Handle<Quote>(s8yRate), 8*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s9y(new SwapRateHelper(Handle<Quote>(s9yRate), 9*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s10y(new SwapRateHelper(Handle<Quote>(s10yRate), 10*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s11y(new SwapRateHelper(Handle<Quote>(s11yRate), 11*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s12y(new SwapRateHelper(Handle<Quote>(s12yRate), 12*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s15y(new SwapRateHelper(Handle<Quote>(s15yRate), 15*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s20y(new SwapRateHelper(Handle<Quote>(s20yRate), 20*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s25y(new SwapRateHelper(Handle<Quote>(s25yRate), 25*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s30y(new SwapRateHelper(Handle<Quote>(s30yRate), 30*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s40y(new SwapRateHelper(Handle<Quote>(s40yRate), 40*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));
                boost::shared_ptr<RateHelper> s50y(new SwapRateHelper(Handle<Quote>(s50yRate), 50*Years, usdgbpCalendar, swFixedLegFrequency, swFixedLegConvention, swFixedLegDayCounter, swFloatingLegIndex));

        /*********************
         **  CURVE BUILDING **
         *********************/

        // Any DayCounter would be fine.
        // ActualActual::ISDA ensures that 30 years is 30.0
        DayCounter termStructureDayCounter =
            ActualActual(ActualActual::ISDA);

        double tolerance = 1.0e-15;

        // A depo-futures-swap curve
        std::vector<boost::shared_ptr<RateHelper> > depoFutSwapInstruments;
                depoFutSwapInstruments.push_back(d1d);
                depoFutSwapInstruments.push_back(d1w);
                depoFutSwapInstruments.push_back(d2w);
                depoFutSwapInstruments.push_back(d3w);
                depoFutSwapInstruments.push_back(d1m);
                depoFutSwapInstruments.push_back(d2m);
                depoFutSwapInstruments.push_back(d3m);
                depoFutSwapInstruments.push_back(fut1);
                depoFutSwapInstruments.push_back(fut2);
                depoFutSwapInstruments.push_back(fut3);
                depoFutSwapInstruments.push_back(fut4);
                depoFutSwapInstruments.push_back(fut5);
                depoFutSwapInstruments.push_back(fut6);
                depoFutSwapInstruments.push_back(fut7);
                depoFutSwapInstruments.push_back(fut8);
                depoFutSwapInstruments.push_back(fut9);
                depoFutSwapInstruments.push_back(fut10);
                depoFutSwapInstruments.push_back(fut11);
                depoFutSwapInstruments.push_back(fut12);
                depoFutSwapInstruments.push_back(s4y);
                depoFutSwapInstruments.push_back(s5y);
                depoFutSwapInstruments.push_back(s6y);
                depoFutSwapInstruments.push_back(s7y);
                depoFutSwapInstruments.push_back(s8y);
                depoFutSwapInstruments.push_back(s9y);
                depoFutSwapInstruments.push_back(s10y);
                depoFutSwapInstruments.push_back(s11y);
                depoFutSwapInstruments.push_back(s12y);
                depoFutSwapInstruments.push_back(s15y);
                depoFutSwapInstruments.push_back(s20y);
                depoFutSwapInstruments.push_back(s25y);
                depoFutSwapInstruments.push_back(s30y);
                depoFutSwapInstruments.push_back(s40y);
                depoFutSwapInstruments.push_back(s50y);
        boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
            //new PiecewiseYieldCurve<Discount, Linear>(
                        new PiecewiseYieldCurve<ZeroYield, Linear>(
                                       settlementDate, depoFutSwapInstruments,
                                       termStructureDayCounter,
                                       tolerance));

        // Term structures that will be used for pricing:
        // the one used for discounting cash flows
        RelinkableHandle<YieldTermStructure> discountingTermStructure;
        // the one used for forward rate forecasting
        RelinkableHandle<YieldTermStructure> forecastingTermStructure;

                RelinkableHandle<YieldTermStructure> h;

        /*********************
        * SWAPS TO BE PRICED *
        **********************/

        // constant nominal 1,000,000 Euro
        Real nominal = 10000000.0;
        // fixed leg
        Frequency fixedLegFrequency = Quarterly;
        BusinessDayConvention fixedLegConvention = ModifiedFollowing;
        BusinessDayConvention floatingLegConvention = ModifiedFollowing;
        DayCounter fixedLegDayCounter = Thirty360();
        //Rate fixedRate = 0.01373122;
                Rate fixedRate = 0.01373120;
        DayCounter floatingLegDayCounter = Actual360();

        // floating leg
        Frequency floatingLegFrequency = Quarterly;
        boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure));
                //boost::shared_ptr<IborIndex> idx(new Euribor3M(forecastingTermStructure));
                //boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), h));
        Spread spread = 0.0;

                idx->clearFixings();
                idx->addFixing(Date(22, March, 2012), 0.0047365);
                idx->addFixing(Date(22, June, 2012), 0.0046156);
                idx->addFixing(Date(24, September, 2012), 0.0052129);
                idx->addFixing(Date(21, December, 2012), 0.0056439);
                idx->addFixing(Date(22, March, 2013), 0.006136);
                idx->addFixing(Date(24, June, 2013), 0.0068255);
                idx->addFixing(Date(24, September, 2013), 0.0076726);
                idx->addFixing(Date(23, December, 2013), 0.0086831);
                idx->addFixing(Date(24, March, 2014), 0.0097157);
                idx->addFixing(Date(24, June, 2014), 0.0110484);
                idx->addFixing(Date(24, September, 2014), 0.0126216);
                idx->addFixing(Date(23, December, 2014), 0.0143848);
                idx->addFixing(Date(24, March, 2015), 0.0161928);
                idx->addFixing(Date(24, June, 2015), 0.0187209);
                idx->addFixing(Date(24, September, 2015), 0.0200915);
                idx->addFixing(Date(23, December, 2015), 0.0214196);
                idx->addFixing(Date(23, March, 2016), 0.0231223);
                idx->addFixing(Date(23, June, 2016), 0.0244363);
                idx->addFixing(Date(22, September, 2016), 0.0257481);
                idx->addFixing(Date(22, December, 2016), 0.0270144);

        Integer lenghtInYears = 5;
        VanillaSwap::Type swapType = VanillaSwap::Payer;

        Date maturity = settlementDate + lenghtInYears*Years;
        Schedule fixedSchedule(settlementDate, maturity,
                               Period(fixedLegFrequency),
                               usdgbpCalendar, fixedLegConvention,
                               fixedLegConvention,
                               DateGeneration::Backward, false);
        Schedule floatSchedule(settlementDate, maturity,
                               Period(floatingLegFrequency),
                               usdgbpCalendar, floatingLegConvention,
                               floatingLegConvention,
                               DateGeneration::Backward, false);
        VanillaSwap spot5YearSwap(swapType, nominal,
            fixedSchedule, fixedRate, fixedLegDayCounter,
            floatSchedule, idx, spread,
            floatingLegDayCounter);

        /***************
        * SWAP PRICING *
        ****************/

        // utilities for reporting
        std::vector<std::string> headers(4);
        headers[0] = "term structure";
        headers[1] = "net present value";
        headers[2] = "fair spread";
        headers[3] = "fair fixed rate";
        std::string separator = " | ";
        Size width = headers[0].size() + separator.size()
                   + headers[1].size() + separator.size()
                   + headers[2].size() + separator.size()
                   + headers[3].size() + separator.size() - 1;
        std::string rule(width, '-'), dblrule(width, '=');
        std::string tab(8, ' ');

        // calculations
        std::cout << dblrule << std::endl;
        std::cout <<  "5-year market swap-rate = "
                  << std::setprecision(8) << io::rate(s5yRate->value())
                  << std::endl;
        std::cout << dblrule << std::endl;

        std::cout << tab << "5-years swap paying "
                  << io::rate(fixedRate) << std::endl;
        std::cout << headers[0] << separator
                  << headers[1] << separator
                  << headers[2] << separator
                  << headers[3] << separator << std::endl;
        std::cout << rule << std::endl;

        Real NPV;
        Rate fairRate;
        Spread fairSpread;

        boost::shared_ptr<PricingEngine> swapEngine(
                         new DiscountingSwapEngine(discountingTermStructure));

        spot5YearSwap.setPricingEngine(swapEngine);

        forecastingTermStructure.linkTo(depoFutSwapTermStructure);
        discountingTermStructure.linkTo(depoFutSwapTermStructure);
                //h.linkTo(indexTermStructure);

        NPV = spot5YearSwap.NPV();
        fairSpread = spot5YearSwap.fairSpread();
        fairRate = spot5YearSwap.fairRate();

        std::cout << std::setw(headers[0].size())
                  << "depo-fut-swap" << separator;
        std::cout << std::setw(headers[1].size())
                  << std::fixed << std::setprecision(8) << NPV << separator;
        std::cout << std::setw(headers[2].size())
                  << io::rate(fairSpread) << separator;
        std::cout << std::setw(headers[3].size())
                  << io::rate(fairRate) << separator;
        std::cout << std::endl;

        //QL_REQUIRE(std::fabs(fairRate-s5yQuote)<1e-8,
        //           "5-years swap mispriced!");

                Leg fixedLeg = spot5YearSwap.fixedLeg();
                Leg floatLeg = spot5YearSwap.floatingLeg();
                Leg::const_iterator i = fixedLeg.begin();
                Leg::const_iterator e = fixedLeg.end();
                Leg::const_iterator ii = floatLeg.begin();
                cout << "Fixed Cf Amount|Fixed Cf Date|Float Cf Amount|Float Cf Date|Fixed Cf DF|Index Fixing\n";
                for (; i != e; i++, ii++)
                {
                        boost::shared_ptr<CashFlow> fixedCf = *i;
                        boost::shared_ptr<CashFlow> floatCf = *ii;
                        Date d = usdgbpCalendar.adjust(floatCf->date(), ModifiedFollowing);
                        cout << -fixedCf->amount() << "|" << fixedCf->date()
                                << "|" << floatCf->amount() << "|" << floatCf->date()
                                << "|" << discountingTermStructure->discount(fixedCf->date())
                                << "|" << idx->fixing(d, false)
                                << endl;
                }
                //cout << "Fixed Cf Amount|Fixed Cf Date|Float Cf Amount|Float Cf Date|Fixed Cf DF|Index Fixing\n";
                //for (; i != e; i++, ii++)
                //{
                // boost::shared_ptr<CashFlow> fixedCf = *i;
                // boost::shared_ptr<CashFlow> floatCf = *ii;
                // Date d = calendar.adjust(floatCf->date(), ModifiedFollowing);
                // cout << -fixedCf->amount() << "|" << fixedCf->date()
                // << "|" << floatCf->amount() << "|" << floatCf->date()
                // << "|" << discountingTermStructure->discount(fixedCf->date())
                // << "|" << idx->fixing(d, false)
                // << endl;
                //}

        Real seconds = timer.elapsed();
        Integer hours = int(seconds/3600);
        seconds -= hours * 3600;
        Integer minutes = int(seconds/60);
        seconds -= minutes * 60;
        std::cout << " \nRun completed in ";
        if (hours > 0)
            std::cout << hours << " h ";
        if (hours > 0 || minutes > 0)
            std::cout << minutes << " m ";
        std::cout << std::fixed << std::setprecision(0)
                  << seconds << " s\n" << std::endl;

                cout << "Press a key then Enter to exit.\n";
                string s;
                cin >> s;

        return 0;

    } catch (std::exception& e) {
        std::cerr << e.what() << std::endl;
                cout << "Press a key then Enter to exit.\n";
                string s;
                cin >> s;
        return 1;
    } catch (...) {
        std::cerr << "unknown error" << std::endl;
                cout << "Press a key then Enter to exit.\n";
                string s;
                cin >> s;
        return 1;
    }
}

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 4:16 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Sorry, I had saved your post but I didn't have time to follow through.
Do you have a set of inputs that reproduces the problem? (Evaluation date, input rates, conventions you're using...)

Luigi


On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:

> Sending again in hopes it was simply forgotten...
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
> From: Smith, Dale
> Sent: Thursday, March 29, 2012 10:43 AM
> To: [hidden email]
> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>
>
>
> Hello,
>
>
>
> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
> I have the deposit, futures, and swap rates as in the Swap example
> project, and created an IborIndex using the joint UK and US calendars
> to pick up both sets of holidays.
>
>
>
> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
> forecastingTermStructure));
>
>
>
> forecastingTermStructure is linked to
>
>
>
>         boost::shared_ptr<YieldTermStructure>
> depoFutSwapTermStructure(
>
>             //new PiecewiseYieldCurve<Discount, Linear>(
>
>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>
>                                        settlementDate,
> depoFutSwapInstruments,
>
>                                        termStructureDayCounter,
>
>                                        tolerance));
>
>
>
> My problem is the fixings used in the floating leg that Bloomberg uses
> are not the same as what QuantLib uses. I did do a clearFixing() on
> the IborIndex object and added the fixings I see on the SWPM Resets
> tab. I've also confirmed by calculations in Excel that the difference
> in cashflows on the floating leg is due entirely to the fixings.
>
>
>
> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
> changed that to Piecewise Linear (Continuous) but the fixings still
> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
> in my own code after confirming with Bloomberg they are interpolating
> the term structure, not the discount factors or the market rates.
>
>
>
> I've used Google to search for answers to this, and looked at the
> examples and unit tests in the QuantLib code. Is there anywhere I've
> missed in my searches?
>
>
>
> Thanks,
>
> Dale Smith, Ph.D.
>
> Senior Financial Quantitative Analyst
>
> Risk & Compliance
>
> Fiserv.
>
> 107 Technology Park
>
> Norcross, GA 30092
>
> Office: 678-375-5315
>
> Mobile: 678-982-6599
>
> Mail: [hidden email]
>
> www.fiserv.com
>
>
>
>
> ----------------------------------------------------------------------
> --------
> This SF email is sponsosred by:
> Try Windows Azure free for 90 days Click Here
> http://p.sf.net/sfu/sfd2d-msazure 
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

SWIG Java

Billy Ng-5
Hi,

I am going to implement a Pricer for a Java based Trading System using QuantLib.

How to build the *.i SWIG interface files for Java under Windows? Are those generic files for any C++ - Java interface or it is specific for QuantLib and needed to be generated per installation?

I have searched in the Mailing List and follow the email on Quantlib Java Module on Windows.... sent from Francis Duffy dated 2011-06-28

Many Thanks

Billy
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: SWIG Java

Billy Ng-5
Finally I have completed the SWIG for Java under Windows and MS Visual Studio 2008 based on Francis Duffy's email dated 2011-06-28
http://sourceforge.net/mailarchive/message.php?msg_id=27720498

A few problems encountered which may be useful to put it down for others reference

1. The *.i SWIG interface files for Java under Windows is in the SVN under QuantLib-SWIG\SWIG.
2. It is better to download QuantLib again to make sure having the same version
e.g. the SVN QL_HEX_VERSION is 0x010300f0, whereas the Website QuantLib 1.2 QL_HEX_VERSION is 0x010200f0
3.  In creating the quantlib_wrap project in VS: Win32 Application Wizard->Next ->Console application -> DLL-> Finish. You CANNOT uncheck "precompiled
headers", instead check "Empty Project"
4. In building the quantlib_wrap project, it creates another QuantLib.lib(much smaller in size) along with QuantLib.dll, it may override the same lib for the QuantLib project and giving an error "Cannot find or open QuantLib.lib"

Hope that may smooth your next installation

Billy


-----Original Message-----
From: Billy Ng [mailto:[hidden email]]
Sent: Wednesday, April 04, 2012 11:23 AM
To: [hidden email]
Subject: [Quantlib-users] SWIG Java


Hi,

I am going to implement a Pricer for a Java based Trading System using QuantLib.

How to build the *.i SWIG interface files for Java under Windows? Are those generic files for any C++ - Java interface or it is specific for QuantLib and needed to be generated per installation?

I have searched in the Mailing List and follow the email on Quantlib Java Module on Windows.... sent from Francis Duffy dated 2011-06-28

Many Thanks

Billy
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: SWIG Java

Billy Ng-5
Hi,

Any document about what functions are ported/accessible from Java via SWIG?
How to add in extra functions using the *.i files, I believe?
 

Couple more problems in compiling and executing the examples under Windows.

1. Rename the QuantLib.dll to QuantLibJNI.dll
2. Specify where to find it by
java -cp %CLASSPATH% -Djava.library.path=%QuantLibJNI% examples.EquityOptions

Billy


-----Original Message-----
From: Billy Ng [mailto:[hidden email]]
Sent: Saturday, April 07, 2012 1:29 PM
To: [hidden email]
Subject: Re: [Quantlib-users] SWIG Java


Finally I have completed the SWIG for Java under Windows and MS Visual Studio 2008 based on Francis Duffy's email dated 2011-06-28
http://sourceforge.net/mailarchive/message.php?msg_id=27720498

A few problems encountered which may be useful to put it down for others reference

1. The *.i SWIG interface files for Java under Windows is in the SVN under QuantLib-SWIG\SWIG.
2. It is better to download QuantLib again to make sure having the same version
e.g. the SVN QL_HEX_VERSION is 0x010300f0, whereas the Website QuantLib 1.2 QL_HEX_VERSION is 0x010200f0
3.  In creating the quantlib_wrap project in VS: Win32 Application Wizard->Next ->Console application -> DLL-> Finish. You CANNOT uncheck "precompiled
headers", instead check "Empty Project"
4. In building the quantlib_wrap project, it creates another QuantLib.lib(much smaller in size) along with QuantLib.dll, it may override the same lib for the QuantLib project and giving an error "Cannot find or open QuantLib.lib"

Hope that may smooth your next installation

Billy


-----Original Message-----
From: Billy Ng [mailto:[hidden email]]
Sent: Wednesday, April 04, 2012 11:23 AM
To: [hidden email]
Subject: [Quantlib-users] SWIG Java


Hi,

I am going to implement a Pricer for a Java based Trading System using QuantLib.

How to build the *.i SWIG interface files for Java under Windows? Are those generic files for any C++ - Java interface or it is specific for QuantLib and needed to be generated per installation?

I have searched in the Mailing List and follow the email on Quantlib Java Module on Windows.... sent from Francis Duffy dated 2011-06-28

Many Thanks

Billy
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)
In reply to this post by Luigi Ballabio
Hello,

Hello,

I don't want to be a pest but I need to get this resolved one way or another. Which YieldTermStructure derived class should I use to get back the exact fixings I've supplied? Here's what I'm using now.

>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));

I sent the interest rates I'm using in an earlier message.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 5:05 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Ok, thanks.  I probably won't be able to follow through this week (I'll be on vacation starting Wednesday) but hopefully someone can pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
> Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation
> date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg
>> uses are not the same as what QuantLib uses. I did do a clearFixing()
>> on the IborIndex object and added the fixings I see on the SWPM
>> Resets tab. I've also confirmed by calculations in Excel that the
>> difference in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure 
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)
In reply to this post by Luigi Ballabio
Following up on my message from last week, here's what I've tried in the past few days.

Background: I created a simple fixed-floating swap in Bloomberg (using SWPM) and used the curve plus fixings from Bloomberg in some QuantLib code, closely following the swap example code in QuantLib.

My problem is the fixings from the floating leg index are not reproduced using

// constant nominal 1,000,000
Real nominal = 10000000.0;
// fixed leg
Frequency fixedLegFrequency = Quarterly;
BusinessDayConvention fixedLegConvention = ModifiedFollowing;
BusinessDayConvention floatingLegConvention = ModifiedFollowing;
DayCounter fixedLegDayCounter = Thirty360();
Rate fixedRate = 0.01373122;
DayCounter floatingLegDayCounter = Actual360();
// floating leg
Frequency floatingLegFrequency = Quarterly;
boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure));
...

boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
  new PiecewiseYieldCurve<ZeroYield, Linear>(
            settlementDate, depoFutSwapInstruments,
            termStructureDayCounter,
            tolerance)
);

My questions are

* Has anyone successfully tied out a swap from SWPM with QuantLib swap valuation?
* Am I using the wrong class to build a YieldTermStructure?

I've done a lot of googling around about this, looked at the QuantLib examples, read the documentation, and stepped through the QuantLib code using a debugger. I've also checked

* Day count conventions (deposit, futures, and swap)
* Schedule dates (QuantLib dates are the same as in Bloomberg)
* Business day convention (modified following for both swap legs)
* Roll convention (Bloomberg has Backward (end of month))
* Bloomberg verifies they are using 3 month forward rates calculated from the curve I've selected in SWPM.

I can calculate the floating leg payments in Excel using the Bloomberg fixings, so I've isolated the problem to just the fixings and the yield curve structure.

Relevant code may be found at

http://sourceforge.net/mailarchive/message.php?msg_id=29078963

I am sure I'm missing something here. Any advice is appreciated.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Smith, Dale
Sent: Tuesday, April 10, 2012 7:58 AM
To: Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Hello,

Hello,

I don't want to be a pest but I need to get this resolved one way or another. Which YieldTermStructure derived class should I use to get back the exact fixings I've supplied? Here's what I'm using now.

>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));

I sent the interest rates I'm using in an earlier message.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 5:05 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Ok, thanks.  I probably won't be able to follow through this week (I'll be on vacation starting Wednesday) but hopefully someone can pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
> Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation
> date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg
>> uses are not the same as what QuantLib uses. I did do a clearFixing()
>> on the IborIndex object and added the fixings I see on the SWPM
>> Resets tab. I've also confirmed by calculations in Excel that the
>> difference in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure 
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Luigi Ballabio
Dale,
    I've had a quick look.
First thing: except for the first one, the fixings you're adding to
the index won't be used since they're for future dates.  The coupon
will look at its fixing date, see that it's in the future, skip the
lookup among the stored fixings and forecast the fixing off the curve.
Second: the way you were printing the fixings was a bit off: you were
adjusting the payment date and asking the index for a fixing at that
date, but this would give you the fixing at the end of the coupon and
moreover would disregard the fixing days. I've modified the printout
loop a bit to get the rates actually used by the coupon, and I'm
attaching the updated file.  With the modification, you can see that
the first coupon is matched exactly (it fixes on today's date, so it
is looked up and found).  Also, I've modified the fixed frequency so
that it matches that of the swaps used to bootstrap the curve (it
doesn't affect the floating-rate fixings anyway) and checked that it
reprices the quoted 5-years rate correctly.

Now, if you want to use the market data (deposit, futures etc.) and
forecast the Libor fixings based on those, you'll probably have to do
some calculations to try and see what's happening.  For instance, you
might estimate what the second fixing should be: from the 3m deposit
you can calculate the discount at three months from today's date, and
from the futures you can work your way outwards and get the discounts
at their maturity date (their price depends on the discounts at the
start and end date of the underlying fixing, you know the discount at
the start date because you can interpolate it from the discounts you
found so far, you get the discount at the end date).  Once you have
the discount at the 6-months point, you can calculate the Libor fixing
for the second coupon.  To check that the curve is doing the same, you
might want to use PiecewiseYieldCurve<Discount, ...> and call its
nodes() method which returns a vector of pairs (date, discount).

If you just want to use the Bloomberg fixings instead, you can try
feeding the first to a DepositRateHelper and the others to
FraRateHelpers instead.  This will bootstrap the curve so that it
reprices the forward rate passed to each helper, so you should
retrieve the same rates in your swap.  The calculation won't really be
based on market rates, though.

Hope this helps,
    Luigi

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

fixings.cpp (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Smith, Dale (Norcross)
Let me read this over carefully. Thanks for the response.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Tuesday, April 10, 2012 10:42 AM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
Bloomberg Fixings

Dale,
    I've had a quick look.
First thing: except for the first one, the fixings you're adding to the
index won't be used since they're for future dates.  The coupon will
look at its fixing date, see that it's in the future, skip the lookup
among the stored fixings and forecast the fixing off the curve.
Second: the way you were printing the fixings was a bit off: you were
adjusting the payment date and asking the index for a fixing at that
date, but this would give you the fixing at the end of the coupon and
moreover would disregard the fixing days. I've modified the printout
loop a bit to get the rates actually used by the coupon, and I'm
attaching the updated file.  With the modification, you can see that the
first coupon is matched exactly (it fixes on today's date, so it is
looked up and found).  Also, I've modified the fixed frequency so that
it matches that of the swaps used to bootstrap the curve (it doesn't
affect the floating-rate fixings anyway) and checked that it reprices
the quoted 5-years rate correctly.

Now, if you want to use the market data (deposit, futures etc.) and
forecast the Libor fixings based on those, you'll probably have to do
some calculations to try and see what's happening.  For instance, you
might estimate what the second fixing should be: from the 3m deposit you
can calculate the discount at three months from today's date, and from
the futures you can work your way outwards and get the discounts at
their maturity date (their price depends on the discounts at the start
and end date of the underlying fixing, you know the discount at the
start date because you can interpolate it from the discounts you found
so far, you get the discount at the end date).  Once you have the
discount at the 6-months point, you can calculate the Libor fixing for
the second coupon.  To check that the curve is doing the same, you might
want to use PiecewiseYieldCurve<Discount, ...> and call its
nodes() method which returns a vector of pairs (date, discount).

If you just want to use the Bloomberg fixings instead, you can try
feeding the first to a DepositRateHelper and the others to
FraRateHelpers instead.  This will bootstrap the curve so that it
reprices the forward rate passed to each helper, so you should retrieve
the same rates in your swap.  The calculation won't really be based on
market rates, though.

Hope this helps,
    Luigi

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Jicun Zhong
In reply to this post by Smith, Dale (Norcross)
Hello Dale,
   If I understood correctly, the fixing will only affect the next floating cash flow in a Vanilla swap. Further floating CFs are estimated using the forward curve. Unless you are calculating already occurred floating CFs you will not need more than one fixing. From your code posted I see that you are value a swap start from March 26, 2012 and stretches out for 5 years, however all the fixings you added are future fixings which should be unknown to you because your today is March 24, 2012. Also I think QuantLib will not even try to use these fixing because future floating CFs are calculated using estimated/interpolated forward rates. So I am not sure what exactly do you want to achieve here. If you want to calculate future floating CFs you will not need more than 1 fixing. If you want to calculated occurred floating CFs, then you need to adjust you today's date.

Jicun
       

-----Original Message-----
From: Smith, Dale [mailto:[hidden email]]
Sent: den 10 april 2012 16:13
To: Smith, Dale; Luigi Ballabio
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Following up on my message from last week, here's what I've tried in the past few days.

Background: I created a simple fixed-floating swap in Bloomberg (using SWPM) and used the curve plus fixings from Bloomberg in some QuantLib code, closely following the swap example code in QuantLib.

My problem is the fixings from the floating leg index are not reproduced using

// constant nominal 1,000,000
Real nominal = 10000000.0;
// fixed leg
Frequency fixedLegFrequency = Quarterly; BusinessDayConvention fixedLegConvention = ModifiedFollowing; BusinessDayConvention floatingLegConvention = ModifiedFollowing; DayCounter fixedLegDayCounter = Thirty360(); Rate fixedRate = 0.01373122; DayCounter floatingLegDayCounter = Actual360(); // floating leg Frequency floatingLegFrequency = Quarterly; boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure)); ...

boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
  new PiecewiseYieldCurve<ZeroYield, Linear>(
            settlementDate, depoFutSwapInstruments,
            termStructureDayCounter,
            tolerance)
);

My questions are

* Has anyone successfully tied out a swap from SWPM with QuantLib swap valuation?
* Am I using the wrong class to build a YieldTermStructure?

I've done a lot of googling around about this, looked at the QuantLib examples, read the documentation, and stepped through the QuantLib code using a debugger. I've also checked

* Day count conventions (deposit, futures, and swap)
* Schedule dates (QuantLib dates are the same as in Bloomberg)
* Business day convention (modified following for both swap legs)
* Roll convention (Bloomberg has Backward (end of month))
* Bloomberg verifies they are using 3 month forward rates calculated from the curve I've selected in SWPM.

I can calculate the floating leg payments in Excel using the Bloomberg fixings, so I've isolated the problem to just the fixings and the yield curve structure.

Relevant code may be found at

http://sourceforge.net/mailarchive/message.php?msg_id=29078963

I am sure I'm missing something here. Any advice is appreciated.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Smith, Dale
Sent: Tuesday, April 10, 2012 7:58 AM
To: Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Hello,

Hello,

I don't want to be a pest but I need to get this resolved one way or another. Which YieldTermStructure derived class should I use to get back the exact fixings I've supplied? Here's what I'm using now.

>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));

I sent the interest rates I'm using in an earlier message.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 5:05 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Ok, thanks.  I probably won't be able to follow through this week (I'll be on vacation starting Wednesday) but hopefully someone can pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
> Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation
> date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg
>> uses are not the same as what QuantLib uses. I did do a clearFixing()
>> on the IborIndex object and added the fixings I see on the SWPM
>> Resets tab. I've also confirmed by calculations in Excel that the
>> difference in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure 
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Smith, Dale (Norcross)
Hello,

Thanks very much for the responses.

The only future fixings available are forward rates built from today's yield curve. That's what Bloomberg uses. I thought the purpose of the IborIndex classes were to encapsulate this, however I see I was wrong.

I've decided I can use the InterpolatedDiscountCurve to achieve one of my goals by giving it discount factors. If this is in error, please let me know.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Jicun Zhong [mailto:[hidden email]]
Sent: Wednesday, April 11, 2012 4:00 AM
To: Smith, Dale; Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Hello Dale,
   If I understood correctly, the fixing will only affect the next floating cash flow in a Vanilla swap. Further floating CFs are estimated using the forward curve. Unless you are calculating already occurred floating CFs you will not need more than one fixing. From your code posted I see that you are value a swap start from March 26, 2012 and stretches out for 5 years, however all the fixings you added are future fixings which should be unknown to you because your today is March 24, 2012. Also I think QuantLib will not even try to use these fixing because future floating CFs are calculated using estimated/interpolated forward rates. So I am not sure what exactly do you want to achieve here. If you want to calculate future floating CFs you will not need more than 1 fixing. If you want to calculated occurred floating CFs, then you need to adjust you today's date.

Jicun
       

-----Original Message-----
From: Smith, Dale [mailto:[hidden email]]
Sent: den 10 april 2012 16:13
To: Smith, Dale; Luigi Ballabio
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Following up on my message from last week, here's what I've tried in the past few days.

Background: I created a simple fixed-floating swap in Bloomberg (using SWPM) and used the curve plus fixings from Bloomberg in some QuantLib code, closely following the swap example code in QuantLib.

My problem is the fixings from the floating leg index are not reproduced using

// constant nominal 1,000,000
Real nominal = 10000000.0;
// fixed leg
Frequency fixedLegFrequency = Quarterly; BusinessDayConvention fixedLegConvention = ModifiedFollowing; BusinessDayConvention floatingLegConvention = ModifiedFollowing; DayCounter fixedLegDayCounter = Thirty360(); Rate fixedRate = 0.01373122; DayCounter floatingLegDayCounter = Actual360(); // floating leg Frequency floatingLegFrequency = Quarterly; boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure)); ...

boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
  new PiecewiseYieldCurve<ZeroYield, Linear>(
            settlementDate, depoFutSwapInstruments,
            termStructureDayCounter,
            tolerance)
);

My questions are

* Has anyone successfully tied out a swap from SWPM with QuantLib swap valuation?
* Am I using the wrong class to build a YieldTermStructure?

I've done a lot of googling around about this, looked at the QuantLib examples, read the documentation, and stepped through the QuantLib code using a debugger. I've also checked

* Day count conventions (deposit, futures, and swap)
* Schedule dates (QuantLib dates are the same as in Bloomberg)
* Business day convention (modified following for both swap legs)
* Roll convention (Bloomberg has Backward (end of month))
* Bloomberg verifies they are using 3 month forward rates calculated from the curve I've selected in SWPM.

I can calculate the floating leg payments in Excel using the Bloomberg fixings, so I've isolated the problem to just the fixings and the yield curve structure.

Relevant code may be found at

http://sourceforge.net/mailarchive/message.php?msg_id=29078963

I am sure I'm missing something here. Any advice is appreciated.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Smith, Dale
Sent: Tuesday, April 10, 2012 7:58 AM
To: Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Hello,

Hello,

I don't want to be a pest but I need to get this resolved one way or another. Which YieldTermStructure derived class should I use to get back the exact fixings I've supplied? Here's what I'm using now.

>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));

I sent the interest rates I'm using in an earlier message.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 5:05 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Ok, thanks.  I probably won't be able to follow through this week (I'll be on vacation starting Wednesday) but hopefully someone can pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
> Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation
> date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg
>> uses are not the same as what QuantLib uses. I did do a clearFixing()
>> on the IborIndex object and added the fixings I see on the SWPM
>> Resets tab. I've also confirmed by calculations in Excel that the
>> difference in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure 
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>



------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Luigi Ballabio
On Wed, Apr 11, 2012 at 2:09 PM, Smith, Dale <[hidden email]> wrote:
> The only future fixings available are forward rates built from today's yield curve. That's what Bloomberg uses. I thought the purpose of the IborIndex classes were to encapsulate this, however I see I was wrong.

No, you were right,  The IborIndex class builds forwards from today's
yield curve.
We'd need more investigation to see why the results are different...

> I've decided I can use the InterpolatedDiscountCurve to achieve one of my goals by giving it discount factors. If this is in error, please let me know.

That's ok if you have a series of discount factors.

Luigi

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Smith, Dale (Norcross)
Hmm. Let me see if I have time today to step back thru the code and
isolate what's going on.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Wednesday, April 11, 2012 8:21 AM
To: Smith, Dale
Cc: Jicun Zhong; [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings
vsBloomberg Fixings

On Wed, Apr 11, 2012 at 2:09 PM, Smith, Dale <[hidden email]>
wrote:
> The only future fixings available are forward rates built from today's
yield curve. That's what Bloomberg uses. I thought the purpose of the
IborIndex classes were to encapsulate this, however I see I was wrong.

No, you were right,  The IborIndex class builds forwards from today's
yield curve.
We'd need more investigation to see why the results are different...

> I've decided I can use the InterpolatedDiscountCurve to achieve one of
my goals by giving it discount factors. If this is in error, please let
me know.

That's ok if you have a series of discount factors.

Luigi

------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Jicun Zhong
In reply to this post by Smith, Dale (Norcross)
Hi,
  I am still not sure what you are trying to achieve here. If you want to calculated the NPV and you define today as March 24, 2012 then you will not need any future fixings and it is also impossible to know any future fixings. Therefore the only thing QuantLib does is to forecast them and then use them to discount CFs to today. If you are interested to get the floating CFs on specific payment dates and you have fixings that should be used for these payment dates, then you can just construct a simple floating schedule to get the exact payment dates, using the floating day counter to get the year fraction and then multiply that with the fixing meant for that date and nominal. It is simple as that.

Regards!

jicun    

-----Original Message-----
From: Smith, Dale [mailto:[hidden email]]
Sent: den 11 april 2012 14:10
To: Jicun Zhong; Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Hello,

Thanks very much for the responses.

The only future fixings available are forward rates built from today's yield curve. That's what Bloomberg uses. I thought the purpose of the IborIndex classes were to encapsulate this, however I see I was wrong.

I've decided I can use the InterpolatedDiscountCurve to achieve one of my goals by giving it discount factors. If this is in error, please let me know.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Jicun Zhong [mailto:[hidden email]]
Sent: Wednesday, April 11, 2012 4:00 AM
To: Smith, Dale; Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vsBloomberg Fixings

Hello Dale,
   If I understood correctly, the fixing will only affect the next floating cash flow in a Vanilla swap. Further floating CFs are estimated using the forward curve. Unless you are calculating already occurred floating CFs you will not need more than one fixing. From your code posted I see that you are value a swap start from March 26, 2012 and stretches out for 5 years, however all the fixings you added are future fixings which should be unknown to you because your today is March 24, 2012. Also I think QuantLib will not even try to use these fixing because future floating CFs are calculated using estimated/interpolated forward rates. So I am not sure what exactly do you want to achieve here. If you want to calculate future floating CFs you will not need more than 1 fixing. If you want to calculated occurred floating CFs, then you need to adjust you today's date.

Jicun
       

-----Original Message-----
From: Smith, Dale [mailto:[hidden email]]
Sent: den 10 april 2012 16:13
To: Smith, Dale; Luigi Ballabio
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Following up on my message from last week, here's what I've tried in the past few days.

Background: I created a simple fixed-floating swap in Bloomberg (using SWPM) and used the curve plus fixings from Bloomberg in some QuantLib code, closely following the swap example code in QuantLib.

My problem is the fixings from the floating leg index are not reproduced using

// constant nominal 1,000,000
Real nominal = 10000000.0;
// fixed leg
Frequency fixedLegFrequency = Quarterly; BusinessDayConvention fixedLegConvention = ModifiedFollowing; BusinessDayConvention floatingLegConvention = ModifiedFollowing; DayCounter fixedLegDayCounter = Thirty360(); Rate fixedRate = 0.01373122; DayCounter floatingLegDayCounter = Actual360(); // floating leg Frequency floatingLegFrequency = Quarterly; boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months), forecastingTermStructure)); ...

boost::shared_ptr<YieldTermStructure> depoFutSwapTermStructure(
  new PiecewiseYieldCurve<ZeroYield, Linear>(
            settlementDate, depoFutSwapInstruments,
            termStructureDayCounter,
            tolerance)
);

My questions are

* Has anyone successfully tied out a swap from SWPM with QuantLib swap valuation?
* Am I using the wrong class to build a YieldTermStructure?

I've done a lot of googling around about this, looked at the QuantLib examples, read the documentation, and stepped through the QuantLib code using a debugger. I've also checked

* Day count conventions (deposit, futures, and swap)
* Schedule dates (QuantLib dates are the same as in Bloomberg)
* Business day convention (modified following for both swap legs)
* Roll convention (Bloomberg has Backward (end of month))
* Bloomberg verifies they are using 3 month forward rates calculated from the curve I've selected in SWPM.

I can calculate the floating leg payments in Excel using the Bloomberg fixings, so I've isolated the problem to just the fixings and the yield curve structure.

Relevant code may be found at

http://sourceforge.net/mailarchive/message.php?msg_id=29078963

I am sure I'm missing something here. Any advice is appreciated.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com


-----Original Message-----
From: Smith, Dale
Sent: Tuesday, April 10, 2012 7:58 AM
To: Luigi Ballabio
Cc: [hidden email]
Subject: RE: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Hello,

Hello,

I don't want to be a pest but I need to get this resolved one way or another. Which YieldTermStructure derived class should I use to get back the exact fixings I've supplied? Here's what I'm using now.

>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));

I sent the interest rates I'm using in an earlier message.

Thanks,
Dale Smith, Ph.D.
Senior Financial Quantitative Analyst
Risk & Compliance
Fiserv.
107 Technology Park
Norcross, GA 30092
Office: 678-375-5315
Mobile: 678-982-6599
Mail: [hidden email]
www.fiserv.com

-----Original Message-----
From: Luigi Ballabio [mailto:[hidden email]]
Sent: Monday, April 02, 2012 5:05 PM
To: Smith, Dale
Cc: [hidden email]
Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings

Ok, thanks.  I probably won't be able to follow through this week (I'll be on vacation starting Wednesday) but hopefully someone can pick it up.

On Mon, Apr 2, 2012 at 10:20 PM, Smith, Dale <[hidden email]> wrote:

> Thanks for responding.
>
> I can put this together for you tomorrow my time.
>
> Thanks,
> Dale Smith, Ph.D.
> Senior Financial Quantitative Analyst
> Risk & Compliance
> Fiserv.
> 107 Technology Park
> Norcross, GA 30092
> Office: 678-375-5315
> Mobile: 678-982-6599
> Mail: [hidden email]
> www.fiserv.com
>
>
> -----Original Message-----
> From: Luigi Ballabio [mailto:[hidden email]]
> Sent: Monday, April 02, 2012 4:16 PM
> To: Smith, Dale
> Cc: [hidden email]
> Subject: Re: [Quantlib-users] [QuantLib-Users] IborIndex Fixings vs
> Bloomberg Fixings
>
> Sorry, I had saved your post but I didn't have time to follow through.
> Do you have a set of inputs that reproduces the problem? (Evaluation
> date, input rates, conventions you're using...)
>
> Luigi
>
>
> On Mon, Apr 2, 2012 at 9:49 PM, Smith, Dale <[hidden email]> wrote:
>> Sending again in hopes it was simply forgotten...
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>> From: Smith, Dale
>> Sent: Thursday, March 29, 2012 10:43 AM
>> To: [hidden email]
>> Subject: [QuantLib-Users] IborIndex Fixings vs Bloomberg Fixings
>>
>>
>>
>> Hello,
>>
>>
>>
>> I'm trying to tie out a QuantLib program with Bloomberg's SWPM screen.
>> I have the deposit, futures, and swap rates as in the Swap example
>> project, and created an IborIndex using the joint UK and US calendars
>> to pick up both sets of holidays.
>>
>>
>>
>> boost::shared_ptr<IborIndex> idx(new USDLibor(Period(3, Months),
>> forecastingTermStructure));
>>
>>
>>
>> forecastingTermStructure is linked to
>>
>>
>>
>>         boost::shared_ptr<YieldTermStructure>
>> depoFutSwapTermStructure(
>>
>>             //new PiecewiseYieldCurve<Discount, Linear>(
>>
>>                      new PiecewiseYieldCurve<ZeroYield, Linear>(
>>
>>                                        settlementDate,
>> depoFutSwapInstruments,
>>
>>                                        termStructureDayCounter,
>>
>>                                        tolerance));
>>
>>
>>
>> My problem is the fixings used in the floating leg that Bloomberg
>> uses are not the same as what QuantLib uses. I did do a clearFixing()
>> on the IborIndex object and added the fixings I see on the SWPM
>> Resets tab. I've also confirmed by calculations in Excel that the
>> difference in cashflows on the floating leg is due entirely to the fixings.
>>
>>
>>
>> Bloomberg uses Piecewise Linear (Simple) for the interpolation. I
>> changed that to Piecewise Linear (Continuous) but the fixings still
>> don't match. I also changed to PiecewiseYieldCurve<ZeroYield, Linear>
>> in my own code after confirming with Bloomberg they are interpolating
>> the term structure, not the discount factors or the market rates.
>>
>>
>>
>> I've used Google to search for answers to this, and looked at the
>> examples and unit tests in the QuantLib code. Is there anywhere I've
>> missed in my searches?
>>
>>
>>
>> Thanks,
>>
>> Dale Smith, Ph.D.
>>
>> Senior Financial Quantitative Analyst
>>
>> Risk & Compliance
>>
>> Fiserv.
>>
>> 107 Technology Park
>>
>> Norcross, GA 30092
>>
>> Office: 678-375-5315
>>
>> Mobile: 678-982-6599
>>
>> Mail: [hidden email]
>>
>> www.fiserv.com
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> -
>> --------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure 
>> _______________________________________________
>> QuantLib-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>



------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users