{"id":207086,"date":"2024-05-23T10:50:13","date_gmt":"2024-05-23T14:50:13","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=207086"},"modified":"2024-05-23T10:50:14","modified_gmt":"2024-05-23T14:50:14","slug":"python-code-estimation-of-dynamic-nelson-siegel-model","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/","title":{"rendered":"Python Code: Estimation of Dynamic Nelson-Siegel Model"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-estimation-and-forecast-of-dynamic-nelson-siegel-model\">Estimation and Forecast of Dynamic Nelson-Siegel model<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">I found the following useful Python library for estimating and forecasting the DNS or Svensson (DNSS) model.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pypi.org\/project\/Dynamic-Nelson-Siegel-Svensson-Kalman-Filter\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>Dynamic-Nelson-Siegel-Svensson-Kalman-Filter 0.1.0<\/strong><\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In the Jupyter notebook, this library can be installed by running the following command.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">!pip install Dynamic-Nelson-Siegel-Svensson-Kalman-Filter<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Correlated-factor DNS model<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This Python DNS library use the specification of correlated-factor DNS model instead of the independent-factor model more generally. The correlated-factor DNS model can be expressed as the state space representation which consists of both measurement and state equation as follows.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"574\" height=\"519\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model.png\" alt=\"\" class=\"wp-image-207090 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model.png 574w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model-300x271.png 300w\" data-sizes=\"(max-width: 574px) 100vw, 574px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 574px; aspect-ratio: 574\/519;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">where&nbsp;<strong><em>y<sub>t<\/sub>(\u03c4)<\/em><\/strong>&nbsp;is continuously compounded spot rates of maturity&nbsp;<strong><em>\u03c4<\/em><\/strong>&nbsp;at time&nbsp;<strong><em>t<\/em><\/strong>.&nbsp;<strong><em>L<sub>t<\/sub>,S<sub>t<\/sub>,C<sub>t<\/sub><\/em><\/strong>&nbsp;are level, slope, curvature factors respectively and its unconditional means and autoregressive coefficients are denoted as&nbsp;<strong><em>\u03bc<sub>L<\/sub>,\u03bc<sub>S<\/sub>,\u03bc<sub>C<\/sub><\/em><\/strong>&nbsp;and&nbsp;<strong><em>\u03d5<sub>L<\/sub>,\u03d5<sub>S<\/sub>,\u03d5<sub>C<\/sub><\/em><\/strong>&nbsp;sequentially.&nbsp;<strong>\u03bb<\/strong>&nbsp;is an exponential time decay parameter.&nbsp;<strong><em>\u03f5<sub>t<\/sub><\/em><\/strong>&nbsp;follows a multivariate normal distribution with only diagonal variances, in other words, a diagonal covariance matrix.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Taking correlated-factors into account,&nbsp;<strong><em>\u03b7<sub>t<\/sub><\/em><\/strong>&nbsp;has a non-diagonal variance-covariance matrix&nbsp;<strong>???? = ???? \u00d7 ????<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"562\" height=\"102\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model-2.png\" alt=\"\" class=\"wp-image-207094 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model-2.png 562w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/Python-Nelson-Siegel-SHLee-AI-Model-2-300x54.png 300w\" data-sizes=\"(max-width: 562px) 100vw, 562px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 562px; aspect-ratio: 562\/102;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Python Jupyter Notebook Code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">From the web page above, sample data can be obtained, which is the Diebold paper&#8217;s monthly U.S yield curve dataset.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"777\" height=\"640\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter01_data-shfintech.png\" alt=\"\" class=\"wp-image-207095 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter01_data-shfintech.png 777w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter01_data-shfintech-700x577.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter01_data-shfintech-300x247.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter01_data-shfintech-768x633.png 768w\" data-sizes=\"(max-width: 777px) 100vw, 777px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 777px; aspect-ratio: 777\/640;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Initial guesses for parameters are prepared and this is a rounded version of initial guesses which are provided by the above web page. I redefine an objective function (<strong>objf<\/strong>) based on&nbsp;<strong>kalman() function in this library<\/strong>&nbsp;to reduce the number of arguments to be passed. I also define a callback function (<strong>callbackF<\/strong>) which prints function evaluations periodically to check the progress of this optimization.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<strong>dynamic Nelson-Siegel-Svensson (DNSS) model&nbsp;<\/strong>can also be estimated by setting&nbsp;<strong>model = &#8216;S&#8217;<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"777\" height=\"800\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter02_init-shfintech.png\" alt=\"\" class=\"wp-image-207097 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter02_init-shfintech.png 777w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter02_init-shfintech-700x721.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter02_init-shfintech-300x309.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter02_init-shfintech-768x791.png 768w\" data-sizes=\"(max-width: 777px) 100vw, 777px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 777px; aspect-ratio: 777\/800;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Optimization is done by using&nbsp;<strong>optimize.minimize()<\/strong>&nbsp;function of&nbsp;<strong>scipy<\/strong>&nbsp;library with &#8216;<strong>L-BFGS-B<\/strong>&#8216; algorithm. Of course, there are many alternative optimization algorithm such as &#8216;<strong>Nelder-Mead<\/strong>&#8216;, &#8216;<strong>BFGS<\/strong>&#8216;, and &#8216;<strong>CG<\/strong>&#8216; to name a few. The callback function prints the number of iteration and the function evaluations.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"777\" height=\"348\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter03_opt-shfintech.png\" alt=\"\" class=\"wp-image-207098 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter03_opt-shfintech.png 777w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter03_opt-shfintech-700x314.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter03_opt-shfintech-300x134.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter03_opt-shfintech-768x344.png 768w\" data-sizes=\"(max-width: 777px) 100vw, 777px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 777px; aspect-ratio: 777\/348;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After many iterations, we can get the following results of estimation.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"899\" height=\"690\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter04_opt_output-shfintech.png\" alt=\"\" class=\"wp-image-207099 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter04_opt_output-shfintech.png 899w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter04_opt_output-shfintech-700x537.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter04_opt_output-shfintech-300x230.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter04_opt_output-shfintech-768x589.png 768w\" data-sizes=\"(max-width: 899px) 100vw, 899px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 899px; aspect-ratio: 899\/690;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Parameter estimates are stored at x of the resulted object (<strong>dns_opt.x<\/strong>).<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"899\" height=\"293\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter05_param_est-shfintech.png\" alt=\"\" class=\"wp-image-207100 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter05_param_est-shfintech.png 899w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter05_param_est-shfintech-700x228.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter05_param_est-shfintech-300x98.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/jupyter05_param_est-shfintech-768x250.png 768w\" data-sizes=\"(max-width: 899px) 100vw, 899px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 899px; aspect-ratio: 899\/293;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Concluding Remarks<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This post gives a guided-tour of how to use a Python library for estimation of dynamic Nelson-Siegel model. This also can be useful when the dynamic Svensson model needs to be estimated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Originally posted on <a href=\"https:\/\/shleeai.blogspot.com\/2022\/10\/python-code-estimation-of-dynamic.html\">SHLee AI Financial Model<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).<\/p>\n","protected":false},"author":662,"featured_media":185996,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[339,343,349,338,341],"tags":[806,17142,595],"contributors-categories":[13728],"class_list":["post-207086","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-python-development","category-ibkr-quant-news","category-quant-development","tag-data-science","tag-dynamic-nelson-siegel-model","tag-python","contributors-categories-sh-fintech-modeling"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v28.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Code: Estimation of Dynamic Nelson-Siegel Model<\/title>\n<meta name=\"description\" content=\"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/207086\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Code: Estimation of Dynamic Nelson-Siegel Model\" \/>\n<meta property=\"og:description\" content=\"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-23T14:50:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-23T14:50:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sang-Heon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sang-Heon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Sang-Heon Lee\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\"\n\t            },\n\t            \"headline\": \"Python Code: Estimation of Dynamic Nelson-Siegel Model\",\n\t            \"datePublished\": \"2024-05-23T14:50:13+00:00\",\n\t            \"dateModified\": \"2024-05-23T14:50:14+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/\"\n\t            },\n\t            \"wordCount\": 414,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/03\\\/python-word-cloud-programming-languages.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"Dynamic Nelson-Siegel Model\",\n\t                \"Python\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/\",\n\t            \"name\": \"Python Code: Estimation of Dynamic Nelson-Siegel Model | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/03\\\/python-word-cloud-programming-languages.jpg\",\n\t            \"datePublished\": \"2024-05-23T14:50:13+00:00\",\n\t            \"dateModified\": \"2024-05-23T14:50:14+00:00\",\n\t            \"description\": \"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/ibkr-quant-news\\\/python-code-estimation-of-dynamic-nelson-siegel-model\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/03\\\/python-word-cloud-programming-languages.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/03\\\/python-word-cloud-programming-languages.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Python\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\",\n\t            \"name\": \"Sang-Heon Lee\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/sang-heonlee\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Code: Estimation of Dynamic Nelson-Siegel Model","description":"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).","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:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/207086\/","og_locale":"en_US","og_type":"article","og_title":"Python Code: Estimation of Dynamic Nelson-Siegel Model","og_description":"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/","og_site_name":"IBKR Campus US","article_published_time":"2024-05-23T14:50:13+00:00","article_modified_time":"2024-05-23T14:50:14+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","type":"image\/jpeg"}],"author":"Sang-Heon Lee","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sang-Heon Lee","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#article","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/"},"author":{"name":"Sang-Heon Lee","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200"},"headline":"Python Code: Estimation of Dynamic Nelson-Siegel Model","datePublished":"2024-05-23T14:50:13+00:00","dateModified":"2024-05-23T14:50:14+00:00","mainEntityOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/"},"wordCount":414,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","keywords":["Data Science","Dynamic Nelson-Siegel Model","Python"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/","url":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/","name":"Python Code: Estimation of Dynamic Nelson-Siegel Model | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#primaryimage"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","datePublished":"2024-05-23T14:50:13+00:00","dateModified":"2024-05-23T14:50:14+00:00","description":"This post introduces a Python library for estimation of the dynamic Nelson-Siegel (DNS).","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/ibkr-quant-news\/python-code-estimation-of-dynamic-nelson-siegel-model\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","width":1000,"height":563,"caption":"Python"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200","name":"Sang-Heon Lee","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/sang-heonlee\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/03\/python-word-cloud-programming-languages.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/207086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=207086"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/207086\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/185996"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=207086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=207086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=207086"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=207086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}