Rank: 1513 based on 85 downloads (last 30 days) and 3 files submitted
photo

Mark Whirdy

E-mail
Company/University
Pioneer Investments

Personal Profile:

http://www.linkedin.com/pub/mark-whirdy/6/a51/159


 

Watch this Author's files

 

Files Posted by Mark Whirdy View all
Updated   File Tags Downloads
(last 30 days)
Comments Rating
27 Jun 2013 Screenshot Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy blackscholes, impliedvolatility, impvol, finance, quant, quantitative 43 7
  • 5.0
5.0 | 3 ratings
28 May 2013 Screenshot Merton Jump Diffusion Option Price (Matrixwise) Calculates Merton's 1976 Jump Diffusion Model by Closed Form Matrixwise Calculation for Full Surface Author: Mark Whirdy merton, options, finance, quant finance, stochastic model, levy model 21 1
  • 5.0
5.0 | 1 rating
14 May 2013 Screenshot Merton Structural Credit Model (Matrixwise Solver) Matrixwise Calculation Firm Asset Value, Volatility, Debt Value, Spread, Default Prob, Exp-Recovery Author: Mark Whirdy credit, merton, structural credit mod..., finance, quantitative finance, structural model 21 7
  • 5.0
5.0 | 2 ratings
Comments and Ratings by Mark Whirdy View all
Updated File Comments Rating
02 Oct 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy

Hi Gabriele
1) I haven't come across this actually
2) Your explanation sounds correct
3) I'd be interested in seeing the values for S,K,T,q & P which cause this?

Perhaps you can track down the particular combination which causes it to occur? Use the "Stop on Warning" option (if u have 2012b)

One total guess would be that if you are using Carr-Madan FFT pricing, short-dated deep-OTM expiries can result in negative prices.

30 Sep 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy

Yes, you're right Gabriele, & thanks for your comments. I've made this & other modifications since actually.

You should, I find, avoid using the repmat function and use "indexing-replication" which should shave a few milliseconds off this

q ---> q_mat = repmat(q,1,size(P,2))

q ---> q_mat = q(:,ones(1,h))

15 Jun 2014 Risk-neutral density recovery via spectral analysis Implementation of Monnier (2013) "RND recovery via spectral analysis" Author: Matthias Held

Hi Matthias

Some nice work here, just looking through it all now. One small suggestion is to replace your complex "i" with "1i" which will speed things up marginally.

21 Apr 2014 Merton Structural Credit Model (Matrixwise Solver) Matrixwise Calculation Firm Asset Value, Volatility, Debt Value, Spread, Default Prob, Exp-Recovery Author: Mark Whirdy

There is a bug with Microsoft's SDK 7.1 which Matlab have provided a troubleshoot for at

http://www.mathworks.co.uk/matlabcentral/answers/101105-how-do-i-install-microsoft-windows-sdk-7-1

Hope this helps

07 Apr 2014 Merton Structural Credit Model (Matrixwise Solver) Matrixwise Calculation Firm Asset Value, Volatility, Debt Value, Spread, Default Prob, Exp-Recovery Author: Mark Whirdy

Hi Joacim - possible incompatability between the compiler you installed and the version of matlab?

http://www.mathworks.co.uk/support/sysreq/previous_releases.html

Comments and Ratings on Mark Whirdy's Files View all
Updated File Comment by Comments Rating
02 Oct 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy Mark Whirdy

Hi Gabriele
1) I haven't come across this actually
2) Your explanation sounds correct
3) I'd be interested in seeing the values for S,K,T,q & P which cause this?

Perhaps you can track down the particular combination which causes it to occur? Use the "Stop on Warning" option (if u have 2012b)

One total guess would be that if you are using Carr-Madan FFT pricing, short-dated deep-OTM expiries can result in negative prices.

02 Oct 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy Gabriele Pompa

Well, in that code I didn't care that much to efficiency since it belonged to a pre-processing step o my data.
But thank for that index trick! I'll use it.

However i'm writing here to ask if you ever experienced a crash in running the code (of course extreme situations). However I did:

--------------------------
Error using erf
Input must be real and full.

Error in calcBSImpVol>fcnN (line 191)
p=0.5*(1.+erf(x./sqrt(2)));

------------------------------

Well, after some backward induction, I came to the conclusion that the problem is in the implementation of the symmetry property of the D domain (eq. (13) and (14) of Li 2006):

v2 = fcnv(p,m,n,i,j,-x,max(exp(x).*c + 1 -exp(x),0)); % Reflection for D+ Domain (x>1)

The fact is that, due to some approximation error, the reflected normalized price c(-x,v) mat become negative, therefore you'll get a complex result in evaluating the sqrt(c) in the rational function "fcnv" definition (eq (19) Li's 2006). Therefore these spurious complex numbers propagate to "v", and then to "sigma" and therefore to both "d1fcn" and "d2fcn", which enter as argument of "fcnN" and finally to the error function "erf".

I fixed this issue naively with a max(.,0), substituting as follows v2:

v2_fixed = fcnv(p,m,n,i,j,-x,max(exp(x).*c + 1 -exp(x),0)); % Reflection for D+ Domain (x>1)

but I was wondering I you can comment:

1) have ever experienced this situation?
2) do you think my explanation is correct?
3) do you think the way I've fixed the problem can be improved (at least in efficiency)

Grazie ;-)

30 Sep 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy Mark Whirdy

Yes, you're right Gabriele, & thanks for your comments. I've made this & other modifications since actually.

You should, I find, avoid using the repmat function and use "indexing-replication" which should shave a few milliseconds off this

q ---> q_mat = repmat(q,1,size(P,2))

q ---> q_mat = q(:,ones(1,h))

30 Sep 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy Gabriele Pompa

Dear Mark, your code was very helpful for me, so thanks a lot!

One little (very little!) possible extension.
With a small modification of your code it is possible to deal also with vectorial (r,q) pairs (vectors of dim. m = number of maturities),
which is a rather realistic case in some pricing problems.

To do so:

----------------------------------------------

1) reshape your [mx1] (r,q) vectors as [mxn] (r_mat, q_mat) matrices (P, is [mxn] matrix of Option Prices):

q ---> q_mat = repmat(q,1,size(P,2))
r ---> r_mat = repmat(r,1,size(P,2))

2) in calcBSImpVol, replace all (r,q) occurrences in lines 148-to-154 with ( r(C), q(C) )

3) use calcBSImpVol with (r_mat, q_mat) as input.

---------------------------------------------

You can easily check it repeating constants (r,q) pairs as to form [mxn] (r_mat, q_mat) matrices:

q_mat = repmat(repmat(q,[size(P,1),1]),1,size(P,2));
r_mat = repmat(repmat(r,[size(P,1),1]),1,size(P,2));

and check whether calcBSImpVol(..., r, q) and calcBSImpVol(..., r_mat, q_mat) return the same sigma matrix of implied volatilities, as they should.

In playing this way, the execution time increased of 10^-2 sec only (well, "only" is my personal point of view).

30 Sep 2014 Fast Matrixwise Black-Scholes Implied Volatility Calculates Black-Scholes Implied Volatility for Full Surface at High Speed Author: Mark Whirdy Gabriele Pompa

Very fast and reliable: 10^-1 sec on a 2009 laptop with a 10 maturities x 118 strikes surface with possibly NaN values in the price matrix P (corresponding to non quoted options)

Very accurate: greater domain of convergence than both blsimpv and impvol

Contact us