{"id":1536,"date":"2021-10-29T10:50:18","date_gmt":"2021-10-29T10:50:18","guid":{"rendered":"https:\/\/www.pyxll.com\/blog\/?p=1536"},"modified":"2022-02-24T19:02:54","modified_gmt":"2022-02-24T19:02:54","slug":"building-a-univariate-garch-model-in-excel","status":"publish","type":"post","link":"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/","title":{"rendered":"Building a Univariate Garch Model in Excel"},"content":{"rendered":"\n<p>In this post, we are going to build a Univariate Garch model in Excel. Garch models are used to estimate the volatility of financial assets.<\/p>\n\n\n\n<p>Building this model in VBA would be an extremely difficult task, even for people who understand VBA very well. Estimating the Univariate Garch parameters would require us to utilize the maximum log-likelihood. Especially, there is no package that is built in Excel to perform such a task.<\/p>\n\n\n\n<p>Building such a model in Python however is straightforward, and using PyXLL we can use that Python model in Excel.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/juRd2E_FTp4?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f8b112a4090\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f8b112a4090\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Building_the_Garch_Model_in_Python\" >Building the Garch Model in Python<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Installing_the_required_depenencies\" >Installing the required depenencies<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Writing_the_garch_parameters_function\" >Writing the garch_parameters function<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Testing_our_function\" >Testing our function<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Calling_the_Garch_Model_from_Excel\" >Calling the Garch Model from Excel<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Exposing_the_Python_function_to_Excel\" >Exposing the Python function to Excel<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Calling_the_Python_function_from_Excel\" >Calling the Python function from Excel<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Using_a_Jupyter_Notebook_for_Python_development\" >Using a Jupyter Notebook for Python development<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Using_the_Garch_model_with_real_data\" >Using the Garch model with real data<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Fetching_returns_data_from_Yahoo_Finance\" >Fetching returns data from Yahoo Finance<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Fitting_the_model_parameters\" >Fitting the model parameters<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Getting_the_conditional_volatilities_from_the_model\" >Getting the conditional volatilities from the model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Plotting_the_results\" >Plotting the results<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#Next_Steps%E2%80%A6\" >Next Steps&#8230;<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/#References\" >References<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Building_the_Garch_Model_in_Python\"><\/span>Building the Garch Model in Python<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We first need to write the Python code to estimate the parameters of the Garch model. The code to do that is as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom arch import arch_model\nimport pandas\n\ndef garch_parameters(array):\n   am = arch_model(array)\n   res = am.fit()\n   parameters = res.params\n   df = pandas.DataFrame(data={&quot;Parameters&quot;: res.params})\n   return df\n<\/pre><\/div>\n\n\n<p>The following describes the steps involved in writing this code:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Installing_the_required_depenencies\"><\/span><strong>Installing the required depenencies<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We need to install the two required packages using Pip.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>First is the arch package which will help us to estimate the Garch parameters. We can install this by running &#8220;pip install arch&#8221;. The documentation for this arch package can be found here <a href=\"https:\/\/arch.readthedocs.io\/en\/latest\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/arch.readthedocs.io\/en\/latest\/<\/a>.<\/li><li>The second package is pandas which helps us to organize our DataFrame. If you don&#8217;t already have pandas installed you can do so by running &#8220;pip install pandas&#8221;. The documentation for pandas is here <a href=\"https:\/\/pandas.pydata.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/pandas.pydata.org\/<\/a>.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Writing_the_garch_parameters_function\"><\/span><strong>Writing the garch_parameters function<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>The name of our function is &#8220;garch_parameters&#8221;. This function will take in a list of numbers and return a pandas DataFrame containing the estimated model parameters. Typically a Garch model would take a list of returns from a financial asset, such as a stock or index.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>We create a variable called \u201cam\u201d which calls in the arch_model library from the arch package.<\/li><li>We create another variable called \u201cres\u201d. This \u201cres\u201d variable will call the function fit() from the arch_model library from the Arch package.&nbsp;<\/li><li>Now this \u201cres\u201d variable stores all the information relating to our Garch model. This includes the model parameters, predicted values, forecasted values, etc&#8230;<\/li><li>We only want the parameters information in this case. Hence, we create another variable called \u201cparameters\u201d and set it to the &#8220;params&#8221; property from the &#8220;res&#8221; object. The &#8220;res.params&#8221; object is a pandas Series.<\/li><li>After that, we create a new pandas DataFrame with a single &#8220;Parameters&#8221; column, populated with the paramaters from the model.<\/li><li>Finally, we have to return the DataFrame from the \u201cgarch_parameters\u201d function.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Testing_our_function\"><\/span><strong>Testing our function<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We would like to test our function to make sure that it actually works as expected.<\/p>\n\n\n\n<p>We can do that by passing a list of numbers from 1 to 9 to the \u201cgarch_parameters\u201d function. These numbers are meaningless but will do to test our function for now. After that, we want to print out the result from the function.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\narray = &#x5B;1, 2, 3, 4, 5, 6, 7, 8, 9]\nparameters = garch_parameters(array)\nprint(parameters)\n<\/pre><\/div>\n\n\n<p>The result of this is below. The first part is logging output when fitting the model, and the last part is our returned DataFrame.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nIteration:      1,   Func. Count:      6,   Neg. LLF: 20.506584350020002\nIteration:      2,   Func. Count:     11,   Neg. LLF: 20.44190810570409\nIteration:      3,   Func. Count:     16,   Neg. LLF: 20.152409978459932\nIteration:      4,   Func. Count:     21,   Neg. LLF: 20.45211420593808\nIteration:      5,   Func. Count:     27,   Neg. LLF: 20.0944858717587\nIteration:      6,   Func. Count:     32,   Neg. LLF: 20.05342532414289\nIteration:      7,   Func. Count:     37,   Neg. LLF: 20.049494048694175\nIteration:      8,   Func. Count:     42,   Neg. LLF: 20.049237484531698\nIteration:      9,   Func. Count:     47,   Neg. LLF: 20.049226996078335\nIteration:     10,   Func. Count:     52,   Neg. LLF: 20.049224914701313\nIteration:     11,   Func. Count:     56,   Neg. LLF: 20.049224940608756\nOptimization terminated successfully    (Exit mode 0)\n            Current function value: 20.049224914701313\n            Iterations: 11\n            Function evaluations: 56\n            Gradient evaluations: 11\n\nParameters\nmu\t        4.419667\nomega\t    1.025551\nalpha&#x5B;1]\t1.000000\nbeta&#x5B;1]\t    0.000000\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-calling-the-garch-model-from-excel\"><span class=\"ez-toc-section\" id=\"Calling_the_Garch_Model_from_Excel\"><\/span>Calling the Garch Model from Excel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Now that we know our Python function works, how do we use this function in an Excel environment? This is where PyXLL comes into play. PyXLL is an Excel add-in that allows us to call Python functions directly from Excel.<\/p>\n\n\n\n<p>If you are new to PyXLL please visit <a href=\"https:\/\/www.pyxll.com\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com<\/a>. There you can find more information about PyXLL, including how to install and configure the add-in.<\/p>\n\n\n\n<p>We are going to use the <em>xl_func<\/em> decorator from PyXLL. The <em>xl_func<\/em> decorator instructs the PyXLL add-in that this function is to be exposed to Excel as a worksheet function. PyXLL will export this function to Excel so we can call it from an Excel worksheet.<\/p>\n\n\n\n<p>The video <a href=\"https:\/\/www.pyxll.com\/docs\/videos\/worksheet-functions.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/docs\/videos\/worksheet-functions.html<\/a> is a good introduction to writing Excel worksheet functions in Python using PyXLL. If you have not written a worksheet function using PyXLL before this video is a good place to start.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-exposing-the-python-function-to-excel\"><span class=\"ez-toc-section\" id=\"Exposing_the_Python_function_to_Excel\"><\/span>Exposing the Python function to Excel<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>To expose our &#8220;garch_parameters&#8221; function to Excel we only need to apply the <em>xl_func<\/em> decorator to the function. We must also add our Python module to the &#8220;modules&#8221; list in the &#8220;pyxll.cfg&#8221; config file (without the .py extension). You may also need to add your source folder to the &#8220;pythonpath&#8221; setting. Your source folder is the folder where you have saved your Python module.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n; Your pyxll.cfg file will need to be updated\n; with the location of your Python code, and the\n; name of the Python module you have written\n; containing the &quot;garch_parameters&quot; function.\n\n&#x5B;PYTHON]\npythonpath =\n    ...\n    C:\\where\\your\\code\\is\n\n&#x5B;PYXLL]\nmodules =\n    ...\n    your_garch_module\n<\/pre><\/div>\n\n\n<p>The <em>xl_func<\/em> decorator takes a string that tells PyXLL what arguments the function expects, and what it returns. PyXLL uses this to convert from the Excel function inputs to the Python arguments. PyXLL will apply some default conversion if we don&#8217;t specify anything, but in this case we want to be explicit.<\/p>\n\n\n\n<p>Our decorated function looks as follows:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom pyxll import xl_func\nfrom arch import arch_model\nimport pandas\n\n@xl_func(&quot;float&#x5B;]: dataframe&lt;index=True&gt;&quot;)\ndef garch_parameters(array):\n   am = arch_model(array)\n   res = am.fit()\n   parameters = res.params\n   df = pandas.DataFrame(data={&quot;Parameters&quot;: res.params})\n   return df\n<\/pre><\/div>\n\n\n<p>Our Excel function takes an array of numbers and returns a 2d array of data back to Excel. This is acheived by the function signature string passed to the <em>xl_func<\/em> decorator. The \u201cfloat[]\u201d argument means that this function will take in 1d array of numbers from Excel and pass it to our function as a list of floats. After a colon we specify the function return type, which tells PyXLL how to convert our returned value to something Excel can handle. We want PyXLL to convert the returned DataFrame, including the index, to a range of values in Excel and so we use \u201cdataframe&lt;index=True&gt;\u201d as the return type.<\/p>\n\n\n\n<p>You can find more about how PyXLL handles argument and return types in the user guide here <a href=\"https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/argtypes.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/argtypes.html<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-calling-the-python-function-from-excel\"><span class=\"ez-toc-section\" id=\"Calling_the_Python_function_from_Excel\"><\/span>Calling the Python function from Excel<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Now we can test this function in Excel. If you open Excel, this function will be automatically available in excel. If you have Excel already open you will need to reload the PyXLL add-in. Reloading PyXLL will load your Python module that you configured in the pyxll.cfg file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image.png\"><img decoding=\"async\" data-attachment-id=\"1537\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-15\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image.png\" data-orig-size=\"999,324\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image.png\" alt=\"\" class=\"wp-image-1537\" width=\"500\" height=\"162\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image.png 999w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-300x97.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-768x249.png 768w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/a><figcaption>Reloading via the PyXLL ribbon. Your ribbon may look different and it can be customised via the ribbon.xml file.<\/figcaption><\/figure>\n\n\n\n<p>To call the function from Excel we enter &#8220;=garch_parameters(&#8230;)&#8221; and pass it an array of numbers. Using the same array of numbers we called the Python function with earlier results in the same result in Excel.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1.png\"><img decoding=\"async\" data-attachment-id=\"1538\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-1-4\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1.png\" data-orig-size=\"770,379\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1.png\" alt=\"\" class=\"wp-image-1538\" width=\"578\" height=\"284\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1.png 770w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1-300x148.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-1-768x378.png 768w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/a><figcaption>The Python function &#8220;garch_paramerters&#8221; can be called directly from Excel. <\/figcaption><\/figure>\n\n\n\n<p><strong>Note<\/strong>: If you are using an old version of Excel you may find that the array doesn&#8217;t automatically expand. Dynamic arrays are a new feature in Office 365. To automatically expand an array in older versions, pass &#8220;auto_expand=True&#8221; to the xl_func decorator. See <a href=\"https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/arrayfuncs.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/arrayfuncs.html<\/a> for more details about array functions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-using-a-jupyter-notebook-for-python-development\"><span class=\"ez-toc-section\" id=\"Using_a_Jupyter_Notebook_for_Python_development\"><\/span>Using a Jupyter Notebook for Python development<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The next step in the process is to load the real data, and estimate the garch model based on this data. We are going to do this in a Jupyter notebook using the PyXLL-Jupyter package.<\/p>\n\n\n\n<p>Using a Jupyter notebook allows us to quickly write Python code directly in Excel. One drawback of using a Jupyter notebook is that it won&#8217;t load automatically when starting Excel. The Jupyter notebook has to be run for our code to be available in Excel. It is useful for developing as we can iterate quickly, but for deployment moving the code to a Python module is often better.<\/p>\n\n\n\n<p>Before we can use a Jupyter notebook in Excel we need to install the PyXLL-Jupyter package, which can be done by running:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npip install pyxll-jupyter\n<\/pre><\/div>\n\n\n<p>Once installed, reload PyXLL and you will see the Jupyter button in the PyXLL ribbon.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2.png\"><img decoding=\"async\" data-attachment-id=\"1540\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-2-4\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2.png\" data-orig-size=\"1090,322\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2-1024x303.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2-1024x303.png\" alt=\"\" class=\"wp-image-1540\" width=\"512\" height=\"152\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2-1024x303.png 1024w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2-300x89.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2-768x227.png 768w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-2.png 1090w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><\/figure>\n\n\n\n<p>Clicking the Jupyter button opens the Jupyter notebooks application inside of Excel. For more details about how to use the PyXLL-Jupyter package please see <a href=\"https:\/\/www.pyxll.com\/blog\/python-jupyter-notebooks-in-excel\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/blog\/python-jupyter-notebooks-in-excel\/<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8.png\"><img decoding=\"async\" width=\"1024\" height=\"571\" data-attachment-id=\"1549\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-8-4\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8.png\" data-orig-size=\"1586,884\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-8\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-1024x571.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-1024x571.png\" alt=\"\" class=\"wp-image-1549\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-1024x571.png 1024w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-300x167.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-768x428.png 768w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8-1536x856.png 1536w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-8.png 1586w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_the_Garch_model_with_real_data\"><\/span>Using the Garch model with real data<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Fetching_returns_data_from_Yahoo_Finance\"><\/span>Fetching returns data from Yahoo Finance<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We&#8217;ve already tested out &#8220;garch_parameters&#8221; function with some test data. To be useful however we need some real data, which we can load from Yahoo Finance using the &#8220;pandas_datareader&#8221; package.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom pyxll import xl_func\nimport pandas\nimport datetime as dt\nimport pandas_datareader.data as web\n\n@xl_func(&quot;string: dataframe&lt;index=False&gt;&quot;)\ndef data_load(symbol):\n    start = dt.datetime(2000,1,1)\n    end = dt.datetime(2014,1,1)\n    data = web.get_data_yahoo(symbol, start=start, end=end)\n    \n    market = data&#x5B;&quot;Adj Close&quot;]\n    returns = 100 * market.pct_change().dropna()\n    return_val = &#x5B;]\n    for i in returns:\n        return_val.append(i)\n    df = pandas.DataFrame(data={&quot;Returns&quot;:return_val})\n    return df\n<\/pre><\/div>\n\n\n<p>There are 2 additional packages that we need are <em>datetime <\/em>and <em>pandas_datareader<\/em>. The <em>pandas_datareader <\/em>package is used to load data from Yahoo Finance. The datetime package is used to specify the start and end dates that we are loading data for (ed: These dates could be passed into our function instead of hard coding them in the function).<\/p>\n\n\n\n<p>Our new function <em>data_load<\/em> takes a string as an argument and returns a DataFrame. The string argument in this case is the symbol of stock, for instance: AAPL, IBM, etc&#8230;. The DataFrame returned contains the returns for that symbol.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7.png\"><img decoding=\"async\" width=\"1024\" height=\"604\" data-attachment-id=\"1548\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-7-4\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7.png\" data-orig-size=\"1583,933\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-7\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-1024x604.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-1024x604.png\" alt=\"\" class=\"wp-image-1548\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-1024x604.png 1024w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-300x177.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-768x453.png 768w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7-1536x905.png 1536w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-7.png 1583w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption> Don&#8217;t forget to &#8220;Run&#8221; the cells in the Jupyter notebook to run the Python code! <\/figcaption><\/figure>\n\n\n\n<p>After entering the code into the Jupyter notebook and running the cell, our new &#8220;data_load&#8221; function is available to call from Excel.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Fitting_the_model_parameters\"><\/span>Fitting the model parameters<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We already have our &#8220;garch_parameters&#8221; function in Excel. We can call this using the returns we&#8217;ve just loaded!<\/p>\n\n\n\n<p><img decoding=\"async\" width=\"335\" height=\"222\" src=\"https:\/\/lh4.googleusercontent.com\/pFsC0U7ENQEr8BejyzEq3-p2YTUnONsMKZZwH5Q6M0ZWJ7NAve3oqAE53X-ZV2572Wml3q9bjQU6AF4d9GDkzi5XA8JAWtJ5lsp-_olmLmTslv5ZIzMMzNT2Px3LG0Q7vcfqFtQW\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Getting_the_conditional_volatilities_from_the_model\"><\/span>Getting the conditional volatilities from the model<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>As well as the model parameters, the Garch model can also return us the conditional volatilities. To access those we can write a function similar to our garch_parameters function, but getting the conditional volatilities from the model instead.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfrom pyxll import xl_func\nimport pandas\nfrom arch import arch_model\n\n@xl_func(&quot;float&#x5B;] array:dataframe&amp;lt;index=False&gt;&quot;)\ndef conditional_vols(array):\n    am = arch_model(array)\n    res = am.fit()\n    df = pandas.DataFrame(data={\n        &quot;conditional_volatility&quot;: res.conditional_volatility\n    })\n    return df\n<\/pre><\/div>\n\n\n<p>Rather than using &#8220;res.params&#8221;, here we use &#8220;res.conditional_volatility&#8221;. This function takes the same array of returns as the garch_parameters function, and we can call it from Excel with our loaded returns data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6.png\"><img decoding=\"async\" width=\"1024\" height=\"555\" data-attachment-id=\"1547\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-6-4\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6.png\" data-orig-size=\"1586,859\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-1024x555.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-1024x555.png\" alt=\"\" class=\"wp-image-1547\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-1024x555.png 1024w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-300x162.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-768x416.png 768w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6-1536x832.png 1536w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-6.png 1586w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Plotting_the_results\"><\/span>Plotting the results<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Pandas has excellent plotting capabilities. Using the <em>pyxll.plot()<\/em> function we can display plots made with pandas in Excel. The following function takes a list of numbers and uses pandas to do a simple line plot:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfrom pyxll import plot\n\n@xl_func(&quot;float&#x5B;]&quot;)\ndef plot_a(data):\n    df = pandas.DataFrame(data={&quot;Volatility&quot;:data})\t\t       \n    df.plot(kind=&#039;line&#039;,\n            xlabel=&quot;Date&quot;,\n            ylabel=&quot;Volatility&quot;,\n            grid=&quot;True&quot;)\n    plot()\n\n<\/pre><\/div>\n\n\n<p>The last line, &#8220;plot()&#8221; (imported from the pyxll package) displays the pandas plot in Excel below where the function is called from.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><a href=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9.png\"><img decoding=\"async\" data-attachment-id=\"1550\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/building-a-univariate-garch-model-in-excel\/image-9-3\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9.png\" data-orig-size=\"945,765\" data-comments-opened=\"0\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-9\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9.png\" alt=\"\" class=\"wp-image-1550\" width=\"473\" height=\"383\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9.png 945w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9-300x243.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/image-9-768x622.png 768w\" sizes=\"(max-width: 473px) 100vw, 473px\" \/><\/a><figcaption>Pandas plots can be displayed in Excel using pyxll.plot()<\/figcaption><\/figure>\n\n\n\n<p>As we change the inputs to the model the output are recalculated automatically, and the plot updates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-next-steps\"><span class=\"ez-toc-section\" id=\"Next_Steps%E2%80%A6\"><\/span>Next Steps&#8230;<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article we have seen how to fit a Garch model using the Python package &#8220;arch&#8221;. We also saw how we can call the Python model from Excel, load data, and extract results from the model.<\/p>\n\n\n\n<p>Garch models are commonly used for forecasting future volatility as part of a trading strategy. The approaches used in this blog can be extended to make predictions based on inputs in Excel. Using Excel as a front-end to a model means that we can interact with it very easily. Any change to an input results in the calculations being recomputed automatically and the results update in real time.<\/p>\n\n\n\n<p>As the code is plain Python code it can be used outside of Excel, for example for unit testing or as part of a batch process. Our Python code takes advantage of sophisticated Python packages, and our Excel spreadsheet simply calls that same Python code.<\/p>\n\n\n\n<p>By adding more Garch functions to our Python module we could build up a complete toolkit of Garch functions in Excel. This could be used to perform analysis directly in Excel, or even build a trading application where all of the inputs and outputs are available to the Excel user. Using the <em>pyxll.plot<\/em> function allows us to build dashboard like features into our Excel application.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"References\"><\/span>References<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>The &#8220;arch&#8221; Python package: <a href=\"https:\/\/arch.readthedocs.io\/en\/latest\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/arch.readthedocs.io\/en\/latest\/<\/a><\/li><li>PyXLL, the Excel Python Add-In: <a href=\"https:\/\/www.pyxll.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com<\/a><\/li><li>Writing Worksheet functions in Excel using PyXLL: <a href=\"https:\/\/www.pyxll.com\/docs\/videos\/worksheet-functions.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/docs\/videos\/worksheet-functions.html<\/a><\/li><li>Python Juputer notebooks in Excel: <a href=\"https:\/\/www.pyxll.com\/blog\/python-jupyter-notebooks-in-excel\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/blog\/python-jupyter-notebooks-in-excel\/<\/a><\/li><li>Pandas: <a href=\"https:\/\/pandas.pydata.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/pandas.pydata.org\/<\/a><\/li><li>Python Plotting in Excel: <a href=\"https:\/\/www.pyxll.com\/docs\/userguide\/plotting\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pyxll.com\/docs\/userguide\/plotting\/index.html<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to build a Univariate Garch model in Excel. Garch models are used to estimate the volatility of financial assets.<\/p>\n","protected":false},"author":853,"featured_media":1552,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[558,649,56,12,2,272],"tags":[],"class_list":["post-1536","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deployment","category-jupyter","category-machine-learning","category-python","category-pyxll","category-visualization"],"acf":[],"jetpack_featured_media_url":"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2021\/10\/garch.png","jetpack_shortlink":"https:\/\/wp.me\/p7l3LP-oM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/users\/853"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/comments?post=1536"}],"version-history":[{"count":1,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1536\/revisions"}],"predecessor-version":[{"id":1603,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1536\/revisions\/1603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/media\/1552"}],"wp:attachment":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/media?parent=1536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/categories?post=1536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/tags?post=1536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}