Views:
TypeRead/writeAuthorAvailability
Data providerReadFINBOURNEProvided with LUSID

Providing you have sufficient access control permissions, the Lusid.PortfolioOrder provider enables you to write a Luminesce SQL query that retrieves orders stored in LUSID.

Note: By default, Lusid.PortfolioOrder cannot retrieve properties for orders. To do this, you must first configure Lusid.PortfolioOrder to 'inline' properties. See how to do this.

See also: Lusid.PortfolioOrder.Writer

Basic usage

select * from Lusid.PortfolioOrder where <filter-expression>

Query parameters

Lusid.PortfolioOrder 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.PortfolioOrder' and FieldType = 'Parameter';

Data fields

By default, Lusid.PortfolioOrder 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.PortfolioOrder' and FieldType = 'Column';

Note: Fields marked 'main' are returned by queries that select a caret character, for example select ^ from Lusid.PortfolioOrder.

Examples

Note: For more example Luminesce SQL queries, visit our Github repo.

Example 1: Retrieve first 10 orders

select * from Lusid.PortfolioOrder limit 10;

Example 2: Retrieve a particular order

select * from Lusid.PortfolioOrder where OrderScope = 'Finbourne-Examples' and OrderCode = 'ORD-123';

Example 3: Retrieve orders for a portfolio on a particular day

select * from Lusid.PortfolioOrder 
where PortfolioScope = 'Finbourne-Examples' 
and PortfolioCode = 'UK-Equities'
and OrderDate between #2023-06-28# and #2023-06-29#; 

Example 4: Retrieve orders and other information for a particular instrument

select ^ from Lusid.PortfolioOrder o
join Lusid.Instrument i
  on o.LusidInstrumentId = i.LusidInstrumentId;