Views:

Related resources:

Explanation

Tutorials

Reference

Providing you have suitable access control permissions, you can value one or more transaction portfolios, all the portfolios in a portfolio group, or notional quantities of arbitrary instruments.

Using the LUSID API

The instructions in this section explain how to value one or more transaction portfolios or portfolio groups using the GetValuation API. To value notional quantities of arbitrary instruments, call the GetValuationOfWeightedInstruments API instead, specifying quantities and economic definitions in the instruments section. The remainder of the detail is shared.

  1. Obtain an API access token.
  2. Call the GetValuation API, specifying:
    • The scope and code of a transaction portfolio (or a list of portfolios). For a portfolio group, set portfolioEntityType to GroupPortfolio
    • A valuationSchedule consisting of an effectiveAt valuation date. If you omit the time component, valuation occurs at 00:00:00. To specify a range of dates and have LUSID produce a separate report for each weekday in the range (note Saturdays and Sundays are omitted), set effectiveFrom to the start date and effectiveAt to the end date. You can optionally specify tenors, holiday calendars and roll and business day conventions to adjust scheduled valuation dates that do not occur on good business days. More information.
    • The scope and code of a recipe that, at a minimum, locates market data suitable for the types of instruments you wish to value for each day in the valuation schedule.
    • At least one metric that reports meaningful information for the types of instruments you wish to value. You can include properties in valuation reports too.
    • Optionally, one or more metrics to group by. If you omit a grouping, one result is produced per holding (this may mean multiple results are reported for the same underlying instrument if holdings have been divided into tax lots or strategies). Find out more about grouping and aggregation.
    • Optionally, one or more metrics to sort and filter results by.

The following example:

  • Values this sample transaction portfolio every day between Monday 7 March and Friday 11 March 2022 inclusive.
  • Reports the valuation date, cost, PV and PnL (PV minus cost) metrics.
  • Groups by valuation date and sums the numeric metrics to produce a total for the portfolio each day. Note for cash amounts it only makes sense to sum metrics in the same currency.
  • Sorts results by the valuation date, earliest first.
curl -X POST "https://<your-domain>.lusid.com/api/api/aggregation/$valuation"
  -H "Authorization: Bearer <your-API-access-token>"
  -H "Content-Type: application/json-patch+json"
  -d '{
    "portfolioEntityIds": [ {"scope": "FBNUniversity", "code": "Module-4-1", "portfolioEntityType": "SinglePortfolio"} ],
    "valuationSchedule": {"effectiveFrom": "2022-03-07T00:00:00.0000000+00:00", "effectiveAt": "2022-03-11T00:00:00.0000000+00:00" },
    "recipeId": {"scope": "FBNUniversity", "code": "Module-4-1Recipe"},
    "metrics": [
      {"key": "Valuation/EffectiveAt", "op": "Value"},
      {"key": "Holding/Cost/Pfolio", "op": "Sum"},
      {"key": "Valuation/PvInPortfolioCcy", "op": "Sum"},
      {"key": "Valuation/PnL/Unrealised/PfolioCcy", "op": "Sum"},
    ],
    "groupBy": ["Valuation/EffectiveAt"],
    "sort": [ {"key": "Valuation/EffectiveAt", "sortOrder": "Ascending"} ]
  }'

The response might look like this (transformed to a Pandas dataframe and with columns renamed for clarity):

Using the LUSID web app

Coming soon