Type | Read/write | Author | Availability |
Read | Finbourne | Provided with LUSID |
Providing you have sufficient access control permissions, the Lusid.Portfolio.Constituent
provider enables you to write a Luminesce SQL query that retrieves constituents from one or more LUSID reference portfolios.
Note: By default,
Lusid.Portfolio.Constituent
cannot retrieve reference holding properties. To do this, you must first configureLusid.Portfolio.Constituent
to 'inline' properties. See how to do this.
See also: Lusid.Portfolio.Constituent.Writer
Basic usage
select * from Lusid.Portfolio.Constituent where <filter-expression>;
Query parameters
Lusid.Portfolio.Constituent
has parameters that enable you to filter or refine a query.
To list available parameters, their data types, default values, and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, ParamDefaultValue, Description from Sys.Field where TableName = 'Lusid.Portfolio.Constituent' and FieldType = 'Parameter';
Data fields
By default, Lusid.Portfolio.Constituent
returns a table of data populated with particular fields (columns). You can return a subset of these fields.
To list fields available to return, their data types, whether fields are considered 'main', and an explanation for each, run the following query using a suitable tool:
select FieldName, DataType, IsMain, IsPrimaryKey, SampleValues, Description from Sys.Field where TableName = 'Lusid.Portfolio.Constituent' and FieldType = 'Column';
Note: Fields marked 'main' are returned by queries that start
select ^ from Lusid.Portfolio.Constituent...
Examples
Note: For more example Luminesce SQL queries, visit our Github repo.
Example 1: Retrieve constituents in every portfolio
select * from Lusid.Portfolio.Constituent;
Example 2: Retrieve constituents in a particular portfolio
select * from Lusid.Portfolio.Constituent where PortfolioScope = 'Finbourne-Examples' and PortfolioCode = 'FTSE100';
Example 3: Retrieve constituents whose floating weight is greater than initial weight on a particular day
select * from Lusid.Portfolio.Constituent where EffectiveAt = #2022-03-02# and FloatingWeight > Weight;
Example 4: Show the friendly name of underlying instruments for constituents
It's typically useful to join to the Lusid.Instrument
provider in order to retrieve the friendly name of underlying instruments. Note that since both providers have a DisplayName
field, only that of Lusid.Instrument
is returned in order to avoid a duplicate column clash:
select
c.^,
i.DisplayName
from Lusid.Portfolio.Constituent c
left outer join Lusid.Instrument i
on c.LusidInstrumentId = i.LusidInstrumentId;