FpML Issues Tracker

744: Precondition/funtion names clash for SameCurrency in new Loan and FX rules

June 6, 2008

closed

Minor

Always

Validation Rules

Admin

None

Summary

The new Loan rules define a precondition/function named "SameCurrency". So do the new FX rules. The problem is that the function SameCurrency is already defined in the EQD rules and the CD rules. The function names collide. Namespaces don't help as there is no namespace given for functions.

The options are:

1. Explicit Namespace --Declare a namespace each for EQD, CD, Loans, and FX. Then explicitly define the function as using that namespace. The namespace definitions already at the top of each page could have an EQD namespace added as something like: " module namespace eqd="http://www.fpml.org/2007/FpML-4-4/eqd"; "

Then the function could be defined with an explicit namespace as: " Function: eqd:same-currency ... ... "

2. Shared functions - Create a new VWG page that contains all the function definitions so they can be shared across the Rules groups.

3. Change the default function namespace to be the a local namespace for each group of rules. This would be added to the existing namespace declarations: " declare default function namespace "http://www.fpml.org/2007/FpML-4-4/eqd"; " This has the major downside now of pushing all the XPath pre-defined terms out of the default namespace. So terms like "exists" and "and" and "count" would all need to be prefixed with a declared namespace: "fn:exists", "fn:and", "fn:count".

IMHO the simplest thing is to share the function across the rules in a page of shared functions.

Notes:

  • lyteck

    08/25/08 2:48 pm

    – a new shared functions page was created (see issue 779) including a same-currency() function.

    – CD, EQD, FX, LOANS refer to currency-related conditions:

    CD Condition: SameCurrency
    Every element of type Money should have the same currency.

    EQD Condition: SameCurrency
    All instances of currency values within the context of this rule must be identical.

    LOAN Condition: SameCurrency
    (context: FacilityNotice) (context: DrawdownNotice) (context: InterestPaymentNotice) (context: LoanContractRepayment) (context: Repayment) All instances of currency values within the context of this rule must be identical.

    FX 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.”

    – If we rewrite the affected rules* with shared function same-currency(), we’d need to explicitely feed parameters. i.e., same-currency(param1, param2). (Seems like lot of work to “customize” each rule while current conditions don’t need parameters.)

    Please advise.

    *cd-37,ln-10,11,12,16,17,20,22,24,25,26,30,31,fx-4,5,6,19,23,27,31,43

  • matthewdr

    08/26/08 1:46 pm

    Agreed at the VWG today to implement as proposed.

    There are a few more to do. For example same-currency needs to move from Loans to the shared functions.

    Agreed at the VWG – we do need to specify the parameters each time, otherwise we don’t know what to test.

    The EQD rules also have many uses of this, such as eqd-19.

  • matthewdr

    08/26/08 1:47 pm

    Be aware the need for brackets for lists:

    Currently:
    “eqd-19 (Mandatory)
    Context: EquityOption (complex type)
    EquityDerivativeShortFormBase (complex type)
    [notional exists] [equityPremium/percentageOfNotional exists] [equityPremium/paymentAmount exists] [same-currency(equityPremium/paymentAmount,notional) = True]
    equityPremium/paymentAmount/amount = notional/amount * equityPremium/percentageOfNotional.

    With the correct braces on the list parameter.

    eqd-19 (Mandatory)
    Context: EquityOption (complex type)
    EquityDerivativeShortFormBase (complex type)
    [notional exists] [equityPremium/percentageOfNotional exists] [equityPremium/paymentAmount exists] [same-currency((equityPremium/paymentAmount,notional)) = True]
    equityPremium/paymentAmount/amount = notional/amount * equityPremium/percentageOfNotional. ”

  • lyteck

    08/26/08 5:43 pm

    EQD – SameCurrency condition removed [superceded by function same-currency() in eqd-19, eqd-20, eqd-25]

    CD – SameCurrency condition removed [superceded by function same-currency() in cd-37]

    FX – SameCurrencyScheme condition removed [superceded by function same-currency() in fx-4,5,6,19,23,27,31,43]

    LOAN – SameCurrency condition removed [superceded by function same-currency() in ln-10,11,12,16,17,18,20,22,23,24,25,26,30,31]

  • lyteck

    08/26/08 7:48 pm

    FX condition was originally SameCurrencyScheme (see above) acting on elements of type Currency whereas function same-currency() only accepts arguments of type Money. It seems not all SameCurrencyScheme conditions can be replaced by same-currency() function (E.g., fx-4,5,6,27,31). Please advise.

  • matthewdr

    08/27/08 1:57 pm

    The latest edit for fx-4 is:

    fx-4 (Mandatory)
    Context: ExchangeRate (complex type)
    [same-currency((,)) = True]
    sideRates/baseCurrency != the values of both quotedCurrencyPair/currency1 and quotedCurrencyPair/currency2.

    This doesn’t make sense because same-currency() has no parameters. And it is invalid syntax because the empty list is “()”, not “(,)”.

    The problem is quality control on the FX schema. The type of /FpML/trade/fxSingleLeg/exchangeRate/quotedCurrencyPair/currency1 is xs:normalizedString. This is wrong. Either this should be an IDREF within the document to a currency or it should be of type “Currency”.

    Currency is defined in fpml-shared as:



    The code representation of a currency or fund. By default it is a valid currency code as defined by the ISO standard 4217 – Codes for representation of currencies and funds http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html.







    Please fix the FX schema.

  • lyteck

    08/27/08 2:44 pm

    The [same-currency((,)) = True] were inserted as temporary placeholders.

    (fx-19,23,43 were implemented using same-currency() function.)

    The proposed schema fix cannot be implemented for 4.5WD1 (needs discussion too)

    I propose we revert back to the “SameCurrencyScheme” condition for the rules fx-4,5,6,27,31. Please advise.

  • matthewdr

    08/27/08 2:51 pm

    “true” is a function in XPath. So you should have brackets on it. This gives either one of:

    “[same-currency(()) = true()]”
    “[same-currency(())]”

  • matthewdr

    08/27/08 2:52 pm

    Please make the change in the 5.x branch. We can revert back in the 4.5 branch.

  • lyteck

    08/27/08 3:04 pm

    – reverted back to the “SameCurrencyScheme” condition for the rules fx-4,5,6,27,31
    – instead of stating “= true()”, removed incorrect “= True” altogether (for function results)

    – I suggest you open a new issue for the schema change and link to this one.

  • Leave an update

    You must be logged in to post an update.