You are on page 1of 10

Debt Instruments - Definition and Evaluation of Cash Flows via Expressions

Sevdalina Trifonova, Nikolay Nikolov, Vladimir Nikolov Abstract: This paper presents a methodology based on the context-free grammar for describing financial products and their cash flows. The paper presents a method for general representation of financial contracts defined by arithmetic expressions. The method is based on grammar description of interest rates, capital cash flows, and specific contract conditions. The program system Risk Framework which implements this methodology is also presented in the paper. The parts of the system referred to by the paper are formula parser, computational tree generation and evaluating expressions. Keywords: Computer Systems and Technologies, Software reuse, Financial Instrument Representation, Context-free grammar INTRODUCTION Financial institutions are competing as to attract clients using for the purpose promotions and special conditions [3]. They offer different non-standardized amortization plans that match clients work-cycle and complicated definition of interest rates (e.g. interest rate as a function of more than one reference inter-banking indexes). Also institutions have to hedge against different risks (credit, market, equity-price) via complex derivative instruments or use optional rights in contracts to achieve maximal profit and to limit loss (e.g. cap option defines maximal interest rate, which is payable, floor minimal interest rate)[4]. Hard coded systems are not adequate for describing this variety of conditions and instrument types because the appearance of a new condition leads to changes in computation procedures and even in the GUI. Thus the focus is moved to finding a flexible way to describe the instruments and cash flows with a high degree of complexity. PRESENTING DIFFERENT INSTUMENTS BASING ON THE SIMPLE CASH FLOW INSTRUMENT The most popular debt financial instruments are bond (market instrument), credit and deposit (over the counter instruments, contracts for borrowing/lending money between financial institutions and their clients). But there are a lot of complex instruments and and derivatives on the market which consist of more than one leg. Figure 1 presents the structure of the model Cash Flow Instrument in Risk Framework [6]. Instrument definition is presented via a hierarchy of dialogs, group boxes and elements generated by script based user interface definition [5]. The instruments data is subdivided into 5 main groups: Instrument Definition - contains the instruments identification information and result of the latest valuation Amortization Schedule used for definition of the debt and amortization cash flows Interest Rate Schedule used for definition of the interest rates and shows interest rate cash flows and related information Cash Flow Schedule - shows the common cash flow - amortization and interest rate payments Instrument Details - contains conventions (date roll, financial center etc.) for payment and fixing, interest rate and valuation attributes (discount curve, spread, activated scenario) Administration of the session

Figure 1 Definition of a simple cash flow instrument - Interest Rate Schedule Most of the financial instruments can be described by using basic constructs. There are three standardized methods of amortization Annuity (the sum of interest and amortization payments is constant for each period), Bullet (amortization at maturity) and Regular (equal amortization payments in all periods). The interest rate type can be fixed or floating. Fixed interest rate means that a constant interest rate is applied from the issue date to the maturity of the contract. Floating interest rate is fixed on a particular interbanking rate (e.g. LIBOR, FIBOR, SOFIBID, and SOFIBOR). Amortization and interest rate payment dates are determined according to standard frequency conventions (Monthly, Quart, Annual etc.) On the other hand, there are a lot of financial instruments with a high degree of complexity. The complexity is expressed in non-standard methods for definition of cash flows and/or instruments which are composed of more than one leg. The complex instruments with more than one leg are presented with multiple simple cash flow instruments assigned to a single position (see Figure 2). Positions are enclosed in a bank portfolio, which is subject to analysis [2]. The most popular type of contract consisting of more than one leg is the swap and especially the plain Vanilla interest rate swap. It represents the exchange of a fixed rate loan with a floating rate loan. This type of swap basically results in transforming the fixed interest rate of a loan into a floating interest rate (or vice versa). The swap is a derivative instrument and plain Vanilla swap is used to hedge against interest rate risk.

