From fd7fea060d7eee296b03add4100251ae4a942a31 Mon Sep 17 00:00:00 2001 From: Georgina Tarres Date: Sat, 20 Sep 2025 00:26:33 +0000 Subject: [PATCH 1/5] CDM Event Model - Qualification for Termination and Partial Termination --- ...-to-workflow-step-fpml-5-10-processes.json | 9 + .../ir-option-debt-option-ex01-term-cdm.xml | 299 ++++++++++++++++++ .../main/rosetta/event-common-func.rosetta | 53 ++-- .../rosetta/event-qualification-func.rosetta | 14 +- .../rosetta/product-template-func.rosetta | 18 +- 5 files changed, 365 insertions(+), 28 deletions(-) create mode 100644 rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml diff --git a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json index 80f81e7849..8f23815b42 100644 --- a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json +++ b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json @@ -167,5 +167,14 @@ "modelValidationFailures" : 3, "runtimeError" : false } + }, { + "id" : "ir-option-debt-option-ex01-term-cdm", + "name" : "IR-Option-Debt-Option-ex01-term-cdm", + "inputPath" : "ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml", + "outputPath" : "ingest/output/fpml-confirmation-to-workflow-step/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.json", + "assertions" : { + "schemaValidationFailure" : false, + "runtimeError" : false + } } ] } \ No newline at end of file diff --git a/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml b/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml new file mode 100644 index 0000000000..0467aa1be6 --- /dev/null +++ b/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml @@ -0,0 +1,299 @@ + +
+ DTD#Approved#2#380513903#EMIR#Risk#New#New#Interest Rate#N#Unknown#Snapshot + DUMMYLEI012345678901 + DTCCEU + 2021-03-13T06:33:27Z + + CA3.0IR1.0 + +
+ false + Trade + 1 + + + + + + + + TM99999999 + DTD380513903 + DTD380513903 + + + 380513903 + 380513903 + + + + 380513903-2-3 + 380513903-2-3 + + + + + + + ReportingParty + + + + Counterparty + + + + Beneficiary + + + + ExecutionFacility + + Principal + false + false + F + B + NO + T + Physical + Y + 2021-03-13T06:32:49Z + false + false + PartiallyCollateralized + NOTAVAILABLE + + ESMA + + ESMA + + ReportingParty + Snapshot + false + Financial + N + + false + OffFacility + Unverified + NotConfirmed + + + + + + Counterparty + + + + ReportingParty + + + + Beneficiary + + + + ExecutionAgent + + + + ThirdPartyViewer + + + + ExecutionFacility + + false + Principal + false + false + N + S + YES + T + N + 2021-03-13T06:32:49Z + false + false + + ESMA + + ESMA + + ReportingParty + Snapshot + false + false + NonFinancial + N + + false + OffFacility + Unverified + NotConfirmed + + 2023-04-19T00:00:00 + + + InterestRate + HRMAVP + OP + InterestRate:Option:DebtOption + US05367AAA16 + + + Call + + + + + + USD + 0 + + + + 2021-03-13T00:00:00 + + NONE + + + + + + + + 2023-04-19T00:00:00 + + NONE + + + + + 10:00:00Z + GBLO + + + 17:00:00Z + GBLO + + + + + false + + true + + + USD + 600000000 + + 100000000 + USD + 1 + Physical + + + 2023-04-24T00:00:00 + + NONE + + + + + + 6 + + + + US05367AAA16 + + + + + ISDA + 1992 + + + + 2008-01-20T00:00:00Z + 2008-01-23T10:12:34Z + 2008-01-23T00:00:00Z + + USD + 600000000 + + + USD + 0 + + + + 1 + PriceMultiplier + + + 1 + QuantityEMIR + + + ReportingTimestamp + + + + 6 + StrikePrice + Units + + + 6 + PriceNotation + Percentage + + + DUMMYLEI012345678903 + Spanish Test Party Belgian Branch + InvestmentFirm + EEA + +
+ ES +
+
+ + BE + +
+ + DUMMYLEI012345678904 + Spanish Test Party 2 + 14 + EEA + +
+ ES +
+
+ + ES + +
+ + DUMMYLEI012345678907 + + + XXXX + XXXX + + + DUMMYLEI012345678911 + DUMMYLEI012345678909 + + + 1111 + + +
diff --git a/rosetta-source/src/main/rosetta/event-common-func.rosetta b/rosetta-source/src/main/rosetta/event-common-func.rosetta index b83f2f8745..54d9e1d069 100644 --- a/rosetta-source/src/main/rosetta/event-common-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-common-func.rosetta @@ -38,10 +38,13 @@ func QuantityIncreased: func QuantityDecreased: inputs: - before TradeState (1..1) + instruction Instruction (0..*) after TradeState (0..*) output: result boolean (1..1) + + alias unitType: <"Unit Types of the instruction's quantities."> + instruction -> primitiveInstruction -> quantityChange -> change -> quantity -> unit set result: after @@ -50,45 +53,57 @@ func QuantityDecreased: CompareTradeLot( item -> trade -> tradeLot only-element, CompareOp -> LessThan, - before -> trade -> tradeLot only-element - ) = True - and // check each after (item) is greater than zero - CompareTradeLotToAmount( - item -> trade -> tradeLot only-element, - CompareOp -> GreaterThan, - 0.0 + instruction -> before -> trade -> tradeLot only-element ) = True + and // Check that changed quantities have not decreased to zero + QuantityDecreasedToZero(instruction, after) = False ] all = True func QuantityDecreasedToZero: inputs: - before TradeState (0..*) + instruction Instruction (0..*) after TradeState (0..*) output: result boolean (1..1) + + alias unitTypes: <"Unit Types of the instruction's quantities."> + instruction -> primitiveInstruction -> quantityChange -> change -> quantity -> unit set result: CompareTradeLotToAmount( - before -> trade -> tradeLot only-element, + instruction -> before -> trade -> tradeLot only-element, CompareOp -> GreaterThan, - 0.0 + 0.0, + unitTypes ) = True - and CompareTradeStatesToAmount(after, CompareOp -> Equals, 0.0) = True + and CompareTradeStatesToAmount(after, CompareOp -> Equals, 0.0, unitTypes) = True -func CompareTradeStatesToAmount: <"For each TradeState, compare the Quantity amounts in each TradeState to the given amount (regardless of unit of amount), based on the CompareOp enum."> +func CompareTradeStatesToAmount: <"For each TradeState, compare the Quantity amounts in each TradeState to the given amount based on the CompareOp enum. If Unit Types are specified, only quantities with those units are compared. Otherwise, the comparison applies to all quantities, regardless of the unit type."> inputs: tradeStates TradeState (0..*) <"List of TradeState to be compared."> op CompareOp (1..1) <"Comparison operation to use."> amount number (1..1) <"Quantity amount to use."> + unitType UnitType (0..*) <"Unit Types to which condition should be applied."> + output: result boolean (1..1) - set result: + alias resultAll: <"Result of applying the comparison to all quantities, regardless of unit."> tradeStates extract [ - CompareTradeLotToAmount(item -> trade -> tradeLot only-element, op, amount) + CompareTradeLotToAmount(item -> trade -> tradeLot only-element, op, amount, unitType) ] all = True + alias resultUnit: <"Result of applying the comparison only to quantities whose unit corresponds to any of the specified Unit Types."> + tradeStates + extract [ + CompareTradeLotToAmount(item -> trade -> tradeLot only-element, op, amount, unitType) + ] all = True + + set result: <"If Unit Types are provided, return the result based only on quantities with those units; otherwise, return the result for all quantities."> + if unitType exists then resultUnit + else resultAll + func TransfersForDate: inputs: transfers Transfer (0..*) @@ -988,9 +1003,11 @@ func Create_QuantityChange: <"A specification of the inputs, outputs and constra set quantityChange -> trade -> ancillaryParty: trade -> ancillaryParty set quantityChange -> trade -> adjustment: trade -> adjustment - set quantityChange -> state -> positionState: - if newTradeLots -> priceQuantity -> quantity -> value all = 0 - then PositionStatusEnum -> Closed + set quantityChange -> state -> positionState: <"Set positionState to Closed if all quantities with the instruction’s unit have decreased to zero."> + newTradeLots -> priceQuantity -> quantity + filter instruction -> change -> quantity -> unit any = item -> unit + then if item -> value all = 0 + then PositionStatusEnum -> Closed func Create_TermsChange: <"A specification of the inputs, outputs and constraints when calculating the after tradeState based Terms Change Primitive Instruction."> inputs: diff --git a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta index 2f044c8f94..417a4a33a6 100644 --- a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta @@ -249,7 +249,7 @@ func Qualify_FullReturn: <"The qualification of a full return event from the fac and businessEvent -> instruction -> primitiveInstruction -> quantityChange exists or (businessEvent -> instruction -> primitiveInstruction -> quantityChange exists and transfer exists)) and QuantityDecreasedToZero( - businessEvent -> instruction -> before, + businessEvent -> instruction, businessEvent -> after ) = True and businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated @@ -517,7 +517,7 @@ func Qualify_PartialNovation: <"The qualification of a novation event from the f or // before trade counterparties match open after trade counterparties, and match trade identifiers, but with decreased quantity (item -> trade -> counterparty -> partyReference = beforeTradeState -> trade -> counterparty -> partyReference and item -> trade -> tradeIdentifier = beforeTradeState -> trade -> tradeIdentifier - and QuantityDecreased(beforeTradeState, [item])) + and QuantityDecreased(businessEvent -> instruction, [item])) ] all = True func Qualify_PartialTermination: <"The qualification of a partial termination event from the fact that (i) the intent is Partial Termination when specified, (ii) the associated primitives are the quantityChange and the cash transfer, the (iii) the quantity associated with the contract decreases, and (iv) there is an actual remaining quantity."> @@ -537,7 +537,7 @@ func Qualify_PartialTermination: <"The qualification of a partial termination ev businessEvent -> intent is absent and (primitiveInstruction -> quantityChange only exists or (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) - and (QuantityDecreased(businessEvent -> instruction -> before only-element, businessEvent -> after) = True) + and (QuantityDecreased(businessEvent -> instruction, businessEvent -> after) = True) and businessEvent -> after -> state -> closedState is absent func Qualify_PortfolioRebalancing: <"The qualification of a portfolio rebalancing event from the fact that (i) the intent is PortfolioRebalancing, and (ii) the execution primitive exists"> @@ -574,7 +574,7 @@ func Qualify_Reallocation: <"The qualification of a reallocation event from the or // before trade counterparties match open after trade counterparties, and match trade identifiers, but with decreased quantity (item -> trade -> counterparty -> partyReference = beforeTradeState -> trade -> counterparty -> partyReference and item -> trade -> tradeIdentifier = beforeTradeState -> trade -> tradeIdentifier - and QuantityDecreased(beforeTradeState, [item])) + and QuantityDecreased(businessEvent -> instruction, [item])) ] all = True func Qualify_Renegotiation: <"The qualification of a renegotiation event from the fact that (i) the intent is Renegotiation when specified, and (ii) the associated primitives instructions are the TermsChange, QuantityChange and the cash transfer."> @@ -593,7 +593,7 @@ func Qualify_Renegotiation: <"The qualification of a renegotiation event from th and (businessEvent -> instruction extract (primitiveInstruction -> termsChange only exists or (primitiveInstruction -> termsChange, primitiveInstruction -> quantityChange) only exists)) all = True - and (QuantityDecreasedToZero(businessEvent -> instruction -> before, businessEvent -> after) = False) + and (QuantityDecreasedToZero(businessEvent -> instruction, businessEvent -> after) = False) and businessEvent -> after -> state -> closedState is absent func Qualify_Reprice: <"This qualification function is used to qualify repricing of a contractual product with an interest rate payout and assetPayout."> @@ -654,7 +654,7 @@ func Qualify_Repurchase: <"The qualification of a repurchase event from the fact extract (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) and QuantityDecreasedToZero( - businessEvent -> instruction -> before, + businessEvent -> instruction, businessEvent -> after ) = True and businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated @@ -853,7 +853,7 @@ func Qualify_Termination: <"The qualification of a termination event from the fa businessEvent -> intent is absent and (primitiveInstruction -> quantityChange only exists or (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) - and (QuantityDecreasedToZero(businessEvent -> instruction -> before, businessEvent -> after) = True) + and (QuantityDecreasedToZero(businessEvent -> instruction, businessEvent -> after) = True) and (businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated) func Qualify_ValuationUpdate: <"The qualification of a valuation update from the fact that the only component is a valuation."> diff --git a/rosetta-source/src/main/rosetta/product-template-func.rosetta b/rosetta-source/src/main/rosetta/product-template-func.rosetta index cd5dcd17e4..67a58036de 100644 --- a/rosetta-source/src/main/rosetta/product-template-func.rosetta +++ b/rosetta-source/src/main/rosetta/product-template-func.rosetta @@ -77,22 +77,34 @@ func CompareTradeLot: <"Compare the Quantity in TradeLot 1 to the Quantity (with }, unitOfAmount ) - ] all = True + ] any = True //the comparison succeeds if at least one quantity meets the condition -func CompareTradeLotToAmount: <"Compare the Quantity amount in TradeLot to the given amount (regardless of unit of amount), based on the CompareOp enum."> +func CompareTradeLotToAmount: <"Compare the Quantity amount in TradeLot to the given amount, based on the CompareOp enum. If Unit Types are specified, only quantities with those units are compared. Otherwise, the comparison applies to all quantities, regardless of the unit type"> inputs: tradeLot TradeLot (1..1) op CompareOp (1..1) amount number (1..1) + unitTypes UnitType (0..*) <"Unit Types to which comparison should be applied."> output: result boolean (1..1) - set result: + alias resultAll: <"Result of applying the comparison to all quantities, regardless of unit."> tradeLot -> priceQuantity -> quantity filter item -> value exists then extract [ CompareNumbers(item -> value, op, amount) ] all = True + alias resultUnit: <"Result of applying the comparison only to quantities whose unit corresponds to any of the specified Unit Types."> + tradeLot -> priceQuantity -> quantity + filter item -> value exists + then filter unitTypes any = item -> unit + then extract [ CompareNumbers(item -> value, op, amount) ] + all = True + + set result: <"If Unit Types are provided, return the result based only on quantities with those units; otherwise, return the result for all quantities."> + if unitTypes exists then resultUnit + else resultAll + func PriceQuantityTriangulation: <"Defines all the scenarios which triangulation can be helpful validation between Prices and Quantities."> inputs: tradeLots TradeLot (0..*) From 67e698809b557f4f7863927a5c2ef26ad211b17a Mon Sep 17 00:00:00 2001 From: Georgina Tarres <118831133+gtarres@users.noreply.github.com> Date: Sat, 20 Sep 2025 02:27:58 +0200 Subject: [PATCH 2/5] Delete rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml Removing file uploaded by mistake. --- .../ir-option-debt-option-ex01-term-cdm.xml | 299 ------------------ 1 file changed, 299 deletions(-) delete mode 100644 rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml diff --git a/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml b/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml deleted file mode 100644 index 0467aa1be6..0000000000 --- a/rosetta-source/src/main/resources/ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml +++ /dev/null @@ -1,299 +0,0 @@ - -
- DTD#Approved#2#380513903#EMIR#Risk#New#New#Interest Rate#N#Unknown#Snapshot - DUMMYLEI012345678901 - DTCCEU - 2021-03-13T06:33:27Z - - CA3.0IR1.0 - -
- false - Trade - 1 - - - - - - - - TM99999999 - DTD380513903 - DTD380513903 - - - 380513903 - 380513903 - - - - 380513903-2-3 - 380513903-2-3 - - - - - - - ReportingParty - - - - Counterparty - - - - Beneficiary - - - - ExecutionFacility - - Principal - false - false - F - B - NO - T - Physical - Y - 2021-03-13T06:32:49Z - false - false - PartiallyCollateralized - NOTAVAILABLE - - ESMA - - ESMA - - ReportingParty - Snapshot - false - Financial - N - - false - OffFacility - Unverified - NotConfirmed - - - - - - Counterparty - - - - ReportingParty - - - - Beneficiary - - - - ExecutionAgent - - - - ThirdPartyViewer - - - - ExecutionFacility - - false - Principal - false - false - N - S - YES - T - N - 2021-03-13T06:32:49Z - false - false - - ESMA - - ESMA - - ReportingParty - Snapshot - false - false - NonFinancial - N - - false - OffFacility - Unverified - NotConfirmed - - 2023-04-19T00:00:00 - - - InterestRate - HRMAVP - OP - InterestRate:Option:DebtOption - US05367AAA16 - - - Call - - - - - - USD - 0 - - - - 2021-03-13T00:00:00 - - NONE - - - - - - - - 2023-04-19T00:00:00 - - NONE - - - - - 10:00:00Z - GBLO - - - 17:00:00Z - GBLO - - - - - false - - true - - - USD - 600000000 - - 100000000 - USD - 1 - Physical - - - 2023-04-24T00:00:00 - - NONE - - - - - - 6 - - - - US05367AAA16 - - - - - ISDA - 1992 - - - - 2008-01-20T00:00:00Z - 2008-01-23T10:12:34Z - 2008-01-23T00:00:00Z - - USD - 600000000 - - - USD - 0 - - - - 1 - PriceMultiplier - - - 1 - QuantityEMIR - - - ReportingTimestamp - - - - 6 - StrikePrice - Units - - - 6 - PriceNotation - Percentage - - - DUMMYLEI012345678903 - Spanish Test Party Belgian Branch - InvestmentFirm - EEA - -
- ES -
-
- - BE - -
- - DUMMYLEI012345678904 - Spanish Test Party 2 - 14 - EEA - -
- ES -
-
- - ES - -
- - DUMMYLEI012345678907 - - - XXXX - XXXX - - - DUMMYLEI012345678911 - DUMMYLEI012345678909 - - - 1111 - - -
From a710786072182193fe9d39ee8ff58f0cb63ddeda Mon Sep 17 00:00:00 2001 From: Georgina Tarres <118831133+gtarres@users.noreply.github.com> Date: Sat, 20 Sep 2025 02:28:53 +0200 Subject: [PATCH 3/5] Update test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json Removing file uploaded by mistake. --- ...rmation-to-workflow-step-fpml-5-10-processes.json | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json index 8f23815b42..6fce2e86a2 100644 --- a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json +++ b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json @@ -167,14 +167,6 @@ "modelValidationFailures" : 3, "runtimeError" : false } - }, { - "id" : "ir-option-debt-option-ex01-term-cdm", - "name" : "IR-Option-Debt-Option-ex01-term-cdm", - "inputPath" : "ingest/input/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.xml", - "outputPath" : "ingest/output/fpml-confirmation-to-workflow-step/fpml-5-10-processes/ir-option-debt-option-ex01-term-cdm.json", - "assertions" : { - "schemaValidationFailure" : false, - "runtimeError" : false - } + } } ] -} \ No newline at end of file +} From fc3f2b40fb2c0862dd74d6f4641f99d4b3f545bb Mon Sep 17 00:00:00 2001 From: Georgina Tarres <118831133+gtarres@users.noreply.github.com> Date: Sat, 20 Sep 2025 02:29:53 +0200 Subject: [PATCH 4/5] Update test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json Removing file uploaded by mistake. --- ...e-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json | 1 - 1 file changed, 1 deletion(-) diff --git a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json index 6fce2e86a2..7755aed223 100644 --- a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json +++ b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json @@ -167,6 +167,5 @@ "modelValidationFailures" : 3, "runtimeError" : false } - } } ] } From 9ae710245082970684d294a2e4561aea21d4e556 Mon Sep 17 00:00:00 2001 From: Georgina Tarres Date: Thu, 9 Oct 2025 15:11:51 +0000 Subject: [PATCH 5/5] Fixed input cardinality and optimized unitType logic --- ...-to-workflow-step-fpml-5-10-processes.json | 2 +- .../main/rosetta/event-common-func.rosetta | 16 +++------------ .../rosetta/event-qualification-func.rosetta | 14 ++++++------- .../rosetta/product-template-func.rosetta | 20 ++++++------------- 4 files changed, 17 insertions(+), 35 deletions(-) diff --git a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json index 7755aed223..80f81e7849 100644 --- a/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json +++ b/rosetta-source/src/main/resources/ingest/config/test-pack-translate-fpml-confirmation-to-workflow-step-fpml-5-10-processes.json @@ -168,4 +168,4 @@ "runtimeError" : false } } ] -} +} \ No newline at end of file diff --git a/rosetta-source/src/main/rosetta/event-common-func.rosetta b/rosetta-source/src/main/rosetta/event-common-func.rosetta index 54d9e1d069..cdf471ed72 100644 --- a/rosetta-source/src/main/rosetta/event-common-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-common-func.rosetta @@ -38,7 +38,7 @@ func QuantityIncreased: func QuantityDecreased: inputs: - instruction Instruction (0..*) + instruction Instruction (1..1) after TradeState (0..*) output: result boolean (1..1) @@ -61,7 +61,7 @@ func QuantityDecreased: func QuantityDecreasedToZero: inputs: - instruction Instruction (0..*) + instruction Instruction (1..1) after TradeState (0..*) output: result boolean (1..1) @@ -88,22 +88,12 @@ func CompareTradeStatesToAmount: <"For each TradeState, compare the Quantity amo output: result boolean (1..1) - alias resultAll: <"Result of applying the comparison to all quantities, regardless of unit."> + set result: <"Result of applying the comparison. If Unit Types are provided, returns the result based only on quantities with those units; otherwise, returns the result for all quantities."> tradeStates extract [ CompareTradeLotToAmount(item -> trade -> tradeLot only-element, op, amount, unitType) ] all = True - alias resultUnit: <"Result of applying the comparison only to quantities whose unit corresponds to any of the specified Unit Types."> - tradeStates - extract [ - CompareTradeLotToAmount(item -> trade -> tradeLot only-element, op, amount, unitType) - ] all = True - - set result: <"If Unit Types are provided, return the result based only on quantities with those units; otherwise, return the result for all quantities."> - if unitType exists then resultUnit - else resultAll - func TransfersForDate: inputs: transfers Transfer (0..*) diff --git a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta index 417a4a33a6..d189e0600e 100644 --- a/rosetta-source/src/main/rosetta/event-qualification-func.rosetta +++ b/rosetta-source/src/main/rosetta/event-qualification-func.rosetta @@ -249,7 +249,7 @@ func Qualify_FullReturn: <"The qualification of a full return event from the fac and businessEvent -> instruction -> primitiveInstruction -> quantityChange exists or (businessEvent -> instruction -> primitiveInstruction -> quantityChange exists and transfer exists)) and QuantityDecreasedToZero( - businessEvent -> instruction, + businessEvent -> instruction only-element, businessEvent -> after ) = True and businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated @@ -517,7 +517,7 @@ func Qualify_PartialNovation: <"The qualification of a novation event from the f or // before trade counterparties match open after trade counterparties, and match trade identifiers, but with decreased quantity (item -> trade -> counterparty -> partyReference = beforeTradeState -> trade -> counterparty -> partyReference and item -> trade -> tradeIdentifier = beforeTradeState -> trade -> tradeIdentifier - and QuantityDecreased(businessEvent -> instruction, [item])) + and QuantityDecreased(businessEvent -> instruction only-element, [item])) ] all = True func Qualify_PartialTermination: <"The qualification of a partial termination event from the fact that (i) the intent is Partial Termination when specified, (ii) the associated primitives are the quantityChange and the cash transfer, the (iii) the quantity associated with the contract decreases, and (iv) there is an actual remaining quantity."> @@ -537,7 +537,7 @@ func Qualify_PartialTermination: <"The qualification of a partial termination ev businessEvent -> intent is absent and (primitiveInstruction -> quantityChange only exists or (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) - and (QuantityDecreased(businessEvent -> instruction, businessEvent -> after) = True) + and (QuantityDecreased(businessEvent -> instruction only-element, businessEvent -> after) = True) and businessEvent -> after -> state -> closedState is absent func Qualify_PortfolioRebalancing: <"The qualification of a portfolio rebalancing event from the fact that (i) the intent is PortfolioRebalancing, and (ii) the execution primitive exists"> @@ -574,7 +574,7 @@ func Qualify_Reallocation: <"The qualification of a reallocation event from the or // before trade counterparties match open after trade counterparties, and match trade identifiers, but with decreased quantity (item -> trade -> counterparty -> partyReference = beforeTradeState -> trade -> counterparty -> partyReference and item -> trade -> tradeIdentifier = beforeTradeState -> trade -> tradeIdentifier - and QuantityDecreased(businessEvent -> instruction, [item])) + and QuantityDecreased(businessEvent -> instruction only-element, [item])) ] all = True func Qualify_Renegotiation: <"The qualification of a renegotiation event from the fact that (i) the intent is Renegotiation when specified, and (ii) the associated primitives instructions are the TermsChange, QuantityChange and the cash transfer."> @@ -593,7 +593,7 @@ func Qualify_Renegotiation: <"The qualification of a renegotiation event from th and (businessEvent -> instruction extract (primitiveInstruction -> termsChange only exists or (primitiveInstruction -> termsChange, primitiveInstruction -> quantityChange) only exists)) all = True - and (QuantityDecreasedToZero(businessEvent -> instruction, businessEvent -> after) = False) + and (QuantityDecreasedToZero(businessEvent -> instruction only-element, businessEvent -> after) = False) and businessEvent -> after -> state -> closedState is absent func Qualify_Reprice: <"This qualification function is used to qualify repricing of a contractual product with an interest rate payout and assetPayout."> @@ -654,7 +654,7 @@ func Qualify_Repurchase: <"The qualification of a repurchase event from the fact extract (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) and QuantityDecreasedToZero( - businessEvent -> instruction, + businessEvent -> instruction only-element, businessEvent -> after ) = True and businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated @@ -853,7 +853,7 @@ func Qualify_Termination: <"The qualification of a termination event from the fa businessEvent -> intent is absent and (primitiveInstruction -> quantityChange only exists or (primitiveInstruction -> quantityChange, primitiveInstruction -> transfer) only exists) - and (QuantityDecreasedToZero(businessEvent -> instruction, businessEvent -> after) = True) + and (QuantityDecreasedToZero(businessEvent -> instruction only-element, businessEvent -> after) = True) and (businessEvent -> after -> state -> closedState -> state all = ClosedStateEnum -> Terminated) func Qualify_ValuationUpdate: <"The qualification of a valuation update from the fact that the only component is a valuation."> diff --git a/rosetta-source/src/main/rosetta/product-template-func.rosetta b/rosetta-source/src/main/rosetta/product-template-func.rosetta index 67a58036de..1ee6c9c4cd 100644 --- a/rosetta-source/src/main/rosetta/product-template-func.rosetta +++ b/rosetta-source/src/main/rosetta/product-template-func.rosetta @@ -87,24 +87,16 @@ func CompareTradeLotToAmount: <"Compare the Quantity amount in TradeLot to the g unitTypes UnitType (0..*) <"Unit Types to which comparison should be applied."> output: result boolean (1..1) - - alias resultAll: <"Result of applying the comparison to all quantities, regardless of unit."> - tradeLot -> priceQuantity -> quantity + + set result: + tradeLot -> priceQuantity -> quantity filter item -> value exists + then (if unitTypes exists + then filter unitTypes any = item -> unit + else item) then extract [ CompareNumbers(item -> value, op, amount) ] all = True - alias resultUnit: <"Result of applying the comparison only to quantities whose unit corresponds to any of the specified Unit Types."> - tradeLot -> priceQuantity -> quantity - filter item -> value exists - then filter unitTypes any = item -> unit - then extract [ CompareNumbers(item -> value, op, amount) ] - all = True - - set result: <"If Unit Types are provided, return the result based only on quantities with those units; otherwise, return the result for all quantities."> - if unitTypes exists then resultUnit - else resultAll - func PriceQuantityTriangulation: <"Defines all the scenarios which triangulation can be helpful validation between Prices and Quantities."> inputs: tradeLots TradeLot (0..*)