{"id":1385,"date":"2023-06-01T08:40:04","date_gmt":"2023-06-01T08:40:04","guid":{"rendered":"https:\/\/nag.com\/?page_id=1385"},"modified":"2023-07-14T13:50:20","modified_gmt":"2023-07-14T13:50:20","slug":"fast-implied-volatilities-in-the-nag-library","status":"publish","type":"page","link":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/","title":{"rendered":"Fast Implied Volatilities in the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library"},"content":{"rendered":"\n<div class=\"gbc-title-banner ta ta-lg ta-xl\" style='background-color: #082d48ff; color: #ffffffff; border-radius: 0px; '>\n    <div class=\"container\" style='border-radius: 0px; '>\n        <div class=\"row justify-content--center\" style='color: #ffffffff;'>\n            <div class=\"col-12\"  >\n                <div class=\"wrap pv-4 \" style=\"0px\">\n                                <div class=\"col-12 col-md-12 col-lg-10 col-xl-8  banner-content\"  >\n    \n                                             <h1>Fast Implied Volatilities in the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library<\/h1>\n                    \n                    <div class=\"mt-1 mb-1 content\"><\/div>\n\n                    \n                                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<div class=\"content-split-three pv-4 \" >\n    <div class=\"container\">\n        <div class=\"row justify-content--center content-area-default\">\n            \n \n                <div class=\"col-10                            col-lg-8 \n                            col-xl-6                             ta ta-lg ta-xl                            content-split-three__wrap\n                            order-1 order-lg-1                            mb-2                            \">\n                    <div class=\"content-split-three__col\">\n                        <p>The Black-Scholes formula for the price of a European call option is<\/p>\n<p><span class=\"math display\">\\[ C = S_0 \\Phi \\left( \\frac {\\ln \\left( \\frac {S_0}{K} \\right) + \\left[ r + \\frac {\\sigma^2}{2} \\right] T}{\\sigma \\sqrt {T}} \\right) &#8211; Ke^{rT} \\Phi \\left( \\frac {\\ln \\left( \\frac {S_0}{K} \\right) + \\left[ r &#8211; \\frac {\\sigma^2}{2} \\right] T}{\\sigma \\sqrt {T}} \\right) \\]<\/span><\/p>\n<p>where\u00a0<span class=\"math inline\">\\(T\\)<\/span>\u00a0is the time to maturity of the contract,\u00a0<span class=\"math inline\">\\(S_0\\)<\/span>\u00a0is the spot price of the underlying asset,\u00a0<span class=\"math inline\">\\(K\\)<\/span>\u00a0is the strike price of exercising the option,\u00a0<span class=\"math inline\">\\(r\\)<\/span>\u00a0is the interest rate and\u00a0<span class=\"math inline\">\\(\\sigma\\)<\/span>\u00a0is the volatility. An important problem in finance is to compute the\u00a0<i>implied volatility<\/i>,\u00a0<span class=\"math inline\">\\(\\sigma\\)<\/span>, given values for\u00a0<span class=\"math inline\">\\(T\\)<\/span>,\u00a0<span class=\"math inline\">\\(K\\)<\/span>,\u00a0<span class=\"math inline\">\\(S_0\\)<\/span>,\u00a0<span class=\"math inline\">\\(r\\)<\/span>\u00a0and\u00a0<span class=\"math inline\">\\(C\\)<\/span>. An explicit formula for\u00a0<span class=\"math inline\">\\(\\sigma\\)<\/span>\u00a0is not available. Furthermore,\u00a0<span class=\"math inline\">\\(\\sigma\\)<\/span>\u00a0cannot be directly measured from financial data. Instead, it must be computed using a numerical approximation.<\/p>\n<p>As shown in the figure, the\u00a0<i>volatility surface<\/i>\u00a0(a three-dimensional plot of how the volatility varies according to the price and time to maturity) can be highly curved. This makes accurately computing the volatility a difficult problem.<\/p>\n                    <\/div>\n                <\/div>\n\n            \n            \n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n<div class=\"content-split-three pv-4 \" >\n    <div class=\"container\">\n        <div class=\"row justify-content--center content-area-default\">\n            \n \n                <div class=\"col-4                            col-lg-4 \n                            col-xl-4                             ta ta-lg ta-xl                            content-split-three__wrap\n                            order-1 order-lg-1                            mb-0                            \">\n                    <div class=\"content-split-three__col\">\n                        <p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1387\" src=\"https:\/\/nag.com\/wp-content\/uploads\/2023\/06\/example-implied-volatility-surface.png\" alt=\"\" width=\"602\" height=\"451\" \/><\/p>\n                    <\/div>\n                <\/div>\n\n            \n \n                <div class=\"col-4                            col-lg-4 \n                            col-xl-4                             ta ta-lg ta-xl                            content-split-three__wrap\n                            order-2 order-lg-2                            mb-0                            \">\n                    <div class=\"content-split-three__col\">\n                        <p>Mark 27.1 of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library contains a new routine,\u00a0<a href=\"https:\/\/support.nag.com\/numeric\/nl\/nagdoc_latest\/flhtml\/s\/s30acf.html\">s30acf<\/a>, for computing the implied volatility of a European option contract for arrays of input data.<\/p>\n<p>This routine gives the user a choice of two algorithms. The first is the method of J\u00e4ckel (2015), which uses a third order Householder method to achieve close to machine accuracy for all but the most extreme inputs. This method is fast for short vectors of input data.<\/p>\n<p>The second algorithm is based on that of Glau et al. (2018), with additional performance enhancements developed in a collaboration between <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG and mathematicians at Queen Mary University of London. This method uses Chebyshev interpolation and is designed for long vectors of input data, where vector instructions can be exploited. For applications in which accuracy to machine precision is not required, the algorithm can also be instructed to aim for accuracy to roughly single precision (approximately seven decimal places), giving even further performance improvements.<\/p>\n                    <\/div>\n                <\/div>\n\n            \n            \n        <\/div>\n    <\/div>\n<\/div>\n\n\n<div class=\"gbc-title-banner tac ta-lg ta-xl\" style='border-radius: 0px; '>\n    <div class=\"container\" style='border-radius: 0px; '>\n        <div class=\"row justify-content--center\" >\n            <div class=\"col-12\"  >\n                <div class=\"wrap pv-4 \" style=\"0pxbackground-color: \">\n                                <div class=\"col-12 col-md-12 col-lg-10 col-xl-8  banner-content\"  >\n    \n                    \n                    <div class=\"mt-1 mb-1 content\"><\/div>\n\n                    \n                    <a href='https:\/\/github.com\/numericalalgorithmsgroup\/NAGPythonExamples\/tree\/master\/special_functions\/opt_imp_vol' style='background-color: #ff7d21ff; color: #ffffffff; border-radius: 30px; font-weight: 600; ' class='btn mr-1  ' >Fast implied volatilities notebook <i class='fas fa-angle-right'><\/i><\/a>                <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<!-- Spacer -->\n<div class=\"pt-4 pt-lg-4 pt-xl-4\" ><\/div>\n\n\n<div class=\"gbc-title-banner ta ta-lg ta-xl\" style='color: #ffffffff; border-radius: 20px; '>\n    <div class=\"container\" style='border-radius: 20px; '>\n        <div class=\"row justify-content--center\" style='color: #ffffffff;'>\n            <div class=\"col-12\"  >\n                <div class=\"wrap pv-4 \" style=\"border-radius: 20px;background-color: #082d48ff\">\n                                <div class=\"col-12 col-md-12 col-lg-10 col-xl-8  banner-content\"  >\n    \n                                             <h2 class=\"field field--name-field-paragraph-title field--type-string field--label-hidden field--item\">References<\/h2>\n                    \n                    <div class=\"mt-1 mb-1 content\"><p class=\"field field--name-field-paragraph-title field--type-string field--label-hidden field--item\">J\u00e4ckel P (2015), Let\u2019s be rational, Wilmott 2015(75), 40-53<\/p>\n<div class=\"field field--name-field-paragraph-text field--type-text-long field--label-hidden field--item\">\n<p>Glau K, Herold P, Madan D B and P\u00f6tz C (2018), The Chebyshev method for the implied volatility, Accepted for publication in the Journal of Computational Finance<\/p>\n<\/div>\n<\/div>\n\n                    \n                                    <\/div>\n                <\/div>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n<!-- Spacer -->\n<div class=\"pt-4 pt-lg-4 pt-xl-4\" ><\/div>","protected":false},"excerpt":{"rendered":"<p>Mark 27.1 of the <span class=\"nag-n-override\" style=\"margin-left: 0 !important;\"><i>n<\/i><\/span>AG Library contains a new routine, s30acf, for computing the implied volatility of a European option contract for arrays of input data.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"content-type":"","footnotes":""},"class_list":["post-1385","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Fast Implied Volatilities in the NAG Library - nAG<\/title>\n<meta name=\"description\" content=\"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Fast Implied Volatilities in the NAG Library - nAG\" \/>\n<meta property=\"og:description\" content=\"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/\" \/>\n<meta property=\"og:site_name\" content=\"nAG\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-14T13:50:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/NAG-Logo-White-On-Blue.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"12770\" \/>\n\t<meta property=\"og:image:height\" content=\"4353\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@NAGTalk\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/\",\"url\":\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/\",\"name\":\"Fast Implied Volatilities in the NAG Library - nAG\",\"isPartOf\":{\"@id\":\"https:\/\/nag.com\/#website\"},\"datePublished\":\"2023-06-01T08:40:04+00:00\",\"dateModified\":\"2023-07-14T13:50:20+00:00\",\"description\":\"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.\",\"breadcrumb\":{\"@id\":\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/nag.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Fast Implied Volatilities in the NAG Library\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/nag.com\/#website\",\"url\":\"https:\/\/nag.com\/\",\"name\":\"NAG\",\"description\":\"Robust, trusted numerical software and computational expertise.\",\"publisher\":{\"@id\":\"https:\/\/nag.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/nag.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/nag.com\/#organization\",\"name\":\"Numerical Algorithms Group\",\"alternateName\":\"NAG\",\"url\":\"https:\/\/nag.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/nag.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png\",\"contentUrl\":\"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png\",\"width\":1244,\"height\":397,\"caption\":\"Numerical Algorithms Group\"},\"image\":{\"@id\":\"https:\/\/nag.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/NAGTalk\",\"https:\/\/www.linkedin.com\/company\/nag\/\",\"https:\/\/www.youtube.com\/user\/NumericalAlgorithms\",\"https:\/\/github.com\/numericalalgorithmsgroup\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Fast Implied Volatilities in the NAG Library - nAG","description":"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/","og_locale":"en_US","og_type":"article","og_title":"Fast Implied Volatilities in the NAG Library - nAG","og_description":"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.","og_url":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/","og_site_name":"nAG","article_modified_time":"2023-07-14T13:50:20+00:00","og_image":[{"width":12770,"height":4353,"url":"https:\/\/nag.com\/wp-content\/uploads\/2024\/02\/NAG-Logo-White-On-Blue.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@NAGTalk","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/","url":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/","name":"Fast Implied Volatilities in the NAG Library - nAG","isPartOf":{"@id":"https:\/\/nag.com\/#website"},"datePublished":"2023-06-01T08:40:04+00:00","dateModified":"2023-07-14T13:50:20+00:00","description":"The NAG Library contains a new routine for computing the implied volatility of a European option contract for arrays of input data.","breadcrumb":{"@id":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/nag.com\/fast-implied-volatilities-in-the-nag-library\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/nag.com\/"},{"@type":"ListItem","position":2,"name":"Fast Implied Volatilities in the NAG Library"}]},{"@type":"WebSite","@id":"https:\/\/nag.com\/#website","url":"https:\/\/nag.com\/","name":"NAG","description":"Robust, trusted numerical software and computational expertise.","publisher":{"@id":"https:\/\/nag.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nag.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/nag.com\/#organization","name":"Numerical Algorithms Group","alternateName":"NAG","url":"https:\/\/nag.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/nag.com\/#\/schema\/logo\/image\/","url":"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png","contentUrl":"https:\/\/nag.com\/wp-content\/uploads\/2023\/11\/NAG-Logo.png","width":1244,"height":397,"caption":"Numerical Algorithms Group"},"image":{"@id":"https:\/\/nag.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/NAGTalk","https:\/\/www.linkedin.com\/company\/nag\/","https:\/\/www.youtube.com\/user\/NumericalAlgorithms","https:\/\/github.com\/numericalalgorithmsgroup"]}]}},"_links":{"self":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/1385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/comments?post=1385"}],"version-history":[{"count":3,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/1385\/revisions"}],"predecessor-version":[{"id":3251,"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/pages\/1385\/revisions\/3251"}],"wp:attachment":[{"href":"https:\/\/nag.com\/wp-json\/wp\/v2\/media?parent=1385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}