Figure 2 Relationships between portfolios, positions and cash flow instruments For example, party B makes periodic interest payments to party A based on a variable interest rate of LIBOR + 20 basis points. Party A in return makes periodic interest payments based on a fixed rate of 3.65%. The payments are calculated over the common notional amount [3]. The first rate is called variable, because it is reset at the beginning of each interest calculation period according a reference rate (such as LIBOR) on a particular date. The interest rate swap is presented as two cash flow instruments one for the payments of party A, and one for the payments of party B. The cash flow of the swap is estimated as the difference between cash flows of the simple instruments. The non-standard methods for definition of cash flows are covered via the formula editor. The definition of a formula for cashflow consists of two tables a parameter table and a table for the formula itself. The first table is used for parametrizing variables or embedded formulae to be used in the expression. The second table contains the formula itself, which can be defined in multiple rows. The general outlook of the formula description tables is uniform for both interest and amortization cashflow streams. The syntax of the formulae closely resembles that of the basic arithmetic expressions in Excel (although poorer in comparison), which makes it also easy to comprehend and utilize. GRAMMAR RULES FOR FORMULA DEFINITION OF AMORTIZATION AND INTEREST PAYMENTS Risk Framework implements formulas for the description of cashflow instruments. This principle enables the universal creation of a huge variety of instruments and in the same time presents a suitable environment for the definition of financial contracts with a high degree of complexity. The formula syntax is based on a context-free grammar described below : Expression => Term ( '+' | '-' ) Term* | Term starting symbol Term => Factor ('*' | '/' ) Factor* | Factor Factor => '(' Expression ')' | NumberConst | Condition | Parameter => TimeFactor | DebtFactor | IrpayFactor => | Fixing | Mean | Exp | Log | FX | => DF | Power | PerExpr | Min | Max | Avg | => ExternalParameter An expression built by following these rules can be considered as an arithmetic expression with proper priority of the basic arithmetic operations (addition, subtraction, multiplication and division). Table 1. Factors in the context-free grammar

Factor type NumberConst (Expression) Condition Parameter TimeFactor DebtFactor IrpayFactor Fixing Mean FX DF PerExpr Exp, Log, Min, Max, Avg, Power External Parameter

Description Decimal number (e.g. 9, 130, 12.32) An expression can be built as an aggregate of several expressions in brackets. Conditional operator (if), the structure of which is described in below The number of amortization or yield payments, which represent the number of dates of payments (for the amortization) or the number of periods (for the yield payments). The time in years between two dates. The average debt in a period, given by two dates. The sum of the interest payments for a period, given by two dates. The interest rate calculated for a date or period according to a particular curve. The mean of yield rates for a given period, frequency and fixing period according to a curve. FX rate between two currencies. Discount factor for a date, according to a particular curve. An expression, describing a period in days, months or years Standard math functions for exponential, natural logarithm. etc Described in the Parameters section of the document.

One of the main functions in finance is fixing of interest rates on market curve or interbanking index. There are three implemented prototypes of the Fixing function: Fixing => 'rate' '(' From ';' To ')' - fixing interest rate on instrument curve for the period From-To. Fixing => 'rate' '(' From ';' To ',' Curve ')' - fixing on explicitly defined yield curve Fixing => 'rate' '(' From ';' IB_Rate ')' fixing from IBRate at From Date There are three prototypes of the Mean function: Mean => 'mean' '(' From ';' To ';' Freq ';' FixPer ')' Mean => 'mean' '(' From ';' To ';' Freq ';' FixPer ';' Curve ')' Mean => 'mean' '(' From ';' To ';' Freq ';' IB_Rate ')' The parameter Freq describes the frequency, which is used to divide the period defined by the From and To parameters into periods, for which yields are returned. The FixPer parameter is used to describe the fixing period for the yield calculation. The definition of the curve or IB rate is analogous to the description of the Fixing function. The DF function returns the discount factor for the date, described with the DateExpr parameter according to the curve from the Curve parameter and has the following syntax: DF => 'df(' DateExpr ';' Curve ') 1 1 DFa ( t 0 , t ) = = CFa ( t 0 , t ) 1 + Y ( t 0 , t )t ( t 0 , t ) (1) Currency exchange rates can be accessed with the FX function, where first parameter Currency is domestic currency and the second one is foreign: FX Currency => => 'fx('Currency ';' Currency ')' 'usd' | 'eur' | gbp | ....

