Skip to content

Commit

Permalink
Merge branch 'master' into product-id-upi
Browse files Browse the repository at this point in the history
  • Loading branch information
hugohills-regnosys authored Nov 14, 2023
2 parents 52715db + a570f5c commit fafbc74
Show file tree
Hide file tree
Showing 73 changed files with 5,480 additions and 4,125 deletions.
43 changes: 20 additions & 23 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
# *Collateral Model - Check Eligibility Function*
# *Rename product qualification for Securities Lending and Repo*

_Background_

As part of the [FINOS BMO Hackathon](https://www.finos.org/hosted-events/2023-05-03-finos-hackathon-bmo-nyc) event in May 2023, a demonstation of a [use-case](https://github.com/finos/community/discussions/251) was created that showed the CDM can be used to check collateral eligibility against multiple jurisdictions’ minimum collateral requirements and specific eligible collateral schedules.
The current product qualification rules do not distinguish between securities lending and repurchase agreement product types. A future enhancement will refactor how `product` works and also introduce additional capabilities to the qualification functions to use additional attributes to support finer grained qualification (see Issue #2365).

The demonstation was successful has been codified into the CDM and the `CheckEligibilityByDetails` function.
In the meantime, the current qualification rule for repurchase agreements - which is invoked also for securities lending products - will be renamed to be "SecuritiesFinancing" to more loosely differentiate both sets of products.

_Model Changes_

- Added new function/types:
- `CheckEligibilityByDetails` - Applys an `EligibilityQuery` to check against a set of given `EligibleCollateralSpecification` to determine which collateral meets the eligibility and can be used/posted for delivery.

_Review directions_
_What is being released?_

- Review the changes in the model
- Inspect the Pull Request: https://github.com/finos/common-domain-model/pull/2439
- An updated product qualification rule: `Qualify_RepurchaseAgreement` is renamed to `Qualify_SecuritiesFinancing`.

# *Product Model/ Collateral – ISO Country Code Enum and connection to Asset/Issuer Criteria*
_Data types_

_What is being released?_
No changes.

A new enumeration list has been added to the Common Domain Model named `ISOCountryCodeEnum`.
The following changes have been made in the CDM to connect to this (including replacing the string with the enum list in the following occurrences):
_Enumerations_

1. Data type `IssuerCriteria` attribute `issuerCountryOfOrigin`, string and metadata scheme removed, `ISOCountryCodeEnum` added.
2. Data type `AssetCriteria` attribute `assetCountryOfOrigin`, string and metadata scheme removed, `ISOCountryCodeEnum` added.

In addition, the following change has been made for connecting to ISO Currency codes:
No changes.

1. Data type `AssetCriteria` attribute `denominatedCurrency`, string and metadata scheme removed, `CurrencyCodeEnum` added.
_Sample Files_

The following JSON sample files have been updated to reflect the current modeling of securities lending products which is to have the collateral information inside the `Collateral` data type rather than inside `AssetPayout`.

_Review Directions_
- create-security-lending-invoice-func-input.json
- full-return-settlement-workflow-func-input.json
- new-settlement-workflow-func-input.json
- new-settlement-workflow-func-input.json
- allocation/allocation-sec-lending-func-input.json
- reallocation/reallocation-pre-settled-func-input.json

In the CDM Portal, select the Textual Browser and inspect the changes mentioned above.
_Review directions_

Changes can be review in PR: https://github.com/finos/common-domain-model/pull/2477
In the CDM Portal, select the Textual Browser and inspect each of the changes identified above.

Changes can be reviewed in PR: https://github.com/finos/common-domain-model/pull/2456
1 change: 1 addition & 0 deletions docs/event-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ type WorkflowStep:
[metadata key]
[rootType]
businessEvent BusinessEvent (0..1)
counterpartyPositionBusinessEvent CounterpartyPositionBusinessEvent (0..1)
proposedEvent EventInstruction (0..1)
rejected boolean (0..1)
approval WorkflowStepApproval (0..*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,13 @@ private PathValue<EconomicTermsBuilder> getEcTerms(PathValue<TradeStateBuilder>

private PathValue<AssetPayout.AssetPayoutBuilder> getSecPO(PathValue<TradeStateBuilder> ts) {
PathValue<EconomicTermsBuilder> et = getEcTerms(ts);
return new PathValue<>(et.getModelPath().addElement("payout").addElement("securityFinancePayout", 0),
et.getValue().getOrCreatePayout().getOrCreateAssetPayout(0));
return new PathValue<>(et.getModelPath().addElement("collateral").addElement("collateralPortfolio", 0)
.addElement("collateralPosition", 0).addElement("product")
.addElement("contractualProduct").addElement("economicTerms")
.addElement("payout").addElement("assetPayout", 0),
et.getValue().getOrCreateCollateral().getOrCreateCollateralPortfolio(0).getOrCreateValue()
.getOrCreateCollateralPosition(0).getOrCreateProduct().getOrCreateContractualProduct()
.getOrCreateEconomicTerms().getOrCreatePayout().getOrCreateAssetPayout(0));
}

private PathValue<CollateralProvisions.CollateralProvisionsBuilder> getColPro(PathValue<TradeStateBuilder> ts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
import cdm.event.common.functions.CalculateTransfer;
import cdm.event.common.functions.Create_BusinessEvent;
import cdm.event.common.functions.Create_Return;
import cdm.event.common.metafields.ReferenceWithMetaCollateralPortfolio;
import cdm.event.workflow.EventInstruction;
import cdm.product.collateral.Collateral;
import cdm.product.template.*;
import com.google.common.collect.Iterables;
import com.rosetta.model.lib.RosettaModelObject;
Expand All @@ -21,9 +23,7 @@

import javax.inject.Inject;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -171,7 +171,17 @@ private Optional<Payout> getPayout(BusinessEvent executionBusinessEvent) {
.map(TradableProduct::getProduct)
.map(Product::getContractualProduct)
.map(ContractualProduct::getEconomicTerms)
.map(EconomicTerms::getPayout);
.map(EconomicTerms::getCollateral)
.map(Collateral::getCollateralPortfolio)
.orElse(Collections.emptyList()).stream()
.map(ReferenceWithMetaCollateralPortfolio::getValue)
.map(CollateralPortfolio::getCollateralPosition)
.flatMap(Collection::stream)
.map(CollateralPosition::getProduct)
.map(Product::getContractualProduct)
.map(ContractualProduct::getEconomicTerms)
.map(EconomicTerms::getPayout)
.findFirst();
}

private Optional<Payout> getSecurityPayout(BusinessEvent executionBusinessEvent) {
Expand Down
Loading

0 comments on commit fafbc74

Please sign in to comment.