swaps

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

swaps

Jens Thiel

Hello, I have some problem here:

I take the swapvaluation example and assume:

- termstructure with constant 4% rates
- 2 year swap, 4% fixed rate, spread 0.0

and get the following results:

  *** 2Y swap at 4.00%
  *** using constant 4% structure:
  2Y 4.00% NPV:               2346.70
  2Y 4.00% fair spread:          0.1228%
  2Y fair fixed rate:             3.8760%

Can somebody explain that to me?

We are also getting "weird" results from the term structures.


Jens.

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

Re: swaps

Ferdinando M. Ametrano-2
Hi Jens

you wrote:

>I take the swapvaluation example and assume:
>
>- termstructure with constant 4% rates
>- 2 year swap, 4% fixed rate, spread 0.0
>
>and get the following results:
>
>   *** 2Y swap at 4.00%
>   *** using constant 4% structure:
>   2Y 4.00% NPV:               2346.70
>   2Y 4.00% fair spread:          0.1228%
>   2Y fair fixed rate:             3.8760%
>
>Can somebody explain that to me?
I'm sorry I cannot double check your example right now, but you might be
paying too little attention to the daycount and compounding conventions.
The 4% rate of a QuantLib term structure is continuos compounding:
discount(t)=QL_EXP(0.04*t)
and the time is measured with the daycount you provided as input (usually
something smooth as act/365, not 30/360)
The 4% fixed rate of a 2 year swap is simple compounding:
cashflow=0.04*Nominal*t, and the time is measured with the daycount you
provided as input (usually 30/360)
This could easily account for the numerical results you provided.

It would be different if you bootstrapped a term structure with a 2 year
swap, 4% fixed rate and then the bootstrapped yield curve wouldn't re-price
the same swap at 4%.
This would be a real problem.

Hope this helps. If not, please let me know and I'll go into the actual
calculations

ciao -- Nando



Reply | Threaded
Open this post in threaded view
|

Re: Re: swaps

Ilja Chagalov
Hi everybody!

If you try to compute zero yields with the constant 4% term structure in the
Jens's example
(TermStructure is fed with four DepositRateHelpers: 1w, 1y, 5y, 10y and the
rate is set to 4% everywhere) ...

  for(double t=1.0; t<=9.0;t+=1.0)
   std::cout <<  "zeroYield(" << t << ") ="
    << RateFormatter::toString(depoSwapTermStructure->zeroYield(t), 4)
    << std::endl;

... you get the following results:

zeroYield(1) =3.9755%
zeroYield(2) =3.7999%
zeroYield(3) =3.7413%
zeroYield(4) =3.7121%
zeroYield(5) =3.6945%
zeroYield(6) =3.5983%
zeroYield(7) =3.5296%
zeroYield(8) =3.4781%
zeroYield(9) =3.4380%

I get similar results using act/365 day counter.
In my understanding it should be appr. =4% everywhere, but it looks
different.
Why is it so? Why is the zero yield going down as t inscreases?

Greetings,
Ilja


----- Original Message -----
From: "Ferdinando Ametrano" <[hidden email]>
To: "Jens Thiel" <[hidden email]>;
<[hidden email]>
Cc: <[hidden email]>
Sent: Wednesday, June 19, 2002 7:07 PM
Subject: Re: [Quantlib-users] swaps


> Hi Jens
>
> you wrote:
> >I take the swapvaluation example and assume:
> >
> >- termstructure with constant 4% rates
> >- 2 year swap, 4% fixed rate, spread 0.0
> >
> >and get the following results:
> >
> >   *** 2Y swap at 4.00%
> >   *** using constant 4% structure:
> >   2Y 4.00% NPV:               2346.70
> >   2Y 4.00% fair spread:          0.1228%
> >   2Y fair fixed rate:             3.8760%
> >
> >Can somebody explain that to me?
> I'm sorry I cannot double check your example right now, but you might be
> paying too little attention to the daycount and compounding conventions.
> The 4% rate of a QuantLib term structure is continuos compounding:
> discount(t)=QL_EXP(0.04*t)
> and the time is measured with the daycount you provided as input (usually
> something smooth as act/365, not 30/360)
> The 4% fixed rate of a 2 year swap is simple compounding:
> cashflow=0.04*Nominal*t, and the time is measured with the daycount you
> provided as input (usually 30/360)
> This could easily account for the numerical results you provided.
>
> It would be different if you bootstrapped a term structure with a 2 year
> swap, 4% fixed rate and then the bootstrapped yield curve wouldn't
re-price

> the same swap at 4%.
> This would be a real problem.
>
> Hope this helps. If not, please let me know and I'll go into the actual
> calculations
>
> ciao -- Nando
>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: Re: swaps

Ferdinando M. Ametrano-2
At 10:48 AM 6/20/2002 +0200, Ilja Chagalov wrote:

>If you try to compute zero yields with the constant 4% term structure in the
>Jens's example (TermStructure is fed with four DepositRateHelpers: 1w, 1y,
>5y, 10y and the
>rate is set to 4% everywhere) ...
>[...]
>... you get the following results:
>
>zeroYield(1) =3.9755%
>zeroYield(2) =3.7999%
>zeroYield(3) =3.7413%
>zeroYield(4) =3.7121%
>zeroYield(5) =3.6945%
>zeroYield(6) =3.5983%
>zeroYield(7) =3.5296%
>zeroYield(8) =3.4781%
>zeroYield(9) =3.4380%
>
>I get similar results using act/365 day counter.
>In my understanding it should be appr. =4% everywhere, but it looks
>different.
>Why is it so? Why is the zero yield going down as t inscreases?
the zero curve is decreasing since depo rates are simple compounding while
zero rate in QuantLib are continuously compounded.
I attach here a simple Excel spreadsheet with the following calculation:

   A          B              C         D                 E
-------------------------------------------------------------------
        time act/365  depo rate  discount=1/(1+C*B)  zero=LN(1/D)/B
1w            0.019         4%  0.999233465         4.00%
1y            1.000         4%  0.961538462         3.92%
5y            5.000         4%  0.833333333         3.65%
10y          10.000         4%  0.714285714         3.36%


The residual difference with the QuantLib output is because my simple
example doesn't take into account the correct (act/360) deposit daycount.
That is the time used in column D should be different (act/360) from the
time used in column E (act/365)

QuantLib::TermStructure::PiecewiseFlatForward does "interpolate" on the 4
discounts bootstrapped from the 4 deposit rates using constant
_continuously_compounded_ forward rates.
Namely:

0-1w     4.00%
1w-1y   3.92%
1y-5y    3.58%
5y-10y  3.08%

The conclusion is that 4% flat deposit rate doesn't mean flat zero/forward,
as long as the zero/forward use a different compounding rule. Besides a
flat forward curve doesn't provide a flat swap (par rate) curve

Market convention are a mess, I know, but this is not QuantLib fault ;-)

hope this helps

ciao -- Nando

PS It's sometime now I'm thinking about posting a short review of "Capital
Market Instruments: Analysis and Valuation"
by Moorad Choudhry, Didier Joannas, Richard Pereira, Rod Pienaar.
I think it is a great introductory book for someone approaching the
complexity of financial market with a strong math background, that is
someone who doesn't really need an introduction to finite difference or
stochastic processes as much as he needs an introduction to market
conventions, products, etc.



Reply | Threaded
Open this post in threaded view
|

Re: Re: swaps

Ferdinando M. Ametrano-2
In reply to this post by Ilja Chagalov
oops, I forgot the attachment. Here it is

ciao -- Nando

example.xls (18K) Download Attachment