Views:
TypeRead/writeAuthorAvailability
Data providerReadFinbourneProvided with LUSID

The Lusid.Calendar.Date provider enables you to write a Luminesce SQL query that retrieves information about dates in your calendars.

Note: The LUSID user running the query must have sufficient access control permissions to both use the provider and read calendar data stored in LUSID. This should automatically be the case if you are the domain owner.

See also: Lusid.Calendar.Date.Writer

Basic usage

select * from Lusid.Calendar.Date where <filter-expression>

Query parameters

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

Data fields

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

Note: Fields marked 'main' are returned by queries that start select ^ from Lusid.Calendar.Date.

Examples

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

Example 1: Determine if a certain date is a holiday

select * from Lusid.Calendar.Date where LocalDate = '2023-12-25'

Example 2: Retrieve calendar dates for a certain year

select * from Lusid.Calendar.Date where CalendarCode = 'GBP' and LocalDate like '%2023%'

Example 3: Check for any bond payments due to mature on a holiday

You can join Lusid.Calendar.Date with an instrument provider to check if a payment date falls on a holiday and subsequently how the payment date will be adjusted. 

select 
    b.DisplayName, 
    b.MaturityDate, 
    b.LusidInstrumentId,
    b.FlowConventionsRollConvention,
    b.FlowConventionsSettleDays,
    c.DateIdentifier
from Lusid.Instrument.Bond b
inner join Lusid.Calendar.Date c
    on b.MaturityDate = c.FromUtc
where b.FlowConventionsPaymentCalendars like '%GBP%'
    and c.CalendarCode like '%GBP%'
group by b.LusidInstrumentId; 

The table of data returned by the query looks like this: