Serving the Quantitative Finance Community

 
User avatar
yyang
Topic Author
Posts: 0
Joined: July 23rd, 2014, 5:19 pm

SSVI calibration

June 30th, 2015, 7:17 pm

Anyone implemented SSVI? With [$]\phi(\theta) = \frac{\eta }{\theta^\gamma(1 + \theta)^{1-\gamma}}[$],[$]constraints: \\\theta \geq 0 \\|\rho| \leq 1 \\\eta \geq 0 \\0 < \gamma < 1 \\\eta (1 + |\rho|) \leq 2[$]I failed to fit a v shaped settle curve. Moneyness: [-0.36797873916671708, -0.34928660615456453, -0.33093746748636804, -0.31291896198368974, -0.29521938488428878, -0.28648570491553421, -0.27782764217241962, -0.26924389848102814, -0.26073320881311951, -0.25229434016725488, -0.2439260904967383, -0.23562728768204319, -0.22739678854552772, -0.2192334779063668, -0.21113626767374744, -0.20310409597648318, -0.19513592632730631, -0.18723074682019303, -0.17938756935916714, -0.1716054289171122, -0.16388338282320189, -0.15622051007763277, -0.14861591069241348, -0.14106870505703056, -0.13357803332787296, -0.12614305484035487, -0.11876294754273233, -0.11143690745065943, -0.10416414812157965, -0.096943900148092579, -0.089775410669480041, -0.082657942900616066, -0.075590775677523619, -0.068573203018876955, -0.061604533702783619, -0.054684090858209841, -0.047811211570447806, -0.040985246500047944, -0.034205559514669186, -0.027471527333325113, -0.020782539182528505, -0.01413799646385993, -0.0075373124325078733, -0.00097991188634880119, 0.0055347691348448915, 0.01200728364046235, 0.018438173970752772, 0.024827972069523783, 0.031177199748182526, 0.037486368941447246, 0.043755981955042635, 0.049986531705678711, 0.056178501953599788, 0.062332367527978043, 0.068448594545414132, 0.074527640621796315, 0.080569955077758937, 0.086575979137970799, 0.092546146124474621, 0.09848088164428917, 0.10438060377147745, 0.11024572322387553, 0.11607664353466873, 0.12187376121899463, 0.12763746593574471, 0.13336814064472974, 0.13906616175936745, 0.14473189929504482, 0.15036571701330081, 0.16153901761142606, 0.172588853798011, 0.18351792433020128, 0.19432884043441689]vols: [0.018014263802804256, 0.016294578914896427, 0.014688592305810971, 0.013190824080912109, 0.011796151245960493, 0.011135965540629318, 0.01049978065802043, 0.0098870450018931633, 0.0092972246851663505, 0.0087298029000756287, 0.0081842793219189004, 0.0076601695451940033, 0.0071570045510267371, 0.0066743296474972031, 0.006211706652791622, 0.0057687082774016416, 0.0053449229010205501, 0.0049399514916578929, 0.0045534078318995716, 0.0041849181930536175, 0.003834121040299579, 0.0035006667703790973, 0.0031842174840650255, 0.0028844467963887927, 0.0026010396887194676, 0.0023336924081190091, 0.0020821124212325711, 0.0018460184324355835, 0.0016251404794349188, 0.001419220124242669, 0.0016407188380974426, 0.0014186198367277724, 0.0012126970235738265, 0.0010227792930380271, 0.00084872216117601546, 0.00069041265371795483, 0.00054777632295492857, 0.0004207876726299803, 0.00030948636866974635, 0.00027499513105685883, 0.00021135804374117575, 0.0001778697044878179, 0.00017138384712163396, 0.00017079784782150249, 0.00017262983219071588, 0.00019043131949690644, 0.00020204804734892681, 0.00023143779737538152, 0.00026203360699471838, 0.00035736359165024017, 0.00046454100158228027, 0.00058299543081855964, 0.00071223627963669779, 0.00061414951200253513, 0.00073132505590046623, 0.00085731711078173103, 0.00099188682781536919, 0.0011348084397989945, 0.001285867602354345, 0.0014448600831742197, 0.0016115907048271357, 0.0017858724768095163, 0.0019675258718129451, 0.0021563782139898359, 0.002352263155574312, 0.0025550202242794568, 0.0027644944281222487, 0.0029805359073842071, 0.0032029996257106515, 0.0036666361221750596, 0.0041543298055406255, 0.0046650696626793203, 0.0051979000987817572]I got [ 2.12905047e-03, -2.71420645e-01, 1.43065784e+00, 1.12364192e-04] for [theta, rho, eta, gamma]
 
User avatar
Quantuplet
Posts: 8
Joined: July 12th, 2014, 9:14 am

SSVI calibration

July 1st, 2015, 6:16 am

Hi,To my mind SSVI should be used for fitting succesive smiles (i.e. a surface) and not a single smile. Don't get me wrong, of course you can theoretically apply it for a single smile, but why not choose SVI which is more malleable (5 dof instead of 4)?Anyway I have an implementation so I can give you my results as soon as I find it.Out of curiosity, what are your initial guesss on the various parameters? Plus does your moneyness corresponds to a log forward moneyness? And what it the time to expiry?
Last edited by Quantuplet on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

SSVI calibration

July 1st, 2015, 6:20 am

QuoteOut of curiosity, what are your initial guesss on the various parameters? And the specific optimizer?
 
User avatar
Quantuplet
Posts: 8
Joined: July 12th, 2014, 9:14 am

SSVI calibration

July 1st, 2015, 6:45 am

QuoteOriginally posted by: CuchulainnQuoteOut of curiosity, what are your initial guesss on the various parameters? And the specific optimizer?Indeed! And I assume these are not volatility figures but rather total variances. Except if you are looking at a very non volatile asset.Plus, I plotted your data and there seems to be a discontinuity between moneyness -0.09694 and -0.08978 as well as between 0.05618 and 0.06141.What if you clarified the situation before we can be of any help?
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

SSVI calibration

July 1st, 2015, 7:45 am

QuoteOriginally posted by: QuantupletQuoteOriginally posted by: CuchulainnQuoteOut of curiosity, what are your initial guesss on the various parameters? And the specific optimizer?Indeed! And I assume these are not volatility figures but rather total variances. Except if you are looking at a very non volatile asset.Plus, I plotted your data and there seems to be a discontinuity between moneyness -0.09694 and -0.08978 as well as between 0.05618 and 0.06141.What if you clarified the situation before we can be of any help?'my' data??
 
User avatar
Quantuplet
Posts: 8
Joined: July 12th, 2014, 9:14 am

SSVI calibration

July 1st, 2015, 7:56 am

Nope sorry Cuch! Quoted you to second your argument, then actually responded to the op. :)
Last edited by Quantuplet on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

SSVI calibration

July 1st, 2015, 8:04 am

QuoteOriginally posted by: QuantupletNope sorry Cuch quoted you to second you argument then actually responded to the op. :)No problem, it was my bad :). I mistook you for OP.Actually, I attended Jim Gatheral's vol course few weeks ago. I'll look up the notes.My rationale was optimisers don't always work as we would hope.
Last edited by Cuchulainn on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Quantuplet
Posts: 8
Joined: July 12th, 2014, 9:14 am

SSVI calibration

July 1st, 2015, 8:20 am

No problem.You are right, optimisation problems are the worst. They are so touchy!But in that case, provided a sound initial guess, everything should be fine.In these situations, I tend to use BFGS (local optimiser, quasi Newton method), with bijective change of variables to integrate the constraints on the definition domain of the parameters.. and it works well.Never tried global optimisers though (genetic algortihms for instance), although they seem like an overkill for the current problem.
 
User avatar
Cuchulainn
Posts: 22926
Joined: July 16th, 2004, 7:38 am

SSVI calibration

July 1st, 2015, 8:45 am

I have a Differential Evolution (DE) algo in C++ waiting in the wings as it were. No seed needed and it is a global optimizer.Just wondering if OP has Matlab code to show or the skeleton of the algo? AFAiR Jim G. uses R.
 
User avatar
Antonio
Posts: 8
Joined: June 30th, 2004, 3:13 pm
Location: Imperial College London
Contact:

SSVI calibration

July 1st, 2015, 9:50 am

