# FpML 4.5 Validation Rules - Rules for FX Derivatives

This is the FX part of the validation rule set accompanying the FpML 4.5 Working Draft. 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

- Definitions
  - calculated schedule dates
- Namespace
- Conditions
- Functions
- Rules

## Namespace

default element namespace = http://www.fpml.org/2008/FpML-4-5

## Definitions

Term: calculated schedule dates
Correctly evaluating rule fx-12 requires generation of a schedule of observation dates based on the observation start date, the observation end date, a calculation period frequency, a date roll convention, and a business day calendar for business center where fixing occurs. The calculation should proceed as follows:

- generatedDates := [null];
- unadjustedDate := observationStartDate;
- while unadjustedDate <= observationEndDate do
  - begin
    - adjustedDate := dateRoll (unadjustedDate,dateRollConvention,businessDayCalendar);
    - if adjustedDate [doesn't belong at] generatedDates then
      - generatedDates := generatedDate [union] adjustedDate;
    - unadjustedDate := unadjustedDate + calculationPeriodFrequency;
  - end;
- return (generatedDates);

The algorithm assumes that implementations can add a time period (e.g. 1D, 1W, 2M, 6M, 1Y, etc.) to dates and understands how perform standard financial date rolls (e.g. following, modified preceding, etc.) against a business day calendar. Implementations must be capable of working with dates that MAY contain time zone offset information.

## Conditions

The Validation Conditions only apply when specific rules reference them. The following conditions are always to be executed relative to the root of the FpML document being validated. The context of the rule is NOT carried through to the condition.

Condition: SameCurrencyScheme
Elements containing currency code values (e.g. GBP, USD, etc.) can only be tested for equality or inequality if they are both reference the same currency scheme URI in their currencyScheme attribute.

## Functions

The following shared functions are used in the rules.

- same-currency

## Rules

#### Unique contexts:

- ExchangeRate (complex type): fx-1 fx-2 fx-3 fx-4 fx-5 fx-6
- FxAmericanTrigger (complex type): fx-7 fx-8
- FxAverageRateObservationSchedule (complex type): fx-9 fx-10
- FxAverageRateOption (complex type): fx-11 fx-12 fx-13 fx-42 fx-43 fx-44 fx-45
- FxBarrier (complex type): fx-14 fx-41
- FxBarrierOption (complex type): fx-15
- FxDigitalOption (complex type): fx-16
- FxEuropeanTrigger (complex type): fx-17
- FxLeg (complex type): fx-18 fx-19 fx-20 fx-21
- FxOptionLeg (complex type): fx-22 fx-23 fx-24
- FxSwap (complex type): fx-25 fx-26
- QuotedCurrencyPair (complex type): fx-27
- SideRate (complex type): fx-28 fx-29 fx-30
- SideRates (complex type): fx-31 fx-46 fx-47
- TermDeposit (complex type): fx-32 fx-33 fx-34 fx-35
- Trade (complex type): fx-36 fx-37 fx-38 fx-39 fx-40
- Deprecated rules
- Removed rules

fx-1 (Mandatory)
Context: ExchangeRate (complex type)
rate > 0.
Test cases: [Invalid] [Invalid] [Invalid] [Invalid]
fx-2 (Mandatory)
Context: ExchangeRate (complex type)
[exists(forwardPoints)]
spotRate must exist.
Test cases: [Invalid] [Invalid] [Invalid]
fx-3 (Mandatory)
Context: ExchangeRate (complex type)
[exists(spotRate)] [exists(forwardPoints)]
rate = spotRate + forwardPoints.
Test cases: [Invalid] [Invalid]
fx-4 (Mandatory)
Context: ExchangeRate (complex type)
[SameCurrencyScheme]
sideRates/baseCurrency != the values of both quotedCurrencyPair/currency1 and quotedCurrencyPair/currency2.
Test cases: [Invalid]
fx-5 (Mandatory)
Context: ExchangeRate (complex type)
[SameCurrencyScheme]
sideRates/currency1SideRate/currency = quotedCurrencyPair/currency1.
Test cases: [Invalid]
fx-6 (Mandatory)
Context: ExchangeRate (complex type)
[SameCurrencyScheme]
sideRates/currency2SideRate/currency = quotedCurrencyPair/currency2.
Test cases: [Invalid]
fx-7 (Mandatory)
Context: FxAmericanTrigger (complex type)
triggerRate > 0.
Test cases: [Invalid] [Invalid] [Invalid] [Invalid]
fx-8 (Mandatory)
Context: FxAmericanTrigger (complex type)
[exists(observationStartDate)] [exists(observationEndDate)]
observationStartDate <= observationEndDate.
Test cases: [Invalid] [Invalid] [Invalid] [Invalid]
fx-9 (Mandatory)
Context: FxAverageRateObservationSchedule (complex type)
[exists(observationStartDate)] [exists(observationEndDate)]
observationStartDate <= observationEndDate.
Test cases: [Invalid]
fx-10 (Mandatory)
Context: FxAverageRateObservationSchedule (complex type)
The observation period defined by observationStartDate and observationEndDate should be an integer multiple of the calculationPeriodFrequency.
Test cases: [Invalid] [Invalid]
fx-11 (Mandatory)
Context: FxAverageRateOption (complex type)
The value of each observedRates/observationDate shall be unique.
Test cases: [Invalid]
fx-12 (Mandatory)
Context: FxAverageRateOption (complex type)
[exists(averageRateObservationSchedule)]
The values of observedRates/observationDate should match the calculated schedule dates derived from parameters defined within the averageRateObservationSchedule element and the business day calendar implied by fixingTime/businessCenter.
Test cases: [Invalid]
fx-13 (Mandatory)
Context: FxAverageRateOption (complex type)
[exists(averageRateObservationDate elements)]
Each observedRates/observationDate should match one of the dates defined by averageRateObservationDate/observationDate.
Test cases: [Invalid]
fx-14 (Mandatory)
Context: FxBarrier (complex type)
[exists(observationStartDate)] [exists(observationEndDate)]
observationStartDate <= observationEndDate.
Test cases: [Invalid] [Invalid]
fx-15 (Mandatory)
Context: FxBarrierOption (complex type)
[exists(spotRate)]
spotRate > 0.
Test cases: [Invalid] [Invalid]
fx-16 (Mandatory)
Context: FxDigitalOption (complex type)
[exists(spotRate)]
spotRate > 0.
Test cases: [Invalid] [Invalid]
fx-17 (Mandatory)
Context: FxEuropeanTrigger (complex type)
triggerRate > 0.
Test cases: [Invalid] [Invalid]
fx-18 (Mandatory)
Context: FxLeg (complex type)
exchangedCurrency1/payerPartyReference/@href = exchangedCurrency2/receiverPartyReference/@href and exchangedCurrency1/receiverPartyReference/@href = exchangedCurrency2/payerPartyReference/@href.
Test cases: [Invalid]
fx-19 (Mandatory)
Context: FxLeg (complex type)
[same-currency((exchangedCurrency1/paymentAmount,exchangedCurrency2/paymentAmount))]
exchangedCurrency1/paymentAmount/currency != exchangedCurrency2/paymentAmount/currency.
Test cases: [Invalid]
fx-20 (Mandatory)
Context: FxLeg (complex type)
[exists(currency1ValueDate)]
currency1ValueDate != currency2ValueDate.
Test cases: [Invalid]
fx-21 (Mandatory)
Context: FxLeg (complex type)
[exists(nonDeliverableForward)]
exchangeRate/forwardPoints must exist.
Test cases: [Invalid]
fx-22 (Mandatory)
Context: FxOptionLeg (complex type)
[exists(fxOptionPremium)]
buyerPartyReference/@href = fxOptionPremium/payerPartyReference/@href and sellerPartyReference/@href = fxOptionPremium/receiverPartyReference/@href.
Test cases: [Invalid] [Invalid] [Invalid]
fx-23 (Mandatory)
Context: FxOptionLeg (complex type)
[same-currency((putCurrencyAmount,callCurrencyAmount))]
putCurrencyAmount/currency != callCurrencyAmount/currency.
Test cases: [Invalid] [Invalid]
fx-24 (Mandatory)
Context: FxOptionLeg (complex type)
rate > 0.
Test cases: [Invalid] [Invalid]
fx-25 (Mandatory)
Context: FxSwap (complex type)
Two or more fxSingleLeg elements must exist.
Test cases: [Invalid]
fx-26 (Mandatory)
Context: FxSwap (complex type)
[two fxSingleLeg elements exist]
The fxSingleLeg\valueDate for each one of the legs must be different.
Test cases: [Invalid]
fx-27 (Mandatory)
Context: QuotedCurrencyPair (complex type)
[SameCurrencyScheme]
currency1 != currency2.
Test cases: [Invalid] [Invalid]
fx-28 (Mandatory)
Context: SideRate (complex type)
rate > 0.
Test cases: [Invalid]
fx-29 (Mandatory)
Context: SideRate (complex type)
[exists(forwardPoints)]
spotRate must exist.
Test cases: [Invalid]
fx-30 (Mandatory)
Context: SideRate (complex type)
[exists(spotRate)] [exists(forwardPoints)]
rate = spotRate + forwardPoints.
Test cases: [Invalid]
fx-31 (Mandatory)
Context: SideRates (complex type)
[SameCurrencyScheme]
baseCurrency != the values of both currency1SideRate/currency and currency2SideRate/currency.
Test cases: [Invalid]
fx-32 (Mandatory)
Context: TermDeposit (complex type)
initialPayerReference/@href != initialReceiverReference/@href .
Test cases: [Invalid]
fx-33 (Mandatory)
Context: TermDeposit (complex type)
maturityDate > startDate.
Test cases: [Invalid] [Invalid]
fx-34 (Mandatory)
Context: TermDeposit (complex type)
principal/amount > 0.
Test cases: [Invalid] [Invalid]
fx-35 (Mandatory)
Context: TermDeposit (complex type)
fixedRate > 0.
Test cases: [Invalid] [Invalid]
fx-36 (Mandatory)
Context: Trade (complex type)
fxAverageRateOption/expiryDateTime/expiryDate > tradeHeader/tradeDate.
Test cases: [Invalid] [Invalid]
fx-37 (Mandatory)
Context: Trade (complex type)
fxBarrierOption/expiryDateTime/expiryDate > tradeHeader/tradeDate.
Test cases: [Invalid] [Invalid]
fx-38 (Mandatory)
Context: Trade (complex type)
fxDigitalOption/expiryDateTime/expiryDate > tradeHeader/tradeDate.
Test cases: [Invalid] [Invalid]
fx-39 (Mandatory)
Context: Trade (complex type)
The value of fxSingleLeg/valueDate or the value of both fxSingleLeg/valueDate1 and fxSingleLeg/valueDate2 > tradeHeader/tradeDate.
Test cases: [Invalid] [Invalid]
fx-40 (Mandatory)
Context: Trade (complex type)
The value of all fxSwap/fxSingleLeg/valueDate, fxswap/fxSingleLeg/valueDate1 and fxSwap/fxSingleLeg/valueDate2 instances > tradeHeader/tradeDate.
Test cases: [Invalid] [Invalid]
fx-41 (Mandatory)
Context: FxBarrier (complex type)
triggerRate > 0.
Test cases: [Invalid] [Invalid]
fx-42 (Mandatory)
Context: FxAverageRateOption (complex type)
The value of each averageRateObservationDate/observationDate must be unique.
Test cases: [Invalid]
fx-43 (Mandatory)
Context: FxAverageRateOption (complex type)
[same-currency((putCurrencyAmount,callCurrencyAmount))]
putCurrencyAmount/currency != callCurrencyAmount/currency.
Test cases: [Invalid]
fx-44 (Mandatory)
Context: FxAverageRateOption (complex type)
[exists(fxOptionPremium)]
buyerPartyReference/@href = fxOptionPremium/payerPartyReference/@href and sellerPartyReference/@href = fxOptionPremium/receiverPartyReference/@href.
Test cases: [Invalid]
fx-45 (Mandatory)
Context: FxAverageRateOption (complex type)
[exists(fxOptionPremium)]
buyerPartyReference/@href = fxOptionPremium/payerPartyReference/@href and sellerPartyReference/@href = fxOptionPremium/receiverPartyReference/@href.
Test cases: [Invalid]
fx-46 (Mandatory)
Context: SideRates (complex type)
currency1SideRate/sideRateBasis = either BaseCurrencyPerCurrency1 or Currency1PerBaseCurrency.
Test cases: [Invalid]
fx-47 (Mandatory)
Context: SideRates (complex type)
currency2SideRate/sideRateBasis = either BaseCurrencyPerCurrency2 or Currency2PerBaseCurrency.
Test cases: [Invalid]

#### Deprecated rules

#### Removed rules