Hi all,
I've recently started using QuantLibXL and I'm familiarizing with it. At this moment I'm trying to understand how to compute sensitivities and I'd like to ask a few questions: 1. In QuantLib's source code I read that the bucketAnalysis function (in its various incarnations) calculates and returns both Delta and Gamma (provided that SensitivityAnalysis == Centered). However, QuantLibXL's function qlBucketAnalysis seems to return only Delta. I expanded the function call into a matrix of cells, each row corresponds to a quote, I was expecting to see two columns, with the Delta on the first column and the Gamma on the second. Instead, no matter how much I expand the matrix, I get always the same column repeated over and over. Is that intentional or is it a bug? If it is intentional, how can I get the Gamma? 2. What is the Parameters argument in qlBucketAnalysisDelta and qlBucketAnalysisDelta2? The documentation doesn't explain. Reading the source code I see that it must be a vector of quotes. I can't make sense of that. The first argument (SimpleQuote) is the quote which I'm calculating the sensitivity with respect to. What are these other quotes for? I also see that this function doesn't take instruments anywhere among its arguments. So does it calculate the sensitivity of what? 3. What is the "BPS" (basis point sensitivity) calculated by qlSwapLegBPS? I was supposing it must be the Delta calculated by shifting the yield curve up and down by 1 basis point (discount curve or forward curve or both?). But the numbers I get from it are very different from the Delta that I computed by shifting the curve by hand. Thank you Gerardo <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head></head> <body> <div style="font-family:Calibri;font-size:10px"> Banca Profilo S.p.A. Corso Italia, 49 - 20122 Milano - Tel. 02 58408.1, Fax 02 5831 6057 Capitale Sociale Euro 136.794.106,00 i.v. Iscrizione al Registro Imprese di Milano, C.F. e P.IVA 09108700155 - [hidden email] Iscritta all’Albo delle Banche e dei Gruppi bancari Aderente al Fondo Interbancario di Tutela dei depositi Aderente al Conciliatore Bancario Finanziario e all’Arbitro Bancario Finanziario Appartenente al Gruppo bancario Banca Profilo e soggetta all’attività di direzione e coordinamento di Arepo BP S.p.A. DISCLAIMER: The information transmitted may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. </div> </body> </html> ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Hi Gerardo
> 1. In QuantLib's source code I read that the bucketAnalysis function (in > its various incarnations) calculates and returns both Delta and Gamma > (provided that SensitivityAnalysis == Centered). However, QuantLibXL's > function qlBucketAnalysis seems to return only Delta. yes it does. qlBucketAnalysis calculates the sensitivity analysis for the aggregated NPV (i.e. a single number) of a collection of Instruments with respect to a matrix of quotes. As such it should return a matrix of deltas and a matrix of gammas, but being limited by gensrc/Excel to have a matrix return it just returns the delta matrix. > I expanded the > function call into a matrix of cells, each row corresponds to a quote, I > was expecting to see two columns, with the Delta on the first column and > the Gamma on the second. Instead, no matter how much I expand the > matrix, I get always the same column repeated over and over. This must be because your input is a vector of quotes, so the result is a degenerate one column matrix, i.e. a vector. The duplication is just Excel usual confusing behavior when dealing with multidimensional output ranges larger than the actual multidimensional result. > how can I get the Gamma? It would be a quick hack to duplicate the function to have the gamma matrix, but this would require two full evaluations. A better way would be to have a different function limited to an input vector of Quotes: in this case the delta would be just a vector and a second Gamma vector could be added side by side as you were expecting. The third best solution might be to have a persistent object in QLAddin which would lazily calculate both delta and gamma and provide two separated inspectors for delta and gamma, independently from their dimension. I was planning to do the latter, but since the current implementation completely satisfy my current needs this got low on my to-do list > 2. What is the Parameters argument in qlBucketAnalysisDelta and > qlBucketAnalysisDelta2? It is used to calculate the sensitivity of some model parameters to market quotes. The usual scenario is to calibrate a model's parameters in a given market scenario and then tweak the market quotes to inspect the parameters' sensitivity. This is similar to NPV sensitivity, but where NPV is just one number, parameters are usually more than one. qlBucketAnalysisDelta calculates the sensitivity of a vector of Parameters to a single Quote, returning a vector. In this case a gamma column could be added, but frankly I don't know why I exported that function since the single quote scenarios is really unrealistic. qlBucketAnalysisDelta2 calculates the sensitivity of a vector of Parameters to a vector of Quote, returning a matrix. Here we have the same problem for Gamma as in qlBucketAnalysis: even if Quotes are just a vector, Parameters are already making up for a second dimension, the result being a matrix. > The documentation doesn't explain. Reading the > source code I see that it must be a vector of quotes. I can't make sense > of that. you're right. The function should have been at least called qlNPVBucketAnalysis and qlParametersBucketAnalysis. Point is that I would love to revisit them implementing an object which would provide result persistance, solving this way the delta/gamma result issue. Besides I would love to implement something like a Quote wrapper for the NPV of a collection of Instruments; this way only the Parameters Sensitivity Analysis should be provided, consolidating the amount of code. > 3. What is the "BPS" (basis point sensitivity) calculated by > qlSwapLegBPS? the change in the leg NPV due to a basis point increase of its coupons > I was supposing it must be the Delta calculated by > shifting the yield curve up and down by 1 basis point a 1bp change in the curve is not well defined: is it a change in its market quotes, its instantaneous forward rates, its zero rates, etc. ? Whatever you are referring to, in no way such a change would generally imply the same change in the coupons being payed on a given leg hope it helps ciao -- Nando ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |