You can specify:
Validity dates for a feature or data policy. Outside these dates, access to features or data is denied.
Time restrictions on the data controlled by a data policy, including rolling restrictions relative to points in time such as ‘now’ or ‘first business day of the month’.
Specifying validity dates for a feature or data policy
You can specify Policy validity dates when you create a policy in the LUSID web app:
If you do not specify a Last day, a policy expires on 31 December 9999 (that is, effectively never).
Note these restrictions are recorded in the JSON document using the when
object:
"when": {
"activate": "2024-10-17T00:00:00.0000000+00:00",
"deactivate": "2027-01-01T00:00:00.0000000+00:00"
}
Specifying time restrictions for data in a data policy
You can specify Time Restrictions on the LUSID data controlled by a data policy. You can use this feature to restrict access to the latest data, or conversely to only allow access to the latest data.
Consider the following examples for a policy designed for a portfolio manager to restrict the ability to upsert transactions to a portfolio. Without time restrictions, a portfolio manager can upsert a transaction with a transaction date of ‘now’, at any point in the past after the creation date of the portfolio, and at any point in the future.
Example 1: Disallow backdated transactions
Allow: Transactions with a transaction date of ‘now’ or later.
Disallow: Transactions with a transaction date before ‘now’.
Note these restrictions are recorded in the JSON document using the for
object:
"for": [
{
"effectiveDateRelative": {
"date": "Now",
"adjustment": 0,
"unit": "Minute",
"relativeToDateTime": "AfterOrOn"
}
}
]
Example 2: Disallow future-dated transactions
Allow: Transactions with a transaction date of ‘now’ or earlier.
Disallow: Transactions with a transaction date after ‘now’.
Example 3: Disallow backdated transactions more than 10 days old
Allow: Transactions with a transaction date of 10 days ago or later.
Disallow: Transactions with a transaction date more than 10 days old.
Note the Adjustment Quantity is negative:
Example 4: Disallow future-dated transactions more than 10 days ahead
Allow: Transactions with a transaction date of 10 days ahead or earlier.
Disallow: Transactions with a transaction date more than 10 days ahead.
Example 5: Disallow future-dated transactions, and backdated ones more than 10 days old
Allow: Transactions with a transaction date of 10 days ago or later, up to ‘now’.
Disallow: Transactions with a transaction date more than 10 days ago, and all future-dated transactions.
Note two time restrictions are required:
Retrieving time-restricted transactions
Note that whenever a user makes an API request to get a set of transactions, a ‘from’ and ‘to’ date are specified. By default, the ‘from’ date is the date the portfolio was created, and the ‘to’ date is the datetime of the API request. A user can override this to return a more limited set of transactions using the fromTransactionDate
and toTransactionDate
parameters, for example:
curl -X GET https://<domain>.lusid.com/api/api/transactionportfolios/<scope>/<code>/transactions?fromTransactionDate=2021-07-01&toTransactionDate=2021-07-10
Note that if any part of the period requested falls outside the allowed time restrictions of a policy, then no transactions are returned, even those nominally within the date. For example, imagine the following scenario:
Policy: Allow access to portfolio data recorded 7 or more days ago
Date of API request: 10 August 2021
XYZ transaction recorded: 2 August 2021
Nominally, the XYZ transaction is 8 days old, and the portfolio manager is entitled to see it. But whether they actually do or not depends on the ‘from’ and ‘to’ dates in their API request:
API request | Transaction returned? | Explanation |
From: 2 July 2021 | YES | Period requested falls wholly within the validity date of the policy |
From: 2 July 2021 | NO (403 Forbidden) | Period requested falls partly outside (by one day) the validity date of the policy |