common-domain-model icon indicating copy to clipboard operation
common-domain-model copied to clipboard

Function Create_QuantityChange does not work for multiple quantities

Open tomhealey-icma opened this issue 7 months ago • 5 comments

Background

The Create_QuantityChange function changes the quantity of all PriceQuantity elements in the array based on a minimal match. Where this fails is in the repo case where the tradeLot contains two priceQuantity elements, one for the cash loan amount and a second element for the collateral amount.

When you run any function, such as Create_RepricePrimitiveInstruction that is used to change the price of the collateral and update the cash amount of the loan. The incorrect result is that the collateral quantity is set to the cash loan amount. Here's an example of the before and after TradeLot:

Correct Collateral Amount: "quantity": [ { "value": { "value": 1000.0, "unit": { "currency": { "value": "GBP"

After changing the cash loan amount to 997833.55, the collateral amount is also set to the same amount:

"quantity": [
		{
		"value": {
			"value": 997833.55,
				"unit": {
					"currency": {
					"value": "GBP"

Proposal

The proposal is to provide more granular matching criteria to update a price or quantity by adding two attributes to NonNegativeQuantitySchedule:

quantityType QuantityTypeEnum (0..1) Refers to quantity types Settlement, PurchasePrice, RepurchasePrice, Accrued Interest, Instrument, etc. quantityTypeReference AssetIdentifier (0..1) refers to the specific asset ID

The Create_QuantityChange will then change it's price/quantity matching function to include addition parameters.

Compatibility

The is a breaking change in v6.

Release

CDM dev 7.x

Additional Context

No response

tomhealey-icma avatar Apr 23 '25 20:04 tomhealey-icma

Another addition related to this issue is, we need to add margin and haircut the priceQuantity structure as percentage adjustments. This is related to the same problem because another price with type Interest Rate will conflict with the repo rate.

After further review this looks like it can be addressed by using collateral object on the trade instead or together with the collateral object in the economicTerms.

tomhealey-icma avatar May 01 '25 18:05 tomhealey-icma

CRWG - 03/06 - Agreed that this needs to be reviewed in more detail and a design for all price/quantity issues decided. This issue is mostly to do with the granularity of the function, other issues are related to using datedValue lists.

chrisisla avatar Jun 03 '25 14:06 chrisisla

Briefly mentioned at the CDM Contribution Review Working Group - June 17th, 2025. This issue should be included as part of a broader review of the price / quantity change primitive function.

lolabeis avatar Jul 01 '25 09:07 lolabeis

Discussed at CDM Contribution Review Working Group - July 15th, 2025

Will be a topic on a CRWG extraordinary session surrounding the QuantityChange function.

Moved from Follow Up to Current until discussion at the deep dive session.

Discussed at CDM Contribution Review Working Group - October 21th, 2025

The item was discussed and left in Current until @tomhealey-icma is able to discuss the issue on the next meeting