From e9c32dc1e1b83b6a05d3dca18a3d7844947563e1 Mon Sep 17 00:00:00 2001 From: "nathan.day" Date: Wed, 16 Oct 2024 15:39:34 +0100 Subject: [PATCH] ANA-4464: instrument event recipe support --- .../instruments/Forward Rate Agreement.ipynb | 24 +++++++++++++++ .../instruments/Interest Rate Swap.ipynb | 24 +++++++++++++++ .../Mortgage Backed Securities.ipynb | 29 +++++++++++++++++++ 3 files changed, 77 insertions(+) diff --git a/examples/use-cases/instruments/Forward Rate Agreement.ipynb b/examples/use-cases/instruments/Forward Rate Agreement.ipynb index cab322df..c54d6bca 100644 --- a/examples/use-cases/instruments/Forward Rate Agreement.ipynb +++ b/examples/use-cases/instruments/Forward Rate Agreement.ipynb @@ -926,6 +926,30 @@ "print(f\"Configuration recipe loaded into LUSID at time {response.value}.\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# For environments that have instrument events configured, we also need to set the instrument events recipe on the portfolio.\n", + "patch_document = [\n", + " {\n", + " \"value\": {\n", + " \"scope\": market_data_scope,\n", + " \"code\": recipe_code\n", + " },\n", + " \"path\": \"/instrumentEventConfiguration/recipeId\",\n", + " \"op\": \"add\"\n", + " }\n", + "]\n", + "\n", + "patch_response = transaction_portfolios_api.patch_portfolio_details(\n", + " scope=scope,\n", + " code=portfolio_code,\n", + " operation=patch_document)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/examples/use-cases/instruments/Interest Rate Swap.ipynb b/examples/use-cases/instruments/Interest Rate Swap.ipynb index f0dd3ba1..382fe4c6 100644 --- a/examples/use-cases/instruments/Interest Rate Swap.ipynb +++ b/examples/use-cases/instruments/Interest Rate Swap.ipynb @@ -2105,6 +2105,30 @@ "print(f\"Configuration recipe for ConstantTimeValueOfMoney Model loaded into LUSID at time {response.value}.\")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# For environments that have instrument events configured, we also need to set the instrument events recipe on the portfolio.\n", + "patch_document = [\n", + " {\n", + " \"value\": {\n", + " \"scope\": market_data_scope,\n", + " \"code\": ctvm_recipe_code\n", + " },\n", + " \"path\": \"/instrumentEventConfiguration/recipeId\",\n", + " \"op\": \"add\"\n", + " }\n", + "]\n", + "\n", + "patch_response = transaction_portfolios_api.patch_portfolio_details(\n", + " scope=portfolio_scope,\n", + " code=portfolio_code,\n", + " operation=patch_document)" + ] + }, { "cell_type": "markdown", "metadata": {}, diff --git a/examples/use-cases/instruments/Mortgage Backed Securities.ipynb b/examples/use-cases/instruments/Mortgage Backed Securities.ipynb index beb71d5a..5ace22a8 100644 --- a/examples/use-cases/instruments/Mortgage Backed Securities.ipynb +++ b/examples/use-cases/instruments/Mortgage Backed Securities.ipynb @@ -680,6 +680,35 @@ ")" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# For environments that have instrument events configured, we also need to set the instrument events recipe on the portfolios.\n", + "patch_document = [\n", + " {\n", + " \"value\": {\n", + " \"scope\": scope,\n", + " \"code\": recipe_code\n", + " },\n", + " \"path\": \"/instrumentEventConfiguration/recipeId\",\n", + " \"op\": \"add\"\n", + " }\n", + "]\n", + "\n", + "patch_response = transaction_portfolios_api.patch_portfolio_details(\n", + " scope=scope,\n", + " code=portfolio_1_code,\n", + " operation=patch_document)\n", + "\n", + "patch_response = transaction_portfolios_api.patch_portfolio_details(\n", + " scope=scope,\n", + " code=portfolio_2_code,\n", + " operation=patch_document)" + ] + }, { "cell_type": "markdown", "metadata": {},