By default, LUSID emits instrument events at UTC midnight, and so transactions generated by those events impact portfolios at the same time.
Note: The information in this article applies to both instrument lifecycle and corporate action events unless otherwise stated.
You can configure the definition of an instrument to add some or all of the following:
A primary timezone so that events are emitted at local midnight rather than UTC midnight.
A start of day time in that timezone so events are emitted at that time rather than local midnight, perhaps to account for daylight saving.
A market open time in that timezone so that generated transactions impact portfolios when the market is open, and market data is available, rather than when the events are emitted.
Example: Configuring the timing of a Microsoft cash dividend
Consider a variation on this example of a CashDividendEvent
, with date stamps instead of the exDate
and paymentDate
datetime fields:
Since no explicit time or timezone information is available for date stamps, and the datetime fields themselves are omitted, LUSID:
Emits the
CashDividendEvent
on 6 February 2024 at UTC midnight.Generates a transaction representing the dividend payment amount with a:
Transaction date of the
exDate
: 6 February 2024 at UTC midnight.Settlement date of the
paymentDate
: 10 February at UTC midnight.
Note: If you specify both date stamps and corresponding datetime fields, the latter are preferred.
Let’s imagine we want to change this to:
Emit the event in the New York timezone rather than UTC.
Set the start of day in New York to be 1am local time instead of midnight.
Set the market open time to be 9:30am local time.
Step 1: Specifying temporal information in the instrument definition
We can call the UpsertInstruments API to add a timeZoneConventions
object to an existing Equity
instrument representing Microsoft:
Note the following:
The
primaryTimeZone
field is mandatory. It accepts any IANA timezone identifier.The
startOfDay
field is optional and accepts the code of a cut label definition in the same timezone.The
primaryMarketOpen
field is optional and accepts the code of a cut label definition in the same timezone. Note further configuration is required to actually generate transactions at this time.
Step 2: Examining resolved datetimes for the corporate action
We can call the GetInstrumentEvents API to examine the time and timezone information resolved for this CashDividendEvent
from the Microsoft instrument definition:
Since LUSID stores all datetimes in UTC (and does not persist date stamps):
The resolved
exDate
is stored as 6 February 2024 at 6am in the UTC timezone.The resolved
paymentDate
is stored as 10 February 2024 at 6am in the UTC timezone.
New York is five hours behind UTC but note the UTC time has been adjusted by one hour to reflect the startOfDay
in the instrument definition.
Step 3: Delaying transaction generation until market open time
To delay the timestamp of the transaction generated by CashDividendEvent
until the market is open, further configuration is required. We must
Create a custom transaction template for
CashDividendEvent
in a particular template scope to override the default template provided by FINBOURNE, keeping all the original settings.Add a
marketOpenTimeAdjustments
object with a list of datetime fields to delay until theprimaryMarketOpen
time in the instrument definition. Note that if theexDate
timestamp is already later than the market open time, no action is taken.Register the custom transaction template scope with the parent portfolio. Note you can patch an existing portfolio.
For example, we can call the CreateTransactionTemplate API as follows to delay both the exDate
and paymentDate
fields (we could choose to delay just one of these):
Step 4: Examining datetimes for events and generated transactions
We can call the QueryApplicableInstrumentEvents API for the parent portfolio to examine the CashDividendEvent
and its impact:
Note the following:
In the
loadedEvent.InstrumentEvent
object, theexDate
andpaymentDate
fields reveal that LUSID emits the event at 6am in the UTC timezone (1am in New York):In the
transactions
object, thetransactionDate
andsettlementDate
fields reveal that LUSID delays generating the transaction until 2:30pm in the UTC timezone (9:30am in New York).