Dear Cuchulainn, Quantuplet,Jim G. does indeed use R.I personally use Python/IPython, with the L-BFGS-B constrained optimisation algorithm (http://docs.scipy.org/doc/scipy-0.15.1/ ... fgs_b.html).So far, it has been working pretty nicely.Best,
 
User avatar
Quantuplet
Posts: 8
Joined: July 12th, 2014, 9:14 am

SSVI calibration

July 1st, 2015, 11:09 am

Aha, never tried the "-B" version which handles box constraints, although I did indeed implement and use the "Limited memory" a.k.a. "L-" version.Antonio, what about constraints where say the upper bound of one parameter depends on the value of another? I found them pretty tricky to integrate except for one-to-one change of variables. Anyway, BFGS seems to be pretty popular for machine learning applications. Another popular choice is conjugate gradients, see Rasmussen's Matlab implementation which is impressive (google "minimize.m").Cuch, I also use Matlab for my prototypes (and C++ for production code). And I did code some optimisation routines myself because it is really a pain in the a** to determine what went wrong when using a black box (I am thinking of gsl here), especially since solving optimisation problems requires a large amount of fine tuning. I did try DE once, but not for such kinds of problems, how has it been working for you ?
Last edited by Quantuplet on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
yyang
Topic Author
Posts: 0
Joined: July 23rd, 2014, 5:19 pm

SSVI calibration

July 1st, 2015, 1:21 pm

QuoteOriginally posted by: QuantupletQuoteOriginally posted by: CuchulainnQuoteOut of curiosity, what are your initial guesss on the various parameters? And the specific optimizer?Indeed! And I assume these are not volatility figures but rather total variances. Except if you are looking at a very non volatile asset.Plus, I plotted your data and there seems to be a discontinuity between moneyness -0.09694 and -0.08978 as well as between 0.05618 and 0.06141.What if you clarified the situation before we can be of any help?Ah, I'm sorry for not being specific. I Hate people for doing that, yet I did it myself. :Pmoneyness: yes, it is the log forward moneyness [$]k = \ln{K/F}[$]vol: yes, this is the total implied variance [$]\omega_t = \sigma(k, t)^2 t[$]p0: [$]\theta = \sigma(0, t)^2 t[$], ATM total variance as the paper suggested[$]\rho \in (-1, 1)[$] random[$]\eta \in (0, 1)[$] random, I did not sample in[$](0, +\infty)[$] [$]\gamma \in (0, 1)[$] randomThe thing about p0 is that if SSVI's performance depend heavily on p0, isn't the model not robust?optimizer: SLSQPAlso the context of the data, this piece of data is calced from implied vols of commodity options settle prices. So far from my observation, discontinuity happens in such markets.
Last edited by yyang on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
yyang
Topic Author
Posts: 0
Joined: July 23rd, 2014, 5:19 pm

SSVI calibration

July 1st, 2015, 1:25 pm

QuoteOriginally posted by: AntonioDear Cuchulainn, Quantuplet,Jim G. does indeed use R.I personally use Python/IPython, with the L-BFGS-B constrained optimisation algorithm (http://docs.scipy.org/doc/scipy-0.15.1/ ... fgs_b.html).So far, it has been working pretty nicely.Best,Doesn't L-BFGS-B only take bounds? How would u deal with [$]\eta (1+|\rho|) \leq 2[$]? as Quantuplet indicated
Last edited by yyang on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
yyang
Topic Author
Posts: 0
Joined: July 23rd, 2014, 5:19 pm

SSVI calibration

July 1st, 2015, 1:46 pm

QuoteOriginally posted by: CuchulainnI have a Differential Evolution (DE) algo in C++ waiting in the wings as it were. No seed needed and it is a global optimizer.Just wondering if OP has Matlab code to show or the skeleton of the algo? AFAiR Jim G. uses R.Here are some stripped code from my Svi class in python. I left out the class structure here and just gave some methods that are used. self.x is the moneyness I mentioned;self.y is the total implied variance I mentioned;self.x_scaler and self.y_scaler are scalers I applied to eliminate the problem of small inputsI apply the optimization 5 time and extract the best result as my final result, but still unsuccessful.
Last edited by yyang on June 30th, 2015, 10:00 pm, edited 1 time in total.
 
User avatar
Antonio
Posts: 8
Joined: June 30th, 2004, 3:13 pm
Location: Imperial College London
Contact:

SSVI calibration

July 1st, 2015, 1:47 pm

I agree. I just check it afterwards.