The TimeFactor, DebtFactor and IrpayFactor functions are described in the following way: TimeFactor => 'time' '(' From ';' To')' returns the length in years of the period From-To dates DebtFactor => 'debt' '(' From ';' To')' returns the remaining average debt for the period IrpayFactor => 'irpay' '(' From ';' To')' returns the interest payment for the period Description of the common parameters used in the abovementioned functions: From, To => DateExpr DateExpr => Date | Date ( '+' | '-' ) PerExpr Freq, FixPer => PerExpr PerExpr => Period '*' NumberConst | Period Period => ( 'Y' | 'y' | 'M' | 'm' ( 'D' | 'd') The Date expressions can be => DateConst | 'ValuationDate' | 'Today' => 'BeginDate' | 'MaturityDate' | => 'SetDate' | 'PayDate' | 'StartDate' | 'EndDate' => 'AmoDate' | 'AmoDate['Index']' | => 'AmoPayDate' | 'AmoPayDate['Index']' | => 'SetDate['Index']' | 'PayDate['Index']' | => 'StartDate['Index']' | 'EndDate['Index']' | => ExternalDateParameter The various date formats that can be used in an interest rate or amortization formula. A DateConst is an explicitly defined date with a format DD.MM.YYYY. The following table gives a brief explanation for the other date types. Date Date type ValuationDate Today BeginDate MaturityDate SetDate SetDate['Index'] PayDate PayDate['Index'] StartDate StartDate['Index'] EndDate EndDate['Index'] AmoDate AmoDate['Index'] AmoPayDate AmoPayDate['Index'] ExternalDateParameter Table 2 Date types in the context-free grammar Description The evaluation date of the instrument. The actual date. The start date of the instrument. The maturity date of the instrument. The settlement date of the current period. The settlement date of a period, described with an Index expression The payment date of the current period. The payment date of a period, described with an Index expression The start date of the current period. The start date of a period, described with an Index expression The end date of the current period. The end date of a period, described with an Index expression The amortization date of the current period. The amortization date of a period, described with an Index expression The amortization payment date of the current period. The amortization payment date of a period, described with an Index expression A date, defined in the parameters table for the amortization or interest rate formulae.

The indexed parameters and expressions are used to get a value for a particular period, for example the starting date of the second period (StartDate[2]). In most cases expressions and parameters are needed in relativity to the current period of calculation (the n-th period of the current schedule) or in relativity to the last period (described with the parameters 'NumAmos' and 'NumRates' for the Amortization schedule and Interest payments schedule respectively). The indices are described as follows: Index => Ikey('+'|'-') NumberConst | Ikey | NumberConst Ikey => 'n' | 'NumAmos' | 'NumRates' Parameter => 'NumAmos' | 'NumRates' The conditional function is described in the following way: Condition => 'if(' Question ';' Expression ';' Expression ')' In the above formula the first expression defines the value if the Question returns a value true, and the second the value for false. There are two ways to use the conditional operator to compare dates, or to compare numbers. Question => DateExpr LocicalOperator DateExpr Question => Expression LocicalOperator Expression LogicalOperator => '>' | '>=' | '<' | '<=' | '=' | '<>' ExternalParameters=> external parameters from Interest Rate and Amortisation Parameter tables, the exact control name from the definition of the instrument (e.g. FaceValue name is case sensitive) or reference to a Framework formula (e.g. TimeFraction[n]) Risk Framework gives an ability to use external parametrizing variables. The variables can be of different types according to their usage. Besides the keywords in the formula itself, additional parameters are used for the description of the yield. These parameters are defined in the Amortization Parameter and Interest Rate Parameter tables. There are four types of parameters: Value, [%], Text and Date. The Value type describes a number constant parameter (the value of the parameter is directly substituted in the formula). The [%] type is substituted after being divided by 100. The Text type is used to describe text elements of the formulae (e.g. IB rate curve names or Yield Curves) or embed other formulae within the one defined with the parameter. The Date type is used to define date parameters.

Figure 3 Interest Rate Parameters and Expression The expressions for amortization and interest payments are defined in the Amortization Expression and Interest Rate Expression tables respectively. The formula is formed by concatenation of all the rows of the formula table. LOGICAL IMPLEMENTATION INTO THE CASH FLOW CALCULATION SYSTEM

Each formula builds a computational tree based on its syntax (using a specially designed parser) which is then used for the calculation of a value (i.e. yield rate, amortization percentage, period amount, etc.). The resulting computational tree is then cloned and used to calculate the particular value for each of the periods of the specified schedule. Each tree is built up by using certain nodes. Generally speaking there are three types of nodes in the tree generation: Arithmetic operator nodes (+,-, *, /) - they return the result of the arithmetic operation Nodes representing functions on numbers and expressions (Logarithm, Exponent, Power, Min, Max, Average) they return the result of the calculation of the respective function Comparator nodes (<, >, +, <=, >=, =, <>) return 0 (false) or 1 (true) depending on whether the compared values meet the condition The conditional function uses the comparator nodes return value to build up a particular tree construct as shown in the example below.

Figure 4 Example of a binary tree built using a formula The diagram shows the resulting tree from an interest rate formula defined by the expression from Figure 3 using the conditional operator. The complete formula, sent to the parser, is built up by substituting the text parameters used in it with their values, defined in the Interest Rate Parameter table. The right sub-tree on the diagram calculates the result if the condition is met for the current period, and the left if the condition is not met. The differentiation between the two values (the Floater and Cap parameters) is done by using the return value of the < node. When the condition is met (value 1 on the < nodes on both sub-trees) the left factor in the left sub-tree multiplication node becomes zero (1-

1=0) and so the whole left multiplication node also returns zero. The left factor on the multiplication node in the right sub-tree on the other hand has a value 1, and so the value of the right factor is returned by the node. That way, when the two values are added, one of them is always zero (the one that corresponds to the condition which is not met), and the other returns the value of the node, corresponding to the value of the condition (in this case the Value if true). Amortization expression presents only column Amortization in % from the amortization grid (see Figure 4). The other columns of the grids are defined by internal formulae transformed to rules of the grammar: Remaining amount formula: if(n=1;0;NominalRemainingAmount[n-1]AmoPayment[n-1]) Amortization Payment formula: (FaceValue/100) * AmoPayment[n] Distance in Years formula: time(ValuationDate;AmoPayDate[n]) Discount factor formula: if(ValuationDate>AmoPayDate[n];1;df(AmoPayDate[n];Curve)), where the Curve parameter is the valuation curve name Present Value formula: AmortizationPayment[n]*AmoDiscountFactor[n]

Figure 5 Amortization Schedule Grid And Interest Rate expression presents only column Rate in % from the amortization grid (see Figure 4). The other columns of the grids are defined by internal formulae transformed to rules of the grammar.

Figure 6 Interest Rate Schedule Grid

Rate Payment formula: fx(ValuationCurrency;InstrumentCurrency)*AverageAmount[n]*InterestRate[n]/ 100*TimeFraction[n] , where Foreign exchange (FX) is between the valuation currency and the currency set in the instrument. The AverageAmount keyword is an internal formula and the TimeFraction formula describes the Distance in Years column Period Length formula: time(StartDate[n];EndDate[n]) Present Value formula: RatePayment[n]*RateDiscountFactor[n] - RateDiscountFactor is the name of the formula of the Discount Factor column

Figure 7 Time structure and cash flow streams of a contract Each of the schedules of the contract (the Amortization and Interest Rate schedules) has an autonomous period structure (the interest rate schedule has a semi-annual frequency, and the amortization a free defined date structure as shown in figures 3 and 5). They are, however, interconnected in a sense that the interest rate payment is dependent on the average remaining debt for its time span. Also, interest rate formulae can access parameters from the amortization schedule and vice versa. CONCLUSION This article has proposed methods for presenting complex financial instruments via grammar rules, implementing evaluation of expressions generated using computational trees. Such an approach has a range of advantages including: Provides a methodology for the description of financial contracts based on relatively simple language syntax rules;

Provides the opportunity to calculate a wide variety of instrument types with complex specifics, which covers a large portion of the requirements in the field, implementing the reusable code principle; Hard-coded equivalent time performance, preserving the advantages of the script-based approach; The methodology, presented in this article and its implementation has been tried out by financial institution in Bulgaria and Bosnia and Herzegovina and is in a stage of testing. The future development of the method is in the field of increasing the range of presentable contracts in accordance to the needs of the consumers on the basis of broadening the grammar of the described implementation. The approach is also set to be used in financial analyses of contract portfolios. REFERENCES: [1] Brealey R., Myers, S. and Marcus, A. (2001): Fundamentals of Corporate . Finance (3rd edition) , McGraw-Hill/Irwin, 2001 [2] Fabozzi Frank J., Peterson Pamela P., Financial Management and Analysis, Second Edition, John Wiley & Sons, Inc., 2003. [3] Fabozzi Frank J., Fixed income Mathematics,1993, Probus Publisching Company, USA [4] Hull John, Options, Futures and other derivatives securities, 1989, Prentice Hall, INC [5] Paskalev Pl., Nikolov Vl., Multi-platform, script-based user interface, CompSysTech, 2004, pp IIIB.14-1, IIIB.14-6. [6] Asset Liability Management in Risk Frameworkhttp://www.eurorisksystems.com/download/Presentation_ALM_EuroRisk_EN.zip. AUTHORS: Sevdalina Trifonova, PhD student, Technical University - Varna, +359 52 644899, sevdraganova@eurorisksystems.com Nikolay Vladimirov Nikolov, student, Technical University - Varna, +359 52 309288, nik0lay@abv.bg Vladimir Nikolov Nikolov, Prof. PhD, Technical University - Varna, +359 52 644899, nikolov@eurorisksystems.com

You might also like