FpML Issues Tracker

849: The term regular Period as a function

September 18, 2008

closed

Minor

Always

Validation Rules

Admin

danieldui

Summary

The term "regularPeriod" can be written out as a function as per the Validation Architecture.

The reason why the function is so much better is that the context of all the item is no longer ambiguous - it becomes explicit.

The XQuery equivalent is included for comparison only. The proposal does not advocate XQuery, it is included for information only. " declare function fun:regularPeriod($cpd as element(*, CalculationPeriodDates)) as element(period) (: The regular period of a set of calculation period dates is the period between a start date and an end date. If firstRegularPeriodStartDate exists, then the start date is firstRegularPeriodStartDate, else the start date is effectiveDate/unadjustedDate. If lastRegularPeriodEndDate exists, then the end date is lastRegularPeriodEndDate, else the end date is terminationDate/unadjustedDate. :) { validate strict { element period { element startDate { if (exists($cpd/firstRegularPeriodStartDate)) then data($cpd/firstRegularPeriodStartDate) else data($cpd/effectiveDate/unadjustedDate) }, element endDate { if (exists($cpd/lastRegularPeriodEndDate)) then data($cpd/lastRegularPeriodEndDate) else data($cpd/terminationDate/unadjustedDate) } } } }; "

Writing the function out as per the FpML Validation Specification gives: " Function Name = regularPeriod Description = The regular period of a set of calculation period dates is the period between a start date and an end date. If firstRegularPeriodStartDate exists, then the start date is firstRegularPeriodStartDate, else the start date is effectiveDate/unadjustedDate. If lastRegularPeriodEndDate exists, then the end date is lastRegularPeriodEndDate, else the end date is terminationDate/unadjustedDate. Parameter 1 = $cpd as element(*, CalculationPeriodDates) (min=1, max=1) Result Type = element(period) Test = startDate has the value of (if exists($cpd/firstRegularPeriodStartDate) then $cpd/firstRegularPeriodStartDate else $cpd/effectiveDate/unadjustedDate). endDate has the value of (if (exists($cpd/lastRegularPeriodEndDate)) then data($cpd/lastRegularPeriodEndDate) else data($cpd/terminationDate/unadjustedDate)) "

Notes:

  • lyteck

    10/07/08 1:56 pm

    ValWG 2008-10-07: agreed to implement as suggested. May be revisited to account for new element (TBD)

  • lyteck

    10/07/08 7:47 pm

    As agreed, the term regularPeriod was re-implemented as a function regular-period().

    The term regularPeriod was used within regular sentences in IRD validation page. How do we reword using the regular-period() function?

    Specifically, regularPeriod [replaced by regular-period()] is used 4 times in the definition of IRD term “unadjusted calculation period dates”:

    “This applies in the context of an InterestRateStream. For the purpose of validation, the unadjusted calculation period dates are determined as follows:
    cashflows element not present: the unadjusted calculation period dates are calculated by stepping through the regular-period() at the frequency specified in calculationPeriodDates/calculationPeriodFrequency. The first date is the start date of the regular-period() and the last date is the end date of the regular-period().

    cashflows element exists and cashflowsMatchParameters is true: the unadjusted calculation period dates are calculated from the regular-period() as in the previous case.”

    How do we reword using the regular-period() function? In particular, regular-period() is expecting one argument.

  • matthew

    10/07/08 9:09 pm

    If you add in regular-period() many times, it doesn’t matter how many times it is evaluated as the result is the same each time for the same context. What matters more is getting the context right.

  • lyteck

    10/09/08 6:33 pm

    I understand the comment, I think. However, I am still unclear what to feed the regular-period() function and how to modify the rules. Please advise.

    parameters for regular-period() can be any element in CalculationPeriodDates. e.g., effectiveDate, firstPeriodStartDate.

    The term “unadjusted calculation period dates”, where regular-period() is mentioned, is used in several rules. E.g., ird-3, ird-4, ird-50.

  • matthew

    10/09/08 7:36 pm

    Lyteck – I have every sympathy with you. If you and I don’t understand it then it is a good indication that others also won’t.

    I find the use of regular-period function inside the term “unadjusted calculation period dates” to be loosely defined. It is how you get from a CalculationPeriodFrequency complex type to a CalculationPeriodDates parameter that I can’t see. I could guess, but I wouldn’t be certain.

    I suggest the only way round this is to define a function for “unadjusted calculation period dates”. I believe Dan Dui took this as an action at the VWG in the Spring. I suggest we ask Dan, or if he hasn’t and can’t do it, then seek Harry’s help.

    By converting all the IRD terms to functions we can be certain what they mean.

  • h_mcallister

    10/09/08 11:21 pm

    Unfortunately this discussion is based on a misunderstanding of what the term “regular period” means.

    The function definition is based on the assumption that a single “regular period” spans the term of the interestRateStream, excepting stub periods where these exist – this is incorrect.

    An interestRateStream schedule comprises a series of one-to-many contiguous calculation periods, implied by the parameters contained in calculationPeriodDates (start- & end- dates, frequency, roll convention).

    A “regular” period is one which conforms to the schedule parameters implied by calculationPeriodDates – in particular, the unadjusted period start- and end- dates conform to the rollConvention, and the period length (calculated to the unadjusted dates) is equal to the calculationPeriodFrequency.

    All of the periods comprising an interestRateStream schedule are regular periods by definition, except where a start- or end- stub exists. In such cases the initial or final period may be irregular (“broken”) – that is, of shorter or longer duration than the interval defined by calculationPeriodFrequency. In all cases, the “interior” periods of the schedule are regular (i.e. all periods except for an irregular start- or end- period).

    The element firstRegularPeriodStartDate denotes the start of the schedule of regular period dates, and signals the existence of a start stub; likewise lastRegularPeriodEndDate denotes the end of the schedule of regular period dates, and signals the existence of an end stub.

    (Note, if the understanding implied by the current function definition were correct, the prefixes “first-” and “last-” would not be required; the terms “regularPeriodStartDate” and “regularPeriodEndDate” would be sufficient.)

    I hope this helps.

  • mgratacos

    10/21/08 1:31 pm

    Lyteck should look at Harry’s description and update function description accordingly.

  • matthewdr

    10/21/08 1:31 pm

    Agreed at the VWG for Lyteck’s to update the function definition based on Harry’s feedback.

  • mgratacos

    11/18/08 2:31 pm

    English description needs to be udpated. Take AJ’s paper on calculation periods.

  • matthewdr

    02/03/09 2:30 pm

    Agreed at the VWG that Andrew will provide a definition of the entire rule, including this term.

  • h_mcallister

    07/30/09 3:11 pm

    The English-language description of the term regularPeriod has not been corrected in the 4-6 Working Draft i.e. it still uses the old, incorrect description (see: http://www.fpml.org/spec/fpml-4-6-4-lcwd-1/html/validation-rules/rules-functions.html#regular-period).

    The function definition should not be permitted to stand in its current form, and must be updated in the 4-6 Recommendation.

    (And no, I still don’t believe that the term regularPeriod is expressible as a function per the Validation Architecture.)

  • danieldui

    07/30/13 2:22 pm

    Action for DD: Check issue, we can probably reference the data calculation paper and close the issue.

  • mgratacos

    10/21/19 11:10 am

    Added the link to the Dates Calculation paper in the Definitions section of the Validation rules.

  • mgratacos

    10/21/19 11:13 am

    The change will be published on version 5.11 Trial Recommendation.

  • Leave an update

    You must be logged in to post an update.