{"id":1263,"date":"2020-02-06T11:10:37","date_gmt":"2020-02-06T11:10:37","guid":{"rendered":"https:\/\/www.pyxll.com\/blog\/?p=1263"},"modified":"2020-06-18T11:07:32","modified_gmt":"2020-06-18T11:07:32","slug":"anvil-pyxll","status":"publish","type":"post","link":"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/","title":{"rendered":"Cloud Deployment of Python Powered Excel Functions"},"content":{"rendered":"\n<p>When tackling real world problems writing the code is only part of the story. Getting the code into the hands of the people it was written for is sometimes just as much of a problem as it was to develop it in the first place.<\/p>\n\n\n\n<p>Companies or teams often feel the pain of code deployment as they scale. It doesn&#8217;t take long before emailing a script for someone else to run on their PC is no longer sufficient (not to mention the operational risk of such practices). Web apps can be an attractive solution but the development, infrastructure and maintenance required presents a new set of problems.<\/p>\n\n\n\n<p>The following video accompanies this article. <\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-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\/fSjYCYMU_J4?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-69f5a3d4de5da\" 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-69f5a3d4de5da\"  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\/anvil-pyxll\/#Introducing_Anvil\" >Introducing Anvil<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#From_a_Web_App_to_Excel\" >From a Web App to Excel<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#Example_A_Black_Scholes_Option_Pricer\" >Example: A Black Scholes Option Pricer<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#An_Option_Pricer_as_a_Web_App\" >An Option Pricer as a Web App<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#Calling_the_Option_Pricer_from_Excel\" >Calling the Option Pricer from Excel<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#Setting_up_the_Anvil_Uplink\" >Setting up the Anvil Uplink<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/#Calling_the_Function_from_Excel\" >Calling the Function from Excel<\/a><\/li><\/ul><\/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\/anvil-pyxll\/#Conclusions\" >Conclusions<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introducing_Anvil\"><\/span>Introducing Anvil<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/anvil.works\" target=\"_blank\">Anvil<\/a> is a solution that enables developers, analysts and data scientists to deploy their Python code as a Python-only Web Application. Unlike other methods of developing web applications, no JavaScript or HTML programming is required. With Anvil you can focus on the functionality of your application without letting the complexities of building the web app from scratch bog you down.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" src=\"https:\/\/anvil.works\/learn\/tutorials\/img\/dashboard\/business-dash.png\" alt=\"\"\/><figcaption>Anvil allows you to create rich web apps using only Python code. No JavaScript required.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"From_a_Web_App_to_Excel\"><\/span>From a Web App to Excel<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>With <a href=\"https:\/\/www.pyxll.com\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">PyXLL<\/a> you can write fully featured Excel add-ins using nothing but Python. The most commonly used feature of PyXLL is its ability to expose Python functions as &#8220;worksheet functions&#8221;, so that Python functions can be called from formulas in Excel workbooks.<\/p>\n\n\n\n<p>Typically, you install the Python code for PyXLL to run on the same local PC that is running Excel. <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/anvil.works\" target=\"_blank\">Anvil<\/a> allows Python code to run on remote servers in the same way that it does when web apps run in a web browser. By combining the two we can have an Excel add-in that exposes Python functions deployed in the cloud, run from worksheet functions right in Excel!<\/p>\n\n\n\n<p>The open-source project <a href=\"https:\/\/github.com\/pyxll\/anvil-pyxll\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Anvil-PyXLL<\/a> bridges Anvil and PyXLL. Exposing a Python function to Excel is as simple as adding the @xl_func decorator to the function definition. We&#8217;ll look at how in the next sections.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"425\" data-attachment-id=\"1303\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/g45462\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462.png\" data-orig-size=\"1687,700\" 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=\"g45462\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-1024x425.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-1024x425.png\" alt=\"Call Python web apps from Excel\" class=\"wp-image-1303\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-1024x425.png 1024w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-300x124.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-768x319.png 768w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462-1536x637.png 1536w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462.png 1687w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Example_A_Black_Scholes_Option_Pricer\"><\/span>Example: A Black Scholes Option Pricer<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The Black Scholes pricing model is a well understood model for pricing European Options. We won&#8217;t go into details about it in this post, we will just use it as an example. If you don&#8217;t know anything about option pricing don&#8217;t be put off, just think of it as a black box function with some inputs that produces an output that we can code in Python.<\/p>\n\n\n\n<p>To follow along in Anvil you can clone the <a href=\"https:\/\/anvil.works\/build#clone:O2G7KS4BHEV7QW4V=ZSZUBOJHI6AINSD7YB6QIY2E%7C6JJFLNHW5OWUUU5V=R64REN5HOEMYJEZPL6K3YI5E\" target=\"_blank\" rel=\"noreferrer noopener\">Black Scholes Option Pricer app<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"An_Option_Pricer_as_a_Web_App\"><\/span>An Option Pricer as a Web App<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>We will start by creating an Anvil app. To design our web app we drag and drop components onto the form as needed. If you&#8217;re new to Anvil take a look at some of the <a rel=\"noreferrer noopener\" aria-label=\"tutorials (opens in a new tab)\" href=\"https:\/\/anvil.works\/learn\/tutorials\" target=\"_blank\">tutorials<\/a> or clone our  <a href=\"https:\/\/anvil.works\/build#clone:O2G7KS4BHEV7QW4V=ZSZUBOJHI6AINSD7YB6QIY2E%7C6JJFLNHW5OWUUU5V=R64REN5HOEMYJEZPL6K3YI5E\" target=\"_blank\" rel=\"noreferrer noopener\">Black Scholes Option Pricer app<\/a>. Here&#8217;s what our form looks like after creating all the inputs needed for pricing an option:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1269\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-10-at-15-59-20\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20.png\" data-orig-size=\"794,772\" 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=\"Screen-Shot-2020-01-10-at-15.59.20\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20.png\" alt=\"\" class=\"wp-image-1269\" width=\"596\" height=\"579\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20.png 794w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20-300x292.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-15.59.20-768x747.png 768w\" sizes=\"(max-width: 596px) 100vw, 596px\" \/><\/figure>\n\n\n\n<p>Now we can flip to the <em>Code<\/em> tab and write the code that will power our web app. The code we write here is Python code but it will actually run in the web browser (or <em>client<\/em>). This code handles how the user interface should respond to events. The actual option pricing will be performed as a <em>server function<\/em>.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nfrom anvil import *\nimport anvil.server\n\n\nclass BlackScholesOptionPricer(BlackScholesOptionPricerTemplate):\n  def __init__(self, **properties):\n    # Set Form properties and Data Bindings.\n    self.init_components(**properties)\n\n    # Any code you write here will run when the form opens.\n    self.calculate()\n\n  def calculate(self, **event_args):\n    &quot;&quot;&quot;Calculate the fair price of the option&quot;&quot;&quot;\n    try:\n        self.result.text = &quot;Calculating...&quot;\n      \n        spot = float(self.spot.text or self.spot.placeholder)\n        strike = float(self.strike.text or self.strike.placeholder)\n        expiry = float(self.expiry.text or self.expiry.placeholder)\n        volatility = float(self.volatility.text or self.volatility.placeholder) \/ 100.0\n        interest_rate = float(self.interest_rate.text or self.interest_rate.placeholder) \/ 100.0\n        div_yield = float(self.div_yield.text or self.div_yield.placeholder) \/ 100.0\n        is_call = self.option_type.selected_value == &#039;Call&#039;\n    \n        result = anvil.server.call(&#039;black_scholes&#039;,\n                                    spot,\n                                    strike,\n                                    expiry,\n                                    volatility,\n                                    interest_rate,\n                                    div_yield,\n                                    is_call)\n        \n        self.result.text = &quot;{result:.2}&quot;.format(result=result)\n    except Exception as e:\n        self.result.text = &quot;Error: {e}&quot;.format(e=e)\n<\/pre><\/div>\n\n\n<p>In code above you will see that we are extracting the values from the form using the names of the controls that we configured when creating the form in the <em>Design<\/em> view. We then call <em>anvil.server.call(&#8216;black_scholes<\/em>&#8216;, &#8230;) with those inputs and set the result back on the form.<\/p>\n\n\n\n<p>The call to <em>anvil.server.call(&#8216;black_scholes<\/em>&#8216;, &#8230;) is calling our Black Scholes server function which we have yet to write. To add this, on the left hand side in the App Browser click the + icon by <em>SERVER MODULES<\/em> and add a new module called &#8216;blackscholes&#8217;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1271\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-10-at-16-07-24\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.07.24.png\" data-orig-size=\"400,235\" 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=\"Screen-Shot-2020-01-10-at-16.07.24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.07.24.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.07.24.png\" alt=\"\" class=\"wp-image-1271\" width=\"300\" height=\"176\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.07.24.png 400w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.07.24-300x176.png 300w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/figure>\n\n\n\n<p>The following code is our &#8216;backscholes&#8217; module. It is missing a few functions in order to keep the code more readable. For the full module clone the <a href=\"https:\/\/anvil.works\/build#clone:O2G7KS4BHEV7QW4V=ZSZUBOJHI6AINSD7YB6QIY2E%7C6JJFLNHW5OWUUU5V=R64REN5HOEMYJEZPL6K3YI5E\" target=\"_blank\" rel=\"noreferrer noopener\">Black Scholes Option Pricer app<\/a>.<\/p>\n\n\n\n<p>The <em>@anvil.server.callable<\/em> decorator applied to our &#8216;black_scholes&#8217; function is what registers this function as a server function. This allows us to call it from the client code using <em>anvil.server.call(&#8216;black_scholes<\/em>&#8216;, &#8230;).<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport anvil.server\nimport math\n\n@anvil.server.callable\ndef black_scholes(spot,\n                  strike,\n                  expiry,\n                  volatility,\n                  interest_rate,\n                  dividend_yield,\n                  is_call=True):\n    &quot;&quot;&quot;\n    Return the fair market value of a European option using the\n    Black-Scholes formula.\n    \n    :param spot: Spot price\n    :param strike: Strike price\n    :param expiry: Time to expiry (year fraction)\n    :param volatility: Volatility of underlying asset\n    :param interest_rate: Risk free interest rate\n    :param dividend_yield: Rate of continuous dividend paying asset\n    :param is_call: True if call option, False if put option\n    :return: Fair market value of the option\n    &quot;&quot;&quot;\n    if expiry &lt;= 0.0:\n        raise ValueError(&quot;Expiry must be &gt; 0&quot;)\n    \n    if volatility &lt;= 0.0:\n        raise ValueError(&quot;Volatility must be &gt; 0&quot;)\n\n    d1 = (math.log(spot \/ strike) + (interest_rate - dividend_yield + 0.5 * volatility ** 2) * expiry) \/ (volatility * math.sqrt(expiry))\n    d2 = (math.log(spot \/ strike) + (interest_rate - dividend_yield - 0.5 * volatility ** 2) * expiry) \/ (volatility * math.sqrt(expiry))\n    \n    if is_call:\n        result = (spot * math.exp(-dividend_yield * expiry) * cdf(d1) - strike * math.exp(-interest_rate * expiry) * cdf(d2))\n    else:\n        result = (strike * math.exp(-interest_rate * expiry) * cdf(-d2) - spot * math.exp(-dividend_yield * expiry) * cdf(-d1))\n        \n    return result\n<\/pre><\/div>\n\n\n<p>Now we have everything in place we can run the Anvil app and test out our option pricer by clicking the &#8220;Run&#8221; button.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1273\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-10-at-16-12-45\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45.png\" data-orig-size=\"735,732\" 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=\"Screen-Shot-2020-01-10-at-16.12.45\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45.png\" alt=\"\" class=\"wp-image-1273\" width=\"551\" height=\"549\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45.png 735w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45-300x300.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-10-at-16.12.45-150x150.png 150w\" sizes=\"(max-width: 551px) 100vw, 551px\" \/><\/figure>\n\n\n\n<p>As the values in the form change the server function is called and the calculated option value updates!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Calling_the_Option_Pricer_from_Excel\"><\/span>Calling the Option Pricer from Excel<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Being able to price a single option is one thing but what if we want to price multiple options, or a whole portfolio? Or what if we want to pull in real-time data to use as the inputs to our pricing functions? Excel is a perfect fit for these types of problems. With PyXLL our Python function can be called directly from Excel.<\/p>\n\n\n\n<p>PyXLL is an Excel add-in that you will need to install on your local PC and add to Excel. If you are new to PyXLL you can <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.pyxll.com\/download.html\" target=\"_blank\">download a trial version of PyXLL<\/a> and follow <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.pyxll.com\/docs\/userguide\/installation.html\" target=\"_blank\">the online documentation to install it<\/a>.<\/p>\n\n\n\n<p>Python functions are exposed to Excel as Worksheet Functions (also called UDFs &#8211; User Defined Functions) via the <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/introduction.html\" target=\"_blank\">PyXLL decorator @xl_func<\/a>. The Python code is written in Python modules, which are listed in the PyXLL config file, <em>pyxll.cfg<\/em>. PyXLL imports these modules and runs the Python code on the local PC in-process. In order to run the Anvil server functions in the cloud we will use an additional package, <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/pyxll\/anvil-pyxll\" target=\"_blank\">anvil-pyxll<\/a>.<\/p>\n\n\n\n<p>The Anvil-PyXLL package can be downloaded or cloned from GitHub here <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/github.com\/pyxll\/anvil-pyxll\" target=\"_blank\">https:\/\/github.com\/pyxll\/anvil-pyxll<\/a>. This package contains everything we&#8217;ll need to connect Excel and PyXLL to our Anvil web app.<\/p>\n\n\n\n<p>After downloading or cloning the <em>anvil-pyxll<\/em> project, install the dependencies by running <em>pip install -r requirements.txt<\/em> in the anvil-pyxll folder.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Setting_up_the_Anvil_Uplink\"><\/span>Setting up the Anvil Uplink<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>Back in Anvil we need to: <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> Enable the <em>Uplink<\/em> feature so that our black_scholes function can be called from outside of our web app. <\/li><li> Apply the @xl_func decorator to the <em>black_scholes<\/em> function so it can be exposed to Excel. <\/li><\/ul>\n\n\n\n<p>To enable the Uplink feature, in Anvil click on the settings icon in the App Browser and select &#8220;Uplink&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1284\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-13-at-12-57-24\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.57.24.png\" data-orig-size=\"236,422\" 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=\"Screen-Shot-2020-01-13-at-12.57.24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.57.24.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.57.24.png\" alt=\"\" class=\"wp-image-1284\" width=\"177\" height=\"317\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.57.24.png 236w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.57.24-168x300.png 168w\" sizes=\"(max-width: 177px) 100vw, 177px\" \/><\/figure>\n\n\n\n<p>Click on the &#8220;Client Code&#8221; button and make a note of the uplink key. We will need this shortly to configure the anvil-pyxll package.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1285\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-13-at-12-58-42\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.58.42.png\" data-orig-size=\"641,343\" 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=\"Screen-Shot-2020-01-13-at-12.58.42\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.58.42.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.58.42.png\" alt=\"\" class=\"wp-image-1285\" width=\"481\" height=\"257\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.58.42.png 641w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-12.58.42-300x161.png 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/><\/figure>\n\n\n\n<p>Next, clone the <a rel=\"noreferrer noopener\" aria-label=\"PyXLL Anvil App (opens in a new tab)\" href=\"https:\/\/pyxll.anvil.app\" target=\"_blank\">PyXLL Anvil App<\/a> using the link <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/anvil.works\/build#clone:O2G7KS4BHEV7QW4V=ZSZUBOJHI6AINSD7YB6QIY2E\" target=\"_blank\">https:\/\/pyxll.anvil.app<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"643\" height=\"213\" data-attachment-id=\"1323\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-13-at-17-58-59\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-17.58.59.png\" data-orig-size=\"643,213\" 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=\"Screen-Shot-2020-01-13-at-17.58.59\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-17.58.59.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-17.58.59.png\" alt=\"\" class=\"wp-image-1323\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-17.58.59.png 643w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-17.58.59-300x99.png 300w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/figure>\n\n\n\n<p>Once you have done that go back to your own Anvil app and add this PyXLL app as a dependency. That is done by clicking &#8220;Dependencies&#8221; in the settings menu in the app browser.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1286\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-13-at-13-02-08\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.02.08.png\" data-orig-size=\"253,422\" 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=\"Screen-Shot-2020-01-13-at-13.02.08\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.02.08.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.02.08.png\" alt=\"\" class=\"wp-image-1286\" width=\"190\" height=\"317\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.02.08.png 253w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.02.08-180x300.png 180w\" sizes=\"(max-width: 190px) 100vw, 190px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" data-attachment-id=\"1287\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/screen-shot-2020-01-13-at-13-03-06\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.03.06.png\" data-orig-size=\"628,619\" 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=\"Screen-Shot-2020-01-13-at-13.03.06\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.03.06.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.03.06.png\" alt=\"\" class=\"wp-image-1287\" width=\"471\" height=\"464\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.03.06.png 628w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/Screen-Shot-2020-01-13-at-13.03.06-300x296.png 300w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><\/figure>\n\n\n\n<p>Now that the PyXLL app has been added as a dependency, in the Server Module we can import the <em>@xl_func<\/em> decorator from the <em>anvil_pyxll.server<\/em> package. This works in the same way as PyXLL&#8217;s normal <em>@xl_func<\/em> decorator to expose the function as an Excel Worksheet Function, except this works from within an Anvil server module instead of a plain Python module run locally.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; highlight: [1,5]; title: ; notranslate\" title=\"\">\nfrom anvil_pyxll.server import xl_func\nimport anvil.server\nimport math\n\n@xl_func\n@anvil.server.callable\ndef black_scholes(spot,\n                  strike,\n                  expiry,\n                  volatility,\n                  interest_rate,\n                  dividend_yield,\n                  is_call=True):\n    ...\n<\/pre><\/div>\n\n\n<p>By applying the <em>@xl_func<\/em> decorator the <em>black_scholes<\/em> function will be exposed to Excel. The @xl_func decorator has several optional arguments for controlling exactly how the function will behave in Excel which you can read more about in the <a rel=\"noreferrer noopener\" aria-label=\"PyXLL Worksheet Functions (opens in a new tab)\" href=\"https:\/\/www.pyxll.com\/docs\/userguide\/udfs\/index.html\" target=\"_blank\">PyXLL Worksheet Functions<\/a> section of the documentation.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Calling_the_Function_from_Excel\"><\/span>Calling the Function from Excel<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<p>The last thing required is to configure PyXLL to use the anvil-pyxll project downloaded earlier from <a rel=\"noreferrer noopener\" aria-label=\"https:\/\/github.com\/pyxll\/anvil-pyxll (opens in a new tab)\" href=\"https:\/\/github.com\/pyxll\/anvil-pyxll\" target=\"_blank\">https:\/\/github.com\/pyxll\/anvil-pyxll<\/a>.<\/p>\n\n\n\n<p>In the code downloaded find the <em>anvil-pyxll.cfg<\/em> file and edit it to use the Anvil uplink key that you noted down earlier. If you didn&#8217;t make a note of it go back into the Uplink options of the Anvil app and you will be able to copy it from there.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n; anvil-pyxll.cfg\n&#x5B;ANVIL]\ntoken = EGNVUIEWSKOLOU77XN2S3QFM-6JJFLNHW5OWUUU5V-CLIENT\n<\/pre><\/div>\n\n\n<p>In your main <em>pyxll.cfg<\/em> file, which you will have downloaded as part of PyXLL, include the settings from the <em>anvil-pyxll.cfg<\/em> file. This can be done by referencing the anvil-pyxll.cfg file as an external config. You will need to change the path below to where you have the anvil-pyxll files.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n; pyxll.cfg\n&#x5B;PYXLL]\nexternal_config = C:\\Your Files\\anvil-pyxll\\anvil-pyxll.cfg\n<\/pre><\/div>\n\n\n<p>If you haven&#8217;t already installed and configured PyXLL, you will need to do so now by following the <a rel=\"noreferrer noopener\" aria-label=\"installation instructions in the documentation (opens in a new tab)\" href=\"https:\/\/www.pyxll.com\/docs\/userguide\/installation.html\" target=\"_blank\">installation instructions in the documentation<\/a>, as well as making the config change above.<\/p>\n\n\n\n<p>With everything configured correctly, when you start Excel the Anvil-PyXLL package will set up the connection to your Anvil app. Any functions decorated with @xl_func are exposed to Excel as worksheet functions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"955\" height=\"750\" data-attachment-id=\"1296\" data-permalink=\"https:\/\/www.pyxll.com\/blog\/anvil-pyxll\/image-11\/\" data-orig-file=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/image.png\" data-orig-size=\"955,750\" 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\/2020\/01\/image.png\" src=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/image.png\" alt=\"\" class=\"wp-image-1296\" srcset=\"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/image.png 955w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/image-300x236.png 300w, https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/image-768x603.png 768w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<p>You can enter the functions directly in the Excel worksheet. If you use the Excel Function Wizard you&#8217;ll see that the docstring from the Python function and the argument names and docstrings have made it across and are visible in Excel.<\/p>\n\n\n\n<p>The code is still running in the cloud as an Anvil server function, so any changes to the Anvil application will be reflected in Excel without needing to change anything on the local PC or deploy any new code to the desktop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusions\"><\/span>Conclusions<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Deploying code to the cloud can have advantages over managing deployment to the local PC.<\/p>\n\n\n\n<p>Anvil enables writing web apps using just Python without the need for specialist web programming abilities.<\/p>\n\n\n\n<p>Excel is an excellent way for users to interact with models and code in a way that cannot easily be replicated in a simple web app. Even the most complex web apps often require Excel import\/export features for the times when using Excel is more practical.<\/p>\n\n\n\n<p>PyXLL enables writing Excel add-ins in Python, and in this article we demonstrated how Anvil web apps written in Python can be integrated into Excel using PyXLL and the Anvil-PyXLL pacakge.<\/p>\n\n\n\n<p>If you would like to talk to us about deploying your Python code to the cloud, Excel integration, or anything else, please contact us:<\/p>\n\n\n\n<p>PyXLL: <a href=\"mailto:info@pyxll.com\">info@pyxll.com<\/a>  <br>Anvil : &nbsp;<a href=\"mailto:contact@anvil.works\">contact@anvil.works<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use Python code deployed to the cloud from Excel. This article demonstrates how Anvil can be used to create web apps that can also power Excel spreadsheets with PyXLL.<\/p>\n","protected":false},"author":1,"featured_media":1303,"comment_status":"closed","ping_status":"open","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,12,2],"tags":[560,561,564,562,563],"class_list":["post-1263","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deployment","category-python","category-pyxll","tag-anvil","tag-black-scholes","tag-cloud","tag-finance","tag-web"],"acf":[],"jetpack_featured_media_url":"https:\/\/www.pyxll.com\/blog\/wp-content\/uploads\/2020\/01\/g45462.png","jetpack_shortlink":"https:\/\/wp.me\/p7l3LP-kn","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1263","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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/comments?post=1263"}],"version-history":[{"count":1,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1263\/revisions"}],"predecessor-version":[{"id":1411,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/posts\/1263\/revisions\/1411"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/media\/1303"}],"wp:attachment":[{"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/media?parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/categories?post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pyxll.com\/blog\/wp-json\/wp\/v2\/tags?post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}