{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# QuantLab: Black Scholes Volatility Surface\n", "### [(Go to Quant Lab)](https://israeldi.github.io/quantlab/)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Table of Contents\n", "\n", "1. [Random Numbers](#1.-Random-Numbers)\n", "2. [Plotting Random Samples](#2.-Plotting-Random-Samples)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4. Valuation\n", "#### ([Back to Top](#Table-of-Contents))\n", "\n", "### 4.1 Valuation of European call options in Black-Scholes-Merton model " ] }, { "cell_type": "code", "execution_count": 280, "metadata": {}, "outputs": [], "source": [ "from math import log, sqrt, exp\n", "from scipy import stats\n", "\n", "\n", "def bsm_call_value(S0, K, T, r, sigma):\n", " ''' Valuation of European call option in BSM model.\n", " Analytical formula.\n", "\n", " Parameters\n", " ==========\n", " S0: float\n", " initial stock/index level\n", " K: float\n", " strike price\n", " T: float\n", " maturity date (in year fractions)\n", " r: float\n", " constant risk-free short rate\n", " sigma: float\n", " volatility factor in diffusion term\n", "\n", " Returns\n", " =======\n", " value: float\n", " present value of the European call option\n", " '''\n", "\n", " S0 = float(S0)\n", " d1 = (log(S0 / K) + (r + 0.5 * (sigma ** 2)) * T) / (sigma * sqrt(T))\n", " d2 = (log(S0 / K) + (r - 0.5 * (sigma ** 2)) * T) / (sigma * sqrt(T))\n", " # stats.norm.cdf --> cumulative distribution function\n", " # for normal distribution\n", " value = (S0 * stats.norm.cdf(d1, 0.0, 1.0) -\n", " K * exp(-r * T) * stats.norm.cdf(d2, 0.0, 1.0))\n", " return value" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 4.2 Vega function and implied volatility estimation" ] }, { "cell_type": "code", "execution_count": 346, "metadata": {}, "outputs": [], "source": [ "def bsm_vega(S0, K, T, r, sigma):\n", " ''' Vega of European option in BSM model.\n", "\n", " Parameters\n", " ==========\n", " S0: float\n", " initial stock/index level\n", " K: float\n", " strike price\n", " T: float\n", " maturity date (in year fractions)\n", " r: float\n", " constant risk-free short rate\n", " sigma: float\n", " volatility factor in diffusion term\n", "\n", " Returns\n", " =======\n", " vega: float\n", " partial derivative of BSM formula with respect\n", " to sigma, i.e. Vega\n", "\n", " '''\n", " from math import log, sqrt\n", " from scipy import stats\n", " \n", " '''\n", " \n", " YOUR CODE HERE\n", " \n", " '''\n", " return\n", "\n", "def bsm_call_imp_vol(S0, K, T, r, C0, sigma_est, it=100):\n", " ''' Implied volatility of European call option in BSM model.\n", "\n", " Parameters\n", " ==========\n", " S0: float\n", " initial stock/index level\n", " K: float\n", " strike price\n", " T: float\n", " maturity date (in year fractions)\n", " r: float\n", " constant risk-free short rate\n", " sigma_est: float\n", " estimate of impl. volatility\n", " it: integer\n", " number of iterations\n", "\n", " Returns\n", " =======\n", " simga_est: float\n", " numerically estimated implied volatility\n", " '''\n", " \n", " \n", " '''\n", " \n", " YOUR CODE HERE\n", " \n", " '''\n", " \n", " return" ] }, { "cell_type": "code", "execution_count": 377, "metadata": {}, "outputs": [], "source": [ "# Parameters\n", "\n", "S0= 500\n", "K = 500\n", "T = 2\n", "r = 0\n", "sigma_est = 0.9\n", "C0= 50\n", "it = 100\n", "\n", "imp_vol = bsm_call_imp_vol(S0, K, T, r, C0, sigma_est, it)" ] }, { "cell_type": "code", "execution_count": 381, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 1.3 Plot Surface" ] }, { "cell_type": "code", "execution_count": 382, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "type": "surface", "x": [ 3.65, 18.473469387755102, 33.296938775510206, 48.1204081632653, 62.943877551020414, 77.76734693877552, 92.59081632653061, 107.41428571428573, 122.23775510204082, 137.06122448979593, 151.88469387755103, 166.70816326530613, 181.53163265306122, 196.35510204081632, 211.17857142857144, 226.0020408163265, 240.82551020408164, 255.64897959183676, 270.47244897959183, 285.2959183673469, 300.119387755102, 314.9428571428572, 329.7663265306123, 344.5897959183674, 359.41326530612247, 374.23673469387757, 389.06020408163266, 403.88367346938776, 418.7071428571429, 433.53061224489795, 448.35408163265305, 463.1775510204082, 478.0010204081633, 492.82448979591834, 507.6479591836735, 522.4714285714286, 537.2948979591837, 552.1183673469388, 566.9418367346939, 581.765306122449, 596.5887755102041, 611.4122448979592, 626.2357142857143, 641.0591836734694, 655.8826530612246, 670.7061224489796, 685.5295918367347, 700.3530612244898, 715.176530612245, 730 ], "y": [ 300, 314.2857142857143, 328.57142857142856, 342.8571428571429, 357.14285714285717, 371.42857142857144, 385.7142857142857, 400, 414.2857142857143, 428.57142857142856, 442.8571428571429, 457.1428571428571, 471.42857142857144, 485.7142857142857, 500, 514.2857142857143, 528.5714285714286, 542.8571428571429, 557.1428571428571, 571.4285714285714, 585.7142857142858, 600, 614.2857142857142, 628.5714285714287, 642.8571428571429, 657.1428571428571, 671.4285714285714, 685.7142857142858, 700, 714.2857142857143, 728.5714285714287, 742.8571428571429, 757.1428571428571, 771.4285714285714, 785.7142857142858, 800, 814.2857142857143, 828.5714285714286, 842.8571428571429, 857.1428571428572, 871.4285714285714, 885.7142857142858, 900, 914.2857142857143, 928.5714285714286, 942.8571428571429, 957.1428571428572, 971.4285714285714, 985.7142857142858, 1000 ], "z": [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.1708836339646336, 1.7476093395703938, 2.1646300051156726, 2.5132269371014817, 2.8197636432387485, 3.0964904162090128, 3.3503841321822514, 3.585915244312334, 3.8061790317112774, 4.01343950286139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 4.040169745619663, 0, 0, 0, 0.5204583439454727, 0.7768131646629626, 0.9621789994545191, 1.1171304900793366, 1.2533861927049954, 1.3763913663967995, 1.4892472353098896, 1.5939409200535395, 1.6918482719547043, 1.783975650906596, 1.871089794482332, 1.9537936161221465, 2.0325731240970524, 2.1078281147940827, 2.1798929873175354, 2.249051372043689, 2.315546703976848, 2.379590053172208, 2.441366050739895, 2.5010374302588563, 2.558748639133849, 2.614628632548862, 0, 2.721346702115513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0.6809220608991522, 0, 0, 0, 0.3876665971691037, 0.5786135970206117, 0.716684402103548, 0.8321008858020901, 0.9335917066264565, 1.025212797324938, 1.1092741215607838, 1.1872557974081166, 1.2601826349652006, 1.3288042222798246, 1.3936916848238174, 1.4552940902438665, 1.5139734582191466, 1.5700276101713133, 1.6237054676088365, 1.6752184767521128, 1.7247478961655087, 1.7724509425479793, 1.8184651364030022, 1.8629116997823523, 1.9058982160177247, 1.9475207416372111, 1.987865504694522, 2.0270102862260106, 2.065025556103739, 2.1019754155190724, 2.137918388369982, 2.1729080600563893, 2.2069936938501358, 2.240220667259779, 2.272630876829398, 2.3042631644950013, 0, 0, 2.3948403685876403, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0.3018409179221879, 0, 0, 0, 0.32247516135778065, 0.48131138828736336, 0.5961636011123923, 0.6921711351019451, 0.7765948167283343, 0.85280850167885, 0.922733703787252, 0.987601640704076, 1.0482647774843574, 1.1053466566850332, 1.1593223577952378, 1.210565430047125, 1.259377007898809, 1.306004804719342, 1.3506560157555993, 1.3935063859985621, 1.4347067711432813, 1.4743877921639896, 1.5126640366795794, 1.54963627033305, 1.5853939847328757, 1.6200170830878067, 1.6535772930422024, 1.686139315926381, 1.7177617712475464, 1.748497980142948, 1.7783966207381763, 1.8075022805398588, 1.8358559252766817, 1.8634952994582852, 1.890455270995888, 1.9167681299575383, 1.9424638483803112, 1.9675703033686345, 1.992113499733218, 2.0161176165114685, 2.039605422550919, 2.062598152889468, 2.085115747634608 ], [ 0, 0, 0, 0, 0, 0, 0, 3.5872671401859844, 0, 0, 0, 0.281958008036157, 0.42083712222894176, 0.5212587517387756, 0.6052034449184229, 0.6790197245757653, 0.7456575605951923, 0.806797025847316, 0.8635146421267389, 0.9165557745569833, 0.9664656194923849, 1.0136595490206037, 1.0584641964474661, 1.101142853967312, 1.1419121105657188, 1.1809531264124677, 1.2184195580174841, 1.2544432868516981, 1.2891386627520514, 1.3226057151611903, 1.354932630297712, 1.3861974978560798, 1.4164703844470072, 1.4458139290126866, 1.474284703480437, 1.501933962081238, 1.5288083263562047, 1.5549503581843218, 1.58039904284249, 1.6051901991043835, 1.6293568296587875, 1.6529294223184712, 1.675936210345733, 1.698403398566335, 1.720355360662147, 1.7418148120527392, 1.7628029620576922, 1.7833396485399393, 1.8034434578647458, 1.8231318324509016 ], [ 0, 0, 0, 0, 0, 0, 0, 0.24092050739828386, 0, 0, 0, 0.2536662220550168, 0.37861005818738513, 0.46895531763283854, 0.5444769470008588, 0.6108864571956861, 0.670837808762579, 0.7258425002774054, 0.7768690383779333, 0.824587988816674, 0.8694898402305807, 0.9119483062920262, 0.9522572342963567, 0.990653480864101, 1.0273319243608627, 1.0624555398223237, 1.0961625655363745, 1.1285716490566085, 1.1597856636968176, 1.1898945950681308, 1.2189777648701505, 1.2471055723603253, 1.2743408784013186, 1.3007401205158446, 1.3263540402829683, 1.3512289547190213, 1.3754067282139577, 1.3989256519537892, 1.421820799391525, 1.4441243951879785, 1.4658661304577856, 1.4870734337461813, 1.50777170524019, 1.5279845202390188, 1.5477338067588298, 1.5670400012450183, 1.585922185650421, 1.6043982085664665, 1.6224847926342336, 1.6401976300914562 ], [ 0, 0, 0, 0, 0, 0, 0, 0.3446966651390455, 0, 0, 0, 0.23247555326860914, 0.3469819427585925, 0.4297799488335786, 0.49899268784132256, 0.5598545116024142, 0.6147976741968461, 0.6652074105530924, 0.7119713238590881, 0.7557039655819862, 0.7968548261059999, 0.8357664043971932, 0.8727080109487798, 0.9078967362374846, 0.941511159592468, 0.9737007236795568, 1.0045918525972022, 1.0342935612982342, 1.0629000340717691, 1.0904937389665774, 1.1171473702472594, 1.142925443467829, 1.16788556218038, 1.1920794369146552, 1.215553714526794, 1.2383506605376058, 1.2605087262434032, 1.2820630246486548, 1.3030454020585942, 1.3234858105548872, 1.343411294960261, 1.3628469925003568, 1.3818161814792873, 1.400340467746827, 1.4184399474584533, 1.4361333497707278, 1.453438162462052, 1.4703707429491144, 1.4869464167521018, 1.5031795651243511 ], [ 0, 0, 0, 0, 0, 0, 0, 0.2079447814140989, 0, 0, 0, 0.21583908396225807, 0.32215120965241684, 0.39902406072263336, 0.4632838016611259, 0.5197902350721023, 0.570801558208221, 0.6176038832048987, 0.6610212710952409, 0.7016243489906442, 0.7398303285603781, 0.7759574036134634, 0.8102553706280784, 0.8429258937881428, 0.8741347866923496, 0.9040207198782201, 0.9327013123710379, 0.960277575341228, 0.9868368426367538, 1.0124558883769454, 1.0372021339179305, 1.06113547776811, 1.0843094007545937, 1.1067719117047223, 1.1285663167578306, 1.1497318517246555, 1.170304206827407, 1.1903159659724623, 1.2097969775129649, 1.2287746696436854, 1.2472743207257115, 1.2653190139900354, 1.2829307309510545, 1.300129383300843, 1.3169336290720677, 1.33336085712054, 1.3494273037538402, 1.365148155799422, 1.3805376420181419, 1.395609114456378 ], [ 0, 0, 0, 0, 0, 0, 0, 0.41757775605902303, 0, 0, 0, 0.20232904757300985, 0.30198690149215524, 0.37404807465504114, 0.43428562607572724, 0.48725517027996534, 0.535073557898287, 0.5789463928951087, 0.6196461707349119, 0.6577078091104515, 0.6935223642109525, 0.7273880801081786, 0.7595392757469932, 0.7901648904163798, 0.8194204088246075, 0.847435656198326, 0.8743210331734106, 0.9001711652186116, 0.9250680805888989, 0.9490836057908095, 0.9722808707734923, 0.994716162434138, 1.0164395673775706, 1.0374960893365384, 1.0579263235615308, 1.0777670494319207, 1.0970517220541327, 1.1158108835499994, 1.1340725098578475, 1.151862305287478, 1.1692039544075197, 1.1861193388392437, 1.202628725003596, 1.2187509276895891, 1.234503453390649, 1.249902225250822, 1.2649630299003127, 1.2796998716517431, 1.294126088647058, 1.3082541971872923 ], [ 0, 0, 0, 0, 0, 0, 0, 1.4348378958340646, 0, 0, 0, 0.19107479704177266, 0.2851894693574548, 0.3532423803705384, 0.41012933553305186, 0.46015255219874734, 0.5053111353123083, 0.5467436294701076, 0.5851795710107776, 0.6211240796436716, 0.6549465359499786, 0.6869285374815287, 0.7172913855985555, 0.7462135102107531, 0.7738416875698698, 0.8002986847848066, 0.8256887175272011, 0.8501009208073943, 0.8736129739687714, 0.8962926380508094, 0.9181996455047396, 0.9393870439147881, 0.9599022774697183, 0.979787393791814, 0.9990812360738394, 1.0178183601842363, 1.0360303602356904, 1.0537460792360214, 1.0709919364636078, 1.087792205417863, 1.104169251358224, 1.1201437355486994, 1.1357347918818448, 1.150960180446342, 1.1658364217402413, 1.1803789145554793, 1.1946020400229733, 1.2085192538776188, 1.2221428501526674, 1.2354851102220978 ], [ 0, 0, 0, 0, 0, 0, 0, 0.19995589290772453, 0, 0, 0, 0.18151123464082486, 0.2709154566732402, 0.33556225271979173, 0.3896019599730882, 0.4371214655744217, 0.48001981730482834, 0.5193785744868146, 0.5558907501974377, 0.5900361834400526, 0.6221658193556941, 0.6525470903378472, 0.6813902481221988, 0.7088647920264195, 0.7351101520068533, 0.7602429505581677, 0.7843621044591483, 0.8075525122671425, 0.8298878988683875, 0.8514323467701199, 0.872242856319437, 0.8923697752049164, 0.9118580583194673, 0.9307480869314226, 0.9490763435409015, 0.9668755528233779, 0.9841760243923784, 1.0010050542289137, 1.0173877392416681, 1.0333471378861891, 1.0489044957505778, 1.0640794394738162, 1.0788901443717682, 1.0933534800897864, 1.1074851377808057, 1.1212997416655295, 1.1348109473238046, 1.148031528661895, 1.1609734551754958, 1.1736479608649302 ], [ 0, 0, 0, 0, 0, 0, 0, 3.211543894462178, 0, 0, 0, 0.17325346342886122, 0.25859037479936386, 0.3202961165481919, 0.3718773305622888, 0.41723497428133693, 0.4581816998269027, 0.4957498618456566, 0.5306009453392477, 0.5631929568891206, 0.5938608832592487, 0.6228599826290706, 0.6503909440302655, 0.6766155555446831, 0.7016669038743372, 0.7256563058667751, 0.7486781781610721, 0.7708135569226676, 0.7921327044559422, 0.8126970805621486, 0.8325610065151732, 0.8517721743082738, 0.8703738138432101, 0.8884044350239032, 0.905898776079751, 0.9228883284437718, 0.9394017772500208, 0.9554653742177991, 0.9711024981460198, 0.9863358366954817, 1.0011854249421168, 1.0156699965619096, 1.0298068998676329, 1.0436122367849863, 1.057100984168715, 1.0702871001771979, 1.083183617938834, 1.0958027283573089, 1.1081558535930636, 1.120253712508063 ], [ 0, 0, 0, 0, 0, 0, 0, 0.2294419409933176, 0, 0, 0, 0.1660290537805402, 0.24780760610798527, 0.30694032566286344, 0.35637069278103384, 0.3998370016595521, 0.4390763199792168, 0.4750779549939259, 0.508475808931414, 0.5397088624814083, 0.5690979535488522, 0.5968878048564709, 0.6232707730590558, 0.6484018638927453, 0.6724086145755788, 0.6953977002361263, 0.7174596005037784, 0.7386719724768155, 0.7591021486437853, 0.7788090260392068, 0.7978445214192587, 0.8162547103633517, 0.8340809170277218, 0.851359582350976, 0.8681243878474451, 0.8844054865926952, 0.9002303203918556, 0.9156238978357375, 0.9306092369063043, 0.9452074766516647, 0.959437734341057, 0.9733183245095756, 0.986865743505551, 1.0000954218006441, 1.0130217116760825, 1.0256579891368787, 1.0380167436349386, 1.050109657367049, 1.0619476756164419, 1.073541069366552 ], [ 0, 0, 0, 0, 0, 0, 0, 0.38067144572237344, 0, 0, 0, 0.15963903502773757, 0.23827018079379295, 0.295127046209312, 0.342654975975477, 0.38444838751667487, 0.42217749360902507, 0.4567935258220143, 0.4889059892495773, 0.5189368955935763, 0.547194921485904, 0.5739152533482504, 0.5992828144826374, 0.6234466795263577, 0.6465294771446946, 0.66863377683716, 0.6898465759237228, 0.7102425426968136, 0.7298864182047172, 0.7488348326989417, 0.767137704804211, 0.7848393367791235, 0.8019792842042432, 0.8185930553956012, 0.8347129164680666, 0.8503672721555705, 0.8655829708391434, 0.8803840824021297, 0.8947926529318386, 0.9088289463064707, 0.9225116525861753, 0.9358580687905765, 0.9488842564912819, 0.9616045305348595, 0.9740333234487264, 0.9861832656933875, 0.9980663660049036, 1.009693856904622, 1.0210762623146865, 1.0322234577346265 ], [ 0, 0, 0, 0, 0, 0, 0, 2.364999941744938, 0, 0, 0.10264889388694642, 0.15393424358014968, 0.22975547355767745, 0.2845805291371049, 0.33041002384177653, 0.37070992628624805, 0.40709076333099725, 0.44046977379568175, 0.471434681795417, 0.5003924182264801, 0.5276406932889448, 0.5534061945698162, 0.5778671343025097, 0.6011674911775354, 0.6234254131288951, 0.6447398042822181, 0.665194553063301, 0.6848616594544658, 0.7038035509490964, 0.7220748340874082, 0.7397236436263905, 0.7567926986607265, 0.7733201412320686, 0.7893402107485828, 0.8048837925793395, 0.8199788689036557, 0.8346508926888071, 0.8489232320503445, 0.86281681911699, 0.8763514834554608, 0.8895452157680532, 0.902414641053113, 0.9149751680207588, 0.9272411199430444, 0.9392258497160229, 0.9509414985204047, 0.9623999501121849, 0.973611926614312, 0.9845875758560084, 0.9953364204014848 ], [ 0, 0, 0, 0, 0, 0, 0, 0.7386013345538833, 0, 0, 0, 0.14880035979107592, 0.22209286758205107, 0.275089444250877, 0.3193904730898406, 0.358346327872348, 0.39351382255084916, 0.4257796049860804, 0.4557117980238784, 0.48370376095146034, 0.5100432128193496, 0.5349493786860186, 0.5585946069745671, 0.5811178704002774, 0.6026334652949336, 0.6232369972190545, 0.6430095568238459, 0.6620207428099851, 0.6803309006425375, 0.6979928156711405, 0.7150530173036821, 0.7315527999044051, 0.7475290334345667, 0.7630148153792531, 0.7780400010454563, 0.7926316393750354, 0.8068143344498405, 0.8206105479002299, 0.8340408538324414, 0.8471243385988456, 0.8598779382903775, 0.8723181023838062, 0.8844597038658568, 0.8963165500866203, 0.9079014923203541, 0.9192265224981875, 0.9303028589128296, 0.9411410223834425, 0.9517504583972549, 0.9621408167222784 ], [ 0, 0, 0, 0, 0, 0, 0, 0.5862311526131054, 0, 0, 0, 0.1441480983258573, 0.21514910832203984, 0.2664887390385487, 0.30940469077602806, 0.34714258598203096, 0.38121056462642317, 0.41246755341710084, 0.44146391276872077, 0.46858070354193593, 0.4940966492164681, 0.5182241564014035, 0.54113007807876, 0.5629491489110162, 0.5837920560925378, 0.6037514160645576, 0.6229057841692898, 0.641322583095408, 0.6590602715993074, 0.6761699846898103, 0.6926967970268428, 0.7086807119011264, 0.7241574465300834, 0.7391590636020414, 0.7537144849944009, 0.7678499139607784, 0.7815891853335639, 0.7949540584775832, 0.8079644642471322, 0.8206387146401762, 0.8329936819395868, 0.8450452065411133, 0.8568070699837349, 0.8682931387188265, 0.8795158475443443, 0.8904867866714241, 0.9012167836396763, 0.9117159761566525, 0.9219938770618388, 0.9320594324202172 ], [ 0, 0, 0, 0, 0, 0, 0, 0.8733999269980721, 0, 0, 0, 0.13990657994910413, 0.2088184022255276, 0.25864737466682164, 0.30030053527548684, 0.33692800237244064, 0.3699935392817818, 0.40033079901024743, 0.4284739477539933, 0.4547928337527488, 0.4795579791186321, 0.5029754997566739, 0.525207493166931, 0.5463845112615886, 0.5666141211217403, 0.5859861819279597, 0.6045769375515531, 0.622451826785592, 0.6396675882520169, 0.6562738523244033, 0.6723143673516142, 0.6878279595371634, 0.7028492951280886, 0.7174094933761502, 0.731536625139936, 0.7452561226491766, 0.7585911194026015, 0.7715627345014422, 0.784190312339776, 0.7964916260896953, 0.808483051571366, 0.8201797167062032, 0.8315956306913328, 0.8427441444850962, 0.8536364744607514, 0.8642845010413762, 0.8746987237609286, 0.8848889635855791, 0.8948644252119404, 0.9046337528101608 ], [ 0, 0, 0, 0, 0, 0, 0, 0.4749483630033011, 0, 0, 0, 0.13601873664427389, 0.20301554452933535, 0.25145981384340965, 0.291955473330369, 0.3275650984816255, 0.35971177604446813, 0.3892059926165335, 0.41656707042920843, 0.44215457999546104, 0.46623152588045963, 0.4889982962283383, 0.5106124730579796, 0.5312010132136488, 0.5508684617467211, 0.569702191686253, 0.5877763281604851, 0.6051544914819814, 0.6218918435611902, 0.6380366355912006, 0.6536314001959423, 0.6687138846356165, 0.6833177918152352, 0.6974733762123241, 0.7112079286233823, 0.7245461745412117, 0.7375106046072692, 0.7501217510437242, 0.7623984206829693, 0.7743578927980722, 0.7860160881411326, 0.797387714243292, 0.8084863909995875, 0.8193247597687547, 0.8299145786019488, 0.8402668057313719, 0.850391921819078, 0.8602988635079712, 0.8699970469555025, 0.879494863772852 ], [ 0, 0, 0, 0, 0, 0, 0, 0.4672940655613185, 0, 0, 0, 0.13243805732024483, 0.19767103857352777, 0.2448399753952314, 0.28426956105953416, 0.3189417403364225, 0.3502421363053468, 0.37895989899692734, 0.40560067915384934, 0.43051458136579784, 0.45395768643843715, 0.47612510717339324, 0.49717025746873517, 0.5172168892870291, 0.5363665014996033, 0.5547044216005839, 0.5723027450145051, 0.5892234172096278, 0.6055201479246015, 0.6212399181092918, 0.6364241406889675, 0.6511095692026678, 0.6653290193044182, 0.6791119490029277, 0.6924849306468968, 0.7054720388148344, 0.718095172068023, 0.7303743221052553, 0.742327800657606, 0.7539724321107938, 0.7653237180934293, 0.7763959789518698, 0.7872024760289603, 0.7977555178917226, 0.8080665530531421, 0.8181462512629403, 0.8280045750704601, 0.8376508430667274, 0.847094147095073, 0.8563417796856764 ], [ 0, 0, 0, 0, 0, 0, 0, 0.5442068996421386, 0, 0, 0, 0.12912624380854987, 0.1927275586703247, 0.2387168529698861, 0.2771603570857197, 0.31096543123695425, 0.3414830458969428, 0.3694826155096039, 0.39545714516020153, 0.41974798378372674, 0.4426048079474391, 0.46421785094427637, 0.48473668999556213, 0.5042819115961079, 0.5229526880489793, 0.5408320011361347, 0.5579902138666362, 0.5744877225356713, 0.5903768936733639, 0.6057035332987154, 0.6205080186545389, 0.6348261841220794, 0.6486900246786297, 0.6621282616264069, 0.6751668027742963, 0.6878291206271747, 0.700136566092279, 0.7121086309027257, 0.7237631688378755, 0.7351165835283849, 0.7461839889282308, 0.7569793472514015, 0.767515588192549, 0.7778047124980434, 0.7878578823689073, 0.7976855007186223, 0.8072972809463516, 0.816702308597432, 0.8259090960512954, 0.8349256311898181 ], [ 0, 0, 0, 0, 0, 0, 0, 0.1792943024382212, 0, 0, 0, 0.12605150437114254, 0.18813734025756298, 0.23303128224466327, 0.27055916912849537, 0.30355910054889773, 0.33334987060499993, 0.3606825684411372, 0.3860384571280421, 0.409750755612779, 0.43206319386458153, 0.45316147435391635, 0.4731916117913359, 0.4922713150136996, 0.5104975516562997, 0.52795088881706, 0.5447004406966466, 0.5608050246462344, 0.5763157599719504, 0.5912773617216227, 0.6057292454647163, 0.6197063921069098, 0.6332400345934451, 0.6463582101641195, 0.6590862095749914, 0.6714469462804472, 0.6834612626680624, 0.6951481862319596, 0.7065251455242931, 0.7176081534872538, 0.7284119641030099, 0.7389502070450467, 0.7492355040592393, 0.7592795700680701, 0.7690933014203797, 0.7786868532614587, 0.7880697076444656, 0.7972507337223548, 0.8062382411333131, 0.8150400275099875 ], [ 0, 0, 0, 0, 0, 0, 0, 2.04836892957323, 0, 0, 0, 0.12318476761426612, 0.18386022313683492, 0.2277335169930801, 0.2644082397149709, 0.2966579461571063, 0.3257714487459198, 0.35248276127608297, 0.37726220570867386, 0.40043542553472805, 0.42224060973549055, 0.44285923900289825, 0.46243400853286853, 0.48107995115334207, 0.49889169295170355, 0.5159483806123963, 0.5323171458722492, 0.5480556059917618, 0.5632137181247853, 0.577835180762119, 0.5919585133948331, 0.6056179016678767, 0.6188438684718587, 0.6316638136431636, 0.6441024529732041, 0.6561821789976585, 0.6679233602695096, 0.6793445917086163, 0.6904629056437712, 0.7012939509767876, 0.7118521462710872, 0.7221508113417815, 0.7322022809908331, 0.7420180038126805, 0.7516086284376423, 0.7609840791430114, 0.7701536224160038, 0.7791259257772559, 0.7879091099525963, 0.7965107953022201 ], [ 0, 0, 0, 0, 0, 0, 0, 0.11459253364924082, 0, 0, 0, 0.1205060789527211, 0.17986216310848732, 0.22278138522238036, 0.25865860537739854, 0.29020703255088875, 0.31868745353226086, 0.3448179207923005, 0.36905852899164054, 0.39172784039259406, 0.4130588644899328, 0.4332291356346894, 0.4523782460805197, 0.4706187272340128, 0.4880433510558097, 0.5047291414621267, 0.5207417542007875, 0.5361379769109907, 0.5509664714713964, 0.5652699861376629, 0.5790862027843288, 0.5924485636799993, 0.6053869279859525, 0.6179280997204053, 0.6300962572215735, 0.6419133060916615, 0.6533991719623249, 0.664572045400476, 0.6754485883612659, 0.6860441094562325, 0.6963727137129253, 0.7064474313034657, 0.7162803288064394, 0.7258826058638773, 0.7352646795491948, 0.7444362583340363, 0.7534064072037264, 0.7621836052016104, 0.7707757964663112, 0.7791904356512808 ], [ 0, 0, 0, 0, 0, 0, 0, 0.1113611095390582, 0, 0, 0, 0.1179948660876608, 0.1761140850990386, 0.21813886815525532, 0.25326844679074006, 0.28415943972890423, 0.31204636031434363, 0.33763229762863955, 0.36136775845307556, 0.3835646665421788, 0.4044511757327739, 0.4242011207698408, 0.4429511849690791, 0.4608115547101624, 0.47787286918129546, 0.49421094236903174, 0.509890073360753, 0.5249654558571044, 0.5394849410285237, 0.5534903863057917, 0.5670186883163872, 0.5801025924301145, 0.5927713355767712, 0.6050511632082056, 0.6169657498119697, 0.6285365445005489, 0.6397830576761431, 0.6507231008331033, 0.6613729887088143, 0.6717477108995445, 0.6818610784992848, 0.6917258501457368, 0.7013538409635949, 0.7107560172072307, 0.7199425788704227, 0.7289230321117345, 0.7377062530129684, 0.7463005439242789, 0.7547136834378296, 0.7629529708608248 ], [ 0, 0, 0, 0, 0, 0, 0, 1.9436560962944778, 0, 0, 0, 0.11563437521336312, 0.17259098900320194, 0.21377499203598457, 0.24820180211257042, 0.2784748196059438, 0.30580386131528886, 0.330877951037879, 0.3541385831274354, 0.3758914412587447, 0.39636011504261504, 0.41571496167048716, 0.43408993011768043, 0.45159300248679723, 0.4683130047244623, 0.4843244209164003, 0.49968997524024167, 0.5144635024562267, 0.5286925247863599, 0.5424177906096034, 0.5556754584367029, 0.5684976185666106, 0.5809129230441686, 0.5929470922801624, 0.6046233271526174, 0.6159626476826585, 0.6269841739647688, 0.6377053611721845, 0.6481421976639404, 0.6583093731676799, 0.6682204224850704, 0.6778878490162819, 0.6873232315238431, 0.6965373168819647, 0.7055401010335943, 0.7143408999668536, 0.7229484121979229, 0.7313707739889002, 0.7396156083216717, 0.7476900684812111 ], [ 0, 0, 0, 0, 0, 0, 0, 0.30869977688805084, 0, 0, 0, 0.11341010976583009, 0.1692709313288748, 0.20966295450193193, 0.2434275526632008, 0.27311825797709904, 0.2999216159103308, 0.3245133966966082, 0.3473266023590395, 0.3686610365919265, 0.38873598817801214, 0.40771853744960573, 0.42574005684645166, 0.44290645140662427, 0.4593048384782805, 0.4750080850524051, 0.49007799994235623, 0.5045676150626895, 0.5185229371143623, 0.5319841925928537, 0.5449868444888413, 0.5575623658348865, 0.5697388575450888, 0.5815415452898155, 0.5929931836699951, 0.6041143883785093, 0.6149239117268315, 0.6254388731302329, 0.6356749534043801, 0.6456465597132786, 0.655366966510601, 0.6648484366882206, 0.6741023262864643, 0.6831391754593732, 0.6919687878744873, 0.7006003003239705, 0.7090422440055475, 0.7173025986781609, 0.7253888406937372, 0.7333079857420891 ], [ 0, 0, 0, 0, 0, 0, 0, 0.8256593708745262, 0, 0, 0, 0.11130945586132959, 0.16613557541769414, 0.2057794290153849, 0.23891861534130024, 0.26805936843282413, 0.2943662556202943, 0.31850253011436724, 0.3408931735274801, 0.3618324363132481, 0.3815355454253569, 0.4001664864432317, 0.41785419846123945, 0.4347026248841421, 0.45079726941318404, 0.466209649340768, 0.48100061114589454, 0.4952216568280398, 0.5089184885325915, 0.5221304051127689, 0.5348922126900327, 0.5472348013332031, 0.5591857514533299, 0.5707698214744767, 0.5820093445213814, 0.592924554428297, 0.6035338561622423, 0.6138540520391885, 0.6239005324219801, 0.6336874376132015, 0.6432277961860715, 0.652533643889108, 0.6616161264169537, 0.670485588690754, 0.6791516527872473, 0.6876232862604752, 0.6959088622875854, 0.7040162128213131, 0.7119526757320112, 0.7197251367607228 ], [ 0, 0, 0, 0, 0, 0, 0, 0.6744023595046422, 0, 0, 0, 0.10932138470996987, 0.1631682305667366, 0.20210400599602263, 0.23465129375459332, 0.26327156434745175, 0.2891085846543651, 0.31281376162601454, 0.3348044862305836, 0.3553697532313279, 0.37472094540337403, 0.3930191194159478, 0.4103909114216423, 0.42693840831553215, 0.44274558662422425, 0.45788268626664175, 0.4724092832795144, 0.4863765167625094, 0.49982870356073067, 0.5128046423072607, 0.5253385114390579, 0.5374606492998456, 0.5491981436896726, 0.5605753108247646, 0.5716140849395699, 0.5823343384726031, 0.5927541476596968, 0.6028900147098831, 0.6127570550974607, 0.6223691565635125, 0.6317391149762759, 0.6408787511122254, 0.649799011591435, 0.6585100565634068, 0.6670213362443123, 0.6753416580184164, 0.6834792455095986, 0.6914417907844325, 0.6992365006521578, 0.7068701378683717 ], [ 0, 0, 0, 0, 0, 0, 0, 1.7274977629537873, 0, 0, 0, 0.1074362205822128, 0.16035440855278293, 0.19861873999738724, 0.23060475247196208, 0.2587314690061461, 0.28412293214798356, 0.30741931551739526, 0.32903081213929625, 0.3492414329696669, 0.36825891548380046, 0.3862415389835954, 0.40331375584122625, 0.41957589250315847, 0.4351104773385413, 0.449986538981837, 0.4642626260773179, 0.47798919489787645, 0.4912092008270317, 0.5039613706304864, 0.5162790942689645, 0.5281921869055505, 0.5397272692158842, 0.550908238087575, 0.5617566495030363, 0.5722920332034516, 0.5825321537018056, 0.5924932286274235, 0.6021901127883604, 0.6116364544311577, 0.620844828758519, 0.6298268526967126, 0.6385932840904709, 0.6471541078768099, 0.6555186113024694, 0.6636954498682259, 0.6716927053817353, 0.6795179372603657, 0.6871782280326878, 0.6946802238315627 ], [ 0, 0, 0, 0, 0, 0, 0, 0.39692925179599015, 0, 0, 0, 0.10564547536099218, 0.15768131203251898, 0.19530777993937015, 0.22676058770684404, 0.2544184339248192, 0.2793866232115952, 0.3022946577037487, 0.32354589244264, 0.34341960378600994, 0.362120066206161, 0.37980292054983267, 0.3965905446405979, 0.4125815925331908, 0.4278572168719626, 0.4424852955879813, 0.4565234013140827, 0.47002094764477126, 0.48302078241719504, 0.49556037062850905, 0.5076727586907018, 0.5193872609184742, 0.530730054224821, 0.5417246371406154, 0.5523922063140786, 0.5627519659288608, 0.572821384365776, 0.5826164089075261, 0.5921516467328728, 0.6014405185717239, 0.6104953899972884, 0.6193276842805128, 0.6279479799315996, 0.6363660954374665, 0.6445911632254362, 0.652631694508339, 0.6604956363696656, 0.6681904222111908, 0.675723016495953, 0.683099954566292 ], [ 0, 0, 0, 0, 0, 0, 0, 0.5111090856956175, 0, 0, 0, 0.10394177429780847, 0.15513758899913507, 0.1921570649733817, 0.2231024742026221, 0.2503141426663331, 0.27487954386618013, 0.29741802499317316, 0.31832643401926664, 0.33787954179689444, 0.35627832738199683, 0.3736759208744001, 0.390192725973579, 0.40592580530000605, 0.42095500236565003, 0.4353471000937657, 0.4491587423424249, 0.46243854554971914, 0.47522891093237296, 0.48756628318360684, 0.4994829556382223, 0.5110084789071919, 0.5221682896802138, 0.5329855074112748, 0.5434809868060543, 0.5536736222478137, 0.5635806003182842, 0.5732176110386058, 0.5825990259437038, 0.591738049258722, 0.6006468470733379, 0.6093366583758328, 0.6178178910212602, 0.6261002051020905, 0.6341925857188692, 0.6421034067793374, 0.649840487162766, 0.6574111403537978, 0.6648222184636476, 0.6720801514057775 ], [ 0, 0, 0, 0, 0, 0, 0, 0.36840182065701765, 0, 0, 0, 0.10231894750659756, 0.1527131294589918, 0.18915407264262027, 0.21961587283436562, 0.24640228277858742, 0.27058378078606754, 0.29277003529128265, 0.31335169224051673, 0.33259922815511717, 0.35071048115921727, 0.36783618833618853, 0.38409487184312263, 0.3995820775019732, 0.41437640108419893, 0.42854358185032193, 0.4421393784296712, 0.4552116474761687, 0.4678018830491011, 0.4799463811263977, 0.49167713484576153, 0.5030225395124597, 0.5140079469622653, 0.5246561153451214, 0.5349875734564967, 0.5450209204049592, 0.5547730741861767, 0.5642594796223355, 0.5734942836535101, 0.5824904841515839, 0.5912600570759906, 0.5998140657727438, 0.6081627554430326, 0.616315635211158, 0.6242815497581068, 0.6320687421237824, 0.6396849089937099, 0.6471372495572925, 0.6544325088410929, 0.6615770162723051 ], [ 0, 0, 0, 0, 0, 0, 0, 0.1351680431683775, 0, 0, 0, 0.10076600059417345, 0.1503988960087283, 0.18628760903265598, 0.2162877869624495, 0.24266827243070857, 0.26648332110788325, 0.28833336279725597, 0.3086031233339479, 0.3275589800605232, 0.3453957729403023, 0.36226195485183954, 0.37827425198194037, 0.39352676233984246, 0.40809689070041605, 0.4220493801181487, 0.4354391442408514, 0.4483133144786075, 0.46071275606539897, 0.472673542367316, 0.48422646781111756, 0.495399674383553, 0.5062186076164069, 0.5167054123412622, 0.5268803062605079, 0.5367616066328147, 0.5463659750795027, 0.5557086223723727, 0.5648034810684742, 0.5736633520688342, 0.582300029847336, 0.5907244100935627, 0.5989465827499877, 0.6069759128364304, 0.6148211109982735, 0.6224902953571361, 0.6299910459598943, 0.6373304528966314, 0.6445151589773144, 0.6515513977109153 ], [ 0, 0, 0, 0, 0, 0, 0, 0.21110687266584222, 0, 0, 0, 0.09928390330735065, 0.14818678182932532, 0.18354763288181575, 0.21310655821401422, 0.23909903128605195, 0.2625638008176995, 0.2840924657614521, 0.3040640930037361, 0.3227411414833709, 0.3403155852646802, 0.3569336938331149, 0.3727104766907716, 0.38773864795313384, 0.4020944739740546, 0.41584174557134995, 0.42903456869979395, 0.44171938152581736, 0.4539364482015043, 0.4657209885784391, 0.4771040518018935, 0.48811318042282664, 0.49877298538243897, 0.5091055468797311, 0.519130785250951, 0.5288667483420307, 0.5383298527133702, 0.5475350854149713, 0.5564961740816812, 0.5652257313361306, 0.5737353781757006, 0.5820358500322157, 0.5901370884408602, 0.5980483206760303, 0.6057781292620834, 0.6133345129144697, 0.6207249401880509, 0.6279563968874398, 0.6350354281160762, 0.6419681756968048 ], [ 0, 0, 0, 0, 0, 0, 0, 1.4720032194537773, 0, 0, 0, 0.09786534029443246, 0.1460694910037149, 0.1809251073425587, 0.2100616943670903, 0.2356827873933932, 0.2588122926912242, 0.2800333570394753, 0.2997196308564041, 0.31812982250676874, 0.33545316295769645, 0.35183383191421225, 0.3673851958231778, 0.3821986442668118, 0.3963493540033076, 0.4099002044454404, 0.42290452848108206, 0.435408100747332, 0.44745061007523385, 0.45906677307031496, 0.4702871918663379, 0.4811392180088409, 0.4916465233596467, 0.5018314533413123, 0.5117134512212491, 0.5213103069808537, 0.5306382026245079, 0.5397119110709601, 0.5485449638177311, 0.5571497932805465, 0.5655378544172417, 0.5737197292720996, 0.5817052173351149, 0.5895034140401589, 0.5971227792827422, 0.6045711974905945, 0.6118560305056234, 0.6189841643169981, 0.6259620505095512, 0.6327957431497816 ], [ 0, 0, 0, 0, 0, 0, 0, 0.794539061685874, 0, 0, 0, 0.09650591219800977, 0.1440404371264699, 0.1784118744001477, 0.20714372353892568, 0.23240891359060525, 0.25521712664288876, 0.276143409712856, 0.2955562223586928, 0.3137106785068424, 0.3307933802866548, 0.346946504737341, 0.3622818437758635, 0.3768895176983376, 0.3908436591085254, 0.40420627401410636, 0.4170299544592635, 0.42935983920276255, 0.44123506572576965, 0.45268986835386166, 0.4637544241007901, 0.47445554287664105, 0.4848170527367011, 0.4948605036674669, 0.5046052305256828, 0.514068776173781, 0.5232670978350213, 0.5322147632210893, 0.5409251158667798, 0.5494104154917587, 0.5576819579347785, 0.5657501782457166, 0.5736247397897097, 0.5813146116550176, 0.5888281362191587, 0.5961730883852241, 0.6033567277294163, 0.6103858445851277, 0.61726680091571, 0.6240055666882128 ], [ 0, 0, 0, 0, 0, 0, 0, 0.7610591920094365, 0, 0, 0, 0.09520166667168745, 0.1420936569924223, 0.17600054796785894, 0.204344070055881, 0.2292677882343488, 0.25176773678841013, 0.27241119161401656, 0.29156163173211086, 0.3094707221700818, 0.3263225427421634, 0.34225734905430366, 0.3573854224000317, 0.3717956653145745, 0.3855612086261979, 0.39874322037473886, 0.4113935818089522, 0.4235568215924559, 0.43527154820741937, 0.44657153324774684, 0.457486545837592, 0.46804300579514185, 0.47826460720563724, 0.4881722108170464, 0.4977852326963977, 0.5071208736674188, 0.5161948752860988, 0.5250216083778434, 0.5336142361367009, 0.5419848525894763, 0.5501446009086186, 0.5581037751107588, 0.5658719079565236, 0.5734578473122646, 0.5808698228031224, 0.58811550424889, 0.5952020531069177, 0.6021361679335021, 0.6089241247043928, 0.615571812697044 ], [ 0, 0, 0, 0, 0, 0, 0, 0.09173742988904843, 0, 0, 0, 0.0939489708836322, 0.14022373678735114, 0.1736844224644179, 0.20165494829494604, 0.22625067609333177, 0.24845453064992512, 0.26882632380995125, 0.2877247504910161, 0.30539816272961484, 0.3220282175205947, 0.3377533249305629, 0.3526823153455608, 0.3669029216886894, 0.38048731261340063, 0.39349585130358145, 0.40597973628695067, 0.41798291021976275, 0.42954347346515603, 0.4406947531463805, 0.4514661265933141, 0.46188366591454477, 0.4719707471222334, 0.48174797515690165, 0.49123449183969725, 0.500447277876634, 0.5094018676699981, 0.5181124429317755, 0.5265919936354531, 0.5348524546572062, 0.5429048225313168, 0.5507592558100981, 0.5584251618068541, 0.5659112719526949, 0.5732257075725543, 0.5803760375521709, 0.5873693291041739, 0.5942121926313694, 0.6009108215167903, 0.607471027533894 ], [ 0, 0, 0, 0, 0, 0, 0, 0.41481764196378057, 0, 0, 0, 0.09274409180248175, 0.1384257487039429, 0.17145739429456844, 0.19906927150065262, 0.2233496260434338, 0.24526877681214201, 0.2653793590505327, 0.28403546734945173, 0.30148226788310184, 0.3178990879232562, 0.3334225630337284, 0.3481601285980872, 0.3621983930057923, 0.37560859980955535, 0.38845033833402837, 0.40077415066441524, 0.41262341599456875, 0.4240357461097934, 0.4350440407519355, 0.4456773005185744, 0.45596126317542046, 0.4659189089053489, 0.4755708963817898, 0.48493574451279525, 0.4940304015952702, 0.502870173091549, 0.5114690588741947, 0.5198398823594559, 0.5279944253954434, 0.5359435435198099, 0.5436972650324127, 0.5512648766258034, 0.5586549977757224, 0.565875645673735, 0.5729342921548845, 0.5798379138129683, 0.586593036288727, 0.5932057735498487, 0.5996818628472738 ], [ 0, 0, 0, 0, 0, 0, 0, 0.15818184437128702, 0, 0, 0, 0.09158465693822128, 0.1366951963059593, 0.16931389413846862, 0.19658057314312996, 0.22055738283352275, 0.2422025080303771, 0.26206167693658, 0.28048455602390354, 0.29771324470612404, 0.31392482778540837, 0.32925423292973105, 0.34380755295199095, 0.35767031398860416, 0.370912869262775, 0.3835940633082585, 0.3957638064085173, 0.4074649354326134, 0.41873459190774065, 0.42960526421431744, 0.44010559033653107, 0.4502609862266682, 0.4600941447400667, 0.469625679746015, 0.47887364430542184, 0.48785419683039866, 0.4965834564100348, 0.5050748417418962, 0.5133410159313306, 0.5213936135379126, 0.5292433543913596, 0.5369001414250494, 0.5443731452356375, 0.5516708775433712, 0.5588012553129073, 0.5657716569693185, 0.5725889718869418, 0.5792596441240188, 0.5857897112117824, 0.592184838673897 ], [ 0, 0, 0, 0, 0, 0, 0, 0.09072827336456007, 0, 0, 0, 0, 0.1350279672946581, 0.16724882834043767, 0.19418293882848536, 0.2178673106905357, 0.23924843734016343, 0.25886539315670093, 0.277063578094775, 0.29408213654964427, 0.3100959927596746, 0.3252384290561031, 0.3396142449414116, 0.353307924024954, 0.3663889618685545, 0.37891548552162857, 0.3909367966098533, 0.4024952095284285, 0.413627412749128, 0.42436549833286874, 0.4347377549066178, 0.44476928837267243, 0.4544825147617413, 0.46389755657960474, 0.4730325654851247, 0.4819039858244948, 0.4905267772375243, 0.49891459567411806, 0.5070799497935422, 0.5150343322559239, 0.5227883321489355, 0.5303517316273231, 0.5377335894406838, 0.5449423134975199, 0.5519857242038626, 0.5588711099936001, 0.5656052762137825, 0.5721945883259452, 0.5786450102222255, 0.5849621383239202 ], [ 0, 0, 0, 0, 0, 0, 0, 0.2750391756634658, 0, 0, 0, 0, 0.13342029262945343, 0.16525750454598784, 0.191870947127957, 0.2152733269309819, 0.236399885155844, 0.25578328061559963, 0.27376479859639574, 0.29058073344825275, 0.3064039258458368, 0.3213660716369068, 0.33557072337281374, 0.34910135952536064, 0.3620266487389402, 0.3744040262725118, 0.3862822068671042, 0.397703001116125, 0.40870266061483995, 0.4193128952499786, 0.4295616567564148, 0.4394737520474462, 0.4490713302046711, 0.45837427410656384, 0.46740051898360246, 0.4761665068498512, 0.48468644046716397, 0.4929743913846478, 0.5010425266921794, 0.5089022022181733, 0.5165638809781485, 0.5240372286627007, 0.5313311961701307, 0.5384540913061148, 0.5454136413679672, 0.5522170480137117, 0.5588710355653427, 0.5653818936958427, 0.5717555152892049, 0.5779974301331315 ], [ 0, 0, 0, 0, 0, 0, 0, 0.28225704710984223, 0, 0, 0, 0, 0.1318687112708291, 0.16333567186222617, 0.18963961797728182, 0.212769844065766, 0.23365071569673546, 0.2528087006565802, 0.2705811124121748, 0.2872014939977152, 0.30284067501428663, 0.3176288202813351, 0.3316682791011951, 0.3450415600575831, 0.3578165338581406, 0.3700499681864685, 0.38179001141428964, 0.3930779879230388, 0.40394972767011933, 0.4144365716896512, 0.4245661465626477, 0.4343629706288192, 0.4438489353195282, 0.4530436922336989, 0.46196496798744874, 0.4706288829911267, 0.47904986592488896, 0.48724143358429045, 0.49521574192936846, 0.5029840147292317, 0.5105565933251164, 0.5179430310067468, 0.5251521745843389, 0.5321922352538843, 0.5390708504532532, 0.5457951380929836, 0.5523717442977326, 0.558806885596894, 0.565106386344397, 0.5712757120196919 ], [ 0, 0, 0, 0, 0, 0, 0, 1.6417299686408606, 0, 0, 0, 0, 0.1303700402205773, 0.16147936540217056, 0.1874843675276633, 0.21035171914318618, 0.23099528136277664, 0.24993554288765013, 0.26750597987978, 0.2839374770087498, 0.2993989211377644, 0.3140189983932815, 0.32789889609428974, 0.34112018622349294, 0.3537499689144524, 0.36584436713238083, 0.37745098223891277, 0.3886106689978935, 0.39935885010221045, 0.4097265102966076, 0.41974096207709866, 0.42942644503064054, 0.4388046017060817, 0.4478948602936423, 0.4567147458957399, 0.4652801363308209, 0.47360551459584493, 0.4817039449796723, 0.4895876254632599, 0.49726761197983177, 0.5047541283437074, 0.5120566192756931, 0.5191838310469918, 0.5261438815383757, 0.5329443213928106, 0.5395921876296093, 0.5460940508431605, 0.5524560569139921, 0.5586839640033278, 0.5647831754756762 ], [ 0, 0, 0, 0, 0, 0, 0, 0.12326492979114456, 0, 0, 0, 0, 0.1289213500121447, 0.15968494424530333, 0.1854009685162055, 0.20801420928416092, 0.22842837391138412, 0.24715817236940155, 0.26453337027754714, 0.28078228152664275, 0.29607191474404626, 0.3105295268317065, 0.32425518215542704, 0.3373295475830357, 0.3498189785503594, 0.3617789749121512, 0.3732566093148048, 0.38429228258172365, 0.3949210237167919, 0.4051734730390679, 0.4150766394107581, 0.424654492938134, 0.43392843556498095, 0.442917679503427, 0.4516395550457348, 0.4601097635234346, 0.46834285022398187, 0.47635145647024996, 0.4841471384215033, 0.49174178193669166, 0.4991451052026726, 0.5063664479898354, 0.5134144593818643, 0.5202971670554701, 0.5270220377528215, 0.5335960302995006, 0.5400256422784847, 0.5463169512775857, 0.5524756514728767, 0.5585070861854664 ], [ 0, 0, 0, 0, 0, 0, 0, 1.1765183248720903, 0, 0, 0, 0, 0.12751994519718005, 0.1579490445459105, 0.18338551537570258, 0.2057529325342319, 0.2259451814745854, 0.2444713831257375, 0.2616575975216078, 0.2777298383576111, 0.29285342034527495, 0.3071538655164691, 0.32073030794175483, 0.3336625392067984, 0.34601619455958926, 0.35784617120230505, 0.36919903037959173, 0.3801147338049616, 0.3906279296318082, 0.40076892497062383, 0.4105644349298966, 0.42003816889975826, 0.4292112960428966, 0.4381028196167445, 0.44672988143961423, 0.45510801209797963, 0.46325133848704464, 0.4711727635156737, 0.4788840819911237, 0.4863961658028114, 0.4937190091524477, 0.5008618502811547, 0.5078332442539327, 0.5146411314851408, 0.5212928975527249, 0.5277954256392702, 0.534155142698235, 0.5403780602527908, 0.5464698105814624, 0.5524356789209753 ], [ 0, 0, 0, 0, 0, 0, 0, 0.11256782490162787, 0, 0, 0, 0, 0.12616333838941657, 0.15626855299961984, 0.18143439342818865, 0.20356383329652872, 0.22354125060899405, 0.24187028676862948, 0.25887370362771456, 0.2747749446015012, 0.28973745267388956, 0.3038859618831212, 0.3173179531325332, 0.33011258566541224, 0.34233479779500986, 0.35403890346890854, 0.36527096893749234, 0.3760705308522533, 0.386471868672588, 0.39650496691877973, 0.40619625629656725, 0.41556919377415374, 0.42464472313677887, 0.4334416453331126, 0.44197691970324315, 0.45026591152203804, 0.4583225973283259, 0.466159736685349, 0.4737891300514371, 0.48122117630944844, 0.4884661085866438, 0.4955329537546339, 0.5024301758593878, 0.5091656308376821, 0.5157466256939262, 0.5221799703825468, 0.5284720234825488, 0.5346287325619632, 0.5406556699783192, 0.5465580647387952 ], [ 0, 0, 0, 0, 0, 0, 0, 0.08520809063995138, 0, 0, 0, 0, 0.12484913018296537, 0.15464058335085443, 0.1795442516091119, 0.20144315172470217, 0.2212124526975096, 0.23935053805246534, 0.2561768172466757, 0.2719124027690888, 0.2867190348923918, 0.3007199465847491, 0.31401225878166594, 0.32667359145066605, 0.3387684667447224, 0.3503506337772871, 0.3614656793745071, 0.37215272844903163, 0.38244570329046684, 0.3923742758916912, 0.40196460141545853, 0.41123989226548224, 0.42022087386281287, 0.4289261511427005, 0.43737250664648064, 0.445575145484441, 0.4535478985225023, 0.461303392349249, 0.46885335095849434, 0.476208459245942, 0.483377381609107, 0.4903706059926092, 0.49719597439284047, 0.5038612609081528, 0.5103736964247542, 0.5167400199576871, 0.5229665238489215, 0.529059093710867, 0.5350232438536126, 0.5408641488130234 ], [ 0, 0, 0, 0, 0, 0, 0, 0.10477577977154973, 0, 0, 0, 0, 0.12357465354579807, 0.15306245553771725, 0.17771197825368776, 0.19938739654967955, 0.21895495412608562, 0.2369079338343148, 0.25356249860135305, 0.2691375003712332, 0.2837930288355492, 0.2976510593535594, 0.31080749909058397, 0.3233398969775274, 0.335311331893696, 0.3467752915834213, 0.35777689824370057, 0.36835487769948544, 0.37854280600758095, 0.3883700521797804, 0.3978625042386711, 0.40704313747445975, 0.4159324655939104, 0.4245489034878651, 0.43290906228403647, 0.44102799180859364, 0.44891938169570933, 0.4565957296156278, 0.4640684830876182, 0.4713481598940788, 0.47844445084542137, 0.48536630842276335, 0.4921220229945313, 0.4987192893244559, 0.505165264510082, 0.5114666187986872, 0.517629580323313, 0.5236599746380753, 0.5295632597834956, 0.5353445574926107 ] ] } ], "layout": { "autosize": false, "height": 500, "margin": { "b": 65, "l": 65, "r": 50, "t": 90 }, "scene": { "xaxis": { "title": { "text": "Days to Expiry" } }, "yaxis": { "title": { "text": "Strike Price" } }, "zaxis": { "title": { "text": "Implied Volatility" } } }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Volatility Surface" }, "width": 500 } }, "text/html": [ "
\n", " \n", " \n", "
\n", " \n", "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = go.Figure(data=[go.Surface(z=sigma_vals, x=T_vals*365, y=K_vals)])\n", "fig.update_layout(title='Volatility Surface', autosize=False,\n", " width=500, height=500,\n", " margin=dict(l=65, r=50, b=65, t=90))\n", "fig.update_layout(scene = dict(\n", " xaxis_title='Days to Expiry',\n", " yaxis_title='Strike Price',\n", " zaxis_title='Implied Volatility'))\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.5" } }, "nbformat": 4, "nbformat_minor": 1 }