A data type to define how non-business days are adjusted.
Field Type Description calendarIds [Text] A list of calendar ids to define holidays. convention BusinessDayConventionEnum The business day convention used for the adjustment.
data BusinessDayConventionEnum
An enum type to specify how a non-business day is adjusted.
Adjust a non-business day to the next business day.
Adjust a non-business day to the next business day unless it is not in the same month. In this case use the previous business day.
Adjust a non-business day to the previous business day unless it is not in the same month. In this case use the next business day.
Non-business days are not adjusted.
Adjust a non-business day to the previous business day.
data HolidayCalendarData
Holiday Calendar Data used to define holidays.
Field Type Description id Text The id of the holiday calendar. weekend [DayOfWeek] A list of week days defining the weekend. holidays [Date] A list of dates defining holidays.
: [HolidayCalendarData] -> HolidayCalendarData
Merge multiple holiday calendars into a single one.
id
s are concatenated by,
.
: HolidayCalendarData -> Date -> Bool
Check if Date is a holiday
: HolidayCalendarData -> Date -> Bool
Check if Date is a business day
: HolidayCalendarData -> Date -> Date
Get next business day
: HolidayCalendarData -> Date -> Date
Get previous business day
: HolidayCalendarData -> Date -> Date
Get next or same business day
: HolidayCalendarData -> Date -> Date
Get previous or same business day
nextSameOrLastInMonthBusinessDay
: HolidayCalendarData -> Date -> Date
Get next or same business day if before end of month. Otherwise get last business day in month.
previousSameOrFirstInMonthBusinessDay
: HolidayCalendarData -> Date -> Date
Get previous or same business day if before end of month. Otherwise get first business day in month.
: HolidayCalendarData -> Int -> Date -> Date
Add business days to a Date
: HolidayCalendarData -> BusinessDayConventionEnum -> Date -> Date
Adjust date according to the given business day convention
data Period
A data type to define periods.
Field Type Description period PeriodEnum A period, e.g. a day, week, month or year. periodMultiplier Int A period multiplier, e.g. 1, 2 or 3 etc.
data PeriodEnum
An enum type to specify a period, e.g. day, week.
Day
Month
Week
Year
data RollConventionEnum
An enum type to specify how to roll dates.
Rolls on month end.
Rolls on the corresponding day of the month.
: Date -> Period -> RollConventionEnum -> Date
Get next periodic (daily
D
and weeklyW
not supported) date according to a given roll convention.
: Date -> Period -> RollConventionEnum -> Date
Get previous periodic (daily
D
and weeklyW
not supported) date according to a given roll convention.
: Date -> Period -> Date
Add period to given date.
data Frequency
Frequency of a periodic schedule.
Field Type Description period PeriodEnum The period, e.g. day, month, etc. periodMultiplier Int The period multiplier. rollConvention RollConventionEnum The roll convention.
data PeriodicSchedule
A periodic schedule.
Field Type Description effectiveDate Date Effective date, i.e. the (unadjusted) start date of the first period. terminationDate Date Termination date, i.e. the (unadjusted) end date of the last period. firstRegularPeriodStartDate Optional Date The (unadjusted) start date of the first regular period (optional). lastRegularPeriodEndDate Optional Date The (unadjusted) end date of the last regular period (optional). frequency Frequency The frequency of the periodic schedule. businessDayAdjustment BusinessDayAdjustment The business day adjustment to determine adjusted dates. effectiveDateBusinessDayAdjustment Optional BusinessDayAdjustment The (optional) business day adjustment of the effective date terminationDateBusinessDayAdjustment Optional BusinessDayAdjustment The (optional) business day adjustment of the termination date stubPeriodType Optional StubPeriodTypeEnum An optional stub to define a stub implicitly and not via firstRegularPeriodStartDate
orlastRegularPeriodEndDate
.
type Schedule
= [SchedulePeriod]
A schedule defined by a list of periods.
data SchedulePeriod
A single period in a schedule.
Field Type Description adjustedEndDate Date Adjusted end date. adjustedStartDate Date Adjusted start date. unadjustedEndDate Date Unadjusted end date. unadjustedStartDate Date Unadjusted start date.
data StubPeriodTypeEnum
An enum type to specify a stub.
A long (more than one period) final stub.
A long (more than one period) initial stub.
A short (less than one period) final stub.
A short (less than one period) initial stub.
: [HolidayCalendarData] -> PeriodicSchedule -> Schedule
Generate schedule from a periodic schedule.
template AssetDecomposition
Describes a decomposition of one asset into n other assets and the corresponding scaling factors. Can be used to process corporate actions such as an equity cash dividend that increases the asset's version number and creates a separate entitlement.
Field Type Description id Id The id of the asset to be decomposed. factors [Asset] The ids and amounts of assets to be created when decomposing one unit of the specified asset id. observers Set Party
Choice Archive
(no fields)
template AssetDeposit
Represents a deposit of an asset in an account. The
account.id
andasset.id
fields can be used to link the contract to other contracts that provide further information such as the type of the asset or reference data for it. This allows new asset classes to be added without having to modify business processes that operate on generic asset deposits.
Field Type Description account Account A deposit is allocated to an account and backed by the account.id.signatories. Depending on the desired trust model this might be (i) both the provider and the owner, (ii) just the provider or (iii) a third party agent. asset Asset Specifies the id and the amount of assets deposited. The asset.id.signatories are the parties that publish reference data and hence the details for how to lifecycle the asset. observers Set Party
Choice Archive
(no fields)
Choice AssetDeposit_SetObservers
Field Type Description newObservers Set Party
template Entitlement
Reference data describing an asset that entitles the owner to receive the underlying asset at the settlement date. Can be used to lifecycle asset deposits, trades or dependent instruments.
Field Type Description id Id The asset id of the entitlement. Depending on the trust model the signatories might be the issuer or a third party reference data provider such as Reuters. settlementDate Date The date on which the underlying asset gets paid. underlyingId Id The id of the underlying asset that gets paid. observers Set Party
Choice Archive
(no fields)
template EquityCashDividend
Reference data describing an equity cash dividend. Can be used to lifecycle asset deposits, trades or dependent instruments.
Field Type Description id Id The asset id to which the dividend applies. Depending on the trust model the signatories might be the issuer or a third party reference data provider such as Reuters. exDate Date The date on or after which a security is traded without the dividend. settlementDate Date The date on which the dividend gets paid. perShare Asset The id and amount of the distributed assets per unit of equity. observers Set Party
Choice Archive
(no fields)
template EquityStockSplit
Reference data describing an equity stock split. Can be used to lifecycle asset deposits, trades or dependent instruments.
Field Type Description id Id The asset id to which the stock split applies. Depending on the trust model the signatories might be the issuer or a third party reference data provider such as Reuters. exDate Date The date on or after which the security is traded with the split applied. rFactor Decimal The factor through which the quantity has to be devided to obtain the new quantity. observers Set Party
Choice Archive
(no fields)
template Dvp
A Delivery vs Payment trade is an obligation to exchange the payment assets against the delivery assets at the agreed settlement date.
Field Type Description masterAgreement MasterAgreement A trade is allocated to a master agreement and backed by the masterAgreement.id.signatories. Depending on the desired trust model this might be both counterparties or a third party agent. tradeId Id The identifier of the trade within the master agreement. The tradeId.signatories can be left empty. buyer Party The buyer is the party that sends the payments and receives the deliveries. The seller is the other counterparty mentioned in the master agreement. status SettlementStatus The settlement status of the trade. settlementDate Optional Date The settlement date of the trade. None indicates instant settlement. payments [Asset] The assets that need to be paid from the buyer to the seller. deliveries [Asset] The assets that need to be delivered from the seller to the buyer. observers Set Party
Choice Archive
(no fields)
template AssetFungible
Rule that allows to split and merge asset deposits in the specified account.
Field Type Description account Account The account for which the rule can be used. observers Set Party
Choice Archive
(no fields)
Choice AssetFungible_Merge
Merges a list of asset deposits into one.
Field Type Description depositCids [ContractId AssetDeposit] The asset deposits that will be consumed. All fields except for the quantity need to match. Choice AssetFungible_Split
Splits an asset deposit according to the provided list of quantities.
Field Type Description depositCid ContractId AssetDeposit The asset deposit that will be consumed. quantities [Decimal] The quantities of the newly created asset deposits. The total quantity needs to match the quantity of the provided asset.
template AssetLifecycle
Rule that allows to lifecycle asset deposits in the specified account according to the provided asset decomposition data.
Field Type Description account Account The account for which the rule can be used. observers Set Party
Choice Archive
(no fields)
Choice AssetLifecycle_Process
Allows the owner to lifecycle an asset deposit according to an asset decomposition published by the deposit.asset.id.signatories.
Field Type Description depositCid ContractId AssetDeposit Asset deposit to be lifecycled. decompositionCid ContractId AssetDecomposition Asset decomposition describing the lifecycle effects.
template AssetSettlement
Rule that allows to credit, debit or transfer asset deposits in the specified account.
Field Type Description account Account The account for which the rule can be used. observers Set Party
Choice Archive
(no fields)
Choice AssetSettlement_Credit
Gives the owner the right to archive an asset deposit.
Field Type Description depositCid ContractId AssetDeposit The asset deposit that will be consumed. Choice AssetSettlement_Debit
Gives the provider the right to create an asset deposit signed by the account.id.signatories.
Field Type Description asset Asset The asset id and amount to be created. Choice AssetSettlement_Debit_Signatories
Helper functions for the account.id.signatories to create an asset deposit signed by them.
Field Type Description asset Asset The asset id and amount to be created. Choice AssetSettlement_SetObservers
Field Type Description newObservers Set Party Choice AssetSettlement_Transfer
Gives the owner the right to transfer an asset deposit to a new owner.
Field Type Description receiver Party The party to which the asset deposit will be transferred to. depositCid ContractId AssetDeposit The asset deposit that will be consumed. debitSettlementCid ContractId AssetSettlement The settlement rule that allows to debit the new asset deposit in the receiver's account.
template AssetSettlementChain
Helper contract that allows to allocate assets to and settle a chain of transfer instructions.
Field Type Description masterAgreement MasterAgreement The master agreement to which the settlement chain applies. tradeId Id The trade under the master agreement to which the settlement chain applies. asset Asset The id and amount of the asset to be settled. steps [AssetSettlementStep] The steps in the settlement chain. observers Set Party
Choice Archive
(no fields)
Choice AssetSettlementChain_AllocateNext
Allocates an asset deposit to the next step of the settlement chain.
Field Type Description depositCid ContractId AssetDeposit Specifies the asset deposit contract to be allocated. Choice AssetSettlementChain_Process
Processes a settlement chain by transferring all allocated asset deposits.
(no fields)
Choice AssetTransferAllocation_Archive
(no fields)
data AssetSettlementStep
Data describing a single step in a settlement chain.
Field Type Description sender Party The sender of an asset deposit. receiver Party The receiver of an asset deposit. depositCid Optional (ContractId AssetDeposit) The allocated asset deposit. creditSettlementCid ContractId AssetSettlement The settlement rule that allows the asset deposit to be credited to the sender. debitSettlementCid ContractId AssetSettlement The settlement rule that allows the asset deposit to be debited to the receiver.
template EntitlementLifecycle
Rule that helps with processing entitlements.
Field Type Description signatories Set Party Publishers of the entitlement reference data. observers Set Party
Choice Archive
(no fields)
Choice EntitlementLifecycle_Process
Allows the entitlement.id.signatories to create an asset decomposition contract from the entitlement reference data.
Field Type Description entitlementCid ContractId Entitlement The provided entitlement reference data.
template EquityCashDividendLifecycle
Rule that helps with processing equity cash dividends.
Field Type Description signatories Set Party Publishers of the dividend reference data. observers Set Party
Choice Archive
(no fields)
Choice EquityCashDividendLifecycle_Process
Allows the dividend.id.signatories to create an entitlement instrument and an asset decomposition contract from the dividend reference data.
Field Type Description dividendCid ContractId EquityCashDividend The provided dividend reference data. entitlementIdLabel Text A label for the entitlement instrument describing the dividend payment.
template EquityStockSplitLifecycle
Rule that helps with processing equity stock splits.
Field Type Description signatories Set Party Publishers of the stock split reference data. observers Set Party
Choice Archive
(no fields)
Choice EquityStockSplitLifecycle_Process
Allows the stockSplit.id.signatories to create an asset decomposition contract from the stock split reference data.
Field Type Description stockSplitCid ContractId EquityStockSplit The provided stock split reference data.
data EquityCashDividendLifecycle_Process_Result
The outputs of the EquityCashDividendLifecycle_Process choice.
EquityCashDividendLifecycle_Process_Result
Field Type Description entitlementCid ContractId Entitlement Entitlement instrument describing the upcoming dividend payment. decompositionCid ContractId AssetDecomposition Asset decomposition describing the increase of the asset's version number and the creation of a separate dividend entitlement. instance Choice EquityCashDividendLifecycle EquityCashDividendLifecycle_Process EquityCashDividendLifecycle_Process_Result
template DvpLifecycle
Rule that allows to lifecycle a Dvp trade under the specified master agreement according to the provided asset decomposition.
Field Type Description masterAgreement MasterAgreement The master agreement for which the rule can be used. observers Set Party
Choice Archive
(no fields)
Choice DvpLifecycle_Process1
Field Type Description param DvpLifecycle_Process_Param Choice DvpLifecycle_Process2
Field Type Description param DvpLifecycle_Process_Param
template DvpSettlement
Rule that allows to settle a Dvp under the specified master agreement by providing fully allocated settlement chains for each payment and delivery obligation.
Field Type Description masterAgreement MasterAgreement The master agreement for which the rule can be used. observers Set Party
Choice Archive
(no fields)
Choice DvpSettlement_Process1
Field Type Description param DvpSettlement_Process_Param Choice DvpSettlement_Process2
Field Type Description param DvpSettlement_Process_Param
data DvpLifecycle_Process_Param
The input parameters of the DvpLifecycle_Process choices.
Field Type Description dvpCid ContractId Dvp Dvp trade to be lifecycled. decompositionCid ContractId AssetDecomposition Asset decomposition describing the lifecycle effects.
data DvpSettlement_Process_Param
The input parameters of the DvpSettlement_Process choices.
Field Type Description dvpCid ContractId Dvp Dvp trade to be settled paymentChainCids [ContractId AssetSettlementChain] Fully allocated settlement chain for each payment asset deliveryChainCids [ContractId AssetSettlementChain] Fully allocated settlement chain for each delivery asset
data DvpSettlement_Process_Result
The outputs of the DvpSettlement_Process choices.
Field Type Description dvpCid ContractId Dvp Settled Dvp trade paymentDepositCids [[ContractId AssetDeposit]] Transferred asset deposits for each payment obligation deliveryDepositCids [[ContractId AssetDeposit]] Transferred asset deposits for each delivery obligation instance Choice DvpSettlement DvpSettlement_Process1 DvpSettlement_Process_Result
instance Choice DvpSettlement DvpSettlement_Process2 DvpSettlement_Process_Result
data Account
A record that identifies an account. Also includes the account stakeholders because they cannot be looked up from another contract when specifying choice actors.
Field Type Description id Id References an account via its id. Depending on the desired trust model, the signatories might be (i) both the provider and the owner, (ii) just the provider or (iii) a third party agent. provider Party Allows to specify choices of the account provider. owner Party Allows to specify choices of the account owner.
data Asset
A record that combines an asset id and quantity. Can be used to describe a quantified claim to an asset.
Field Type Description id Id The asset id. Depending on the trust model, the signatories might be the issuer or a third party reference data provider such as Reuters. quantity Decimal The amount of assets with the specified id. instance Choice AssetSettlement AssetSettlement_Credit Asset
data Id
A versioned identifier backed by a set of signatories. Can be used as a primary key or foreign key of a contract.
Field Type Description signatories Set Party The parties that need to sign a contract with this id and that are responsible to ensure primary key uniqueness. label Text A label that makes a contract unique for a given set of signatories. version Int Allows to model multiple revisions of the same contract.
data MasterAgreement
A record that specifies a master agreement. Also includes the counterparties because they cannot be looked up from another contract when specifying choice actors.
Field Type Description id Id References a master agreement via its id. Depending on the desired trust model, the signatories might be both counterparties or a third party agent. party1 Party Allows to specify choices of the first counterparty. party2 Party Allows to specify choices of the second counterparty.
data SettlementStatus
An enum that captures the settlement status of a trade.
An active trade prior to settlement
A trade that has been instructed for settlement
A trade that has been settled
type Lens s a
= (s -> a, a -> s -> s)
Hand-crafted lens functionality to view, update and modify nested record fields.
: a -> (a -> b) -> b
&
is a reverse application operator. This provides notational convenience. Its precedence is one higher than that of the forward application operator$
, which allows&
to be nested in$
.
: Template a => ContractId a -> Update a
Fetches a contract, archives it and returns its value.
: (CanAbort m, HasTime m) => Text -> Date -> m ()
Checks that the ledger time is on or after the provided date.
: (a -> Optional a) -> [a] -> [a]
Replaces the first element of a list for which the provided function returns Some x.
: [a] -> [b] -> [(a, b)]
Like zip but fails if the list lengths don't match
: MapKey k => Map k v -> [k]
Return all keys of the map in ascending order.
: MapKey k => Map k v -> [v]
Return all elements of the map in the ascending order of their keys.
: MapKey k => Map k v -> k -> v
Find the value at a key. Calls error when the element can not be found.
: (Action m, MapKey k) => Map k v -> k -> m v -> m (Map k v)
Like map insert but takes an Action as value and returns the modified map as action.
: Lens a b -> Lens b c -> Lens a c
Lens composition.