Asset swap spread calculation

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

Asset swap spread calculation

MDecau
Hello!

I am trying to get the asset swap spread of a bond.
I set up the bond, an Ibor curve, and an asset swap with these two elements.
After setting the pricing engine, I called the fairSpread function on the new asset swap.

I did all of these with real market data (from Bloomberg), in order to test my results. Everything works fine (the bond valuation), except the asset swap spread, which is very far from the one provided by Bloomberg (2.994% with Quantlib and 0.118% with Bloomberg).

Because every results on the bond is good, my mistake has to be in the set up of the asset swap. Or maybe the fairSpread function does not do what I think. I tried to go inside the code of Quantlib, but it is very complex, I have a hard time to understand it.

I can't figure out what is wrong with it, I thought about it for a while and I am really stuck. It may be an easy thing to do, but I'm still learning. What could I do to fix this? How can I calculate the asset swap spread of a bond?

Thank you for your help
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
Hi,

can you post the code or spreadsheet you used for the calculation ?

best regards
Peter


On 10 April 2015 at 14:00, MDecau <[hidden email]> wrote:

> Hello!
>
> I am trying to get the asset swap spread of a bond.
> I set up the bond, an Ibor curve, and an asset swap with these two elements.
> After setting the pricing engine, I called the fairSpread function on the
> new asset swap.
>
> I did all of these with real market data (from Bloomberg), in order to test
> my results. Everything works fine (the bond valuation), except the asset
> swap spread, which is very far from the one provided by Bloomberg (2.994%
> with Quantlib and 0.118% with Bloomberg).
>
> Because every results on the bond is good, my mistake has to be in the set
> up of the asset swap. Or maybe the fairSpread function does not do what I
> think. I tried to go inside the code of Quantlib, but it is very complex, I
> have a hard time to understand it.
>
> I can't figure out what is wrong with it, I thought about it for a while and
> I am really stuck. It may be an easy thing to do, but I'm still learning.
> What could I do to fix this? How can I calculate the asset swap spread of a
> bond?
>
> Thank you for your help
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Sure. But I should first let you know that I am not using the real QuantLib, but QLNet instead, which is just the C# version of Quantlib. I guess you're also familiar with it, it is almost always exactly the same structures and function names.

