|Data provider||Read||Finbourne||Provided with LUSID|
Lusid.Portfolio.Constituent provider enables you to write a Luminesce SQL query that retrieves constituents from one or more LUSID reference portfolios.
Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and read constituent data in LUSID. This should automatically be the case if you are the domain owner.
See also: Lusid.Portfolio.Constituent.Writer
select * from Lusid.Portfolio.Constituent where <filter-expression>;
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';
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...
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;