# FpML 5.3 Validation Rules - Collateral

This is the Collateral part of the validation rule set accompanying the FpML 5.3 Working Draft #2. The introductory section in the validation section of the specifications contains background information and documentation for this page.

The rules contained on this page contain links to cut down versions of valid and invalid test cases. The cut down test cases are non-normative and are provided for the purpose of documentation only.

## Content

- Namespace
- Functions
- Rules

## Namespace

default element namespace = http://www.fpml.org/spec/fpml-5-3-2-wd-2

namespace xs = http://www.w3.org/2001/XMLSchema

## Functions

The following shared functions are used in the rules.

- same-currency

## Rules

#### Unique contexts:

- RequestMargin (complex type): col-1 col-2 col-5
- MarkToMarket (complex type): col-3
- CollateralBalance (complex type): col-4 col-8
- CashDeliveryReturn (complex type): col-6
- SecurityDeliveryReturn (complex type): col-7
- RequestSubstitution (complex type): col-9
- interestPeriod (complex type): col-10
- interestCalculationDetails (complex type): col-11
- Deprecated rules
- Removed rules

col-1 (Mandatory)
English Description:
Context: RequestMargin (complex type)
If marginCallResult/variationMargin exists, if marginRequirement/variationMargin exists, and if marginCallResult/variationMargin/marginCallAmount/amount, marginRequirement/variationMargin/deliver/amount and marginRequirement/variationMargin/return/amount have the same-currency, the marginCallResult/variationMargin/marginCallAmount/amount must be the sum of the marginRequirement/variationMargin/deliver/amount and the marginRequirement/variationMargin/return/amount.
XPath Description:
Context: RequestMargin
[same-currency(marginCallResult/variationMargin/marginCallAmount/amount, marginRequirement/variationMargin/deliver/amount, marginRequirement/variationMargin/return/amount)] [exists(marginCallResult/variationMargin)] [exists(marginRequirement/variationMargin)]
marginCallResult/variationMargin/marginCallAmount/amount eq marginRequirement/variationMargin/deliver/amount + marginRequirement/variationMargin/return/amount.
Test cases: [Invalid]
col-2 (Mandatory)
English Description:
Context: RequestMargin (complex type)
If marginCallResult/segregatedIndependentAmount exists, if marginRequirement/segregatedIndependentAmount exists, and if marginCallResult/segregatedIndependentAmount/marginCallAmount/amount, marginRequirement/segregatedIndependentAmount/deliver/amount and marginRequirement/segregatedIndependentAmount/return/amount have the same-currency, the marginCallResult/segregatedIndependentAmount/marginCallAmount/amount must be the sum of the marginRequirement/segregatedIndependentAmount/deliver/amount and the marginRequirement/segregatedIndependentAmount/return/amount.
XPath Description:
Context: RequestMargin
[same-currency(marginCallResult/segregatedIndependentAmount/marginCallAmount/amount, marginRequirement/segregatedIndependentAmount/deliver/amount, marginRequirement/segregatedIndependentAmount/return/amount)] [exists(marginCallResult/segregatedIndependentAmount)] [exists(marginRequirement/segregatedIndependentAmount)]
marginCallResult/segregatedIndependentAmount/marginCallAmount/amount eq marginRequirement/segregatedIndependentAmount/deliver/amount + marginRequirement/segregatedIndependentAmount/return/amount.
Test cases: [Invalid]
col-3 (Mandatory)
English Description:
Context: MarkToMarket (complex type)
If two exposure elements exist, the direction of each exposure (indicated by the exposedPartyReference / obligatedPartyReference) pair must be different.
XPath Description:
Context: MarkToMarket
[count(exposure) eq 2]
exposure[1]/exposedPartyReference neq exposure[2]/exposedPartyReference && exposure[1]/obligatedPartyReference neq exposure[2]/obligatedPartyReference
Test cases: [Invalid]
col-4 (Mandatory)
English Description:
Context: CollateralBalance (complex type)
If two pendingCollateral elements exist, the direction of each pendingCollateral (indicated by the giverPartyReference / takerPartyReference pair) must be different.
XPath Description:
Context: CollateralBalance
[exists(variationMargin)] [count(pendingCollateral) eq 2]
variationMargin/pendingCollateral[1]/giverPartyReference neq variationMargin/pendingCollateral[2]/giverPartyReference && variationMargin/pendingCollateral[1]/receiverPartyReference neq variationMargin/pendingCollateral[2]/ receiverPartyReference
Test cases: [Invalid]
col-5 (Mandatory)
English Description:
Context: RequestMargin (complex type)
The @href attributes of marginCallIssuerPartyReference and marginCallReceiverPartyReference must be different.
XPath Description:
Context: RequestMargin
marginCallIssuerPartyReference/@href neq marginCallReceiverPartyReference/@href
Test cases: [Invalid]
col-6 (Mandatory)
English Description:
Context: CashDeliveryReturn (complex type)
The @href attribute is equal to the @id attribute of an element of type Assets
XPath Description:
Context: CashDeliveryReturn
id($context/@href) instance of element(*, Assets)
Test cases: [Invalid]
col-7 (Mandatory)
English Description:
Context: SecurityDeliveryReturn (complex type)
The @href attribute is equal to the @id attribute of an element of type Assets
XPath Description:
Context: SecurityDeliveryReturn
id($context/@href) instance of element(*, Assets)
Test cases: [Invalid]
col-8 (Mandatory)
English Description:
Context: CollateralBalance (complex type)
If two heldCollateral elements exist, the direction of each heldCollateral (indicated by the holdingPartyReference / postingPartyReference pair) must be different.
XPath Description:
Context: CollateralBalance
[exists(variationMargin)] [count(heldCollateral) eq 2]
variationMargin/heldCollateral[1]/postingPartyReference neq variationMargin/heldCollateral[2]/holdingPartyReference && variationMargin/heldCollateral[1]/holdingPartyReference neq variationMargin/heldCollateral[2]/postingPartyReference
Test cases: [Invalid]
col-9 (Mandatory)
English Description:
Context: RequestSubstitution (complex type)
The @href attributes of substitutionIssuerPartyReference and substitutionReceiverPartyReference must be different.
XPath Description:
Context: RequestSubstitution
substitutionIssuerPartyReference/@href neq substitutionReceiverPartyReference/@href
Test cases: [Invalid]
col-10 (Mandatory)
English Description:
Context: interestPeriod (complex type)
If startDate exists, and if endDate exists, then startDate must be before endDate.
XPath Description:
Context: interestPeriod
[exists(startDate)] [exists(endDate)]
startDate le endDate
Test cases: [Invalid]
col-11 (Mandatory)
English Description:
Context: interestCalculationDetails (complex type)
The value of each dailyInterestCalculation/calculationDate must be unique
XPath Description:
Context: interestCalculationDetails
count(distinct-values(dailyInterestCalculation/calculationDate)) eq count(dailyInterestCalculation/calculationDate)
Test cases: [Invalid]

#### Deprecated rules

#### Removed rules