Here is a link to download the code of my small test program (only 4 small files, but don't forget to add a reference to QLNet dll) : Bond_pricer_test.zip

And here is the part that does not work (at the far end of the FixedRateBondProcess class) :

            IPricingEngine assetSwapEngine = new DiscountingSwapEngine(Program.currentYieldCurves.discountingTermStructure);

            AssetSwap assSwap = new AssetSwap(true, fixedRateBond, fixedRateBond.cleanPrice(yield, dc, Compounding.Compounded, Frequency.Annual), new Euribor6M(Program.currentYieldCurves.discountingTermStructure), 0);
           
            assSwap.setPricingEngine(assetSwapEngine);

            Console.WriteLine("Asset Swap Spread = " + assSwap.fairSpread());
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
ok, which "market price" do you enter in your application and what do
you get then for yield, clean price, dirty price, asset swap spread ?

On 10 April 2015 at 17:48, MDecau <[hidden email]> wrote:

> Sure. But I should first let you know that I am not using the real QuantLib,
> but QLNet instead, which is just the C# version of Quantlib. I guess you're
> also familiar with it, it is almost always exactly the same structures and
> function names.
>
> Here is a link to download the code of my small test program (only 4 small
> files, but don't forget to add a reference to QLNet dll) :
> Bond_pricer_test.zip
> <http://quantlib.10058.n7.nabble.com/file/n16459/Bond_pricer_test.zip>
>
> And here is the part that does not work (at the far end of the
> FixedRateBondProcess class) :
>
>             IPricingEngine assetSwapEngine = new
> DiscountingSwapEngine(Program.currentYieldCurves.discountingTermStructure);
>
>             AssetSwap assSwap = new AssetSwap(true, fixedRateBond,
> fixedRateBond.cleanPrice(yield, dc, Compounding.Compounded,
> Frequency.Annual), new
> Euribor6M(Program.currentYieldCurves.discountingTermStructure), 0);
>
>             assSwap.setPricingEngine(assetSwapEngine);
>
>             Console.WriteLine("Asset Swap Spread = " +
> assSwap.fairSpread());
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16459.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Sorry for my late answer, the week-end was pretty busy.

As a market price, I entered 102.283, which was the market price of this bond on 7th April. Of course, I also entered 07/04/2015 as a trading date (first line of the command prompt) and the yield curve of this date hard coded in the program.

And I got these outputs :
Yield : 0.21102%
Clean price : 102.283000507 (I don't know why I don't have exactly 102.283)
Dirty price : 103.724096
Asset swap spread : 2.99384%

As I said in my first message, all of them are the same than Bloomberg's but the asset swap spread which is 2.9% instead of 0.118%.

Here are some screenshots that I took on 7th April :
YAS.PNG
Output.PNG

Again, thank you for your help!
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
I set up your example (except I use a simplified yield term structure,
just flat @8bp) and get 13bp, which is quite close to BBG. There are
some details one should pay attention to (like asset swaps are OIS
discounted, the front stub period on the float leg is interpolated in
the index), but you are far off. For further investigation, can you
extract the cashflows from the two legs of your swap ?

On my side I get:

fixed leg
July 20th, 2015;2
July 20th, 2016;2
July 20th, 2016;100

float leg
April 9th, 2015;3.7241
July 20th, 2015;0.0223587
January 20th, 2016;0.0403369
July 20th, 2016;0.0398984
July 20th, 2016;100

Which version of QuanLib is the basis for your dot-net-thing ?

Best regards
Peter


On 13 April 2015 at 08:59, MDecau <[hidden email]> wrote:

> Sorry for my late answer, the week-end was pretty busy.
>
> As a market price, I entered 102.283, which was the market price of this
> bond on 7th April. Of course, I also entered 07/04/2015 as a trading date
> (first line of the command prompt) and the yield curve of this date hard
> coded in the program.
>
> And I got these outputs :
> Yield : 0.21102%
> Clean price : 102.283000507 (I don't know why I don't have exactly 102.283)
> Dirty price : 103.724096
> Asset swap spread : 2.99384%
>
> As I said in my first message, all of them are the same than Bloomberg's but
> the asset swap spread which is 2.9% instead of 0.118%.
>
> Here are some screenshots that I took on 7th April :
> YAS.PNG <http://quantlib.10058.n7.nabble.com/file/n16461/YAS.PNG>
> Output.PNG <http://quantlib.10058.n7.nabble.com/file/n16461/Output.PNG>
>
> Again, thank you for your help!
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16461.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Three of my floating leg cash flows are different from yours. They are :

fixed leg
July 20th, 2015;2
July 20th, 2016;100
July 20th, 2016;2

float leg
April 9th, 2015;3.7240964
July 20th, 2015;0.0343361 (different from your 0.0223587)
January 20th,0.0148592 (different from your 2016;0.0403369)
July 20th, 2016;0.0587326 (different from your 0.0398984)
July 20th, 2016;100

And I'm not really sure of the version of QuantLib on which QLNet is based. I think it was developped in 2009, but every commit on QuantLib is replicated shortly on QLNet, which makes it pretty comprehensive.
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
I don't think that these differences are serious. What about the float
leg bps and swap npv ?

fair spread     0.0013154
float leg bps   0.0129909
npv             -0.170883

On 13 April 2015 at 11:21, MDecau <[hidden email]> wrote:

> Three of my floating leg cash flows are different from yours. They are :
>
> fixed leg
> July 20th, 2015;2
> July 20th, 2016;100
> July 20th, 2016;2
>
> float leg
> April 9th, 2015;3.7240964
> July 20th, 2015;0.0343361 (different from your 0.0223587)
> January 20th,0.0148592 (different from your 2016;0.0403369)
> July 20th, 2016;0.0587326 (different from your 0.0398984)
> July 20th, 2016;100
>
> And I'm not really sure of the version of QuantLib on which QLNet is based.
> I think it was developped in 2009, but every commit on QuantLib is
> replicated shortly on QLNet, which makes it pretty comprehensive.
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16463.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
I got the same float leg bps, but my swap npv is (very) different : -3.8893.
And my fair spread is of course different (0.029938), since it is the initial problem.
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
sorry to ask again, you have this flow here

April 9th, 2015;3.7240964

?

Maybe it is because you set the reference date for the yts to
"settlementDate" (is this 09-04-2015 ?), so this flow is missing in
the swap NPV ?

           YieldTermStructure depoSwapTermStructure = new
PiecewiseYieldCurve<Discount, LogLinear>(
                            Program.currentMarketData.settlementDate,
depoSwapInstruments,
                            termStructureDayCounter,
                            new List<Handle<Quote>>(),
                            new List<Date>(),
                            tolerance);

Can you try to change "settlementDate" to "tradeDate" (or whatever
variable that is set to the 07-04-2015) ?


On 13 April 2015 at 12:34, MDecau <[hidden email]> wrote:

> I got the same float leg bps, but my swap npv is (very) different : -3.8893.
> And my fair spread is of course different (0.029938), since it is the
> initial problem.
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16465.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Yes I have this flow. But I understand why you ask that: it's true that my NPV looks just like yours if we remove this cash flow. And it's weird, because the NPV should be the sum of all discounted cash flows, which should be :
floating leg NPV - fixed leg NPV = 103.5613 - 103.7229 = -0.16
These leg NPV are outputs from my program, and they seem consistent. But my swap NPV is still -3.8893.
Or maybe I am not using the right function to get my asset swap NPV. I used the function Instrument.NPV(). Am I wrong?

The settlement date is indeed 09-04-2015.

I tried to change the settlement date to 07-04-2015 as you suggested, but it did not change a thing.
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
no sorry, you should only change the date in the YieldTermStructure
constructor. Just remove marketData.settlementDate and plug in
Date(7,Apr,2015) directly (or the C# equivalent), does that work ?

On 13 April 2015 at 14:37, MDecau <[hidden email]> wrote:

> Yes I have this flow. But I understand why you ask that: it's true that my
> NPV looks just like yours if we remove this cash flow. And it's weird,
> because the NPV should be the sum of all discounted cash flows, which should
> be :
> floating leg NPV - fixed leg NPV = 103.5613 - 103.7229 = -0.16
> These leg NPV are outputs from my program, and they seem consistent. But my
> swap NPV is still -3.8893.
> Or maybe I am not using the right function to get my asset swap NPV. I used
> the function Instrument.NPV(). Am I wrong?
>
> The settlement date is indeed 09-04-2015.
>
> I tried to change the settlement date to 07-04-2015 as you suggested, but it
> did not change a thing.
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16467.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Sorry, it was not clear but that's what I meant, I only change the settlement date in the constructor. And it did not work.
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
oh no sorry, by settlement date you actually mean trade date (looking
at Program.cs), right ? Not like settlement = trade + 2 good days or
something. I misunderstood that. Ok, that changes things again.

But: do you set QL's global evaluation date somewhere ? In C++ this
would be a statement

Settings::instance().evaluationDate() = settlementDate



On 13 April 2015 at 14:50, MDecau <[hidden email]> wrote:

> Sorry, it was not clear but that's what I meant, I only change the settlement
> date in the constructor. And it did not work.
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16469.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
This post was updated on .
Yes, that's true, I'm not using the right variable names in Program.cs and in MarketData.cs (for the pSettlementDate parameter). It should be TradeDate instead of SettlementDate at several places.

I think that I do
Settings::instance().evaluationDate() = settlementDate
in MarketData.cs through :
todaysDate = calendar.advance(settlementDate, -fixingDays, TimeUnit.Days);
Settings.setEvaluationDate(todaysDate);
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
yes, but here you are shifting the date backwards again (fixingDays is
2 ?), don't you ?

Maybe you can just output the different dates to be sure, that

trade date  = global eval date = yts reference date = 07-04-0215
settlement date = trade date + 2bd

?

You could also do the setting "includeReferenceDateCashFlows = true"
to include the missing flow in the NPV, but I guess it's better if you
go through the dates first.



On 13 April 2015 at 15:13, MDecau <[hidden email]> wrote:

> Yes, that's true, I'm not using the right variable names in Program.cs and in
> MarketData.cs (for the pSettlementDate parameter). It should be TradeDate
> instead of SettlementDate at several places.
>
> I think that I do Settings::instance().evaluationDate() = settlementDate in
> MarketData.cs through :
> todaysDate = calendar.advance(settlementDate, -fixingDays, TimeUnit.Days);
> Settings.setEvaluationDate(todaysDate);
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16471.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
This post was updated on .
Yes I shift it backward. Is that wrong? I just did it because it was done that way in the QLNet example (here). I am not sure of what this global evaluationDate does actually.

So I tried to output the dates. I got :
trade date = 07-04-2015
global eval date = 07-04-2015
yts ref date = 07-04-2015
settlement date = 09-04-2015

However, I have two yield term structure. bondDiscountingTermStructure and depoSwapTermStructure. When I hard code 7-4-2015 in depoSwapTermStructure as you said, it does not have any effect. But if I do it in bondDiscountingTermStructure, it changes my swap NPV and my swap spread to the right values.

Did you mean to change the date in bondDiscountingTermStructure instead of depoSwapTermStructure?
Then, should I change it to trade date in both yts or just in the first one?

And I also tried to set includeReferenceDateCashFlows to true. It also worked (with bondDiscountingTermStructure reference date on 09-04-2015).
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
no, the dates look plausible.

It's a bit confusing, because your discounting and depo-swap
termstructures look similar and the discounting ts is used for the
Euribor index.

But yes, the reference date should be 07-04-2015 in both, then you
will get all flows > 07-04-2015 in your NPV by default. Or if you set
includeReferenceDateCashFlows to true, you will get all flows >=
07-04-2015.

You can also use the 09-04-2015 for the termstructures, but then you
have to include the reference date cash flows, otherwise you will miss
the upfront payment from the asset swap.

best regards
Peter

On 13 April 2015 at 15:48, MDecau <[hidden email]> wrote:

> Yes I shift it backward. Is that wrong? I just did it because it was done
> that way in the example. I am not sure of what this global evaluationDate
> does actually.
>
> So I tried to output the dates. I got :
> trade date = 07-04-2015
> global eval date = 07-04-2015
> yts ref date = 07-04-2015
> settlement date = 09-04-2015
>
> However, I have two yield term structure. bondDiscountingTermStructure and
> depoSwapTermStructure. When I hard code 7-4-2015 in depoSwapTermStructure as
> you said, it does not have any effect. But if I do it in
> bondDiscountingTermStructure, it changes my swap NPV and my swap spread to
> the right values.
>
> Did you mean to change the date in bondDiscountingTermStructure instead of
> depoSwapTermStructure?
> Then, should I change it to trade date in both yts or just to the first one?
>
> And I also tried to set includeReferenceDateCashFlows to true. It also
> worked (with bondDiscountingTermStructure reference date on 09-04-2015).
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16473.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

MDecau
Yes you are right, I mixed my term structures together, with small consequences because they are actually equals. I could actually use just one, both for ibor and for discounting.

Anyway, thank you so much for your help, it is very nice from you.

There is one last thing I don't understand : in the example provided with QLNet (here), they price a bond with a term structure reference date set to the settlement date, and not the trade date. They don't either include the reference date cash flows.
There is no effect on their program because they don't try to calculate any asset swap with it, but shouldn't they use the trade date for the reference date of their term structures? I think this example has an error there, right?
Reply | Threaded
Open this post in threaded view
|

Re: Asset swap spread calculation

Peter Caspers-4
no, not necessarily, an NPV as of +2 business days in the future does
make sense as well. Actually if you trade a bond or a swap you
_should_ calculate the amount that is settled two days later this way,
it is some kind of a forward-npv if you want. But you have to be
careful, what flows are included in your NPV then. In QuantLib you can
also use the npvDate (which can be set in the DiscountingSwapEngine
for example) to calculate a forward npv without moving the yield term
structure's reference date. Independent of that there is the
settlement date with which you can control what flows are considered
part of the NPV. If you don't specify the npvDate and the
settlementDate they are both set to the yield term structures
reference date.
Peter

On 13 April 2015 at 16:22, MDecau <[hidden email]> wrote:

> Yes you are right, I mixed my term structures together, with small
> consequences because they are actually equals. I could actually use just
> one, both for ibor and for discounting.
>
> Anyway, thank you so much for your help, it is very nice from you.
>
> There is one last thing I don't understand : in the example provided with
> QLNet ( here
> <https://github.com/ammachado/QLNet/blob/master/QLNet/Examples/Bonds/Bonds.cs>
> ), they price a bond with a term structure reference date set to the
> settlement date, and not the trade date. They don't either include the
> reference date cash flows.
> There is no effect on their program because they don't try to calculate any
> asset swap with it, but shouldn't they use the trade date for the reference
> date of their term structures? I think this example has an error there,
> right?
>
>
>
> --
> View this message in context: http://quantlib.10058.n7.nabble.com/Asset-swap-spread-calculation-tp16457p16475.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
12