180 likes | 425 Views
A Domain-Specific Language for Financial Products. Arie van Deursen May 2001. Financial Products. Financial needs of large customers Start date, short / long maturity, currency Manage risks (opportunities) currency / interest rates Interest rate products: Loan, bond, option, future, swap
E N D
A Domain-Specific Languagefor Financial Products Arie van Deursen May 2001
Financial Products • Financial needs of large customers • Start date, short / long maturity, currency • Manage risks (opportunities) • currency / interest rates • Interest rate products: • Loan, bond, option, future, swap • Different rate expectations / risk reallocation • Interbank trade.
Principle Amount Flow start maturity Interest Amount Flow start maturity Interest Payment period Deposit Cash Flows
Currency Interest Rate Swap • Start date: Bank A and Bank B exchange a large principle amount. • Bank A: Currency A, fixed interest rate P. • Bank B: Currency B, floating market rate. • Interest payment intervals • Maturity: swap back principle amounts. • Valuation depends on market expectations
Staying Competitive • Banks introduce new interest rate products • Software implications: • Management information systems (risk!) • Financial administration • All sorts or reporting • Bank’s solution: • Software generation
Risla • Rente Informatie Systeem -- Language • Describe essence of interest rate products in domain-specific language • Appropriate level of abstraction • Generate necessary Cobol routines • Interface to bank’s existing systems • Started in 1990 • CAP, MeesPierson, ING, CWI.
The Risla Language • Product characterized by cash flows • Object-oriented influences: • Product description ~ class • Contract ~ object • Product provides methods for access, query, registraction • Various built-in data types + operations • Based on existing Cobol library
Example Risla Data Types • cash flow: <amount, date> • Interval: <start-date, end-date> • cf-list: [<a1,d1>, … <aN,dN>] • rate-interval:<Rate, interval> • int-rate-set: [ri1, …, riN] • balance: [<a1, intv1>, …, <aN, intvN>] • given int-rate-set, balance, and date convention, compute interest amount cash flow list. Unpleasant to express in Cobol
Risla Loan: Interface product LOAN declaration contract data PAMOUNT : amount %% Principal Amount STARTDATE : date %% Starting date MATURDATE : date %% Maturity data INTRATE : int-rate %% Interest rate RDMLIST := [] : cashflow-list %% List of redemptions. information PAF : cashflow-list %% Principal Amount Flow IAF : cashflow-list %% Interest Amount Flow registration %% Register one redemption. RDM(AMOUNT : amount, DATE : date)
Risla Loan: Internals local %% Final Principal Amount FPA(CHFLLIST : cashflow-list) : amount %% Final redemption FRDM : cashflow error checks "Wrong term dates" in case of STARTDATE >= MATURDATE "Negative amount" in case of PAMOUNT < 0.0 implementation local define FPA as IBD(CHFLLIST, -/-PAMOUNT, MATURDATE) define FRDM as <-/-FPA(RDMLIST), MATURDATE>
Risla Loan: Semantics information define PAF as [<-/-PAMOUNT, STARTDATE>] >> RDMLIST >> [FRDM] define IAF as [< -/-CIA( BL(RDMLIST, <-/-PAMOUNT, <STARTDATE, MATURDATE>>), INTRATE ), MATURDATE >] registration define RDM as error checks "Date not in interval" in case of (DATUM < STARTDATE) or (DATUM >= MATURDATE) "Negative amount" in case of AMOUNT <= 0.0 "Amount too big" in case of FPA(RDMLIST >> [<AMOUNT, DATE>]) > 0.0 RDMLIST := RDMLIST >> [<AMOUNT, DATE>]
Risla’s Generated Cobol Risla Product Definition Legacy Data Structures (VSAM) Input Screens (CICS) Risla Compiler Registration Methods (Cobol Management Info. Routines (Cobol)
Modular Risla • Different products share larger chunks: • Swap consists of two Deposits • Various loans share “principal amount construction” • Combinations of product (parts) required • Modularization constructs • Library of “Building Blocks” • “Flattener”, mapping mod. Risla to pure Risla.
Modular Risla (II) • Modularization constructs: • Uses “one”, uses “many” • export, parameterization, renaming. • Example components: • Principle amount, duration, interest computations, • Flattening: • pro: simplicity; con: code size explosion
From Risla to Cobol Risla Building Blocks Risla Functions Cobol Library Modular Risla Flat Risla Flat Risla COBOL ASF + SDF C / lex yacc
Risla Evaluation • Successful adoption • Time to market: 3 months -> 3 weeks. • 100 building blocks, 50 products • Merger survivor thanks to flexibility • Problematic • Maintenance of Risla tools • Flattening code explosion
Benefits Correct level of abstraction. Self documenting Portability Optimizability Testability Risks Cost of DSL design and implementation Education cost Limited availability Finding proper scope Balance between general purpose / domspec Loss of efficiency Domain-Specific Languages
In Conclusion • Risla users satisfied • Open issues • How to decrease cost of tool development and maintenance • How to find suitable domains: domain engineering