14
Types in APL – The SimCorp Way Dyalog User Conference 2007 Lars Stampe Villadsen, SimCorp A/S (Denmark)

Types in APL – The SimCorp Way Dyalog User Conference 2007 Lars Stampe Villadsen, SimCorp A/S (Denmark)

Embed Size (px)

Citation preview

Types in APL – The SimCorp Way

Dyalog User Conference 2007

Lars Stampe Villadsen, SimCorp A/S (Denmark)

2

Agenda

• Company presentation (short )• It is all about structure• Defined types in SimCorp Dimension

3

Business Idea

SimCorp offers integrated software solutions to financial service providers supporting their activities worldwide on the financial markets. Our solutions are firmly based on our high quality standards and our insight into financial theory, methods and practices.

4

10 Years Revenue Development

0

20

40

60

80

100

120

140

160

1996 1998 2000 2002 2004 2006

EURm

2007 SimCorp sells IT2

2003 SimCorp Dimension

2000 TMS2000 full STP product

1999 IT2 acquired to substitute TRACTS

1998 TMS2000 most important product

1997 Sale of Actuarial department

Official launch of TMS2000

1996 First TMS2000 implementations

1995 TMS2000 development intensified

Getting Focused

1991 Risk management modules

1990 Financial analytics and library

1985 Building society systems

Money market systems

Pricing models for derivatives

Treasury systems

Sim

Co

rp D

imen

sio

n e

raC

ust

om

ised

so

ftw

are

SimCorp History

5

It is all about structure

Big house – strict rules Naming conventions:^[a-z_][a-z0-9_]+$ Local variable: dates^[a-z][a-zA-Z0-9_]+[A-Z] [a-zA-Z0-9_]+[a-z]$ Function: dcAndBasicParts^_[a-z0-9] [a-z0-9_]+$ Local d-func: _swap^[a-z][a-zA-Z0-9_]+[A-Z] [a-zA-Z0-9_]+[A-Z]$ Global variable: intTAB^[A-Z][A-Z0-9_]+$ Utility function: FSI

Reserved prefixes:^t[A_Z0_9_]+$ Constant for a table: tIBI^p[A_Z0_9_]+$ Constant for a ’pointer’: pSECSHORT^d[A_Z0_9_]+$ Constant for an enumeration: dIT_BOND…

6

It is all about structure – cont.

Lets make a simple function:

datessince„ex1Main date© Calculate dayes between today and specified date. toDay„10000 100 100ƒ3†ŒTS datessince„toDay-date

ex1Main 200710011 CHK 'ex1Main' © ... Comply with standards ?ERROR: Missing header: ex1MainERROR: Missing header (©0©): ex1MainERROR: Parameters/result not specified in ex1Main: date datessince WARNING: References to unknown functions in ex1Main: toDay

7

It is all about structure – cont.

datessince„ex1Main date©0©©3© date :©4© datessince :© Calculate dayes between today and specified date. toDay„10000 100 100ƒ3†ŒTS datessince„toDay-date

Comment conventions:©0© General description of function ©2© Description of left argument©3© Description of right argument©4© Description of result

8

It is all about structure – cont.

Clean up:

datessince„ex1Main date;today©0© Calculate days between today and specified date.©3© date : Reference date©4© datessince : Days between reference date and today today„10000 100 100ƒ3†ŒTS datessince„today-date

CHK 'ex1Main' © ... Comply with standards ?

Yes!

9

It is all about structure – cont.

But it is so hard to program in Power Point so we go the dangerous way – live action!

10

Defined types in SimCorp Dimension

vtBOOL Boolean. Valid values are bFALSE and bTRUE (wrapping 0 and 1).

vtCHAR Character

vtDATE APL internal date (integer of the form yyyymmdd).

vtDOMAIN(dDOMAIN) Domain. Valid values are members of domain dDOMAIN.

vtDOUBLE Floating point number.

vtENUM(APL expr.) Enumeration. Valid values are the result of the enclosed APL expression.

vtINT Integer.

vtNULL Null. Valid values are numeric null and text null.

vtSTRING String of characters. Note that also a single character will be accepted as a string.

vtTIME APL Time of day fraction. Floating point number between 0 and 1.

vtTS Full APL time stamp. Floating point number.

vtUINT Unsigned integer.

vtVARIANT The joker type. Variables not type declared are considered variants.

vtZERO Zero. Valid values are – surprise – 0.

11

Defined types in SimCorp Dimension – cont.

The named variables types can be used in the function comment headers to specify argument and result types. They can be grouped together to form more complex variables, e.g,

{vtUINT {vtSTRING vtTS}}

A 2-vector consisting of an unsigned integer and a 2-vector consisting of a string and a timestamp.

{vtDOUBLE vtDATE vtDOMAIN(dPRICETYPE)}

A 3-vector consisting of a float, a date and a domain value in the domain dPRICETYPE.

12

Defined types in SimCorp Dimension – cont.

Arrays of different dimensions of a variable type can be specified using “[“, “]” and “;”, e.g,

vtBOOL[] A vector of Booleans.

vtINT[;] A 2-dimensional array of integers.

vtSTRING[2-] A vector of length two or more containing strings.

13

Defined types in SimCorp Dimension – cont.

Sometimes several types are allowed for a variable. Use “|” to separate different choices, e.g,

vtDATE|vtZERO A scalar date or zero.

vtDOUBLE|vtNULL A float or null.

Any combination of the above is allowed, e.g,

{vtDOUBLE|vtSTRING|vtNULL}[;5-10] A matrix with between 5 and 10 columns containing a mix of floats, strings and nulls.

14

Defined types in SimCorp Dimension – cont.

It is possible to specify the shape of a variable relative to another variable in the argument and result.

The main limitation is that the shape of a variable can only be specified relative to an already declared variable, e.g,

fooGoo arg;flds;mat;opt©0© A function.©3© arg[1] : mat As vtDOUBLE[;] : Matrix of floats©3© [2] : flds As vtUINT[$3:mat:2] : Field list corresponding to <mat>©3© [3] : opt As vtBOOL : Option©5© FST: VarTypes mat flds opt„arg