Registering a portfolio recipe

A recipe is a hierarchical, modular document whose primary purpose is to govern valuation operations. More information.

You must register a recipe with a portfolio if:

Note: You can create a single recipe that enables instrument events, generates holdings and governs valuation operations for a portfolio; you do not have to create separate recipes. And you can design a recipe to be applicable to every portfolio you own, not just specific to one.

Creating a portfolio recipe

As a minimum, we recommend calling the UpsertConfigurationRecipe API to create a basic portfolio recipe as follows:

curl -X POST 'https://<your-domain>.lusid.com/api/api/recipes'
  -H 'Content-Type: application/json-patch+json'
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '{
  "configurationRecipe": {
    "scope": "MyRecipes",
    "code": "MyPortfolioRecipe",
    "description": "Basic portfolio recipe",
    "market": {
      "marketRules": [
        {
          "key": "Fx.*.*",
          "supplier": "Lusid",
          "dataScope": "MyFxRates",
          "quoteType": "Rate",
          "field": "mid",
          "quoteInterval": "1D.0D"
        },
        {
          "key": "Quote.RIC.*",
          "supplier": "Lusid",
          "dataScope": "MyFloatingRateBondFixings",
          "quoteType": "Rate",
          "field": "mid",
          "quoteInterval": "1D.0D"
        },
        {
          "key": "Inflation.InflationIndex.*",
          "supplier": "Lusid",
          "dataScope": "MyInflationIndexFixings",
          "quoteType": "Index",
          "field": "mid",
          "quoteInterval": "1D.0D"
        }
      ]
    },
    "pricing": {
      "modelRules": [
        {
          "instrumentType": "Bond",
          "modelName": "BondLookupPricer"
        },
        {
          "instrumentType": "ComplexBond",
          "modelName": "BondLookupPricer"
        },
        {
          "instrumentType": "InflationLinkedBond",
          "modelName": "BondLookupPricer"
        },
      ]
    }
  }
}'

This recipe:

  • Has a scope of MyRecipes and a code of MyPortfolioRecipe. You can of course change these to any values you like, providing the latter is unique within the former.

  • Has three market data rules that locate market data. Note that the dataScope field must be the same as the scope in which quotes are encapsulated when loaded into the LUSID Quote Store, so you might want to change these to something more appropriate.

  • Has three pricing rules that set the default pricing model for supported types of bond to the recommended BondLookupPricer.

Registering the recipe with portfolios

Existing portfolios

Call the PatchPortfolioDetails API to register the scope and code of the recipe with an existing portfolio, for example:

curl -X POST 'https://<your-domain>.lusid.com/api/api/transactionportfolios/US-Equities/Income/details'
  -H 'Content-Type: application/json-patch+json'
  -H 'Authorization: Bearer <your-API-access-token>'
  -d '[
  {
    "value": {
      "scope": "MyRecipes",
      "code": "MyBasicPortfolioRecipe"
    },
    "path": "/instrumentEventConfiguration/recipeId",
    "op": "add"
  }
]'

In the LUSID web app, navigate to the Data Management > Portfolios dashboard, locate the portfolio, click the Edit button (at the end of the row), click Next to open the Details screen, and then select the recipe from the Holdings recipe dropdown:

New portfolios

Call the CreatePortfolio API and specify an instrumentEventConfiguration object to register the recipe when you create a portfolio, for example:

curl -X POST 'https://<your-domain>.lusid.com/api/api/transactionportfolios/US-Equities'
-H 'Authorization: Bearer <your-API-access-token>'
-H 'Content-Type: application/json-patch+json'
-d '{
  "displayName": "Income portfolio for US equities",
  "code": "Income",
  "created": "2024-10-30T00:00:00Z",
  "baseCurrency": "USD",
  "instrumentEventConfiguration": {
    "recipeId": {
      "scope": "MyRecipes",
      "code": "MyBasicPortfolioRecipe"
    }
  }
}'

In the LUSID web app, navigate to the Data Management > Portfolios dashboard, click the Create portfolio button and follow the instructions, making sure to select the recipe from the Holdings recipe dropdown on the Details screen: