TAPCore ScriptLanguage ReferenceGuide
TAPCore ScriptLanguage ReferenceGuide
TAPCore ScriptLanguage ReferenceGuide
Release 15.06
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 2
Document Revision History
Version Date Description
4.30.3 20080422 Disclaimer updated
4.40.0 SP4 20101210 PMSTA-10710: In section ENUM_LIST, updated the Remarks subsection to
change limit of ENUM_LIST.
4.40.0 SP5 20110418 PMSTA-11850: Corrected the list of arguments for MSG() in section MSG.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 3
Version Date Description
4.40.0 SP6 20111107 PSMTA-12956: In subsection Arguments of section SEL_EXTPOS, added
new parameter for keyword SEL_EXTPOS.
12 20120606 PMSTA-14071: Added new section Carriage return operator and updated
section PRINTF to explain the carriage return operator CR.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 4
Version Date Description
12 SP1 20121016 PMSTA-15055: In subsections Return type and Remarks of section
PERF_INTER_BENCH,
Added information about new attributes Initial Performance Effect and
Effect's market segment.
Replaced data_type “Numberic” with “number_t” and “Id” with “id_t”
13 20121120 PMSTA-15295: Added new section SWITCH, CASE to describe new
keywords SWITCH and CASE.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 5
Version Date Description
14.12 20141007 PMSTA-18085: In subsection Arguments of section SEL_EXTPOS, added
new optional parameters min_status and max_status for keyword
SEL_EXTPOS.
20141125 PMSTA-19069: Changed all references of “From Date”, “Till Date”, and
“Ref. Date” to new labelling "Initial Date”, “Final Date”, and “Reference
Date”.
20141203 PMSTA-19153: Added the following sections to describe the new script
functions:
GET_RISK_COMPLIANCE
GET_RISK_OBJECTIVE
GET_RISK_RULE
GET_RISK_VALUE
20141204 PMSTA-18081: In subsection Arguments of section CRYPT, added
SSHA256 (Salted SHA256) as a supported password encryption method.
20141205 PMSTA-18601: Added the following sections to describe the new script
functions:
GET_MASTER
GET_SLAVE
GET_SLAVE_ARRAY
20150129 PMSTA-19072: Changed the maximum script size to 65025 in section
Script expression size.
15.06 20150318 PMSTA-20178: Added new section Limitations for keyword AUTOCREATE.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 6
Contents
1 Introduction ..........................................................................15
1.1 Coloured scripts .......................................................................15
1.1.1 Six categories of script text ................................................................15
1.1.2 Graphical features of each category .....................................................16
1.1.3 Examples .........................................................................................16
4 Functions...............................................................................25
4.1 Overview.................................................................................25
4.2 Function categories...................................................................26
4.3 Alphabetical list of functions.......................................................30
4.3.1 AA_BS_OPT......................................................................................30
4.3.2 AA_CC_FUT......................................................................................32
4.3.3 AA_CRR_CONVBOND .........................................................................33
4.3.4 AA_CRR_OPT....................................................................................35
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 7
4.3.5 AA_DF_BOND ...................................................................................37
4.3.6 AA_DF_FLOW ...................................................................................39
4.3.7 AA_DF_FUT ......................................................................................39
4.3.8 AA_ZERO_RATE ................................................................................41
4.3.9 ABS ................................................................................................42
4.3.10 ACCPER_PARAM................................................................................43
4.3.11 ACCR_INTER ....................................................................................43
4.3.12 ACCT_STATUS ..................................................................................45
4.3.13 ADD_BUSINESSDAYS ........................................................................45
4.3.14 ADDRESS.........................................................................................46
4.3.15 AUTOCREATE ...................................................................................47
4.3.16 BAL_EXT_POS ..................................................................................47
4.3.17 BENCH_RETURN ...............................................................................52
4.3.18 BENCH_WEIGHT ...............................................................................55
4.3.19 CASE_LINKED_OBJECT ......................................................................56
4.3.20 CASE_MSG.......................................................................................57
4.3.21 CELL_FORMAT ..................................................................................58
4.3.22 CHAIN_PERIOD ................................................................................60
4.3.23 CHECK_SUM.....................................................................................60
4.3.24 CLASSIFY.........................................................................................62
4.3.25 CLASSIFY_ACC_PLAN ........................................................................63
4.3.26 COMPLIANCE_CHRONO......................................................................64
4.3.27 COMPLIANCE_CHRONO_ARRAY...........................................................66
4.3.28 CONCAT ..........................................................................................67
4.3.29 CONCAT_FMTHIER ............................................................................67
4.3.30 CONV, DURA, MDURA ........................................................................68
4.3.31 CONV_AMOUNT ................................................................................69
4.3.32 COUNT ............................................................................................70
4.3.33 CRYPT .............................................................................................71
4.3.34 CURR_CHRONO ................................................................................71
4.3.35 CURRENT_ACTION ............................................................................71
4.3.36 CURRENT_CASE................................................................................72
4.3.37 CURRENT_REC..................................................................................73
4.3.38 CURRENT_YIELD ...............................................................................73
4.3.39 DATE...............................................................................................74
4.3.40 DATEADD, DATEDIFF, DATEPOSI ........................................................74
4.3.41 DATEPART .......................................................................................75
4.3.42 DATEPOSI ........................................................................................76
4.3.43 DATESTR .........................................................................................76
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 8
4.3.44 DAYSINMONTH, DAYSINYEAR .............................................................77
4.3.45 DBDATETIME....................................................................................77
4.3.46 DEFAULT..........................................................................................78
4.3.47 DENOMINATION................................................................................79
4.3.48 DEPENDENCE ...................................................................................80
4.3.49 DIFF................................................................................................80
4.3.50 DIFF_BUSINESSDATE ........................................................................81
4.3.51 DISP_MSG .......................................................................................81
4.3.52 DOMAIN ..........................................................................................82
4.3.53 DURA ..............................................................................................85
4.3.54 ENUM_LIST ......................................................................................86
4.3.55 ESTVOL ...........................................................................................86
4.3.56 EVENT_SCHEDUL ..............................................................................87
4.3.57 EXCH_FORMAT .................................................................................88
4.3.58 EXCH_RATE .....................................................................................88
4.3.59 EXCH_RATE_ARRAY ..........................................................................90
4.3.60 EXCH_UNDERLY_CURRENCY...............................................................91
4.3.61 EXPORT_DATE ..................................................................................92
4.3.62 EXPORT_PARAM................................................................................92
4.3.63 FIRST_MKT_STRUCT_SUBSET ............................................................92
4.3.64 FMT_EXCH .......................................................................................93
4.3.65 FORMAT...........................................................................................94
4.3.66 FREQ_DATE .....................................................................................94
4.3.67 FUND_VALO .....................................................................................95
4.3.68 FUS_DATE_RULE ..............................................................................96
4.3.69 GEOSUM ..........................................................................................97
4.3.70 GET_ADMIN_RIGHTS.........................................................................97
4.3.71 GET_APPL_PARAM.............................................................................98
4.3.72 GET_BALANCE ..................................................................................98
4.3.73 GET_BALANCE_POS_TYPE ..................................................................99
4.3.74 GET_BEST_OBJECT .........................................................................100
4.3.75 GET_DEF_OPTION ...........................................................................102
4.3.76 GET_ENTITY ...................................................................................102
4.3.77 GET_EXT_OP ..................................................................................103
4.3.78 GET_EXTOP_NUM............................................................................103
4.3.79 GET_FIRST .....................................................................................104
4.3.80 GET_FIRST_OBJECT ........................................................................104
4.3.81 GET_FMTROOT ...............................................................................105
4.3.82 GET_FT_RATE .................................................................................106
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 9
4.3.83 GET_MASTER..................................................................................107
4.3.84 GET_OBJECT ..................................................................................108
4.3.85 GET_OBJECT_ARRAY .......................................................................108
4.3.86 GET_OP_NUM .................................................................................110
4.3.87 GET_RATE ......................................................................................110
4.3.88 GET_RIGHTS ..................................................................................111
4.3.89 GET_RISK_COMPLIANCE ..................................................................112
4.3.90 GET_RISK_OBJECTIVE .....................................................................112
4.3.91 GET_RISK_RULE .............................................................................113
4.3.92 GET_RISK_VALUE ...........................................................................114
4.3.93 GET_SLAVE ....................................................................................115
4.3.94 GET_SLAVE_ARRAY .........................................................................116
4.3.95 GET_STRATEGY ..............................................................................117
4.3.96 GET_TERM_EVENT ..........................................................................118
4.3.97 GET_TYPE ......................................................................................119
4.3.98 GUARANTEE ...................................................................................120
4.3.99 INIT ..............................................................................................121
4.3.100 INSTR_CHRONO..............................................................................121
4.3.101 INSTR_CHRONO_ARRAY...................................................................123
4.3.102 INSTR_FLOW ..................................................................................123
4.3.103 INSTR_PRICE .................................................................................126
4.3.104 INSTR_PRICE_ARRAY ......................................................................128
4.3.105 INTEREST_COND ............................................................................128
4.3.106 IS_BUSINESSDATE..........................................................................130
4.3.107 IS_FMTLEAF ...................................................................................130
4.3.108 IS_IN_LIST ....................................................................................131
4.3.109 LABEL............................................................................................132
4.3.110 LAST_BUSINESSDATE......................................................................133
4.3.111 LAST_PORT_SYNTH .........................................................................133
4.3.112 LEFT, RIGHT ...................................................................................134
4.3.113 LIST_CHRONO ................................................................................135
4.3.114 LIST_CHRONO_ARRAY .....................................................................136
4.3.115 LIST_HIST_DATE ............................................................................136
4.3.116 LOWER, UPPER ...............................................................................137
4.3.117 MAX, MIN.......................................................................................138
4.3.118 MDURA ..........................................................................................138
4.3.119 MEAN_CAP .....................................................................................139
4.3.120 MIN ...............................................................................................140
4.3.121 MSG ..............................................................................................140
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 10
4.3.122 NET_AMOUNT .................................................................................141
4.3.123 NEW_INDEX ...................................................................................142
4.3.124 NEXT_BUSINESSDATE .....................................................................143
4.3.125 NOTEPAD .......................................................................................144
4.3.126 NUMMASK ......................................................................................145
4.3.127 NUMSTR ........................................................................................146
4.3.128 OBJECT_MODIF_STAT......................................................................147
4.3.129 OLD...............................................................................................148
4.3.130 OPT_PRICE, OPT_SENS, OPT_IMPVOL ................................................149
4.3.131 PARAM...........................................................................................150
4.3.132 PERF_EFFECT_DEF ..........................................................................151
4.3.133 PERF_INTER_BENCH........................................................................151
4.3.134 PORT_CHRONO, CURR_CHRONO, THIRD_CHRONO ..............................152
4.3.135 PORT_CHRONO_ARRAY ....................................................................153
4.3.136 PORT_SYNTH..................................................................................154
4.3.137 POWER ..........................................................................................157
4.3.138 PRICE_TO_QUOTE, QUOTE_TO_PRICE ...............................................157
4.3.139 PRINTF ..........................................................................................158
4.3.140 PTF_DEF_ACCOUNT .........................................................................159
4.3.141 QUOTE_TO_PRICE ...........................................................................160
4.3.142 RATING_ATTRIB..............................................................................160
4.3.143 REF_FUND_VALO ............................................................................161
4.3.144 REGR.............................................................................................162
4.3.145 RETURN .........................................................................................163
4.3.146 RIGHT ...........................................................................................168
4.3.147 RISK_RATIO ...................................................................................168
4.3.148 RNDAMT ........................................................................................171
4.3.149 ROUND ..........................................................................................172
4.3.150 SEARCH_BEST_EXTPOS ...................................................................172
4.3.151 SEARCH_BEST_OPER .......................................................................173
4.3.152 SECTOR_ATTRIB .............................................................................174
4.3.153 SEL_EXTOP ....................................................................................175
4.3.154 SEL_EXTPOS ..................................................................................176
4.3.155 SEL_FMTCHILDREN .........................................................................177
4.3.156 SEL_FT_RATE .................................................................................178
4.3.157 SEL_OP..........................................................................................179
4.3.158 SEL_SYNTH ....................................................................................180
4.3.159 SIGN .............................................................................................180
4.3.160 SQRT.............................................................................................181
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 11
4.3.161 STANDARD_PERF_DATA ...................................................................181
4.3.162 STAT .............................................................................................182
4.3.163 STRDATE .......................................................................................184
4.3.164 STRLEN..........................................................................................185
4.3.165 STRNUM ........................................................................................185
4.3.166 SUBSTR .........................................................................................186
4.3.167 SUM, GEOSUM ................................................................................186
4.3.168 SWITCH, CASE................................................................................187
4.3.169 SYNONYM ......................................................................................188
4.3.170 SYS_CURRENCY ..............................................................................189
4.3.171 SYS_DEF_ACCOUNT ........................................................................190
4.3.172 SYSDATE, WORKDATE .....................................................................191
4.3.173 SYSTEM .........................................................................................191
4.3.174 TARGET_BOOK_VALUE.....................................................................192
4.3.175 THIRD_CHRONO, ............................................................................193
4.3.176 THIRD_CHRONO_ARRAY ..................................................................194
4.3.177 TOT_FIRST .....................................................................................194
4.3.178 TOT_GEOM.....................................................................................195
4.3.179 TOT_REGR .....................................................................................196
4.3.180 TOT_STAT ......................................................................................198
4.3.181 TOT_SUM, TOT_MAX, TOT_MIN, TOT_MEAN, TOT_GMEAN, TOT_WMEAN 200
4.3.182 TRIMSTR........................................................................................202
4.3.183 TSL_CURRENT_LANGUAGE ...............................................................202
4.3.184 UNITACCRINT .................................................................................203
4.3.185 UNREALISED_PL .............................................................................203
4.3.186 UPDATE_OBJECT_ARRAY ..................................................................204
4.3.187 UPPER ...........................................................................................205
4.3.188 USER .............................................................................................205
4.3.189 USER_INPUT () ...............................................................................207
4.3.190 VAL_RULE_COEF .............................................................................208
4.3.191 VAL_RULE_ELEM .............................................................................208
4.3.192 VAL_RULE_HIST..............................................................................210
4.3.193 WHERE_IN_GRID ............................................................................210
4.3.194 WORKDATE ....................................................................................211
4.3.195 YTM...............................................................................................211
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 12
5 Keywords ............................................................................215
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 13
13.3 Managing Administration Rights Scripts .....................................231
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 14
1 Introduction
The Triple’A Plus Core Script Language is a versatile tool that lets you define:
Format elements
Constrained lists: applies to financial instrument, portfolio, third party, manager,
economic sector, currency, strategies, extended position and geographical area lists.
Constrained lists can be based upon financial or chronological criteria.
Default values for entity attributes
Rules: special rules can be applied to specific cases (for instance, to define fees and
taxes rules in operation screens).
Input controls: data validity checks can be defined for the data entered by users. If
the user's data fails the check, Triple'A Plus Core can display a warning message or
prohibit the Save command.
Constraints: unstructured constraints can be defined in scripts.
Filters: you can refine the list of data that can be displayed in data entry fields that
show table contents. You can also limit the number of possible choices for fields that
display enumerated choices.
Native interface: scripts can be used to make data imports easier. Scripts are also
used for data exports to specify the conditions data must satisfy before it can be
exported.
In other words, you can use script language anytime you access the database or run a
special function on data.
The script language can perform a variety of actions on data sent from the database. You
can use scripts to satisfy all your management requirements.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 15
1.1.1.2 How to define the particularities
1.1.2.3 Font
The system variable AAAAdvantage.script.category.font defines the font used to display the
indicated category.
Example: AAAAdvantage.script.category.font=DataBold
1.1.2.4 Remarks
The system variable AAASCRIPT_DISPLAY must be set to TRUE to display scripts in
colour
The list of authorized colours can be obtained using the program color.exe
A colour cam be defined by its name or its RGB code
List of authorized fonts: DataBold, DataItalic, DataUnderline
If no graphical feature is defined for a category, the display is normal
1.1.3 Examples
1.1.3.1 Definitions
AAASCRIPT_DISPLAY=TRUE
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 16
AAASCRIPT_KEYWORD_MAIN=IF,AND,OR
AAASCRIPT_KEYWORD_EXCLUDED=NULL,DEPENDENCE
AAASCRIPT_SEPARATOR_EXCLUDED=,()+-=
AAAAdvantage.script.comment.foreground=seagreen4
AAAAdvantage.script.comment.background=yellowchiffon
AAAAdvantage.script.comment.font=DataBold
AAAAdvantage.script.numeric.foreground=cyan4
AAAAdvantage.script.quoted.foreground=cadetblue
AAAAdvantage.script.quoted.font=DataItalic
AAAAdvantage.script.keyword.foreground=pink
AAAAdvantage.script.main_keyword.foreground=red
AAAAdvantage.script.main_keyword.font=DataUnderline
AAAAdvantage.script.separator.foreground=orchid2
1.1.3.2 Example
1.2 Unicode
Triple'A Plus Core uses Unicode to allow you to display the GUI in more languages, especially
languages that use graphical script forms such as Hebrew. Full details are provided in the
Triple’A Plus Core System Management Guide.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 17
1.3 Testing scripts
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 18
2 Types, operators, and expressions
2.1.1 Numbers
Negative numbers are preceded by the minus sign (-).
The decimal separator is the dot (.) even if the comma (,) is defined as the decimal
separator in the configuration files.
Examples:
-12
123.45
2.1.2 Dates
Dates are always represented using the following formats:
DD separator MM separator YY
Notes:
The separator can be either the slash (/), the dot (.) or the minus sign (-)
The year can be expressed in 2 or 4 digits. If the year is expressed in two digits, 50 to
99 means 1950 to 1999 and 00 to 49 means 2000 to 2049.
Note that input fields in Triple'A Plus Core only accept the format DD/MM/YYYY.
Examples:
31/12/1994
31.12.1994
31/12/94
31-12-94
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 19
2.2 Carriage return operator
Some script functions, like PRINTF, allow the manipulation of strings. Using the carriage
return operator CR, it is possible to separate two strings by a carriage return.
Example:
PRINTF("This is a test%sfor carriage return", CR) will display:
This is a test
for carriage return.
Operator Meaning
= or == equals
!= or <> is different
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 20
Operator Meaning
LIKE equality operator for strings
Notes:
The LIKE operator is used for strings. The allowed patterns are:
Pattern Description
* any string including the null string
Example:
NOT( instr_id.risk_curr_id.code LIKE U* )
The IN operator can have up to 64 arguments and returns 1 (true) if the value is in
the list or 0 (false) if the value is not in the list.
Example: instr_id.risk_curr_id.code IN(USD,DEM,GBP)
The LIKE and IN operators are not commutative.
The NULL value can only be used with the = ( == ) or != ( <> ) operators. Any
attempt to use another operator returns the value 0 (false).
The empty string "" does not exist in the database. The NULL value has to be used if a
comparison has to be done with an empty string.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 21
There is no specific rule for the spacing between keywords, operators and values but it is
recommended not to insert a blank between the name of a function and its opening
parenthesis or between a logical field and its opening bracket.
2.8 Comments
Comments can be included in script expressions provided that they are surrounded by the
characters { }. The following expressions are correct:
Expression Description
pos_val_id.ref_mkt_val_m Displays the market value of the position.
IF (quantity_n < 0 "quantity must be positive") quantity_n < 0 = the quantity is negative.
When a script expression is specified in a default value, input control, or filter, you can put
the character string {NOTUSED} in front of it to disable it. Scripts that are commented out
without {NOTUSED} are evaluated to NULL.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 22
3 Accessing tables
The starting point to accessing data in the database tables depends on the context in which
the script language is used.
For format element definitions, the starting point is the table specified in the format's
Entity field.
For list definitions, the starting table is implicit (portfolios, instruments, etc.) as you
have implicitly specified the entity from which you want to build the list (from the
context).
For input controls, default values and filters, you must specify the required entity.
To access the different fields, use the SQL name of the attributes.
The starting table defines the kind of access that must be used by the user in the script
definition. In fact, if data is retrieved from the defined starting table, direct access is used.
Otherwise, indirect access is used.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 23
notepads
denominations
synonyms
sector attributions
guarantees
income events
exchange events
issue/redemption events
term events
prices
chronological data
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 24
4 Functions
4.1 Overview
Functions are used to process data. The following rules apply to the use of functions:
Use uppercase characters for function names.
Functions are followed by parentheses ( ) or square brackets [ ].
Function arguments are separated by commas (,).
Arguments can be character strings, numbers, dates, keywords or the NULL value.
If a function requires an argument of one type and you use a different type, the value
NULL is returned.
Some functions take one or more optional arguments. If you do not want to include
optional arguments, you can simply put a comma to indicate empty arguments. Note
that you can omit empty optional arguments altogether if they come last in the
function’s argument list. You cannot do this when they are followed by other
arguments (i.e. they are not last in the argument list). Triple'A Plus Core identifies the
arguments passed to a function by counting the commas separating them. If you omit
intermediary empty arguments, the other arguments are miscounted.
Examples:
FUNCTION( arg1 , arg2 , , arg4)
FUNCTION( arg1 , arg2 , , ) and FUNCTION( arg1 , arg2 ) are equivalent (final
empty optional arguments can be omitted)
The values returned by functions are numbers, strings, dates or defined structures. If
the returned value is a structure, you can provide access to a specific field of the
structure by adding a dot (.) followed by the SQL name of the attribute.
Example:
DOMAIN( ).min_status_e returns the minimum status specified in the domain.
Note:
If none of the attribute names of the structure is specified, the value of one of
the attributes (the default attribute) is returned. See the description of the
different functions for details of the default attribute.
Some functions can be used directly or as a part of an expression. In the first case,
the function arguments must be surrounded by parentheses and in the second by
square brackets. If a function is used as part of an expression it takes fewer
arguments than when used directly. This is because the value of some arguments is
provided by the preceding part of the expression.
Examples:
CLASSIFY("instrument", instr_id,"WORLD-CLASSID").list_id.code
Instr_id.CLASSIFY["WORLD-CLASSIF"].list_id.code
Note that the second expression is faster than the first. Secondly, it is only when _id
ends a script expression that you must absolutely include it as in this case (e.g. instr.).
Otherwise, you can write, for example, instr_id.denom or instr.denom. However, it is
better to include the _id for performance reasons, even if it is not at the end of the
argument.
When a function parameter accepts either id or code, providing the id will improve the
performance.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 25
Example:
Use ADDRESS(portfolio_id.third_id,"resid").phone_c instead of
ADDRESS(portfolio_id.third_id.code,"resid").phone_c
Functions can be passed as arguments to other functions.
Example:
DATEADD(DATEPOSI(DOMAIN().calc_from_d,BEGIN_OF,YEAR),DAY,-1)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 26
Function category Function
Date functions DATE
DATEADD
DATEDIFF
DATEPART
DATEPOSI
DAYSINMONTH
DAYSINYEAR
FREQ_DATE
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 27
Function category Function
Fund management functions ACCPER_PARAM
CLASSIFY_ACC_PLAN
FUND_VALO
REF_FUND_VALO
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 28
Function category Function
Mathematical functions ABS
MAX
MIN
POWER
ROUND
SIGN
SQRT
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 29
Function category Function
String functions CONCAT
COUNT
LEFT
LOWER
PRINTF
RIGHT
STRLEN
SUBSTR
TRIMSTR
UPPER
Note that with all TOT* keywords you can now embed several TOT* expressions in a TOT*
statement. However, this does not work with the Debt instrument nature.
4.3.1 AA_BS_OPT
4.3.1.1 Description
Returns the theoretical price, the dollar duration, the dollar convexity and the value of one
basis point for the specified instrument, computed using the Black and Scholes (BS) model.
4.3.1.2 Synopsis
AA_BS_OPT([instr], [date], [spread], [shock], [calendar], [margin], [domestic], [black],
[volatility], [yield_curve])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 30
4.3.1.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only when the
function is used in an extended position context. It is an id or a code.
date Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a decimal
number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency is used.
margin Optional flag for margining forcing the default flagging (TRUE for futures, FALSE for
forwards).
domestic Optional flag for domestic or foreign risk numbers, forcing the default (TRUE i.e.
domestic).
black Optional flag indicating if the spread is lognormally (so that the Black and Scholes
formula can be used) or normally distributed. The default is TRUE (used for spread
options only).
volatility Optional volatility figure, very often a decimal number. When not specified, defaults to 0.
yield_curve Optional parameter which contains a yield curve that discounts the future cash flows. It
supersedes the one stored in the instrument [instr_id]. It can be a unique identifier (id)
or the code of an existing yield curve.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 31
4.3.1.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
European Options
Exotic Options (only European)
4.3.1.6 Examples
On the Extended Position entity:
AA_BS_OPT(,,,,,,,,,INSTR_CHRONO(GET_TERM_EVENT().underly_instr_id,
DOMAIN().calc_from_d, "Volatility", , 0).value_n).delta
Returns the delta of the instrument on the begin date of the domain, based on the volatility
stored in the chrono data of the underlying instrument.
AA_BS_OPT(,,,,,,,,,INSTR_CHRONO(GET_TERM_EVENT().underly_instr_id,
DOMAIN().calc_from_d, "Volatility", , 0).value_n, instr_id.ud_stress_yield_
_instr_id).delta
Returns the delta of the instrument on the begin date of the domain, based on the volatility
stored in the chronological data of the underlying instrument and the stress yield curve
stored in the instrument (user-defined field).
On the Instrument entity:
AA_BS_OPT(id,,,,,,,,,INSTR_CHRONO(GET_DEF_OPTION(nature_e, ref_curr_id,
underly_instr_id.ref_curr_id).id, DOMAIN().calc_from_d, "Volatility", ,
0).value_n).price
Returns the instrument theoretical price on the begin date of the domain based on the
volatility stored in the chronological data of the corresponding default option.
4.3.2 AA_CC_FUT
4.3.2.1 Description
Returns the theoretical price or NPV, the dollar duration, the dollar convexity and the value
of one basis point for the specified instrument computed using the Cost of Carry (CC) model.
4.3.2.2 Synopsis
AA_CC_FUT( [instr], [date], [spread], [shock], [calendar], [margin], [yield_curve])
4.3.2.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only when the
function is used in an extended position context. It is an id or a code.
date Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a decimal
number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency is used.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 32
Argument Description
margin Optional flag for margining forcing the default flagging (TRUE for futures, FALSE for
forwards).
yield_curve Optional parameter which contains a yield curve that discounts the future cash flows. It
supersedes the one stored in the instrument [instr_id]. It can be a unique identifier (id)
or the code of an existing yield curve.
4.3.2.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
Equity and Index Futures
4.3.2.6 Examples
On Extended Position Entity:
AA_CC_FUT().npv
Returns the net present value of the position in the instrument on the begin date of the
domain.
On Instrument Entity:
AA_CC_FUT(id).price
Returns the instrument theoretical price on the begin date of the domain.
AA_CC_FUT(, , , , , ,instr_id.ud_stress_yield_instr_id).npv
Returns the net present value of the position in the instrument on the begin date of the
domain, using the stress yield curve defined as a user-defined field in the instrument.
4.3.3 AA_CRR_CONVBOND
4.3.3.1 Description
Returns the theoretical price and several greeks of the specified instrument, computed using
the Cox Ross and Rubinstein (CRR) model.
4.3.3.2 Synopsis
AA_CRR_CONVBOND([instr], [date], [spread], [shock], [calendar], [steps], [volatility],
[yield_curve])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 33
4.3.3.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only when the
function is used in an extended position context. It is an id or a code.
date Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a decimal
number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency is used.
steps Optional argument forcing the number of steps on the binomial computation process; it
overwrites the system BIN_NUM_OF_PERIODS parameter.
volatility Optional volatility figure, very often a decimal number. When not specified, defaults to 0.
yield_curve Optional parameter which contains a yield curve that discounts the future cash flows. It
supersedes the one stored in the instrument [instr_id]. It can be a unique identifier (id)
or the code of an existing yield curve.
4.3.3.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
Convertible Bonds
4.3.3.6 Examples
AA_CRR_CONVBOND(,,,,,,INSTR_CHRONO (INSTR_FLOW(instr_id,DOMAIN().calc_from_d,
DOMAIN().calc_from_d, CURRENT,,6).new_instr_id,
DOMAIN().calc_from_d,"Volatility",,0).value_n).price
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 34
Returns the instrument theoretical price on the begin date of the domain based on the
volatility stored in the chrono data of the stock to which the bond can be converted.
AA_CRR_CONVBOND(,,,,,,INSTR_CHRONO (INSTR_FLOW(instr_id,DOMAIN().calc_from_d,
DOMAIN().calc_from_d,CURRENT,,6).new_instr_id, DOMAIN().calc_from_d,
"Volatility",,0).value_n).delta
Returns the instrument delta on the begin date of the domain based on the volatility stored
in the chrono data of the stock to which the bond can be converted.
On the Extended Position Entity:
AA_CRR_CONVBOND(,,,,,,INSTR_CHRONO(
INSTR_FLOW(instr_id,DOMAIN().calc_from_d,DOMAIN().calc_from_d,
CURRENT,,6).new_instr_id,DOMAIN().calc_from_d,"Volatility",,0).value_n,
"CHF_YC_STRESS").price
Returns the instrument theoretical price on the begin date of the domain, based on the
volatility stored in the chronological data of the stock into which the bond can be converted.
The statement uses the "CHF_YC_STRESS" yield curve instrument (which must be an
existing yield curve in the database) to discount the future flows.
4.3.4 AA_CRR_OPT
4.3.4.1 Description
Returns the theoretical price and formulae (Greek letters) for the specified instrument,
computed using the Cox, Ross and Rubinstein (CRR) model.
4.3.4.2 Synopsis
AA_CRR_OPT([instr], [date], [spread], [shock], [calendar], [margin], [domestic], [steps],
[volatility] , [yield_curve])
4.3.4.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only when the
function is used in an extended position context. It is an id or a code.
date Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a decimal
number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency is used.
margin Optional flag for margining forcing the default flagging (TRUE for futures, FALSE for
forwards).
domestic Optional flag for domestic or foreign risk numbers, forcing the default (TRUE i.e.
domestic).
steps Optional argument forcing the number of steps on binomial computation process. It
overwrites the BIN_NUM_OF_PERIODS system parameter.
volatility Optional volatility figure, very often a decimal number. When not specified, defaults to 0.
yield_curve Optional parameter which contains a yield curve that discounts the future cash flows. It
supersedes the one stored in the instrument [instr_id]. It can be a unique identifier (id)
or the code of an existing yield curve.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 35
4.3.4.4 Return type
Returns the following structure:
4.3.4.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
Option
4.3.4.6 Examples
On the Extended Position entity:
AA_CRR_OPT(,,,,,,,,INSTR_CHRONO(GET_TERM_EVENT().underly_instr_id,DOMAIN().calc_from_
d, "Volatility", , 0).value_n).vega
Returns the vega of the instrument on the begin date of the domain, based on the volatility
stored in the chronological data of the underlying instrument.
On the Extended Position entity:
AA_CRR_OPT(,,,,,,,,INSTR_CHRONO(GET_TERM_EVENT().underly_instr_id,DOMAIN().calc_from_
d,"Volatility",,0).value_n, instr_id.ud_stress_yield_instr_id).vega
Returns the delta of the instrument on the begin date of the domain, based on the volatility
stored in the chronological data of the underlying instrument and the stress yield curve
stored in the instrument (user-defined field).
On the Instrument Entity:
AA_CRR_OPT(id,,,,,,,,INSTR_CHRONO(GET_DEF_OPTION(nature_e,
ref_curr_id,underly_instr_id.ref_curr_id).id,DOMAIN().calc_from_d,
"Volatility",,0).value_n).price
Returns the instrument theoretical price on the begin date of the domain based on the
volatility stored in the chrono data of the corresponding default option.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 36
4.3.5 AA_DF_BOND
4.3.5.1 Description
Returns the theoretical price, the dollar duration, the dollar convexity and the value of one
basis point for the specified instrument computed using the Discount Factor (DF) model.
Synopsis
AA_DF_BOND([instr], [date], [spread], [shock], [calendar],[yield_curve],
[paid_leg_yield_curve], [float_yield_curve], [paid_leg_float_yield_curve], [margin])
4.3.5.2 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional
only when the function is used in an extended position context. It is an id
or a code.
date Optional reference date. If not specified, then the begin date of the domain
is used. It is a date.
spread Optional spread value. If not specified, the standard zero curve is used. It
can be a decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be
a decimal number.
calendar Optional calendar id. If not specified, then the calendar of the reference
currency is used.
yield_curve Optional parameter which contains a yield curve that discounts the future
cash flows. It supersedes the one stored in the instrument [instr_id]. It can
be a unique identifier (id) or the code of an existing yield curve.
paid_leg_yield_curve Optional parameter which contains a yield curve used to discount the paid
leg of a swap. It supersedes the one stored in the instrument [instr_id]. It
can be a unique identifier (id) or the code of an existing yield curve.
float_yield_curve Optional parameter which contains a yield curve used to compute the
forward-forward rates for floating rates notes and the floating benchmark
of the received leg of a swap. It supersedes the one stored in the floating
instrument [instr_id.float_instr_id]. It can be the unique identifier (id) or
the code of an existing yield curve.
paid_leg_float_yield_curve Optional parameter which contains a yield curve used to compute the
forward-forward rates for the floating benchmark of the paid leg of a swap.
It supersedes the one stored in the floating instrument
[instr_id.paid_float_instr_id]. It can be the unique identifier (id) or the
code of an existing yield curve.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 37
Name sqlname_c data_type
Dollar convexity convexity number_t
4.3.5.4 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
Fixed income
Money Market
Swap
Discount
Forex Swap
Convertible bond
4.3.5.5 Examples
On the Extended Position Entity:
AA_DF_BOND(instr_id, DOMAIN().calc_from_d,0.20,0.10,).duration
Returns the dollar duration price of the instrument on the begin date of the domain for a
credit spread of 20 basis points and a curve shock size of 10 basis points.
AA_DF_BOND(,,,,,"CHF_YC_UP").duration
Returns the dollar duration of a standard Government Bond using the "CHF_YC_UP" yield
curve (which must exist in the database).
AA_DF_BOND(,,,,,"CHF_YC_DOWN","CHF_YC_DOWN").duration
Returns the dollar duration of each of the two legs of an IRS in the risk view, using the
"CHF_YC_DOWN" yield curve for the two legs of the swap to discount the future cash flows.
AA_DF_BOND(,,,,,"EUR_YC_STRESS",,"EURIBOR_YC_STRESS").price
Returns the theoretical price of a FRN, based on a EURIBOR benchmark, using the
"EURIBOR_YC_STRESS" yield curve to compute forward-forward rates and the
EUR_YC_STRESS yield curve to simulate the discounted cash flows.
AA_DF_BOND(,,,,,"EUR_YC_STRESS","EUR_YC_STRESS", "EURIBOR_YC_STRESS" ).duration
Returns in the risk view the dollar duration of each of the two legs of an IRS, for which the
received leg is simulated with the "EURIBOR_YC_STRESS" yield curve, and the discounted
cash flows with the "EUR_YC_STRESS" yield curve.
AA_DF_BOND(,,,,,"EUR_YC_STRESS","GBP_YC_STRESS",
"EURIBOR_YC_STRESS","LIBOR_YC_STRESS" ).duration
Returns the dollar duration of each of the two legs of a cross currency basis swap in the risk
view. The received leg’s forward-forward rates are computed in the "EURIBOR_YC_STRESS"
yield curve and discounted with the "EUR_YC_STRESS" yield curve. For the paid leg, the
forward-forward rates are simulated with the "LIBOR_YC_STRESS" yield curve and
discounted with the "GBP_YC_STRESS" yield curve.
On the Instrument Entity:
AA_DF_BOND(id).price
Returns the instrument theoretical price on the begin date of the domain.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 38
4.3.6 AA_DF_FLOW
4.3.6.1 Description
Returns the theoretical dirty price for the specified instrument, computed using the Discount
Factor (DF) model.
4.3.6.2 Synopsis
AA_DF_FLOW(instr, [date], [spread], [calendar])
4.3.6.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only when the
function is used in an extended position context. It is an id or a code.
date Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a decimal
number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency is used.
4.3.6.5 Remarks
This keyword can only be used with the Flow Instrument nature.
4.3.6.6 Examples
AA_DF_FLOW( instr_id, , , ) returns the dirty price of the current flow instrument.
4.3.7 AA_DF_FUT
4.3.7.1 Description
Returns the theoretical price or NPV, the dollar duration, the dollar convexity, the value of
one basis point, the CTD and the delivery date for the specified instrument computed using
the Discount Factor (DF) model. When the marketCTD optional flag is TRUE, the market CTD
is computed using the Cost of Carry model.
4.3.7.2 Synopsis
AA_DF_FUT ([instr], [date], [spread], [shock], [calendar], [margin], [domestic],
[marketCTD], [yield_curve], [underly_yield_curve], [expiration_date], [quote])
4.3.7.3 Arguments
Argument Description
instr Optional instrument id or code on which the computation is done. Optional only
when the function is used in an extended position context. It is an id or a code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 39
Argument Description
date Optional reference date. If not specified, then the begin date of the domain is
used. It is a date.
spread Optional spread value. If not specified, the standard zero curve is used. It can be
a decimal number.
shock Optional shock value. If not specified, standard shocks are used. It can be a
decimal number.
calendar Optional calendar id. If not specified, then the calendar of the reference currency
is used.
margin Optional flag for margins, forcing the default flagging (TRUE for futures, FALSE for
forwards).
domestic Optional flag for domestic or foreign risk numbers. The default is TRUE, i.e.
domestic.
marketCTD Optional flag for specifying if the calculations use the market CTD (TRUE) or
theoretical CTD (FALSE). The default is TRUE.
yield_curve Optional parameter which contains a yield curve that discounts the future cash
flows. It supersedes the one stored in the instrument [instr_id]. It can be a
unique identifier (id) or the code of an existing yield curve.
underly_yield_curve Optional parameter which contains a yield curve used to discount the future cash
flows in the underlying currency (for forex forward/futures). It supersedes the
one stored in the underlying instrument [instr_id.underly_instr_id]. It can be the
unique identifier (id) or the code of an existing yield curve.
expiration_date Date data type. New optional parameter that lets users display the Forward
theoretical price at this date.
4.3.7.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this
keyword will return 0.
This keyword can be used only with the following instrument natures:
FX Forwards
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 40
FX and Bond Futures
The expiration_date argument can only be used with the Forward instrument nature. With
due customisation, it displays the theoretical price of a Forward in the Buy Screen.
4.3.7.6 Examples
On the Extended Position entity:
AA_DF_FUT(,,,,,,FALSE).convexity
Returns the dollar convexity of the instrument on the begin date of the domain in the foreign
currency.
AA_DF_FUT(,,,,,,,"EUR_YC_UP").price
Returns the price of a futures on bonds using the "EUR_YC_UP" yield curve to discount the
future cash flows.
AA_DF_FUT(,,,,,,,"EUR_YC_UP","USD_YC_DOWN").price
Returns the price of a EUR/USD forex forward, using the "EUR_YC_UP" yield curve to
discount the future EURO cash flow and the "USD_YC_DOWN" yield curve to compute the net
present value of the dollar leg.
AA_DF_FUT(,,,,,,,"EURIBOR_YC_STRESS").price
Returns the price of a FRA, using the "EURIBOR_YC_STRESS" yield curve to simulate the
forward-forward rate.
On the Instrument entity:
AA_DF_FUT(id).price
Returns the instrument theoretical price on the begin date of the domain.
AA_DF_FUT(,,,,,,,,»DD/MM/AAA»,).price
4.3.8 AA_ZERO_RATE
4.3.8.1 Description
Returns the rate of the specified yield curve for the period between date1 and date2 of the
current record.
4.3.8.2 Synopsis
AA_ZERO_RATE(entity [, instr] , date1, date2, [,spread])
4.3.8.3 Arguments
Argument Description
entity Specifies if the id of the next argument comes from the instrument table or the currency
table.
instr Optional yield curve instrument id or code, on which the computation is performed,
optional only when the function is used in an extended position context. It is an id or a
code. It can also be a currency id or code. In this case, the yield curve that is retrieved is
in the same currency with the default flag set to 1.
date1 Optional reference date. If not specified, then the begin date of the domain is used. It is
a date.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 41
Argument Description
date2 Date of the rate to compute. This is the date at which the value has to be computed in
the same way as the pricing. This date can be retrieved from the instrument or from the
extended position (in the case of generic instruments). The default value is the begin
date of the domain.
spread Optional spread value. If not specified, the standard zero curve is used. It can be a
decimal number.
4.3.8.5 Remarks
This keyword requires the AdAM licence. If the AdAM licence is not available, this keyword
will return 0.
The rate retrieved is used to compute the Discount factor used to discount the flows of the
instrument. This makes it possible to compute the NPV.
4.3.8.6 Examples
AA_ZERO_RATE("instrument",instr_id.yield_curve_instr_id, DOMAIN().calc_from_d,
instr_id.end_d, 0)
Returns the rate of the instrument yield curve that can be used to compute the discount
factor between the begin date of the domain and the instrument End Date.
AA_ZERO_RATE("currency","USD", DOMAIN().calc_from_d,instr_id.end_d,0)
Returns the rate of the default yield curve of the DEM currency that is used to compute the
discount factor between the begin date of the domain and the instrument End Date.
4.3.9 ABS
4.3.9.1 Description
Returns the absolute value of the val argument.
4.3.9.2 Synopsis
ABS( val )
4.3.9.3 Arguments
Argument Description
val A numeric expression.
4.3.9.5 Remarks
ABS( NULL ) returns NULL.
4.3.9.6 Examples
ABS( -10.2 ) returns 10.2.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 42
4.3.10 ACCPER_PARAM
4.3.10.1 Description
Returns a valid occurrence of the accounting period parameter.
4.3.10.2 Synopsis
ACCPER_PARAM(portfolio, nature, date)
4.3.10.3 Arguments
Argument Description
portfolio Id or code.
4.3.10.5 Examples
ACCPER_PARAM(DOMAIN().port_object_id,"Redemption
Fee",DOMAIN().calc_from_d).round_unit_n
This script returns the accurate rounding rule based on the begin date of the domain, used to
compute the Redemption Fee.
4.3.11 ACCR_INTER
4.3.11.1 Description
Computes an accrued interest amount according to a currency. The method argument lets
you choose the accrued valuation method used to compute the accounting value of French
swaps.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 43
4.3.11.2 Synopsis
ACCR_INTER( instrument , date1 , curr , quantity [, fus_date_rule ][, flag1 ][, flag2 ][, flag3
][, date2 ][, rate ] [,income tax] [,method] [,accrual rule])
4.3.11.3 Arguments
Argument Description
instrument Instrument code or id.
flag2 Optional force calculation flag indicating whether the function should first attempt to find
an appropriate entry in the chronological data table or not.
date2 Optional date which indicates the starting date for the interest computation. When the
method argument is set to ACCR_VAL, this date is the beginning of the accrued
valuation computation period. If it is not entered, the accrued valuation begins on the
1st January of the year of the valuation.
income tax Optional income tax rate given as a percentage. If the tax rate is 25%, for example, the
argument is 25.
accrual rule Optional enumerated accrual rule keyword (or integer value) to overload the instrument
accrual rule. A 0 value uses the instrument accrual rule (that is, the accrual rule defined
at instrument level).
4.3.11.5 Remarks
ACCR_INTER can only be used in formats that use the extpos table.
4.3.11.6 Examples
ACCR_INTER(instr_id,value_d,pos_currency_id,quantity_
*instr_id.contract_size_n,FUS_DATE_RULE(portfolio_id,
value_d),0,1,0,,,,,“Actual/360”))
For a buy operation, computes the amount of accrued interests to be paid on that operation.
The accrual rule in this case is always forced to “Actual/360”.
ACCR_INTER(instr_id,DOMAIN().calc_from_d,DOMAIN().currency_id, quantity_n *
instr_id.contract_size_n,portfolio_id.fusion_date_rule_e,1,1,0,
DATEPOSI(DOMAIN().calc_from_d,BEGIN_OF,YEAR),,,ACCR_VAL)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 44
In a Valuation, computes the accrued value of a swap in the accounting view or the accrued
value of the legs of a swap in the risk view.
4.3.12 ACCT_STATUS
4.3.12.1 Description
Returns the accounting status, a numeric parameter stored in the appl_param table.
4.3.12.2 Synopsis
ACCT_STATUS()
4.3.12.3 Arguments
None.
4.3.12.5 Examples
ACCT_STATUS() returns the accounting status specified in the application parameters
table.
4.3.13 ADD_BUSINESSDAYS
4.3.13.1 Description
Returns the date of the nth working day after a specific date following a defined date.
4.3.13.2 Synopsis
ADD_BUSINESSDAYS (date [, nbdays] [, calendar] )
4.3.13.3 Arguments
Argument Description
date To which the number of business days is added.
4.3.13.5 Examples
ADD_BUSINESSDAYS(operation_d, 3,"CH-CALENDAR")
Returns the third working day after the operation date according to the calendar CH-
CALENDAR.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 45
4.3.14 ADDRESS
4.3.14.1 Description
Returns the address of a third party.
4.3.14.2 Synopsis
ADDRESS(third_party, type)
4.3.14.3 Arguments
Argument Description
third_party Id or code of the third party.
4.3.14.5 Remarks
ADDRESS can also be used in an indirect access context. In that case, it takes only one
argument (the type) enclosed by square brackets ‘[ ]’
4.3.14.6 Examples
ADDRESS(portfolio_id.third_id,"resid").phone_c
Returns the phone number of the customer who owns the current portfolio. The phone
number is specified in the address whose type is "resid".
portfolio_id.third_id.ADDRESS["resid"].postal_c
Returns the postal code of the customer who owns the current portfolio. This postal code is
specified in the address whose type is "resid".
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 46
4.3.15 AUTOCREATE
4.3.15.1 Description
Automatically creates an occurrence in one table from another table.
4.3.15.2 Synopsis
AUTOCREATE (table, action, expr1 [, expr2 ] [, ...] [, expr20 ])
4.3.15.3 Arguments
Argument Description
table Indicates the id of the table where the new occurrence must be created. This argument
normally includes the GET_ENTITY function.
action Action to be performed on the database. The two possible choices are:
INSERT
INSERT_UPDATE
expr1...expr20 Script expressions indicating the content of the fields of the newly created occurrence.
The syntax of these arguments must be:
&attribute_name:= script_expression
4.3.15.5 Limitations
This keyword cannot be used in the optimised batch mode (block mode).
This keyword does not work in function Order Entry or in any other function that works
with extended operations.
4.3.15.6 Remarks
The contents of the fields that are not specified in the AUTOCREATE parameters are
determined by the GUI default values.
When using this script keyword, you must enter the entire business key in the script
expression and not just attributes.
4.3.15.7 Examples
IF(nature_e=3,AUTOCREATE(GET_ENTITY("instrument"),
INSERT_UPDATE,&code:=CONCAT(ref_curr_id.code,"-INDEX"),
&name:=CONCAT(ref_curr_id.code,"-INDEX"), &nature_e:=8))
If defined as a default value for the index attribute of an instrument, this expression
automatically creates an occurrence in the instrument table. This occurrence has the nature
"index"; its name and code are the concatenation of the currency code of the newly created
option and the string "-INDEX".
4.3.16 BAL_EXT_POS
4.3.16.1 Description
Returns the structure of a balance position of a defined type for a specific instrument.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 47
4.3.16.2 Synopsis
BAL_EXT_POS( type [ , instrument ] )
4.3.16.3 Arguments
Argument Description
type Balance position type.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 48
Name sqlname_c data_type
Accounting Flag acct_f flag_t
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 49
Name sqlname_c data_type
Value Date value_d datetime_t
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 50
Name sqlname_c data_type
Book Sys Amount book_sys_amount_m amount_t
4.3.16.5 Remarks
You must call this function directly. You cannot call it using an attribute followed by a dot
and the function call. Note that this keyword only returns balance positions whose main_f
flag is set to zero: main_f=0 (P&L balance positions, fees linked to a buy/sell operation,
etc.). Balance positions from Fee operations are not returned.
4.3.16.6 Examples
BAL_EXT_POS("CAPITAL_PROFIT").sys_net_amount_m returns the first net capital profit
expressed in the system currency.
BAL_EXT_POS("CURRENCY_PROFIT",acct_ext_pos_id.instr_id).ref_net_amount_m returns
the currency profit expressed in the reference currency for the current cash account.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 51
4.3.17 BENCH_RETURN
4.3.17.1 Description
Computes the return of an instrument or a strategy.
4.3.17.2 Synopsis
BENCH_RETURN(entity , object , date1 , date2 [, line_pos][, curr ][, type ][, ret_nature ][,
rate1 ][, rate2 ][, flag][, rule ] [,rebal_rule] [,freq] [,freq_unit] [,rebal_date]
[,contrib_object] [,contrib_rule] [,price_val_code] [,exch_val_code])
4.3.17.3 Arguments
Argument Description
entity entity_dict_id or name.
curr Optional. Id or code of the currency in which the return is computed. If this argument
is not specified, it defaults to the reference currency of the instrument.
type Optional. Defines which kind of return is computed. There are three possible values:
0: total return which includes all the factors (capital, income, currency)
1: capital return that expresses the return due to an instrument appreciation in
the instrument reference currency.
2: income return which returns the return due to any income event received or
paid in this instrument.
ret_nature Optional. Defines the return nature. There are three possible natures:
0: local return. Computes the above return in the instrument currency
1: currency return. Computes the above return in the input currency
2: currency effect return. Indicates the return due to the difference between the
local currency return and the currency return.
rate1 Optional. Capital gains tax rate applied to any capital gains over the period.
rate2 Optional. Income tax rate applied to any income earned during the period.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 52
Argument Description
rebal_rule Optional. This parameter specifies if the initial weight is recalculated or not and if
intermediate weights, stored in the database are taken into account (irregular
rebalancing). The possible values are:
0 or NULL: no initial weight calculation and no irregular rebalancing. The initial weights
are equal to weights stored in the database that are valid at either the rebal_date date
or at the begin date (if rebal_date is not specified).
1: initial weight calculation and no irregular rebalancing. The initial weights are
equal to price adjusted weights that are valid either at the rebal_date date or at
the begin date (if rebal_date is not specified).
2: no initial weight calculation and irregular rebalancing. If an intermediate weight
is available between the most recent logical rebalancing date (rebal_date for
BENCH_WEIGHT) and the begin date, the initial weights are equal to these weights
(as stored in the database). Otherwise the weights are the same as for rebal_rule
= 0.
3: initial weight calculation and irregular rebalancing. If an intermediate weight is
available between the most recent logical rebalancing date (rebal_date for
BENCH_WEIGHT) and the begin date, the initial weights are equal to these price
adjusted weights. Otherwise the weights are the same as for rebal_rule = 0.
freq Optional. Describes the number of "frequency units" between two occurrences.
freq_unit Optional, mandatory if freq is used. Describes the units used to compute the frequency
("Day", "Month").
rebal_date Optional, mandatory if freq is used. The first rebalancing date of the index.
contrib_object Optional. Object id of a component of the index given as an object. If this information
is not given, the total benchmark return is calculated.
price_val_code Optional. Code or id of the valuation rule to be used to determine the price.
exch_val_code Optional. Code or id of the valuation rule to be used to determine the exchange rate.
4.3.17.5 Remarks
If the return is computed for a strategy, its nature must be Model Portfolio or Asset
Allocation. Otherwise, the value will be NULL.
If the return should be computed for a strategy that has another nature (e.g., Benchmark),
then the financial function Performance Analysis will perform the calculation and the use of
the script keyword BENCH_RETURN is not necessary. A specific Performance Analysis licence
might be required.
4.3.17.6 Examples
BENCH_RETURN("instrument","MSCI",DOMAIN().calc_till_d, DOMAIN().calc_from_d)
Calculates the total return from a benchmark that is rebalanced every end of month.
BENCH_RETURN("strategy",@strat_id,DOMAIN().calc_till_d,
DOMAIN().calc_from_d,,portfolio_id.currency_id,1,1,,,,,3,,,, @market_seg_id, 0)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 53
Calculates the return contribution from the market segment of a strategy (without cross-
effect), whose re-balancing is done when new weights are stored in the database.
Theoretical Example
The example below shows possible return calculations between 15/01/2000 and 15/07/2000
for a benchmark that is composed of two indexes and with weights defined for the given
dates:
Index I1 Index I2
31/12/1999 50% 50%
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 54
4.3.18 BENCH_WEIGHT
4.3.18.1 Description
Retrieves an instrument or market segment's benchmark when passed a strategy or index. It
can also return stored weights or price adjusted weights. The BENCH_WEIGHT keyword
returns the initial weight used by BENCH_RETURN.
If an asset allocation strategy and market segment are supplied, the function checks the
strategy element table and returns the benchmark and its weight.
If an index (instrument) and instrument are supplied, the function retrieves the appropriate
entry from the instrument composition table.
If a model portfolio and an instrument are supplied, the function retrieves the appropriate
instrument weight from the model portfolio.
If a recommendation list and an instrument are supplied, the function retrieves the
instrument's recommendation nature (from the recommendation list).
4.3.18.2 Synopsis
BENCH_WEIGHT(entity1 , object1 , entity2 , object2 , date [,curr] [,rebal_rule] [,rebal_date]
[,price_val_rule] [,exch_val_rule])
4.3.18.3 Arguments
Argument Description
entity1 Specifies whether the information has to be retrieved for an instrument or a strategy.
curr Optional. The currency in which the return is computed. If this argument is not
specified, the function calculates returns in local currencies.
rebal_rule Optional. Describes the way the weights are recalculated. The possible values are:
0 or NULL: database weights valid at date rebal_date date or date date (if
rebal_date is not specified)
1: price adjusted weights valid at rebal_date date or date date (if rebal_date is not
specified)
2: if an intermediate weight is available between rebal_date and date, database
weights valid at date date
3: if an intermediate weight is available between rebal_date and date, price
adjusted weights valid at date date
price_val_rule Optional. Code or id of the valuation rule to be used to determine the price.
exch_val_rule Optional. Code or id of the valuation rule to be used to determine the exchange rate.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 55
4.3.18.4 Return type
Returns the structure of a Bench weight.
4.3.18.5 Remarks
To retrieve the exact weights used by BENCH_RETURN, apply the following rules:
1. If BENCH_RETURN does not have a logical frequency, rebal_date = NULL
2. If BENCH_RETURN has a logical frequency, rebal_date = maximum date in the
frequency, which is lower than or equal to date
Among the possibilities are:
BENCH_WEIGHT("strategy", strat_id, "market_segment", ms_id, date) returns the valid
weight for a market segment in a grid.
BENCH_WEIGHT("instrument", index_id, "instrument", instr_id, date) returns the valid
"weight" for an instrument in an index.
BENCH_WEIGHT("strategy", strat_id, "instrument", instr_id, date) returns the valid weight
for an instrument in a model portfolio or a recommendation nature if you pass a
recommendation list as the strategy parameter.
4.3.18.6 Examples
BENCH_WEIGHT("strategy", GET_STRATEGY("portfolio", portfolio_id, 2,
DOMAIN().calc_till_d, ).id,"market segment", market_segment_id,
DOMAIN().calc_till_d).weight_n
Returns the weight (stored in the database and valid at end date) of the market segment in
the strategy linked to the current portfolio.
The next example uses the same script as before, only with the last three parameters not
NULL:
BENCH_WEIGHT("strategy", GET_STRATEGY("portfolio", portfolio_id, 2,
DOMAIN().calc_till_d,).id,"market segment", market_segment_id,
DOMAIN().calc_till_d,"CHF",1, DOMAIN().calc_from_d).weight_n
Returns the weight valid at the begin date, adjusted dynamically to the end date.
BENCH_WEIGHT("instrument",instr_id.index_instr,"instrument", instr,
DOMAIN().calc_from_d).weight_n
4.3.19 CASE_LINKED_OBJECT
4.3.19.1 Description
Returns a record linked to a case.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 56
4.3.19.2 Synopsis
CASE_LINKED_OBJECT(entity, case)
4.3.19.3 Arguments
Argument Description
Entity The entity of the linked object to return. GET_ENTITY must be used to get
it.
4.3.19.5 Example
In a usual format element on the case management entity:
CASE_LINKED_OBJECT(GET_ENTITY("ext_operation"),id).nature_e.LABEL[], for the
current case, gives the nature (buy, sell, etc) of the operation (used into the case
message template for Trading Constraint).
While generating a case_management_description_c attribute using CASE_MSG()
template:
CASE_LINKED_OBJECT(GET_ENTITY("ext_operation"),CURRENT_CASE().id).nature_e.
LABEL[], for the current case, gives the nature (buy, sell, etc) of the operation (used
into the case message template for Trading Constraint).
4.3.20 CASE_MSG
4.3.20.1 Description
It returns a message using Case Message Template infrastructure. It can only be used for
default value on entity “case management”.
4.3.20.2 Synopsis
CASE_MSG([template], [language], [min_priority], [max_priority])
The CASE_MSG() script keyword contains 4 attributes:
case message template’s code
case message template’s language
minimum priority
maximum priority
4.3.20.3 Arguments
Argument Description
Template Optional case message template’s code into which the message is
defined.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 57
Argument Description
Language Optional case message template’s language to use. If there is no
definition that exists for the specified language, the default language is
used.
Min Priority Optional minimum template’s priority. Used only when no template is
given as first parameter.
Max Priority Optional maximum template’s priority. Used only when no template is
given as first parameter.
4.3.20.5 Example
CASE_MSG(“Msg_1”,”de”,,) displays the message scripted for the case message template
“Msg_1” into “de” language.
Default Cases’ descriptions are defined as CASE_MSG( , ,10,10).
4.3.21 CELL_FORMAT
4.3.21.1 Description
Defines the graphical effects used in functions to describe if a line is checked or not.
4.3.21.2 Synopsis
CELL_FORMAT(attribute [, min ] [, minincl ] [, max ] [, maxincl ] [, icon ] [, backround ] [,
foreground ] [, bold ] [, italic ] [, justification ] [, bump ] )
4.3.21.3 Arguments
Argument Description
attribute sqlname of the attribute whose data is used in the comparison.
min Optional minimum value for the formatting parameters. It is an absolute value.
minincl Optional flag (TRUE or FALSE) that defines if the minimum value is included or not in the
comparison.
max Optional maximum value for the formatting parameters. It is an absolute value.
maxincl Optional flag (TRUE or FALSE) that defines if the maximum value is included in the
comparison or not.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 58
Argument Description
icon Optional string that defines the icon name. Below is a list of some delivered icons, used
to describe a check (for example, constraints and objectives compliance):
foreground Optional cell foreground colour. The possible values are the same as for the background.
bump Bump flag that highlights selected data with a bump effect if set.
4.3.21.5 Remarks
You can define different cell formats for the same format element. In this case, you must
separate the cell formats with semi-colons (;).
In summary lists, this effect only works with the foreground colour.
4.3.21.6 Examples
CELL_FORMAT("strat_check_e", 1,TRUE,1,TRUE,"GenCheck",3,,,,);
CELL_FORMAT("strat_check_e", 2,TRUE,2,TRUE,"GenCross",2,,,,)
Returns a green tick () if the strategy is checked and a red cross (X) if it is unchecked.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 59
CELL_FORMAT("object_weight_contrib",0.05,TRUE,0.1,TRUE,,1,,,,1)
Returns the objective weight contribution data of 5% and 10% in yellow, for example.
4.3.22 CHAIN_PERIOD
4.3.22.1 Description
Computes the periodic chaining of performance data.
4.3.22.2 Synopsis
CHAIN_PERIOD (date1, date2 [ , flag])
4.3.22.3 Arguments
Argument Description
date1 Begin date.
4.3.22.5 Remark
The method of chaining is defined through the performance analysis parameters entity.
4.3.22.6 Examples
CHAIN_PERIOD(DOMAIN().calc_ref_d, final_d).return_n
4.3.23 CHECK_SUM
4.3.23.1 Description
Defines unstructured constraints.
4.3.23.2 Synopsis
CHECK_SUM(val, operator, objective [,margin] [,filter] [,break] [,operator2][, logical
operator][, new constraint definition])
4.3.23.3 Arguments
Argument Description
val Value. (I.e. market value position market value, position instrument quantity, etc.)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 60
Argument Description
operator Comparative operator:
EQ: equals
LT: less than
NE: not equal
LE: less than or equals
GT: greater than
GE: greater than or equal
filter Specifies to which part of the portfolio the constraint must be applied. Must be 1 if
no specific filter is applied.
operator2 Optional keyword for a comparative operator: EQ, LT, NE, LE, GT or GE.
If the first objective is checked for a break criteria value the system sums up the
corresponding value. The latter value is compared to the second objective using the
second operator.
Example:
All instruments that represent more than 5% of the NAV cannot represent more
than 40% of the NAV. In this case, a break criterion is required.
margin2 Allowed margin for the second objective (break criteria required).
4.3.23.5 Remark
The underlying data structure is the extended position table. Consequently, the value, filter
and break criteria are based upon this working data structure and not the extended strategy
element table.
4.3.23.6 Examples
CHECK_SUM(100 * pos_val_id.ref_mkt_val_m/portfolio_id.mkt_val_m, LT, 20,
,instr_id.type_id.code="Fund")
Indicates that the weight of the Fund instruments must be less than 20% of the portfolio.
CHECK_SUM( 100 * pos_val_id.ref_mkt_val_m / portfolio_id.mkt_val_m, LT, 5 , ,
instr_id.nature_e <> 4, instr_id.code)
Means that no positions other than cash accounts (nature value 4) can be more than 5% of
the portfolio.
IF(C1 OR C2', C1, C3) is equivalent to:
IF(CHECK_SUM( 100 * pos_val.ref_mkt_val_m / portfolio.mkt_val_m, LT,
30,,instr.nature_e=2,instr.issuer_third_id.name,,,,OR_CHECK, CHECK_SUM(1 / TOT_STAT(
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 61
1, instr.nature_e = 2, instr_id ).num_record,
GE,4,,instr.nature_e=2)),{then}CHECK_SUM( 100 * pos_val.ref_mkt_val_m /
portfolio.mkt_val_m, LT, 30 , , instr.nature_e = 2,
instr.issuer_third_id.name),{else} CHECK_SUM(100 *
pos_val.ref_mkt_val_m/portfolio_id.mkt_val_m, LT, 20, ,instr_id.nature_e = 2,
instr_id.name))
CHECK_SUM(pos_val_id.ref_mkt_val_m / portfolio_id.mkt_val_m, LT, 0.1, , ,
instr_id.nature_e, LT, 0.03)
The script returns True if the instruments (grouped by nature) that have a relative market
value less than 10% also have a relative market value less than 3%. It returns False if at
least one instrument group that has a relative market value smaller than 10% has a relative
market value greater than or equal to 3%.
CHECK_SUM(100*pos_val_id.ref_mkt_val_m/portfolio_id.mkt_val_m, EQ, 35, 10,
instr_id.nature_e = 1)
The script returns True if there are between 25% and 45% of equities in the portfolio (35%
+/- 10%).
4.3.24 CLASSIFY
4.3.24.1 Description
Classifies an object in the lists of a classification.
4.3.24.2 Synopsis
CLASSIFY(entity, object, classif [, date enum ] [, date])))
4.3.24.3 Arguments
Argument Description
entity Entity of the object to be classified.
date enum Specifies the context in which the user wants the data to be retrieved:
date enum = 0 to work on the Domain context
date enum = 1 to work on the current list
date enum = 2 to work on the historical list
date Date at which the user wants to perform the list historisation.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 62
4.3.24.5 Remarks
CLASSIFY can also be called indirectly. In this case, the function takes only one argument
(the 3rd argument - the code of the classification) surrounded by square brackets ([ ]).
4.3.24.6 Examples
CLASSIFY("instrument", instr_id, "classif_new_categ").list_id.code returns the code
of the list (to which the current instrument belongs) in the classification
"classif_new_categ".
instr_id.CLASSIFY[classif_new_categ ].rank_n returns the rank of the list (to which the
current instrument belongs) in the classification "classif_new_categ".
4.3.25 CLASSIFY_ACC_PLAN
4.3.25.1 Description
Classifies extended positions or related extended positions according to the accounting plan
element.
4.3.25.2 Synopsis
CLASSIFY_ACC_PLAN(object, date, nature, obj_indicator [,object_id ])
4.3.25.3 Arguments
Argument Description
object Portfolio or accounting plan id or code.
obj_indicator Specifies if the first argument is a portfolio or an accounting plan. The possible values
are:
1 or BY_PORTFOLIO_ID
2 or BY_ACCPLAN_ID
object_id Optional. Extended position foreign key (id) that references another record in the same
table.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 63
Name sqlname_c data_type
Rank rank_n smallint_t
4.3.25.5 Remarks
None.
4.3.25.6 Example
CLASSIFY_ACC_PLAN(DOMAIN().acc_plan_id, DOMAIN().calc_till_d, 2,
BY_ACCPLAN_ID).account_number
This script returns the balance sheet account number assigned to the extended position,
based on the accounting plan specified in the DOMAIN.
CLASSIFY_ACC_PLAN(DOMAIN().acc_plan_id, DOMAIN().calc_till_d, 2, BY_ACCPLAN_ID,
acct_ext_pos_id).account_number
This script returns the balance sheet account number of the corresponding cash account of
the extended position, based on the accounting plan specified in the DOMAIN.
4.3.26 COMPLIANCE_CHRONO
4.3.26.1 Description
Returns a compliance chronological data structure.
4.3.26.2 Synopsis
COMPLIANCE_CHRONO(ptf,time_dim,nature,date[,strategy] [,compliance_nature]
[,sub_nature_type] [,third_party] [,curr] [,flag] )
4.3.26.3 Arguments
Argument Description
ptf Id or code of the portfolio.
nature Indicates which chronological data has to be accessed. The different natures of
compliance chronological data are listed in the data model.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 64
Argument Description
date At which the chronological data is expected.
strategy Optional. Id or code of the chronological data strategy. If this parameter is not
provided, no filter is applied.
compliance_nature Optional. Indicates which chronological data has to be accessed. The different
compliance natures of compliance chronological data are listed in the data model.
If this parameter is not provided, no filter is applied.
sub_nature_type Optional. The chronological records are filtered using the sub-nature type code
provided. If this parameter is not provided, no filter is applied.
third_party Optional. Id or code of the chronological data provider. If this parameter is not
provided, no filter is applied.
flag Optional. If the flag is set to 1 and time_dim = LAST, only the valid chronological
data (depending on the relevant system parameter) is retrieved.
4.3.26.5 Remarks
COMPLIANCE_CHRONO can also be used in an indirect access context. In that case, the first
argument is not required and the other arguments must be surrounded by square brackets ‘[
]’.
4.3.26.6 Examples
COMPLIANCE_CHRONO(portfolio_id, LAST, "Volatility Percent", DOMAIN().calc_from_d,
"T_ME_ALLOC_REP").value_n
Returns the value of the last available Volatility Percent for the current portfolio on strategy
T_ME_ALLOC_REP.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 65
portfolio_id.COMPLIANCE_CHRONO[LAST,"Volatility Percent",DOMAIN().calc_from_d,
"T_ME_ALLOCATION","Measure", "PMSTA-5345_SubNatTyp","REUTERS","CHF"].value_n
Returns the value of the last available Volatility Percent for the current portfolio and with all
parameters able in this keyword.
4.3.27 COMPLIANCE_CHRONO_ARRAY
4.3.27.1 Description
Returns an array of compliance chronological data.
4.3.27.2 Synopsis
COMPLIANCE_CHRONO_ARRAY( date , freq , unit , number , portfolio , nature [,strategy]
[,compliance_nature] [,sub_nature_type] [,third_party] [,curr] [,missing_data] )
4.3.27.3 Arguments
Argument Description
date Date until which the historical data occurs. (the end date of the series)
freq The frequency at which the data is extracted according to the arg3, the frequency
unit. (e.g., each day, every two days, etc.) .
unit The frequency unit at which the data is extracted.Enumerated date unit keyword.
This argument has to be filled in between double quotes or replaced by the figure
preceding the value: "Week" or 3.
number The number of readings indicates how many periods or occurrences are to be
selected.
nature Indicates which chronological data has to be accessed. The different natures of
compliance chronological data are listed in the data model.
strategy Optional. Id or code of the chronological data strategy. If this parameter is not
provided, no filter is applied.
compliance_nature Optional. Indicates which chronological data has to be accessed. The different
compliance natures of compliance chronological data are listed in the data model.
If this parameter is not provided, no filter is applied.
sub_nature_type Optional. The chronological records are filtered using the sub-nature type code
provided. If this parameter is not provided, no filter is applied.
third_party Optional. Id or code of the chronological data provider. If this parameter is not
provided, no filter is applied.
curr Indicates the currency in which the chronological data has to be. This implies the
conversion using the prevalent exchange rates.
missing_data Optional. Specifies how missing data is treated by the financial server. If you pass
0 or NULL as the value, the most recent valid data is used. If you pass a value of
1, the missing data is ignored, i.e. it is removed from the array. The missing_data
parameter can be used with any _ARRAY keyword, although in the other cases it is
the last parameter in the list and, consequently, its inclusion or replacement with a
comma in the parameter list is not critical.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 66
4.3.27.5 Remarks
None.
4.3.27.6 Examples
STAT(COMPLIANCE_CHRONO_ARRAY(DOMAIN().calc_from_d,1,4, 12, portfolio, "Volatility
Percent", "T_ME_ALLOCATION", "Measure", "PMSTA-5345_SubNatTyp", "REUTERS",
portfolio_id.currency, LASTVALID)).mean
Computes the average Volatility Percent on the last 12 months for the current portfolio.
4.3.28 CONCAT
4.3.28.1 Description
Concatenates two strings, adding num spaces between them, if necessary, and returns the
concatenated string.
4.3.28.2 Synopsis
CONCAT(str1, str2 [, num ])
4.3.28.3 Arguments
Argument Description
str1 Strings to be concatenated.
str2
num Optional number of spaces to insert between the two strings. If num is not specified or is
negative, no spaces are inserted.
4.3.28.5 Remarks
None.
4.3.28.6 Examples
If the current instrument is Nestlé stock (code="NESTLE" and reference currency="CHF"),
CONCAT("CHF",instr_id.code) returns "CHFNESTLE";
CONCAT("CHF",instr_id.code,1) returns "CHF NESTLE";
CONCAT(CONCAT(instr_id.ref_curr_id.code,"-"),instr_id.code)
Returns "CHF-NESTLE".
4.3.29 CONCAT_FMTHIER
4.3.29.1 Description
Concatenates strings built for each level of a hierarchy. A separator can be inserted between
each level.
4.3.29.2 Synopsis
CONCAT_FMTHIER(parent attribute, is attribute, str [, separator ])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 67
4.3.29.3 Arguments
Argument Description
parent attribute Attribute where the parent id is stored.
4.3.29.5 Remarks
It can only be used in format elements. Parent attribute and id attribute must be attributes
of the format's entity.
4.3.29.6 Examples
{This script generates the appropriate portfolio dimension hierarchy structure
according to the load hierarchy and consolidation method}
{----------------------------------------------------}
{This script generates the appropriate market structure according to the rebalancing
strategy linked to the portfolio}
{----------------------------------------------------}
CONCAT_FMTHIER(disp_parent_ext_strat_elem_id,
id,
IF( id <> -1 {To remove first level dedicated to grid},
PRINTF("%s[HIERLEV%i]",
GET_FIRST(market_segment_id.DENOMINATION[TSL_CURRENT_LANGUAGE()].denom,
market_segment_id.name),
market_segment_id
),
{ELSE}
NULL
)
)
This example is a format element of a format for which the entity is ext_strategy_element.
4.3.30.1 Description
These functions compute a security's convexity (duration or modified duration).
4.3.30.2 Synopsis
CONV( [ instr ][, type ][, flag1 ][, flag2 ][, flag3 ][, date ][, flag4 ][, flag5 ][, rate ][, date
][, price1 ] [,price2][,income tax][,capital tax])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 68
DURA ( [ instr ][, type ][, flag1 ][, flag2 ][, flag3 ][, date ][, flag4 ][, flag5 ][, rate ][, date
][, price1 ] [,price2][,income tax][,capital tax])
MDURA ( [ instr ][, type ][, flag1 ][, flag2 ][, flag3 ][, date ][, flag4 ][, flag5 ][, rate ][, date
][, price1 ] [,price2][,income tax][,capital tax])
4.3.30.3 Arguments
Same as the YTM (Yield To Maturity) function
4.3.30.5 Remarks
You can use CONV with the following instrument natures: Bonds, Option and Convertible
Bonds.
DURA can be used with the following natures: Money Markets, Discounts, Bonds, Option
Bonds, Convertible Bonds or Miscellaneous.
The duration of money markets and discount instruments is the life of the instrument
expressed in years.
The duration for cash is 0.
You can use MDURA with the following natures: Money Markets, Discounts, Bonds, Option
Bonds, Convertible Bonds and Miscellaneous.
For money markets, discount and miscellaneous instruments, the modified duration is
calculated as follows:
Duration
1 Yield
Note that the computation of DURA and MDURA for Floating Rate Notes is no longer
supported (i.e. it returns 0) as the old computation was open to error.
4.3.30.6 Examples
CONV( )
4.3.31 CONV_AMOUNT
4.3.31.1 Description
Converts an amount from one currency to another.
4.3.31.2 Synopsis
CONV_AMOUNT(amount_m, from_currency_id, to_currency_id, from_to_exch_rate, exch_d
[, ref_currency_id] [, from_ref_exch_rate] [, ref_to_exch_rate] [,ref_rounding_rule_e] [,
ref_rounding_unit_e])
4.3.31.3 Arguments
Argument Description
amount_m Amount (expressed in the From currency) to convert.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 69
Argument Description
from_to_exchange_rate Exchange rate used to convert the amount.
from_ref_exch_rate Exchange rate for the conversion of the amount from the from currency to the
ref currency.
ref_to_exch_rate Exchange rate for the conversion of the amount from the ref currency to the
to currency.
ref_rounding_rule_e Rule to apply when rounding the amount expressed in the reference currency.
Ref_rounding_unit_e Unit to use when rounding the amount expressed in the reference currency.
4.3.31.5 Remarks
None.
4.3.31.6 Examples
CONV_AMOUNT((op_net_amount_m–(acc2_net_amount_m/acc2_exch_rate)–
(acc3_net_amount_m/acc3_exch_rate)),
op_currency_id,acc_currency_id,acc_exch_rate,operation_d)
When the above script is used for a Buy operation, it returns the amount debited from the
cash account specified in the Account field.
4.3.32 COUNT
4.3.32.1 Description
Searchs and counts how many times a string is present in one other string.
4.3.32.2 Synopsis
COUNT(str1, str2)
4.3.32.3 Arguments
Argument Description
str1 String
4.3.32.5 Remarks
None.
4.3.32.6 Examples
COUNT("/Bond/USD/AAA/", "/") returns "4";
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 70
COUNT("abcabcabcabcabcabc", "abcabc") returns "3";
COUNT("Stock<*>EUR<*>","<*>") returns "2";
4.3.33 CRYPT
4.3.33.1 Description
Encrypts the input string using the method defined by the first parameter.
4.3.33.2 Synopsis
CRYPT(method, input_string)
4.3.33.3 Arguments
Argument Description
method Refers to the encryption type. Three different encryption algorithms are available:
MD5
SMD5 (Salted MD5)
SHA256 (Note that using SHA256 makes security compliant with U.S. government
guidelines FIPS PUB 180-2 and FIPS PUB 180-3.)
SSHA256 (Salted SHA256)
salt Optional salt for SSHA256 only. If nothing is provided, the parameter input_string and
the character ":" will be used has a salt.
4.3.33.5 Remarks
The input string can be an immediate value or one returned by another function. Returns the
encrypted string.
4.3.33.6 Examples
CRYPT(MD5, code)
4.3.34 CURR_CHRONO
Refer to section PORT_CHRONO, CURR_CHRONO, THIRD_CHRONO.
4.3.35 CURRENT_ACTION
4.3.35.1 Description
Returns the current action performed by the user. It allows the user to define specific input
controls on particular action (Save Draft or Save Session).
4.3.35.2 Synopsis
CURRENT_ACTION( )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 71
4.3.35.3 Arguments
None (empty argument list).
4.3.35.5 Remarks
This function can only be used in input control in the financial function screens such as order
entry. It could be used on domain or on operation entity.
Supported financial functions are:
Order Entry.
Reconcile Strategy.
Allocate order.
Order List.
Event Generation (only Save Session used for save all).
4.3.35.6 Examples
Input Control for domain entity:
IF (CURRENT_ACTION() = SAVE_DRAFT, MSG(WARNING ,NULL, NULL, NULL, "Performed action :
Save Draft"));
IF (CURRENT_ACTION() = SAVE_SESSION, MSG(WARNING ,NULL, NULL, NULL, " Performed
action : Save Session")
4.3.36 CURRENT_CASE
4.3.36.1 Description
Returns the current case management record. This keyword is only valid when used in the
context of Case Message Templates, which builds the message with the CASE_MSG()
keyword.
4.3.36.2 Synopsis
CURRENT_CASE()
4.3.36.3 Arguments
No argument required.
4.3.36.5 Example
CURRENT_CASE().instr_id.code, for the current case, gives the code of instrument (only
when an Instrument is directly linked to a Constraint, for example, in the case of Trading
Constraint).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 72
4.3.37 CURRENT_REC
4.3.37.1 Description
Returns the structure (extended positions, portfolio synthetics, etc.) for the current
structure.
4.3.37.2 Synopsis
CURRENT_REC( )
4.3.37.3 Arguments
None (empty argument list).
4.3.37.5 Remarks
This function is only used to define the Base value of a debt. You use it as part of the second
argument of a totaliser function.
4.3.37.6 Examples
TOT_SUM(pos_val_id.ref_mkt_val_m,portfolio_id= CURRENT_REC().portfolio_id AND
nature_e = CURRENT_REC().nature_e )
4.3.38 CURRENT_YIELD
4.3.38.1 Description
Computes an instrument's current yield.
4.3.38.2 Synopsis
CURRENT_YIELD(instr, date [,flag1 ] [, income tax ] [, flag2 ])
4.3.38.3 Arguments
Argument Description
instr Id or code of the instrument whose current yield is to be computed.
flag1 Optional dividend projection flag that indicates if the current yield for stocks and fund
shares must be based on projected dividends (1) or paid dividends (0). The default is
False (0). Note that the last paid coupon is always used to compute the current yield for
bonds even if the projection flag is enabled. Specify the payment frequency for stocks in
the static data and not in the income events.
income tax Optional income tax rate. If the tax rate is 25%, the argument is 25.
flag2 Optional clean price flag. If the flag is activated, the clean price (excluding accrued
interests) is used for the denominator; otherwise the dirty price is used. The default is 0.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 73
4.3.38.5 Remarks
The current yield is only computed for the following natures: Stock, Fund Share, Fixed
Income, Money Market, Option Bond or Convertible Bond.
4.3.38.6 Examples
CURRENT_YIELD(instr_id,DOMAIN().calc_from_d,0)
Computes the current yield of the instrument at the begin date specified in the domain.
4.3.39 DATE
4.3.39.1 Description
Returns a date based on the day, month and year arguments.
4.3.39.2 Synopsis
DATE(day , month , year)
4.3.39.3 Arguments
Argument Description
day Day number of the date to return. The allowed range is from 1 to 31.
month Number of the month to return. The allowed range is from 1 to 12.
year Year of the date to return. It can be a two-digit number (50 to 99 for 1950 to 1999 and
00 to 49 for 2000 to 2049) or a four-digit number.
4.3.39.5 Remarks
None.
4.3.39.6 Examples
DATE(17, 8, 1998)
4.3.40.1 Description
DATEADD adds a defined number of units (days, months or years) to a date and returns the
new computed date.
DATEDIFF returns the difference between two dates (the date1 and date2 arguments). The
difference is computed in the unit of the dateunit argument in the method specified by the
argument. The difference is positive if date1 is earlier than date2.
DATEPOSI returns a positioned date (preceding, next, begin, end) based on a given date.
4.3.40.2 Synopsis
DATEADD(date, dateunit, num)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 74
DATEDIFF(date1, date2, dateunit [ , method ] )
DATEPOSI(date, dateposition, dateunit)
4.3.40.3 Arguments
Argument Description
date Dates.
date1
date2
dateunit Keyword indicating the unit to be added. It must belong to the date units keywords.
dateposition Keyword indicating the way the date must be positioned. It must belong to the date
position keywords.
4.3.40.5 Remarks
None.
4.3.40.6 Examples
DATEADD("13/05/97",WEEK,1)
Returns 7.
DATEDIFF(20/05/97,13/05/97,WEEK)
Returns -1.
DATEPOSI(20/05/97, BEGIN_OF , MONTH )
Returns 01/05/97.
DATEPOSI( DATEADD( SYSDATE( ) , YEAR , -1) , END_OF , YEAR)
4.3.41 DATEPART
4.3.41.1 Description
Returns the requested part of a date as a number.
4.3.41.2 Synopsis
DATEPART(date, datepart )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 75
4.3.41.3 Arguments
Argument Description
date Date to analyse.
datepart Keyword indicating the part of the date to extract. It must a date part keyword.
4.3.41.5 Examples
DATEPART( SYSDATE( ), DAY_IN_YEAR )
4.3.42 DATEPOSI
Refer to section DATEADD, DATEDIFF, DATEPOSI.
4.3.43 DATESTR
4.3.43.1 Description
Converts a date to a string according to an optional mask and returns the string.
4.3.43.2 Synopsis
DATESTR(date [ , mask ] )
4.3.43.3 Arguments
Argument Description
date Date to be converted.
mask Optional mask applied to the converted number. It must be a string composed of the
following characters:
N in first position displays the null string if no date is specified
DD prints the day
MM prints the month in numeric format
MON prints the short name of the month, depending on the user’s language.
MONTH prints the full name of the month, depending on the user’s language.
YY prints the last two numbers of the year
YYYY prints the full year
HH displays the hour
II (2 uppercase i's) displays the minutes
SS displays the seconds
other characters are separators.
If mask is not specified, the default mask is DD/MM/YYYY.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 76
4.3.43.4 Return type
Returns a string.
4.3.43.5 Examples
DATESTR(DOMAIN( ).calc_from_d)
4.3.44.1 Description
DAYSINMONTH returns the number of days in the month passed as an argument.
DAYSINYEAR returns the number of days in the year passed as an argument.
4.3.44.2 Synopsis
DAYSINMONTH( month [ , year ] )
DAYSINYEAR( [ year ] )
4.3.44.3 Arguments
Argument Description
month Number from 1 to 12 indicating the month to be analysed.
year Optional number indicating the year to analyse. It can be a number of two digits (50 to
99 means 1950 to 1999 and 00 to 49 means 2000 to 2049) or a number of four digits. If
it is not specified, the current year is used by default.
4.3.44.5 Remarks
None.
4.3.44.6 Examples
DAYSINMONTH(5)
Returns 31.
DAYSINMONTH(2,1997)
Returns 28.
DAYSINYEAR(1997)
Returns 365.
4.3.45 DBDATETIME
4.3.45.1 Description
Returns the date and time from the database at the time of creating a record.
4.3.45.2 Synopsis
DBDATETIME()
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 77
4.3.45.3 Arguments
None.
4.3.45.5 Remarks
DBDATETIME is useful where a record needs to be maintained of the date and time of a
database occurrence such as the creation of an operation in the database.
4.3.45.6 Examples
DATESTR(DBDATETIME(),"HH:II:SS")
4.3.46 DEFAULT
4.3.46.1 Description
Returns the first non-NULL script definition from the preceding levels, which is then
substituted for the keyword. Can only be used in default values and input controls. The
underlying mechanism is, in fact, a dynamic cut and paste of the returned script definition.
4.3.46.2 Synopsis
DEFAULT()
4.3.46.3 Arguments
None.
4.3.46.5 Remarks
Cannot be used for filters.
4.3.46.6 Examples
Given the following values:
System default value: SYSDATE()
User default value: NULL
Function default value: IF(dim_port_dict_id=“portfolio”, calc_till_d, DEFAULT())
The default value that is executed is: IF(dim_port_dict_id = “portfolio”, calc_till_d,
SYSDATE()), that is, the first non-NULL value from the preceding levels.
As a second example, take the following values:
System default value: SYSDATE()
User default value: calc_from_d
Function default value: IF(dim_port_dict_id=“portfolio”, calc_till_d, DEFAULT())
The default value that is executed is: IF(dim_port_dict_id = “portfolio”, calc_till_d,
calc_from_d)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 78
4.3.47 DENOMINATION
4.3.47.1 Description
Returns the structure of an entity denomination.
4.3.47.2 Synopsis
DENOMINATION( entity , object , language )
4.3.47.3 Arguments
Argument Description
entity Entity string of the object whose denomination is to be returned. It can be a hard-coded
string surrounded by double quotes ("instrument", "portfolio", ...).
object Code or id of the object whose denomination is to be returned. The id must be used in
cases where the accessed entity has a complex business key, which has at least one
attribute more than the simple code.
language In which the denomination has to be returned. It must be one of the standard languages
defined in the system. Refer to the table ‘languages’ to see the codes of the available
languages.
4.3.47.5 Remarks
DENOMINATION can also be used indirectly. In that case, it requires only one argument (the
language) surrounded by square brackets ([ ]). If there is no denomination for the selected
language, the function returns the content of the Denomination field.
4.3.47.6 Examples
DENOMINATION("instrument", instr_id, "fr").denom
Both the following return the denomination of the type linked to the instrument:
DENOMINATION("type",instr_id.type_id, DOMAIN().language_dict_id).denom
and
instr_id.type_id.DENOMINATION[DOMAIN().language_dict_id].denom
The first uses the direct method and the second the indirect method.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 79
4.3.48 DEPENDENCE
4.3.48.1 Description
Checks how the default values are evaluated.
4.3.48.2 Synopsis
DEPENDENCE( [name] )
4.3.48.3 Arguments
Argument Description
name Optional. sqlname.c of an attribute.
4.3.48.5 Remarks
When you modify a value in the domain, the other default values that depend on this
attribute are re-evaluated. In this case, DEPENDENCE() returns 1.
4.3.48.6 Examples
DEPENDENCE( "calc_from_d")
Returns 0 when a new domain is displayed. If you change the date of calc_from_d, the
default values that depend on calc_from_d are re-evaluated and
DEPENDENCE("calc_from_d") returns 1. If these default values are re-evaluated due to a
change in another dependence, DEPENDENCE( "calc_from_d") returns 0.
4.3.49 DIFF
4.3.49.1 Description
Returns an array by calculating the relative change from one occurrence to another. You
must use this function with the STAT function to calculate statistics on the returned array.
4.3.49.2 Synopsis
DIFF(arrayfunct)
4.3.49.3 Arguments
Argument Description
arrayfunct One of the following functions with their correct arguments:
INSTR_PRICE_ARRAY(…)
EXCH_RATE_ARRAY(…)
INSTR_CHRONO_ARRAY(…)
PORT_CHRONO_ARRAY(…)
THIRD_CHRONO_ARRAY(…)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 80
4.3.49.4 Return type
Returns an array.
4.3.49.5 Examples
STAT(DIFF(INSTR_PRICE_ARRAY(DOMAIN().calc_from_d,1,1,100,"NESTLE","CHF"))).mean
Computes the average relative changes in the price of Nestlé over the 100 last prices.
4.3.50 DIFF_BUSINESSDATE
4.3.50.1 Description
Computes the number of business days between two dates.
4.3.50.2 Synopsis
DIFF_BUSINESSDATE ( date1 , date2 [ , calendar ] )
4.3.50.3 Arguments
Argument Description
date1 Begin date.
calendar Used to compute the number of business days between two dates.
4.3.50.5 Examples
DIFF_BUSINESSDATE( DOMAIN().calc_from_d, expiration_d,"FR-CALENDAR")
Computes the number of business days between the begin date of the domain and the
expiration date of the current record.
4.3.51 DISP_MSG
4.3.51.1 Description
Displays a message from the message table.
4.3.51.2 Synopsis
DISP_MSG (nature , code , language , text [,var1] [,var2] [..., var10] )
4.3.51.3 Arguments
Argument Description
nature Nature of the message to be displayed. If the message is hard-coded, it must be set to
NULL. Possible values are:
User Message
User Report Label
code Code of the message to display. It must belong to the message table. If the message is
hard-coded (using text argument), it must be set to NULL.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 81
Argument Description
language Code or id of the language in which the message is expressed. If the message is hard-
coded, code2 must be set to NULL.
text Hard-coded message. Must be set to NULL if the message is displayed via a code. This
message can contain references to variables. Refer to section PRINTF function for more
details.
var1 ... Optional variables whose values appear in the hard-coded message.
var10
4.3.51.4 Return
Returns a string of characters.
4.3.51.5 Examples
DISP_MSG ("User Message","NO-NEGATIVE-FIGURES","fr", NULL )
4.3.52 DOMAIN
4.3.52.1 Description
Returns a structure containing all the parameters of the current domain.
4.3.52.2 Synopsis
DOMAIN( )
4.3.52.3 Arguments
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 82
Name sqlname_c data_type
Exch. Valuation Rule exch_val_rule_id id_t
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 83
Name sqlname_c data_type
Frequency 1 freq1_n tinyint_t
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 84
Name sqlname_c data_type
List Historisation list_hist_e enum_t
4.3.52.5 Example
DOMAIN( ).calc_from_d
4.3.53 DURA
Refer to section CONV, DURA, MDURA.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 85
4.3.54 ENUM_LIST
4.3.54.1 Description
Displays a limited number of choices for fields whose datatype is enum_t.
4.3.54.2 Synopsis
ENUM_LIST ( choice1, choice2, ..., choicen )
4.3.54.3 Arguments
Argument Description
choice1...choicen numbers of the enumerated choices (refer to the Triple’A Plus Core Data Model
Reference Guide).
4.3.54.5 Remarks
This function can be used only in filters. You can only use a maximum of 255 arguments.
4.3.54.6 Examples
IF (nature_e = 2, ENUM_LIST (1, 2, 3) ) is used as the filter of the accrual_rule_e field of
the instrument table, this expression displays the first three choices if the instrument nature
is fixed income.
4.3.55 ESTVOL
4.3.55.1 Description
Computes the estimated volatility.
4.3.55.2 Synopsis
ESTVOL( [ instr ][, date ][, cur ][, flag ][, rule ][, freq ][, unit ][, readings ] )
4.3.55.3 Arguments
Argument Description
instr Optional id or code of the instrument on which the estimated volatility is to be calculated.
This argument can be omitted for extended positions.
date Optional reference date. If it is not specified, the default date is the begin date specified
in the domain.
cur Optional computation currency that indicates the currency the price must be converted
into. If not specified, the currency defaults to the option reference currency.
flag Optional calculation flag that specifies if the function must compute the volatility or query
the chronological database. The default is to use the chronological data.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 86
Argument Description
rule Optional historical volatility rule that defines the price to use:
1 for Default prices
2 for Closing prices
3 for High and Low prices
4 for High, Low and Closing prices
freq Frequency at which the data is extracted in accordance with argument 7, the frequency
unit. E.g.: every day, every two days, etc.
unit Optional historical volatility frequency unit - indicates the frequency unit at which the
data is extracted. You must use time unit keywords for this argument.
readings Optional historical volatility number of readings - specifies the number of periods or
occurrences.
4.3.55.5 Examples
ESTVOL( , DATEPOSI ( SYSDATE( ) , BEGIN_OF , YEAR ) )
Returns the estimated volatility of the current instrument at the beginning of the year.
4.3.56 EVENT_SCHEDUL
4.3.56.1 Description
Returns the oldest date of a specific nature from the event_scheduler table for a portfolio or
a list.
4.3.56.2 Synopsis
EVENT_SCHEDUL(entity, object1, event_nature)
4.3.56.3 Arguments
Argument Description
Entity Portfolio dimension entity (list or portfolio).
Object portfolio_id or list_id (or code) from which the event_scheduler date has to be retrieved.
Event_nature event_scheduler_nat_e (Synth Admin or Fusion) from which the event_scheduler date is
retrieved. Possible values are:
O = All
1 = Import
2= Fusion
3 = Synth Admin.
4.3.56.5 Examples
Constrained List with definition:
EVENT_SCHEDUL("portfolio",id,"Synth Admin")<>NULL
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 87
Returns a list of all the portfolios that have an event of Synth Admin nature in the
Event_Scheduler table.
4.3.57 EXCH_FORMAT
4.3.57.1 Description
Returns the structure of an exchange rate format.
4.3.57.2 Synopsis
EXCH_FORMAT( curr , underl_curr )
4.3.57.3 Arguments
Argument Description
curr Currency id or code.
4.3.57.5 Remarks
EXCH_FORMAT can also be used indirectly. In that case, it takes only one argument (the
underlying currency) surrounded by square brackets ([ ]);
4.3.57.6 Examples
EXCH_FORMAT(instr_id.ref_curr, "CHF").multiply_n
Returns the multiplicator of the instrument currency when quoted against CHF, as defined in
the exchange_format table.
instr_id.ref_curr_id.EXCH_FORMAT["CHF"].multiply_n
4.3.58 EXCH_RATE
4.3.58.1 Description
Returns an exchange rate structure.
4.3.58.2 Synopsis
EXCH_RATE(curr, date, underl_curr, flag1, flag2, flag3 [, type ] [, market ] [, flag4 ]
[, provider ] [, rule ] [, rule_coef_nat] )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 88
4.3.58.3 Arguments
Argument Description
curr Currency id or code.
flag1 Mandatory type flag. If this flag is set, you must also set the seventh argument (type);
a structure is only returned if an exchange rate exists for the given type. Otherwise, the
NULL value is returned.
flag2 Mandatory third flag (market). If this flag is set, you must also set the eighth argument
(market); a structure is only returned if an exchange rate exists for the given market.
Otherwise, the NULL value is returned.
flag4 Optional third party flag (provider). If it is set, you must also set the tenth argument; a
structure is only returned if an exchange rate exists for the given provider. Otherwise,
the NULL value is returned.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 89
4.3.58.5 Remarks
EXCH_RATE can also be used indirectly. In this case, do not specify the first argument and
surround the other arguments with square brackets ([ ]).
The exchange rate returned is the number of the underlying currency for one unit of
currency. Irrespective to the value of the system parameter EXCH_INVERSE_FLAG, this
implies that the default method (EXCH_INVERSE_FLAG=0) is always applied.
4.3.58.6 Examples
EXCH_RATE( instr_id.risk_curr_id ,DOMAIN().calc_till_d ,USD, 0 , 0 , 0 , , ,
).exch_rate
Returns the exchange rate of the instrument risk currency expressed in USD at the end date
of the domain.
EXCH_RATE(instr_id.ref_curr_id,DOMAIN().calc_till_d,"CHF",1,1,0,"Bid","0000103").exch
_rate
Returns the exchange rate of the instrument reference currency expressed in CHF. The rate
type must be Bid and the rate provider must be 0000103.
4.3.59 EXCH_RATE_ARRAY
4.3.59.1 Description
Returns an array of currency exchange rates.
4.3.59.2 Synopsis
EXCH_RATE_ARRAY(date, freq,unit, number,curr,underly_curr [ ,val_rule] )
4.3.59.3 Arguments
Argument Description
date The end date of the historical data (i.e. the end date of the series).
freq The frequency at which the data is extracted according to argument 3, the frequency
unit. e.g: each day, every two days, etc.
unit The frequency unit for extracting the data. Enumerated date unit keyword.
You must enter this argument between double quotes or use the corresponding
numerical value: for example, "Week" or 3.
curr currency_id.
4.3.59.4 Examples
STAT ( EXCH_RATE_ARRAY ( DOMAIN().calc_from_d, 1 ,1 , 100, fi_currency
,SYS_CURRENCY().id ) ).mean
Computes the average exchange rate of the instrument currency compared to the system
currency for the last 100 available rates.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 90
4.3.60 EXCH_UNDERLY_CURRENCY
4.3.60.1 Description
Returns a structure that defines the default underlying currency for the exchange rates. The
default underlying currency is not necessarily the same as the system currency.
4.3.60.2 Synopsis
EXCH_UNDERLY_CURRENCY( )
4.3.60.3 Arguments
None.
4.3.60.5 Remarks
Note that if the value returned by EXCH_UNDERLY_CURRENCY() is null, the result is the
same as SYS_CURRENCY().
4.3.60.6 Examples
EXCH_UNDERLY_CURRENCY( ).name
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 91
4.3.61 EXPORT_DATE
4.3.61.1 Description
Returns the date given as parameter (@export_date) to sel_export_data rpc. This keyword
can only be used for sel_export_data all other cases will return NULL.
4.3.61.2 Synopsis
EXPORT_DATE()
4.3.61.3 Arguments
None.
4.3.61.5 Examples
EXPORT_DATE().
4.3.62 EXPORT_PARAM
4.3.62.1 Description
Returns parameters given as parameter (@param1 to @param5) to sel_export_data rpc.
This keyword can only be used for sel_export_data all other cases will return NULL.
4.3.62.2 Synopsis
EXPORT_PARAM(param_number)
4.3.62.3 Arguments
Argument Description
param_number The number of the parameter to be returned.
4.3.62.5 Examples
EXPORT_PARAM(1)
4.3.63 FIRST_MKT_STRUCT_SUBSET
4.3.63.1 Description
Returns the market structure with the lowest rank from the records of the market structure
subset table of a grid.
4.3.63.2 Synopsis
FIRST_MKT_STRUCT_SUBSET(grid)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 92
4.3.63.3 Arguments
Argument Description
grid Id or code of the grid.
4.3.63.5 Remarks
FIRST_MKT_STRUCT_SUBSET can only be used with a grid with the market structure subset
nature.
4.3.63.6 Examples
FIRST_MKT_STRUCT_SUBSET(GET_OBJECT("grid",
grid_object_id).id).parent_market_segment_id
Returns the parent market segment of the market structure with the lowest rank in the
selected grid.
4.3.64 FMT_EXCH
4.3.64.1 Description
Formats an exchange rate according to criteria expressed in a currency format.
4.3.64.2 Synopsis
FMT_EXCH( rate [,cur1] [,cur2] [,flag] [,coef] )
4.3.64.3 Arguments
Argument Description
rate Exchange rate to format.
flag Optional flag that defines the way the exchange rate is displayed (currency/underlying
currency or underlying currency/currency).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 93
4.3.64.4 Return type
Returns a number.
4.3.64.5 Remarks
Note that the two last arguments are only taken into account when the two currencies are
not specified.
4.3.64.6 Examples
FMT_EXCH(pos_val_id.fi_exch_rate,fi_currency, DOMAIN().currency_id)
Formats the exchange rate of the instrument currency towards the currency of the domain.
4.3.65 FORMAT
4.3.65.1 Description
Provides access to the currently displayed format record.
4.3.65.2 Synopsis
FORMAT()
4.3.65.3 Arguments
None.
4.3.65.5 Remarks
This function can only be used with the Initiate Order function and its sub-functions when
you define the rights linked to the function.
4.3.65.6 Examples
IF (FORMAT().code LIKE "PCK*"
4.3.66 FREQ_DATE
4.3.66.1 Description
Used with the RISK_RATIO keyword. It returns the date derived from the frequency defined
in the parameters of the RISK_RATIO keyword to find the data that is valid at this date.
4.3.66.2 Synopsis
FREQ_DATE()
4.3.66.3 Arguments
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 94
4.3.66.5 Example
Refer to examples for the RISK_RATIO() keyword in section RISK_RATIO.
4.3.67 FUND_VALO
4.3.67.1 Description
Accesses a stored unit valuation element.
4.3.67.2 Synopsis
FUND_VALO ( portfolio , date , time_dim , account_nbr [, val_seq_number] [, instrument] [,
Sel_method])
4.3.67.3 Arguments
Argument Description
portfolio Portfolio id or code whose fund valuation is to be accessed.
account_nbr The element of the stored valuation to be returned. It corresponds to the account
number of an element in the accounting plan with the nature ‘Valuation’.
instrument Optional id or code. This argument will be implemented in a future release when
multiple units are managed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 95
4.3.67.5 Remark
If several "official" records exist for the specified date and the time_dim parameter is set to
CURRENT, the function selects the last official valuation record (identified by the optional
val_seq_number parameter).
4.3.67.6 Examples
FUND_VALO(portfolio_id,valuation_d,CURRENT,"9910",valo_seq_no_n). val_amount_m
Returns the last official fund_val_element amount before the domain's end date plus one
day.
4.3.68 FUS_DATE_RULE
4.3.68.1 Description
Returns the fusion date rule of the portfolio specified in the portfolio argument. If no
argument is provided, FUS_DATE_RULE returns the fusion date rule of the system. If the
FUSION_SWITCH_DATE system parameter is set and the date argument is less than the
fusion switch date, FUS_DATE_RULE() returns the value of the old fusion date rule. In any
other case, the fusion date rule is returned as in normal circumstances (refer to the Triple’A
Plus Core Operations, Positions, and Fusions Guide for more information).
4.3.68.2 Synopsis
FUS_DATE_RULE( [ portfolio ] [, date] )
4.3.68.3 Arguments
Argument Description
portfolio Optional portfolio id or code.
date Optional date (only necessary if the FUSION_SWITCH_DATE system parameter is set).
4.3.68.5 Remarks
If FUSION_SWITCH_DATE is set, it is important to set the date argument. If you do not
include the date argument, the system date is used by default.
4.3.68.6 Example
FUS_DATE_RULE( )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 96
Returns the fusion date rule of the system that is valid at the Begin Date (for an extended
position format).
FUS_DATE_RULE(“PTF_138”, DOMAIN().calc_from_date)
Returns the fusion date rule that is valid at the begin date of the domain.
4.3.69 GEOSUM
Refer to section SUM, GEOSUM.
4.3.70 GET_ADMIN_RIGHTS
4.3.70.1 Description
Indicates whether the current user has the rights to run a specific action for a specific
record. Two different types of rights can be changed:
Data profile security: rights linked to the data profile of the current user.
Function security: rights linked to the function security profile of the current user.
The current selected object could be any from any entity. For entities without data security
profile, all actions will be allowed.
4.3.70.2 Synopsis
GET_ADMIN_RIGHTS(entity , object , action[, data_profile_flag ][, fct_flag])
4.3.70.3 Arguments
Argument Description
entity Mandatory sqlname of the record’s entity.
object Mandatory id or code of the record for which the user wants to know whether he has
the rights to run a specific action.
action Mandatory value to define actions for which rights must be checked.
0 or VIEW: Rights to view the record. This action is only defined by the data profile;
there is no definition of this action in the function security profile. The view flag of
function security is linked to menu construction in the GUI.
1 or CREATE: Rights to create a record. This action is only defined by the function
security profile; there is no definition of this action in the data profile.
2 or UPDATE: Rights to update the record. This action can be defined by the data
profile or the function security profile.
3 or DELETE: Rights to delete the record. This action can be defined by the data
profile or the function security profile.
data_profile_flag Optional flag which indicates whether the data profile must be checked. If this flag is
not specified, the default value is TRUE (to be checked).
fct_flag Optional flag which indicates whether the function security must be checked. If this
flag is not specified, the default value is TRUE (to be checked).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 97
4.3.70.5 Examples
GET_ADMIN_RIGHTS(“porfolio”, portfolio_id, UPDATE)
Returns TRUE if the current user has the rights to update the given portfolio. Check is based
on data profile and function security profile.
GET_ADMIN_RIGHTS(“porfolio”, portfolio_id, DELETE, TRUE, FALSE)
Returns TRUE if the current user has the rights to delete the given portfolio. Check is only
based on data profile.
GET_ADMIN_RIGHTS(“porfolio”, portfolio_id, UPDATE, FALSE, TRUE)
Returns TRUE if the current user has the rights to update the given portfolio. Check is only
based function security profile.
4.3.71 GET_APPL_PARAM
4.3.71.1 Description
Returns a string representing the value of a system parameter.
4.3.71.2 Synopsis
GET_APPL_PARAM( code [, user] )
4.3.71.3 Arguments
Argument Description
code Code of the parameter to be retrieved.
4.3.71.5 Remarks
The string can be converted with the STRDATE and STRNUM functions.
4.3.71.6 Examples
GET_APPL_PARAM("WORKDATE")
4.3.72 GET_BALANCE
4.3.72.1 Description
Returns the sum of the quantity or of an expression based on the extended position array
resulting from the SEL_EXTPOS function.
4.3.72.2 Synopsis
GET_BALANCE( flag , ext_pos_array , filter, expression )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 98
4.3.72.3 Arguments
Argument Description
flag This argument is important whenever an operation is modified. It indicates whether the
quantity generated by the currently modified operation must be taken into account (0)
or not (1). Possible values are:
0: take into account
1: do not take into account
ext_pos_array Extended position array. This argument normally includes the SEL_EXTPOS function.
filter Optional filter which has to be applied on the extended position array. The ampersand
sign (&) must be used to reference an attribute of the selected extended positions.
expression Optional expression that sums an extended position expression instead of working
simply on the quantity_n attribute. If this argument is not passed to the function, the
computation is performed on the quantity_n extended position attribute as before.
4.3.72.5 Examples
IF ( GET_BALANCE (1 , SEL_EXTPOS( portfolio_id , instr_id , operation_d) , &status_e
= status_e) < quantity_n , MSG(WARNING ,"quantity_n", 2 , NULL,"quantity too high for
the held position"))
If this expression is defined as an input control for a Sell operation, it displays the message
"quantity too high for the held position" if the quantity specified in the operation is greater
than the held position.
IF ( GET_BALANCE (1, SEL_EXTPOS( portfolio_id , NULL , operation_d ) , &status_e =
status_e AND &instr_id.nature_e = 4, &quantity_n * &pos_exch_rate)<quantity_n *
op_exch_rate, MSG(WARNING ,"quantity_n", 2 , NULL, "Account quantity too high
compared to held cash positions"))
IF ( GET_BALANCE (1 , SEL_EXTPOS( portfolio_id , NULL , operation_d ) , &status_e =
status_e AND &instr_id.nature_e = 4, &quantity_n * EXCH_RATE( &instr_id.ref_curr_id ,
operation_d , op_currency_id , 0 , 0 , 0 , , , ).exch_rate )<quantity_n *
op_exch_rate , MSG(WARNING ,"quantity_n", 2 , NULL, "Account quantity too high
compared to held cash positions"))
IF(GET_BALANCE(1,SEL_EXTPOS(portfolio_id,account_id,operation_d),&status_e=40)
<acc_net_amount_m, MSG(WARNING,"acc_net_amount_m",2, "Not enough cash on the
account",NULL))
If this expression is defined as an input control for a Buy operation, it displays the message
"Not enough cash on the account" if the amount to be debited from the account is greater
than the current balance of the account at the operation date and the account status is equal
to 40 (Accounted).
4.3.73 GET_BALANCE_POS_TYPE
4.3.73.1 Description
Returns the structure of a balance position type in the database.
4.3.73.2 Synopsis
GET_BALANCE_POS_TYPE( rank )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 99
4.3.73.3 Arguments
Argument Description
rank The rank of balance position type to find.
4.3.73.5 Examples
GET_BALANCE_POS_TYPE( 1 ).code can be used to find the balance position type with the
rank 1.
4.3.74 GET_BEST_OBJECT
4.3.74.1 Description
Returns the structure of an occurrence of an entity corresponding to the function's first non-
null filter criteria.
4.3.74.2 Synopsis
GET_BEST_OBJECT (entity, general criteria, filter1, sort criteria1.1, Ascending-Descending,
sort criteria1.2, Ascending-Descending, filter2, sort criteria2.1, Ascending-Descending, sort
criteria2.2, Ascending-Descending, filter3, sort criteria3.1, Ascending-Descending, sort
criteria4.2, Ascending-Descending, filter1, sort criteria4.1, Ascending-Descending, sort
criteria4.2, Ascending-Descending)
4.3.74.3 Arguments
Argument Description
entity Mandatory. name of the entity whose occurrence is returned. To refer to this entity,
you must use the GET_ENTITY keyword.
general criteria Mandatory. A script expression that selects from the entity passed as the first
argument. Referenced attributes of the corresponding entity must be preceded by the
character ‘&’. The remaining arguments (filter criteria) refer to this array of
occurrences. The role of this argument is to limit accesses to the database.
filter1 Script expression that selects from the records returned by the second argument.
Referenced attributes of the corresponding entity must be preceded by the character
‘&’.
Sort criteria1.1 Optional sorting criteria. Referenced attributes of the corresponding entity must be
preceded by the character ‘&’.
Sort criteria1.2
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 100
Argument Description
filter2 Optional script expression. Referenced attributes of the corresponding entity must be
preceded by the character ‘&’.
filter3
filter4
Sort_criteria Optional sorting criteria. Referenced attributes of the corresponding entity must be
2.1 … 5.2 preceded by the character ‘&’.
4.3.74.5 Remarks:
The general criterion selects an array of records from the entity specified as the first
argument of the function from the database. This operation is based on a script expression
that has a corresponding SQL command (i.e. the script expression can be run using a SQL
command). If this is not the case, Triple'A Plus Core writes a message to the log file.
The number of records returned by the general criteria is specified by the value of the
MAX_GET_BEST_OBJECT_NUMBER system parameter. If the procedure returns more than the
specified number, a message is written to the log file.
Note that you cannot use embedded calls with the keywords GET_BEST_OBJECT and
GET_OBJECT_ARRAY. For example, a GET_BEST_OBJECT statement cannot take as a
parameter the result from an embedded GET_BEST_OBJECT or GET_OBJECT_ARRAY call.
4.3.74.6 Example
Payment instructions.
To ensure that a value is always returned when you define payment instructions, you can
use the following script:
GET_FIRST_OBJECT ("instrument", GET_BEST_OBJECT (GET_ENTITY("instrument"), &nature_e
= 4 AND &portfolio_id = portfolio_id, &ref_curr_id = instr_id.ref_curr_id, &code, 1,
, , instr_id.euro_conv_d <> NULL AND &ref_curr_id.code = "EUR", &code, 1, , ,
instr_id.euro_conv_d <> NULL AND &ref_curr_id.code IN ("DEM", "FRF", "BEF"), &code,
1, , , &ref_curr_id = portfolio_id.currency_id, code).id,
PTF_DEF_ACCOUNT(portfolio_id, op_currency_id, 1, type_id, subtype_id).id).id
This script searches for accounts in the portfolio whose currency is the same as the
instrument currency.
If more than one is found, they are sorted by code and the first is returned. If no accounts
are found, the script interprets the second filter, that is, it checks if the instrument currency
is an "in" currency.
If so, it searches for accounts in the portfolio with the euro currency. If more than one is
found, they are sorted by code and the first is returned. If no accounts are found, the script
interprets the third filter, that is, it checks if the instrument currency is an "in" currency.
If so, it searches for accounts in the portfolio with one of the following currencies: DEM, FRF
or BEF. If more than one is found, they are sorted by code and the first is returned. If none
is found, the script interprets the fourth filter.
Again, it searches for accounts in the portfolio whose currency is the same as the instrument
currency. If more than one is found, they are sorted by code and the first is returned. If
none is found, it executes the PTF_DEF_ACCOUNT keyword.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 101
4.3.75 GET_DEF_OPTION
4.3.75.1 Description
Returns the structure of the instrument whose nature is passed. The structure includes the
reference currency, underlying instrument currency. The instrument's default flag must be
set to TRUE. Applies to Options (3) or Exotic Options (22).
4.3.75.2 Synopsis
GET_DEF_OPTION(nature, curr, underly_curr)
4.3.75.3 Arguments
Argument Description
nature Mandatory instrument nature.
4.3.75.5 Remarks
This keyword is an extension of the GET_RATE() keyword. GET_RATE() retrieves instruments
whose nature is Rate and whose default flag is set to TRUE, in the specified currency.
GET_DEF_OPTION() retrieves instruments of nature Option (3) or Exotic Options (22) in the
specified currency, whose default flag is TRUE and also the specified underlying instrument
currency. You can use the keyword, for example, to retrieve an Option instrument in a
specified currency and underlying currency, considered as a default repository of volatility for
all the options in same currency and underlying currency.
4.3.75.6 Examples
GET_DEF_OPTION("Option", CHF, USD).code
Returns the code of the CHF option instrument flagged as default, whose underlying
instrument reference currency is USD.
4.3.76 GET_ENTITY
4.3.76.1 Description
Returns the identifier of an entity.
4.3.76.2 Synopsis
GET_ENTITY ( name )
4.3.76.3 Arguments
Argument Description
name Name of the entity.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 102
4.3.76.4 Return value
Returns the id of the entity.
4.3.76.5 Remarks
This function is mainly used as the first argument of the AUTOCREATE function
4.3.76.6 Examples
GET_ENTITY("instrument")
4.3.77 GET_EXT_OP
4.3.77.1 Description
Returns the structure of an extended operation that corresponds to the arguments.
4.3.77.2 Synopsis
GET_EXT_OP ( code[ ,status] [ , seq_number ] )
4.3.77.3 Arguments
Argument Description
code Indicates the code of the extended operation to be returned.
4.3.77.5 Examples
The following example checks that the reversed operation exists:
IF (revers_oper_nat_e = 1 AND GET_EXT_OP( revers_oper_code).operation_id= NULL, MSG
( ERROR,"revers_oper_code", NULL, NULL,"Operation to reverse not found") )
4.3.78 GET_EXTOP_NUM
4.3.78.1 Description
Counts how many extended operations have been opened in a period. This function must be
used in combination with the function SEL_EXTOP.
4.3.78.2 Synopsis
GET_EXTOP_NUM ( array [ , filter ] )
4.3.78.3 Arguments
Argument Description
Array Array of extended operations returned by the SEL_EXTOP function.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 103
Argument Description
Filter Script expression performing a selection among the array returned by SEL_EXTOP. Any
referenced attribute belonging to the extended operation entity must be preceded by the
character &.
4.3.78.5 Examples
IF ( GET_EXTOP_NUM ( SEL_EXTOP ( portfolio_id , instr_id , operation_d ,"31/12/9999",
0) , &status_e_e.LABEL[]="Accounted") != NULL , MSG ( WARNING ,"instr_id", NULL ,
NULL ,"Other operations have been booked for this position") )
Displays a warning when an operation has been introduced with a status "Accounted" and
with the same operation date or later.
4.3.79 GET_FIRST
4.3.79.1 Description
Returns the first non null argument of the function.
4.3.79.2 Synopsis
GET_FIRST ( [param1] , [param2 ] , [param3 ] , [param4 ] , [param5 ] , . . . [param32 ])
4.3.79.3 Arguments
Argument Description
param1…param32 Optional script expressions of any type (number, string or date).
4.3.79.5 Examples
This following type of script definition:
IF(instr_id.DENOMINATION[].denom<>NULL, instr_id.DENOMINATION[].denom, instr_id.name)
4.3.80 GET_FIRST_OBJECT
4.3.80.1 Description
Returns the structure of an occurrence of an entity corresponding to the id of the first non
null argument of the function.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 104
4.3.80.2 Synopsis
GET_FIRST_OBJECT ( name , [ id1 ] [, id2] [, id3] [, id4] [, id5 ] [, id6 ] [, id7 ] [, id8 ] [,
id9 ] [, id10] )
4.3.80.3 Arguments
Argument Description
name Name of the entity from which an occurrence has to be returned.
Id1…id10 Optional script expressions returning an id of an occurrence of the entity specified as first
argument.
4.3.80.5 Examples
GET_FIRST_OBJECT("calendar", instr_id.ud_calendar_id, market_third.ud_calendar_id,
instr_id.ref_curr_id.calendar_id).code
Returns the code of the first non-null occurrence of the calendar specified in the current
instrument, the calendar of the current market or the calendar of the reference currency of
the current instrument. If the three arguments are all null, the NULL value is returned.
4.3.81 GET_FMTROOT
4.3.81.1 Description
Finds the root of an element in a format. It can be used with various format natures. A root
is an element without parent in the current dataset set, even id the parent_id is not null it
can be a root for the format.
4.3.81.2 Synopsis
GET_FMTROOT(parent attribute , id attribute [, element’s id ])
4.3.81.3 Arguments
Argument Description
parent Attribute where the parent id is stored.
attribute
element’s id Optional id of an element, if the value is not given, a root is returned only if it is unique
(if multiple roots exist and no id given, NULL is returned).
4.3.81.5 Remarks
It can only be used for format element definition.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 105
4.3.81.6 Limitations
It can only be used in format based on entity with hierarchy between a parent_id element
and an id element. This is possible on two tables, ext_strategy_element and
ext_ret_analysis.
4.3.81.7 Examples
GET_FMTROOT(parent_id, id, id).code
4.3.82 GET_FT_RATE
4.3.82.1 Description
Returns the structure of the ft_rate table for a line corresponding to a tax convention
history. This function will be mainly used in a default value context to compute the tax
amounts.
4.3.82.2 Synopsis
GET_FT_RATE ( array , filter )
4.3.82.3 Arguments
Argument Description
array Array of history returned by the function SEL_FT_RATE.
filter Script expression allowing to perform a selection among the array. Attributes referring.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 106
Name sqlname_c data_type
Long Term Period long_term_period_n tinyint_t
4.3.82.5 Examples
GET_FT_RATE(SEL_FT_RATE(portfolio_id.tax_convention_id,
operation_d),&instr_list_id=instr_id.CLASSIFY[portoflio_id.tax_convention_id.classifi
cation_id].list_id AND &tax_geo_id = instr_id.tax_geo_id).reclaim_tax_rate_p / 100 *
op_gross_amount_m
4.3.83 GET_MASTER
4.3.83.1 Description
This function is applicable in the context of a compound order.
It provides the ability to access any attribute of the master element of a compound order
from any other elements.
It can be used on all logical entity link to operation (e.g., Buy, Sell, Income) and
ext_operation.
4.3.83.2 Synopsis
GET_MASTER()
4.3.83.3 Arguments
Not applicable.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 107
4.3.83.4 Return type
Returns the record of the entity associated with the master element of a compound order.
4.3.83.5 Examples
GET_MASTER().instr_id.end_d
Provides the end date of the instrument defined in the master element order of a compound
order.
4.3.84 GET_OBJECT
4.3.84.1 Description
Returns the structure of any object in the database.
Refer to the Triple’A Plus Core Data Model Reference Guide for the structure of an entity
type.
4.3.84.2 Synopsis
GET_OBJECT( entity , object )
4.3.84.3 Arguments
Argument Description
entity String, entity type of the object.
4.3.84.5 Examples
GET_OBJECT( instrument , MSN.O ).face_value_n
GET_OBJECT("portfolio","45897-29").third_id.name
4.3.85 GET_OBJECT_ARRAY
4.3.85.1 Description
Returns an array of data of any sort from any entity in the Triple'A Plus Core database.
4.3.85.2 Synopsis
GET_OBJECT_ARRAY(entity, general_criteria, attribute_return [,filter] [, distinct_flag] [,
database_flag ])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 108
4.3.85.3 Arguments
Argument Description
entity Name of the entity whose data is returned. To refer to this entity, you must use the
GET_ENTITY keyword.
general_criteria This argument is a script expression that selects an initial array of data from the
reference entity defined in the first argument. The referenced attributes of the
corresponding entity must be preceded by the ampersand character (&). The filter
criteria argument refers to this array of data. The role of this argument is to limit calls
to the database.
Attribute_return Name of the specific attribute (from the reference entity) that you want to obtain in
an array. It must be preceded by the ampersand character (&).
filter Optional. This argument is a script expression that is applied to the records returned
by the general criteria. Note that the referenced attributes of the corresponding entity
must be preceded by the character ‘&’. You can use any Triple'A Plus Core script
keywords in this expression.
distinct_flag Optional. If set to 1, the system returns each data item only once. It automatically
defaults to 1 when used with filters.
database_flag Optional. If set to 0 (the default value), the system returns data from the physical
database. If set to 1, the system returns data from the memory.
4.3.85.5 Remarks
The GET_OBJECT_ARRAY keyword is similar to the following keywords:
EXCH_RATE_ARRAY
INSTR_CHRONO_ARRAY
INSTR_PRICE_ARRAY
LIST_CHRONO_ARRAY
PORT_CHRONO_ARRAY
THIRD_CHRONO_ARRAY
All these keywords return an array of data. However, in this case, they process specific
entities and pass numerical data only to the script functions that accept an array as an input
parameter (i.e. DIFF, REGR, SUM, GEOSUM, STAT).
GET_OBJECT_ARRAY is more flexible: you can obtain any data you want from any entity. In
addition, instead of passing data to a function that takes arrays, you can define a filter with
the GET_OBJECT_ARRAY and IN() keywords. For example, you can display all the trading
places linked to an instrument in a drop-down list.
Note that you cannot use embedded calls with the keywords GET_BEST_OBJECT and
GET_OBJECT_ARRAY. For example, a GET_BEST_OBJECT statement cannot take as a
parameter the result from an embedded GET_BEST_OBJECT or GET_OBJECT_ARRAY call.
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 109
4.3.85.6 Examples
The following example illustrates a filter on the MarketThirdId attribute in the Buy Operation
entity:
&id IN (GET_OBJECT_ARRAY(GET_ENTITY("trading_place"),
&instr_id=instr_id,&market_place_id,&market_place_id.code LIKE "A*"))
This script example returns all the market places linked to the instrument specified in your
order input screen where the first character of the code is A.
4.3.86 GET_OP_NUM
4.3.86.1 Description
Counts how many operations have been opened in a period. This function must be used in
combination with the function SEL_OP.
4.3.86.2 Synopsis
GET_OP_NUM ( array [ , filter ] )
4.3.86.3 Arguments
Argument Description
array Array of extended operations returned by the SEL_OP function.
filter Script expression performing a selection among the array returned by SEL_OP. Any
referenced attribute belonging to the operation entity must be preceded by the character
&.
4.3.86.5 Example
GET_OP_NUM ( SEL_OP ( portfolio_id , instr_id , 0 , DOMAIN().calc_from_d ,
DOMAIN().calc_till_d ) )
4.3.87 GET_RATE
4.3.87.1 Description
Returns the risk free rate linked to a currency.
4.3.87.2 Synopsis
GET_RATE ( curr )
4.3.87.3 Arguments
Argument Description
curr Currency id or code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 110
4.3.87.5 Example
GET_RATE(fi_currency_id).code
Returns the code of the instrument which is the risk free rate of the instrument currency.
4.3.88 GET_RIGHTS
4.3.88.1 Description
Indicates whether the current user has the rights to run a specific function on the current
selected object. Three different types of rights can be checked:
function security: rights linked to the function security profile of the current user
function: evaluation of the rights script linked to the given function
portfolio: rights linked to portfolio data security profile
The currently selected object could be a position, an operation, a strategy element, or
formatted data.
4.3.88.2 Synopsis
GET_RIGHTS( function[, fct_flag ][, script_flag ][, ptf_data_flag ])
4.3.88.3 Arguments
Argument Description
function Mandatory sysname. This is the proc_name of the function the user wants to know if he
has the rights to run the current selected object.
fct_flag Optional flag which indicates whether the function security must be checked. If it is not
specified, the default value is TRUE (to be checked).
script_flag Optional flag which indicates whether the rights script must be evaluated. If it is not
specified, the default value is TRUE (to be checked).
ptf_data_flag Optional flag which indicates whether portfolio data security must be checked, i.e
whether the user access rights need to be checked. Default value is TRUE (to be
checked).
4.3.88.5 Examples
GET_RIGHTS(“sub_initiate_order”, TRUE, TRUE, FALSE)
Returns TRUE if the current user has the rights to run the function sub_initiate_order in his
function security profile (create flag equal TRUE in the corresponding composition) and if the
evaluation of the rights script linked to this function returns TRUE. In this case, the portfolio
security rights are not tested within GET_RIGHTS: it is surely tested elsewhere.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 111
4.3.89 GET_RISK_COMPLIANCE
4.3.89.1 Description
Loads the risk compliance of an indicator from the Risk Strategy Element Composition. This
service is used for building format based on Risk Strategy Element or Extended Strategy
Element.
4.3.89.2 Synopsis
GET_COMPLIANCE (Id, Nature)
4.3.89.3 Arguments
Argument Description
Id Id of the risk _strategy_element, mandatory.
4.3.89.5 Remarks
The risk strategy element compostion structure is generated when the Check Strategy or
PTCC functions are launched with the risk mode activated.
4.3.89.6 Example
GET_RISK_COMPLIANCE(risk_strategy_element_id,1).obj_pct_n
Returns the objective expressed as a percentage of the risk indicator "VaR %".
4.3.90 GET_RISK_OBJECTIVE
4.3.90.1 Description
Returns the loading of risk threshold/objectives applicable for a portfolio from strategy or
from the portfolio compliance chrono.
4.3.90.2 Synopsis
GET_RISK_OBJECTIVE(nature,portfolio,Date,Risk Strategy,Flag,Convert amount)
4.3.90.3 Arguments
Argument Description
Nature Nature of risk indicator based on enumerated compliance chrono, mandatory.
Date Date on which objectives are valid, if no date is specified, the current is applied by
default.
Risk Code or Id of the risk strategy, mandatory if the flag (see below for argument “flag”) is
Strategy set to 0.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 112
Argument Description
1: objectives are retreived in the compliance chrono entity.
Convert If the risk indicator is expressed as an amount, an automatic conversion into the domain
amount currency is possible:
0 (by default): amount is not converted.
1: amount is converted in domain currency.
4.3.90.5 Remarks
When the convert flag is set to false, the currency of amount is returned. This currency is:
The currency of the risk strategy if data is retrieved in strategy entities.
The currency of the compliance chrono if data is retrieved in compliance chrono.
4.3.90.6 Examples
GET_RISK_OBJECTIVE (risk_nature_e,
risk_strategy_element_id.ext_strategy_element_id.portfolio_id, DOMAIN().calc_from_d,
risk_strategy_element_id.risk_strategy_id, 0, 0). min_n
4.3.91 GET_RISK_RULE
4.3.91.1 Description
Returns the data from risk rule composition entity.
4.3.91.2 Synopsis
GET_RISK_RULE (risk rule,rule type,rank)
4.3.91.3 Arguments
Argument Description
Risk rule Code or Id of risk rule, mandatory.
4.3.91.5 Remarks
A risk rule and rule type are delivered in the standard packaging:
Risk rule: PCK_DS_RULE_BY_DEFAULT
Rule type: PCK_DS_RULE_DEFAULT
The standard packaging is based on the risk rule composition with the
rule type = PCK_DS_RULE_DEFAULT and a rank = 1.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 113
4.3.91.6 Example
GET_RISK_RULE (DOMAIN().risk_rule_id,"PCK_DS_RULE_DEFAULT",1).confidence_level_ n.
Returns the level of confidence of the domain risk rule with the rule
type = PCK_DS_RULE_DEFAULT and the rank = 1.
4.3.92 GET_RISK_VALUE
4.3.92.1 Description
Returns the actual risk value from risk value element and risk value element composition
entities.
4.3.92.2 Synopsis
GET_RISK_VALUE (object entity, object, level of confidence, time horizon, time horizon unit,
post order, indicator nature, instrument, nature, grid, market segment, strategy, currency,
convert amount, date )
4.3.92.3 Arguments
Argument Description
Object Name of the entity: "portfolio" or "strategy", mandatory.
entity
Time Time horizon unit based on enumerated risk value element, mandatory.
Horizon unit
Market Code or Id of the market segment, optional. If empty, replaced by null value.
Segment
Convert If the risk indicator is expressed as an amount, an automatic conversion into the domain
amount currency is possible:
0 (by default): amount is not converted.
1: amount is converted into domain currency.
Date Date on which the risk values are valid; by default the domain "initial date".
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 114
4.3.92.4 Return type
Returns data from risk value element composition.
4.3.92.5 Remarks
Only a valid structure is returned; a valid structure must include an End Validity Date not
greater than the Input Date. If several valid structures are present, the more recent is
returned.
If a currency is defined in parameters, only the element in this currency is returned.
If no currency is defined, a first search is done to select the element on the domain currency.
If no element is returned, a second search is done without the currency. If several elements
are returned, the highest End Validity Date is chosen, and then if several elements are again
returned, the highest Computation Date is chosen.
If convert amount flag is set to true, indicators with an amount as data type must be
converted into the domain currency (if different) by using the Computation Date (of risk
value) as the Exchange Rate Date.
If the convert flag is set to false, the currency of the risk value is returned.
4.3.92.6 Example
GET_RISK_VALUE (
{entity} "portfolio",
{Object} risk_strategy_element_id.ext_strategy_element_id.portfolio_id,
{Level of Confidence} GET_RISK_RULE (DOMAIN().risk_rule_id,
"PCK_DS_RULE_DEFAULT", 1).confidence_level_n,
{Time Horizon} GET_RISK_RULE (DOMAIN().risk_rule_id,
"PCK_DS_RULE_DEFAULT", 1).time_horizon_n,
{Time Horizon Unit} GET_RISK_RULE (DOMAIN().risk_rule_id,
"PCK_DS_RULE_DEFAULT", 1).time_horizon_unit_e,
{0 without Orders, 1 with orders}0,
{Indicator nature} risk_nature_e,
{Instrument} risk_strategy_element_id.ext_strategy_element_id.instr_id,
{Grid} risk_strategy_element_id.ext_strategy_element_id.grid_id,
{Market Segment}
risk_strategy_element_id.ext_strategy_element_id.market_segment_id,
{Strategy} risk_strategy_element_id.ext_strategy_element_id.strategy_id,
{Currency},
{Convert Amount}1,
{Date} DOMAIN().calc_from_d
).indicator_value_m
Returns the actual risk value of the level defined by the setting of instrument, grid, market
segment, and strategy. With this script, all levels can be managed. Only a value valid on the
domain “initial date” is returned. This script is applied on a risk indicator expressed as an
amount; this amount is converted into the domain currency.
4.3.93 GET_SLAVE
4.3.93.1 Description
This function is applicable in the context of a compound order.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 115
It provides access to the record of a slave element of a compound order.
This keyword can be used on all logical entity linked to operation (e.g., Buy, Sell, Income)
and ext_operation. When it is used on logical operation, the extension field to ext_operation
must be used to get it. Then, extension to master order must be used to get the master
record. From master, an extension exists on all slave operations; it must be used to get all
slave operations and then to find the one corresponding slave element to return.
4.3.93.2 Synopsis
GET_SLAVE()
4.3.93.3 Arguments
Argument Description
code Code of the compound order rule slave element.
4.3.93.5 Example
GET_SLAVE(GET_BEST_OBJECT(GET_ENTITY("compound_order_slave_elt"),
&compound_order_master_elt_id=compound_order_master_elt_id).code).instr_id.name
Provides the name of the instrument defined in a slave element order of a compound order.
4.3.94 GET_SLAVE_ARRAY
4.3.94.1 Description
Returns array of values (as GET_OBJECT_ARRAY).
This function is applicable in the context of a compound order.
It provides access to the records of a set of slave element of a compound order.
This keyword can be used on all logical entity linked to operation (e.g., Buy, Sell, Income)
and ext_operation. When it is used on logical operation, the extension field to ext_operation
must be used to get it. Then, extension to master order must be used to get the master
record. From master, an extension exists on all slave operations; it must be used to get all
slave operations. Then, filter must be applied on all of them to build result array.
4.3.94.2 Arguments
GET_SLAVE_ARRAY(general,attribute)
Argument Description
general_criteria This argument is a script expression that selects an initial array of data from the
reference entity defined in the first argument. The referenced attributes of the
corresponding entity must be preceded by the ampersand character (&). The filter
criteria argument refers to this array of data. The role of this argument is to limit calls
to the database.
Attribute_return Name of the specific attribute (from the reference entity) that you want to obtain in
an array. It must be preceded by the ampersand character (&).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 116
4.3.94.4 Example
STAT(GET_SLAVE_ARRAY(&compound_order_slave_elt_id.compound_order_master_elt_id=compou
nd_order_master_elt_id AND &compound_order_code=compound_order_code,
&op_gross_amount_m)).maximum
Provides the biggest operation gross amount from the slave element orders of a compound
order.
4.3.95 GET_STRATEGY
4.3.95.1 Description
Retrieves a strategy linked to a portfolio or portfolio list at a specific date for a specific link
nature. The priority or the grid can also be mentioned.
4.3.95.2 Synopsis
GET_STRATEGY( port_dim , object , nature , date [, priority] [, grid] [, grid list] [,
expand_strategy] [, rank])
4.3.95.3 Arguments
Argument Description
port_dim Portfolio dimension object. Possible choices are "portfolio" or "list".
priority Optional.
expand_strategy Optional. Takes into account the components of the composite strategy. Possible
values are:
1 or "Investment profile"
2 or "Benchmark"
3 or "IP&Benchmark"
rank Optional. Rank of the strategy you want to retrieve. It depends on the Priority of the
Strategy Composition. If the Priority is NULL, the Strategy comes after the Strategies
with a defined rank.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 117
Name sqlname_c data_type
Code code code_t
4.3.95.5 Example
GET_STRATEGY("portfolio", portfolio_id, 2, DOMAIN().calc_from_d).code
Returns the code of the strategy linked to the current portfolio at the Initial Date of the
domain whose nature is Benchmark.
GET_STRATEGY("portfolio", portfolio_id, 1, DOMAIN().calc_from_d,,,,3,1).code
Returns the code of the first strategy linked to the current portfolio at the Initial Date of the
domain. It takes into account the strategies that are in the composition of both the
investment profile and the benchmark.
4.3.96 GET_TERM_EVENT
4.3.96.1 Description
Retrieves data from the Term Event table associated with the instrument.
4.3.96.2 Synopsis
GET_TERM_EVENT(instr, date)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 118
4.3.96.3 Arguments
Argument Description
instr Instrument id or code on which the computation is done. Optional only when the function
is used on an extended position. It can be an id or a code.
date Reference date on which the valid Term Event is retrieved, if not specified then the begin
date of the domain is used. It is a date.
4.3.96.5 Remarks
Returns the structure of the Term Event associated with the instrument, valid on the date.
Only the following instrument natures can have an associated Term Event:
3. Option
6. Future
7. Forward
22. Exotic Option
23. Swaption
4.3.96.6 Examples
GET_TERM_EVENT(instr_id, DOMAIN().calc_from_d).underly_instr_id
Returns the id of the underlying instrument specified in the instrument Term Event, or uses
the instrument's id if no Term Event has been defined.
4.3.97 GET_TYPE
4.3.97.1 Description
Returns the structure of any object in the database.
4.3.97.2 Synopsis
GET_TYPE( entity , attribute , type )
4.3.97.3 Arguments
Argument Description
entity String, entity of the type.
4.3.97.5 Examples
GET_TYPE( operation , type_id, T_Bonds ).id
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 119
Can be used to find the foreign key of the operation type that has the code T_Bonds.
4.3.98 GUARANTEE
4.3.98.1 Description
Returns the structure of a guarantee.
4.3.98.2 Synopsis
GUARANTEE( instrument , type , guarantor )
4.3.98.3 Arguments
Argument Description
instrument Id or code of the instrument.
4.3.98.5 Remarks
GUARANTEE can also be used in an indirect access context. In that case, it requires only two
arguments (the type of guarantee and the guarantor) surrounded by square brackets ‘[ ]’;
4.3.98.6 Example
GUARANTEE(instr ,"main", instr_id.issuer_third ).guarantee_p
Returns the percentage of guarantee the issuer has guaranteed on the current security
assuming that the guarantee type is "main".
instr_id.GUARANTEE["main" , instr_id.issuer_third ].guarantee_p
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 120
4.3.99 INIT
4.3.99.1 Description
Provides access to the currently selected record in the format.
4.3.99.2 Synopsis
INIT()
4.3.99.3 Arguments
None.
4.3.99.5 Remarks
This function is especially used to define the order grouping block init script. INIT()
represents one of the currently selected lines. It is also used in the Order Allocation function
to limit the list of domain allocation natures. In this case, INIT() represents the unallocated
block order. If the block order already has a child, only a manual allocation can be
performed.
4.3.99.6 Example
INIT().portfolio_id
Copies the portfolio_id of the selected line into the portfolio_id field of the new block order.
IF(dim_port_dict_id=NULL, ENUM_LIST(5), IF(INIT().eff_child_qty > 0, ENUM_LIST(5, 6),
ENUM_LIST(0,1,2,3,4,5,6)))
Limits the list of domain allocation natures according to the first condition.
4.3.100 INSTR_CHRONO
4.3.100.1 Description
Returns an instrument chronological data structure.
4.3.100.2 Synopsis
INSTR_CHRONO( instrument , date , nature , number , flag [, market] [, sub_nature_type])
4.3.100.3 Arguments
Argument Description
instrument Id or code of the instrument.
nature String. Refers to a chronological data type keyword- indicates which chronological
data has to be accessed. The available natures are listed in the data model.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 121
Argument Description
number Number of days for which a chronological data is valid.
0 days means always compute the chronological data,
1 day means valid the same day.
Null means that the system default defined in the appl_param table is used.
Following the nature of the instrument, the parameters referring to this argument
are:
BOND_DATA_VAL_PERIOD
STOCK_DATA_VAL_PERIOD
OPTION_DATA_VAL_PERIOD
FUTURE_DATA_VAL_PERIOD
flag Indicates that if no valid data is found the function will compute the data if possible.
Two integers are the possible values:
0: no computation
1: computation
market Optional. A search is made in the instr_chrono records to match the market (id or
code) provided. If this parameter is not provided, only a record with no market
(value =“NULL”) can be returned.
sub_nature_type Optional. The instr_chrono records are filtered using the sub-nature type code
provided. If this parameter is not provided, no filter is applied.
4.3.100.5 Remarks
INSTR_CHRONO also can be used in an indirect access context. In that case, it requires only
three arguments (the time dimension keyword, the chronological data type and the date)
surrounded by square brackets ‘[ ]’
4.3.100.6 Examples
INSTR_CHRONO(instr_id, DOMAIN().calc_from_d,"Beta",1,1).value_n
Returns the beta coefficient of the current instrument at the begin date of the domain. If the
data is not found in the database, it will be automatically computed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 122
4.3.101 INSTR_CHRONO_ARRAY
4.3.101.1 Description
Returns an array of instrument chronological data.
4.3.101.2 Synopsis
INSTR_CHRONO_ARRAY( date , freq , unit , number , instr , nature [, curr] [, missing_data]
[, market] [, sub_nature_type])
4.3.101.3 Arguments
Argument Description
date The date up to which the historical data is extracted (the end date of the series).
freq The frequency at which the data is extracted. The frequency unit is specified in
argument 3, unit, e.g. each day, every two days, etc.
unit The frequency unit at which the data is extracted. Enumerated date unit keyword.
The string version of the argument ("day", "month", etc.) has to be placed between
double quotes or replaced by the corresponding number: "Week" or 3.
number The number of readings indicates how many periods or occurrences are to be
selected.
nature Nature of the chronological data (e.g., alpha, beta, gamma, etc.). For the list of
available natures, refer to the instrument chrono table in the data model. The
argument must be placed in double quotes or replaced by the corresponding
number: "Beta" or 3.
curr Optional. The currency in which the chronological data should be returned. The
currency is converted using the prevalent exchange rates.
missing_data Optional. Specifies how missing data is treated by the financial server. If you pass 0
or NULL as the value, the most recent valid data is used. If you pass a value of 1,
the missing data is ignored, i.e. it is removed from the array. The missing_data
parameter can be used with any _ARRAY keyword, although in the other cases it is
the last parameter in the list and, consequently, its inclusion or replacement with a
comma in the parameter list is not critical.
market Optional. A search is made in the instr_chrono records to match the market (id or
code) provided. If this parameter is not provided, only a record with no market
(value =“NULL”) can be returned.
sub_nature_type Optional. The instr_chrono records are filtered using the sub-nature type code
provided. If this parameter is not provided, no filter is applied.
4.3.101.4 Examples
STAT (INSTR_CHRONO_ARRAY ( DOMAIN().calc_from_d, 1, 1, 50, instr_id, 3,
fi_currency_id) ).mean
Returns the average beta over the last 50 days for the current instrument.
4.3.102 INSTR_FLOW
4.3.102.1 Description
Returns the flow structure of an instrument.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 123
4.3.102.2 Synopsis
INSTR_FLOW( instr , date1, date2, position [, counter] [, nature][, subnature]
[,eventdaterule])
4.3.102.3 Arguments
Argument Description
instr Instrument id or code.
position Flow position used to determine which flow to return. The available values are:
FIRST: returns the earliest flow corresponding to the specified criteria.
PREVIOUS: returns a flow occurring strictly before the reference date.
CURRENT: returns the flow occurring at or immediately after the reference date.
NEXT: returns a flow occurring strictly immediately after the reference date
FINAL: returns the final flow corresponding to the specified criteria.
counter Optional flow counter used in conjunction with the PREVIOUS and NEXT flow positions to
enumerate the flows. If no flow counter is supplied, the function returns the one
corresponding to the integer 1.
nature Optional. Defines the flow nature such as a final redemption, a paid dividend,.... Default
value is 0 for any event. The different natures available are:
0: any event
1: income event
2: issue event
3: redemption event
4: debt event
5: term contract event
6: exchange event.
subnature Optional. Defines the flow sub-nature. The different sub-natures available are defined in
the table "flow" of the data model. Default value is 0 for any event. This argument will
be taken into account before the previous argument if both are provided.
eventdaterule Optional parameter. Choose between Term Date (value = 1) and Earliest Date (value =
2). The default is 1. Refer to the appendix of the Triple’A Plus Core Operations,
Positions, and Fusions Guide. You can only use Earliest Date (value = 2) in the following
case:
position = CURRENT, NEXT or LAST
nature = 0 (any event), 5 (term contract event) or 6 (exchange event)
subnature = 0 (any event), 14 (term expiration), 19 or 20 (optional conversions).
If you use Earliest Date in other cases, the result is the same as for Term Date.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 124
Name sqlname_c data_type
Event Number event_number_n int_t
4.3.102.5 Remarks
INSTR_FLOW can also be used in an indirect access context. In that case, the first argument
is not required and the other arguments must be surrounded by square brackets ‘[ ]’.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 125
If there is no event defined for the instrument, the flow returned will be based on the
instrument definition.
4.3.102.6 Examples
INSTR_FLOW(instr_id, DOMAIN().calc_from_d, DOMAIN().calc_from_d,
PREVIOUS,1,1).quote_n
Returns the next coupon date. Note that it is also possible to write
INSTR_FLOW(instr , DOMAIN().calc_from_d, DOMAIN().calc_from_d, CURRENT, ,1).end_d
4.3.103 INSTR_PRICE
4.3.103.1 Description
Returns an instrument price structure.
4.3.103.2 Synopsis
INSTR_PRICE( instr ,date ,flag1 ,flag2 ,flag3 ,flag4 [, curr ] [, type ] [, market ]
[, term_type ] [, flag5 ] [, provider ] [, val_rule ] [, val_rule_coef ] [, cost_quote ]
[, allow_adj_price_f ] )
4.3.103.3 Arguments
Argument Description
instr Instrument id or code.
flag1 Currency mandatory flag. If this flag is set, the seventh argument must be specified
and a structure will be returned only if an instrument price exists for the given
currency. Otherwise, the NULL value will be returned.
flag2 Type mandatory flag. If this flag is set, the eighth argument (type) must be
specified and a structure will be returned only if an instrument price exists for the
given type. Otherwise, the NULL value will be returned.
flag3 Third party (market) mandatory flag. If this flag is set, the ninth argument (market)
must be specified and a structure will be returned only if an instrument price exists
for the given market. Otherwise, the NULL value will be returned.
flag4 Term type mandatory flag. If this flag is set, the tenth argument (term_type) must
be specified and a structure will be returned only if an exchange rate exists for the
given term type. Otherwise, the NULL value will be returned.
market Optional third party (market) id or code. It has to be specified if flag3 is set.
flag5 Optional provider flag. If this flag is set the twelfth argument (provider) must be
specified and a structure will be returned only if an instrument price exists for the
given market. Otherwise, the NULL value will be returned.
provider Optional third party (provider) id or code. It has to be specified if flag5 is set.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 126
Argument Description
val_rule Optional code or id of the valuation rule to be used to determine the best price.
cost_quote Optional. This information is useful when the market price of an instrument is based
on its cost price (price calculation rule).
allow_adj_price_f Optional. If this flag is set, adjusted prices (i.e., prices which price type rank equal
to the value of the system parameter ADJUSTED_PRICE_TYPE_RANK) can be used.
4.3.103.5 Remarks
INSTR_PRICE also can be used in an indirect access context. In that case, the first argument
must not be specified and square brackets ‘[ ]’ must surround the arguments.
4.3.103.6 Examples
INSTR_PRICE(instr_id , DOMAIN().calc_from_d , 0 ,0 ,0 ,0 ,,,,).price_n
Returns the price of the instrument at the Initial Date of the domain.
INSTR_PRICE(instr , DOMAIN().calc_from_d , 0 , 0 , 0 , 0 , ,,, 1 , "FT").quote_n
Returns the quote of the current instrument if the provider "FT" has fed the price otherwise it
returns null.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 127
4.3.104 INSTR_PRICE_ARRAY
4.3.104.1 Description
Returns an array of instrument prices.
4.3.104.2 Synopsis
INSTR_PRICE_ARRAY(date , freq, unit, number, instrument [, curr ] [, val_rule] )
4.3.104.3 Arguments
Argument Description
date The date until which the historical data occurs (the end date of the series).
freq The frequency at which the data is extracted. This argument is a number that is used
with the frequency unit, argument 3, to define the frequency, e.g. 1, DAY for each day;
3, WEEK for every three weeks, etc.
unit The frequency unit at which the data is extracted. Enumerated date unit. The enumerated
values are as follows: DAY, 2; WEEK, 3; MONTH, 4; YEAR, 5
This argument must be passed in upper case characters or as the integer value assigned
to the unit: WEEK or 3.
Instrument Id or code.
curr The currency of the prices. Prices are converted using the current exchange rates.
4.3.104.5 Remarks
None.
4.3.104.6 Examples
STAT( INSTR_PRICE_ARRAY(DOMAIN().calc_from_d, 1, 1, 100, instr, fi_currency).mean
Returns the average price of the current instrument over the last 100 days.
4.3.105 INTEREST_COND
4.3.105.1 Description
Returns the structure of an interest rate condition.
4.3.105.2 Synopsis
INTEREST_COND( instr ,date1, date2, [rule], [nature] )
4.3.105.3 Arguments
Argument Description
instr Instrument id or code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 128
Argument Description
date1 Reference date at which the interest rate conditions are applied.
rule Optional interest calculation rule that allows selecting the interest rate condition (fixed or
floating rate).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 129
Name sqlname_c data_type
Average Period aver_period_n tinyint_t
4.3.105.5 Remarks
None.
4.3.105.6 Example
INTEREST_COND(instr_id,DOMAIN().calc_from_d, DOMAIN().calc_from_d ,
, ).interest_rate_p
Returns the interest rate applied at the begin date of the domain.
4.3.106 IS_BUSINESSDATE
4.3.106.1 Description
Checks if a specified date is a business day.
4.3.106.2 Synopsis
IS_BUSINESSDATE ( date [ , calendar ] )
4.3.106.3 Arguments
Argument Description
date The date to be checked.
4.3.106.5 Remarks
None.
4.3.106.6 Examples
IS_BUSINESSDATE( value_d ,"JPN-CALENDAR")
Returns 1 if the value date is a business date according to the calendar JPN-CALENDAR else
it returns 0.
4.3.107 IS_FMTLEAF
4.3.107.1 Description
Checks whether an element is a leaf in the current format. A leaf is an element without child.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 130
4.3.107.2 Synopsis
IS_FMTLEAF( parent attribute, id attribute, element’s id )
4.3.107.3 Arguments
Argument Description
parent attribute Attribute where the parent id is stored.
element’s id Id of an element.
4.3.107.5 Remarks
It can only be used for format element definition.
It always analyses whole elements of the format without taking into account format filters.
It can only be used in formats based on entities with a hierarchy between a parent_id
element and an id element. This is possible on two tables, ext_strategy_element and
ext_ret_analysis.
4.3.107.6 Examples
IS_FMTLEAF(parent_id, id, id)
For leaf, calculate the difference between objective and actual quantity.
4.3.108 IS_IN_LIST
4.3.108.1 Description
Returns 1 if the object specified by the object argument belongs to the list specified by the
list argument. Otherwise, it returns 0.
IS_IN_LIST can also be used in an indirect access context. In that case, it requires only the
list argument surrounded by square brackets ([ ]).
4.3.108.2 Synopsis
IS_IN_LIST( entity , object ,list [, date enum ] [, date ])))
IS_IN_LIST[ list ]
4.3.108.3 Arguments
Argument Description
entity String with the name of the entity type.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 131
Argument Description
date enum specifies in which context the user wants the data to be retrieved:
date enum = 0 to work on the Domain context
date enum = 1 to work on the current list
date enum = 2 to work on the historical list
date Date at which the user wants to perform the list historisation.
4.3.108.5 Remarks
When IS_IN_LIST is applied on a list of sectors, the second argument must be an id and not
a code. So, the following expression is correct:
IS_IN_LIST("sector", instr_id.SECTOR_ATTRIB["NACE"].sector_id,"R3-sector"),
whereas
IS_IN_LIST("sector", instr_id.SECTOR_ATTRIB["NACE"].sector_id.code,"R3-sector")
is incorrect.
4.3.108.6 Examples
IS_IN_LIST("currency",fi_currency_id,"DOLLAR_AREA_LIST")
Returns 1 if the currency of the current instrument belongs to the list "DOLLAR_AREA_LIST".
fi_currency_id.IS_IN_LIST["DOLLAR_AREA_LIST"]
4.3.109 LABEL
4.3.109.1 Description
Returns the label of an enum_t data type.
4.3.109.2 Synopsis
LABEL( entity , attribute , enum_t [, language ] )
4.3.109.3 Arguments
Argument Description
entity Entity of the object to be enumerated.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 132
4.3.109.5 Remarks
If the code of the language is not mentioned the default value is the name of the permitted
value. LABEL can also be used in an indirect access context. In this case, the function
requires only the 4th argument (the language code) enclosed in square brackets ‘[ ]’.
Note that you cannot use the LABEL function inside a filter definition.
4.3.109.6 Examples
instr_id.nature_e.LABEL[ ]
Returns the label of the nature of the current instrument in the system’s language.
instr_id.nature_e.LABEL[fr]
Returns the label of the nature of the current instrument in user's language.
4.3.110 LAST_BUSINESSDATE
4.3.110.1 Description
Determines the last business day of the month on basis of a specified date.
4.3.110.2 Synopsis
LAST_BUSINESSDATE (date [ , calendar ] )
4.3.110.3 Arguments
Argument Description
date Date from which the last business date of the month has to be computed.
4.3.110.5 Remarks
None.
4.3.110.6 Examples
LAST_BUSINESSDATE( DOMAIN().calc_from_d,"FR-CALENDAR")
Returns the last business day of the month of the Initial Date of the domain according to the
calendar FR-CALENDAR.
4.3.111 LAST_PORT_SYNTH
4.3.111.1 Description
Returns the most recent portfolio or list synthetic data (enum = 1) from the portfolios that
have an Event_Scheduler of nature Synth Admin that is earlier than the date (<date1).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 133
4.3.111.2 Synopsis
LAST_PORT_SYNTH(port_dim, object, risk_nat [, enum][, date])
4.3.111.3 Arguments
Argument Description
port_dim Portfolio dimension entity (list or portfolio).
object Portfolio or list (id or code) from which the last synthetic data is retrieved.
enum Optional joint with event_scheduler table (0 or NULL = without, 1=with join).
4.3.111.5 Remarks
None.
4.3.111.6 Examples
LAST_PORT_SYNTH("portfolio",GET_OBJECT("portfolio", port_object).id,0).final_d
4.3.112.1 Description
LEFT returns the first or leftmost num characters of the string argument.
RIGHT returns the last or rightmost num characters of the string argument.
If num is greater than the length of string, the whole string is returned.
4.3.112.2 Synopsis
LEFT ( str , num )
RIGHT ( str , num )
4.3.112.3 Arguments
Argument Description
str String.
4.3.112.5 Remarks
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 134
4.3.112.6 Examples
LEFT( instr_id.code , 3 )
Returns the three first characters of the code of the current instrument.
RIGHT("ABCDEF", 3 )
Returns "DEF".
4.3.113 LIST_CHRONO
4.3.113.1 Description
Returns a chronological data structure based on a portfolio list.
4.3.113.2 Synopsis
LIST_CHRONO(entity, object , time_dim , nature , date [, curr ] [, flag ] )
4.3.113.3 Arguments
Argument Description
entity Entity from which the chronological data list is built.
nature Refers to a chronological data type keyword - indicates which chronological data has to
be accessed. The different natures of list chrono chronological data are listed in the data
model.
4.3.113.5 Remarks
None.
4.3.113.6 Examples
LIST_CHRONO("portfolio",DOMAIN().port_object_id,LAST,"Market
Value",DOMAIN().calc_from_d,"CHF").value_n
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 135
Returns the value of the last available Market Value (stored in a chrono) for the current
portfolio list.
4.3.114 LIST_CHRONO_ARRAY
4.3.114.1 Description
returns an array of chronological data based on a portfolio list.
4.3.114.2 Synopsis
LIST_CHRONO_ARRAY( date , freq , unit , number , entity , list , nature , curr )
4.3.114.3 Arguments
Argument Description
date Date up to which the historical data occurs (the end date of the series).
freq The frequency at which the data is extracted according to the third argument, the
frequency unit, e.g. each day, every two days, etc.
unit The frequency unit at which the data is extracted. Enumerated date unit keyword.
This argument has to be entered in double quotes, for example "Week" or as the
corresponding numerical value, for example 3.
number The number of readings indicates how many periods or occurrences are to be selected.
nature Nature of the chronological data, e.g. market value. This argument must be entered
between double quotes or as the corresponding numerical value: "Market value" or 1.
curr Indicates the currency of the returned chronological data. This means that the currency is
converted using the prevalent exchange rates.
4.3.114.5 Remarks
None.
4.3.114.6 Examples
STAT
(LIST_CHRONO_ARRAY("31/01/2001",1,4,12,"portfolio",DOMAIN().port_object_id,"Market
Value","CHF")).mean
Computes the average Market Value over the last 12 months for the current portfolio list.
4.3.115 LIST_HIST_DATE
4.3.115.1 Description
Retrieves the historical date from the build list compo function when used in a list definition.
If the list is built using built list compo, LIST_HIST_DATE() returns build_list_compo.hist_id
if this attribute is not NULL. If build_list_compo.hist_id is NULL, LIST_HIST_DATE() returns
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 136
the system date. In every other case of list construction, LIST_HIST_DATE returns the
system date.
4.3.115.2 Synopsis
LIST_LIST_DATE()
4.3.115.3 Arguments
None.
4.3.115.5 Remarks
None.
4.3.115.6 Example
The following script is used in a list definition:
PORT_CHRONO(id,LAST, "composite", LIST_HIST_DATE(),"CHF").value_n=1
Creates a list of the portfolios with a port_chrono whose nature is "composite" and whose
value is 1 for the date when the list is built.
4.3.116.1 Description
LOWER converts all uppercase letters of the string argument to lowercase letters and returns
the resulting string.
UPPER converts all lowercase letters of the string argument to uppercase letters and returns
the resulting string.
4.3.116.2 Synopsis
LOWER( str )
UPPER( str )
4.3.116.3 Arguments
Argument Description
str String to be converted.
4.3.116.5 Remarks
None.
4.3.116.6 Examples
LOWER("AbcDEfG 123")
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 137
Returns "ABCDEFG 123".
UPPER( instr_id.code )
4.3.117.1 Description
MAX and MIN respectively return the maximum and the minimum of their arguments.
Maximum number of arguments supplied is 200.
4.3.117.2 Synopsis
MAX( val1 , val2,….,val200 )
MIN( val1 , val2,…..,val200 )
4.3.117.3 Arguments
Argument Description
val1 Numeric expressions.
val2
……..
val200
4.3.117.5 Remarks
If one of the arguments is the value NULL, the value NULL is returned.
If the maximum (or minimum) value among three or more arguments has to be returned,
embedded MAX (or MIN) can be used.
4.3.117.6 Examples
MAX(4.5, rate_p)
Returns the rate of the current position if it is greater than 4.5 else it returns 4.5.
MIN(4.5,rate_p)
Returns the rate of the current position if it is lower than 4.5 else 4.5 is returned
MAX(6.5,price_n,35.5,5.0)
Returns the price of the current position if it is greater than all the elements else 35.5 is
returned.
4.3.118 MDURA
Refer to section CONV, DURA, MDURA.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 138
4.3.119 MEAN_CAP
4.3.119.1 Description
Computes the mean invested capital.
4.3.119.2 Synopsis
MEAN_CAP( date1 , date2 , flag1 , flag2, flag3 [, flag4 ] [, flag5 ] [, flag6 ]
[, SEL_SYNTH() ][, meancap_f ])
4.3.119.3 Arguments
Argument Description
date1 Date from which the computation is done.
flag1 Tax credit mandatory flag which indicates whether tax credits are to be included as
withdrawals from the system.
flag2 Gross effect mandatory flag whether the investment and withdrawal amounts are Gross
or Net amounts
SEL_SYNTH Optional keyword that selects the port_synthetic data on which the return is calculated. If
the parameter is not used, the synthetic data linked to the current row is used by default.
Refer to section SEL_SYNTH keyword for more information.
Mean_cap_f Optional argument. The value NULL or 0 calculates a return with the mean capital, 1
calculates a return with the mean invested capital.
4.3.119.5 Remark
The mean invested capital does not take the uninvested period into account for the
calculation. On the contrary, the mean capital takes the entire period into account.
Consequently, the sum of market segment (or instrument) mean capitals equals the global
mean capital. Refer to section RETURN for an example.
4.3.119.6 Examples
MEAN_CAP(DOMAIN().calc_from_d,DOMAIN().calc_till_d,0,0,0)
Computes the mean invested capital between the begin date and the end date specified in
the domain.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 139
4.3.120 MIN
Refer to section MAX, MIN.
4.3.121 MSG
4.3.121.1 Description
Defines the message for the input control. The message is either displayed (in GUI client) or
printed (in importation client). It must always be used in combination with the conditional
keyword IF.
4.3.121.2 Synopsis
MSG( msgtype , attribute , msgnature , msgref , msgtxt [,var1] [,var2]
[, ... , var10] )
4.3.121.3 Arguments
Argument Description
msgtype A keyword describing the type of message. For the first type of message relating to the
standard input controls, the value can be ERROR, WARNING, or INFO. For the last two
types of messages, a confirmation request that is displayed after the input validation.
The value can be one of the following:
QUESTION_YES_NO_CANCEL
QUESTION_YES_NO
QUESTION_OK_CANCEL
attribute Name of the attribute of the entity type on which the cursor has to be located after
closing the error window. Enter the name as a string datatype enclosed in quotation
marks ("").
msgnature Integer or string giving nature of the message displayed if it has been defined in the
message table. It may be NULL, refer to Remarks section for more information. Possible
values are:
1: System Message
2: User Message
3: System Report Label
4: User Report Label
5: Multilingual Label
msgref String giving the reference of the message in the message table. It may be NULL, refer to
Remarks section for more information.
msgtxt String with the text of the message to present. It may be NULL, refer to Remarks section
for more information. This message can contain references to variables. Refer to section
PRINTF function for more details.
var1 .. Optional variables which content will appear in the hard-coded message.
var10
4.3.121.5 Remarks
If the message to present is defined in the message table, the msgnature and msgref
arguments must be specified and the msgtxt must be NULL. If msgref is not NULL and
msgnature is NULL then the following message is displayed: "Invalid nature provided for
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 140
message …". If no message exists for the provided nature in the database then the following
message is displayed: "Message … in appropriate language or appropriate nature not found
in database".
If the message you want to display is not stored in the message table but defined in the
current MSG function, the msgnature and msgref arguments must be NULL and the msgtxt
argument must be specified.
In Orders and Productivity functions, Input Controls for the Domain are executed before
those defined for operations. You can use a conditional statement with the
func_result_status_e attribute in the input control to display specific messages, for example,
when saving a session.
Only one QUESTION message is displayed per save action. This means that only one
QUESTION message must be written per Input Control. If several input controls are executed
(for example, when saving a session with several orders), only one QUESTION message is
displayed. The QUESTION input control must be used to confirm the saving of records in
general and not be linked to a specific kind of operation.
The QUESTION message is only used in the GUI. It cannot be displayed during batch
imports, for example.
4.3.121.6 Examples
IF(name LIKE "X*", MSG(ERROR,"name",NULL,NULL,"No symbol beginning with X"))
Returns an error message box displaying "No symbol beginning with X" if the name of the
occurrence begins with the letter X.
IF(name LIKE "X*", MSG(QUESTION_YES_NO_CANCEL, NULL, NULL, NULL, "Do you really want
to save these orders?"))
Returns a question message box, displayed after any WARNING messages, requesting the
user to re-validate the storage of the orders.
4.3.122 NET_AMOUNT
4.3.122.1 Description
Computes the net amount of an operation, taking into account the possibility to have Fees &
Taxes in several currencies.
4.3.122.2 Synopsis
NET_AMOUNT( currkw )
4.3.122.3 Arguments
Argument Description
currkw Keyword defining the currency in which the net amount must be computed. Five values
are available:
INSTR_CURR: instrument currency
PTF_CURR: portfolio currency
SYS_CURR: system currency
OPER_CURR: operation currency
ACCT_CURR: account currency
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 141
4.3.122.5 Remarks
None.
4.3.122.6 Examples
NET_AMOUNT(OPER_CURR)
4.3.123 NEW_INDEX
4.3.123.1 Description
Generates a document index for an operation code or an accounting code.
4.3.123.2 Synopsis
NEW_INDEX( portfolio , refdate , codenature)
4.3.123.3 Arguments
Argument Description
portfolio Id or code of the portfolio.
4.3.123.5 Examples
IF (code = NULL, PRINTF("AAA%s%05d",portfolio_id.code, NEW_INDEX(portfolio_id,
account_d, 1).index_n))
If the above expression is the default value for the operation code, it automatically generates
a code composed of the string AAA, the code of the portfolio and an index which is
incremented when an operation is created in the portfolio at the specified date.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 142
IF (code=NULL,
{then} IF (STRLEN(user_id.code) > 12,
{then} PRINTF("AAA%s%05d", LEFT(user_id.code, 12), NEW_INDEX(NULL, SYSDATE(),
3).index_n),
{else} PRINTF("AAA%s%05d", user_id.code, NEW_INDEX(NULL, SYSDATE(),
3).index_n)
)
)
The above expression automatically generates a code composed of the string AAA, the code
of the user and an index which is incremented when a function result is created, because the
default value is assigned to the code of a function result.
If you want to generate a code for a specific attribute, you can choose a number between
100 and 255 which is then associated to your attribute. For example, if the following script is
the default value assigned to the denomination of an instrument, it will generate a code
composed of the user code, the instrument nature (if the nature is stock or bond) and an
index that is incremented when the user creates a new instrument of stock or bond nature:
IF(USER().code="MyCode",
{then}
IF(code=NULL,
{then}
IF(nature_e=1,
{then}
PRINTF("%s%s%05d",LEFT(USER().code,10),
"Stock",NEW_INDEX(NULL,SYSDATE(),125).index_n),
{else}
IF(nature_e=2,
{then}
PRINTF("%s%s%05d",LEFT(USER().code,10),
"Bond",NEW_INDEX(NULL,SYSDATE(),126).index_n),
{else}
name))),
{else}
{else}
{else}
name)
Note that in this example, the value of 125 is assigned to the codenature variable for the
stocks created by the user whose user code is MyCode. The value 126 is assigned to the
codenature variable for the bonds created by this user.
4.3.124 NEXT_BUSINESSDATE
4.3.124.1 Description
Determines the next business day on the basis of a specified date.
4.3.124.2 Synopsis
NEXT_BUSINESSDATE ( date [, next_business_rule] [, calendar ] )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 143
4.3.124.3 Arguments
Argument Description
date The reference date from which the the next business day is calculated.
next_business_rule Determines the way the next business day will be defined. Notice that if this
argument is not specified, the rule specified in the calendar (third argument).
Possible values are:
0 (Default): the next business date is the date specified as first argument
1 (Next): returns the next business date
2 (Next in Month): returns the next business date in the same month as the
first argument. If the next business date is in the next month, the return date
will be the last business day of the current month.
3 (Closest): returns the closest business day
4 (Closest in Month): returns the closest business day of the month of the first
argument
5 (Previous): returns the previous business day
6 (Previous in Month): returns the previous business day belonging to the
month of the first argument
4.3.124.5 Remarks
The keyword only looks for the next business date IF the first argument is NOT a business
date. If the first argument is a business date, then the same date is returned.
4.3.124.6 Examples
NEXT_BUSINESSDATE( instr_id.end_d , 0,"CH-CALENDAR")
Returns the first business date after the end date of the current instrument.
4.3.125 NOTEPAD
4.3.125.1 Description
Returns a notepad structure.
4.3.125.2 Synopsis
NOTEPAD(entity , object , date [,user] [,type] )
4.3.125.3 Arguments
Argument Description
entity Entity of the object which notepad has to be accessed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 144
4.3.125.4 Return type
Returns a structure notepad.
4.3.125.5 Remarks
NOTEPAD also can be used in an indirect access context. In that case, it requires up to three
arguments (the date and optionally the user and the type) surrounded by square brackets
‘[]’.
4.3.125.6 Examples
NOTEPAD("instrument", instr_id , 01/01/1996).title_c
Returns the title of the notepad introduced for the current instrument at 1st January 1996 or
earlier.
instr_id. NOTEPAD[01/01/1996].note_c
returns the content of the notepad for the current instrument at 1st January 1996 or earlier.
4.3.126 NUMMASK
4.3.126.1 Description
Tests the value of a digit in a binary number.
4.3.126.2 Synopsis
NUMMASK (num1, num2)
4.3.126.3 Arguments
Argument Description
num1 Mask value to be tested.
4.3.126.5 Remarks
The NUMMASK keyword is most useful in the performance attribution module. With this
context in mind, the constants (permitted values) below were defined for the num2 attribute
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 145
to facilitate the use of the NUMMASK keyword. These permitted values allow you to use the
following script code:
NUMMASK(level_n, PORTFOLIO)
Returns 1 if the current port_synthetic’s end date is due to the portfolio frequency.
NUMMASK(level_n, BENCHMARK)
Returns 1 if the current port_synthetic is to be taken into account in the case of parallel
storage.
4.3.126.6 Example
IF (NUMMASK(level_n, 4)=1, 1, 0)
4.3.127 NUMSTR
4.3.127.1 Description
Converts a number to a string according to an optional mask and returns the string.
4.3.127.2 Synopsis
NUMSTR( num [, mask ] )
4.3.127.3 Arguments
Argument Description
num Number to be converted.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 146
Argument Description
mask Optional mask to be applied to the converted number. It must be a string composed of
the following characters:
.: decimal separator.
,: thousand separator.
9: prints a number. non significative zeros will not be printed on the left but well on
the right
0: prints a number. non significative zeros will not be printed on the right but well on
the left
N: prints a string if value to be printed is null
C: displays negative numbers in colour
+: displays the sign ‘+’ when the number is positive
( ): displays negative numbers between parenthesis
%: prints the percent sign
4.3.127.5 Remarks
Note that the default mask (defined in Administration > Security > Language) is
used if your NUMSTR mask is invalid. This applies throughout Triple'A Plus Core.
The format of the decimal and thousand separators defined for each language
will be used for displaying converted numbers. For example, you must use the
point "." as decimal separator as argument in the mask, but for a French user,
the comma "," will be displayed because the comma has been defined as
decimal separator for the French language.
4.3.127.6 Examples
NUMSTR(quantity_n, "999,999.99")
4.3.128 OBJECT_MODIF_STAT
4.3.128.1 Description
Returns a structure of the current record treated by the rule engine.
4.3.128.2 Synopsis
OBJECT_MODIF_STAT()
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 147
4.3.128.3 Arguments
None.
Defines the entity that is impacted by the action (can be the impacted_entity_dict_id dict_id
same as updated_entity)
Date and time when the update action occurred object_impact_d datetime_t
4.3.128.5 Remarks
This keyword can only be used in the default value for records generated by the rule engine.
4.3.128.6 Examples
IF (OBJECT_MODIF_STAT() <> NULL, OBJECT_MODIF_STAT().data_dependency_id.code)
4.3.129 OLD
4.3.129.1 Description
In Update mode, returns a structure of the currently modified entity containing the
previously used values.
4.3.129.2 Synopsis
OLD()
4.3.129.3 Arguments
None.
4.3.129.5 Remarks
None.
4.3.129.6 Limitations
GUI usage: OLD() refers to the last saved state in the database. There are no
limitations of use.
WUI usage: OLD() refers to the current state before script evaluation. This keyword is
only operational when used in the default value script definitions. It is not operational
when used in input controls, for example.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 148
4.3.129.7 Examples
IF ( quantity_n <> OLD().quantity_n , MSG ( ERROR,"quantity_n", NULL, NULL,"You are
not allowed to modify the quantity of an operation") )
4.3.130.1 Description
Computes the theoretical price of an option (OPT_PRICE), its sensitivity (OPT_SENS) or its
implied volatility.
4.3.130.2 Synopsis
OPT_PRICE( [ instr ][, model ][, flag ][, date ][, price ][, volatility ][, rate ] )
4.3.130.3 Arguments
Argument Description
instr Optional instrument id or code indicating the option for which a price must be calculated.
This argument must refer to an option and can be omitted only in an extended positions
context.
model Optional pricing model indicating which model has to be used. Possible values are:
1: Binomial
2: Black & Scholes
3: Whaley & Adesi
If the model is not specified, the used method will be the one specified in the Default
option model field in the signaletic (first priority) or the one specified in the application
parameters (second priority)
date Optional reference date must be less or equal to the expiration date of the option -
default is the Initial Date specified in the domain.
price Optional underlying price. If the price is expressed in a currency other than that of the
option, it should be converted into the option currency using the exchange rate on the
reference date. The price must be greater than 0 - default is that of the underlying
instrument.
volatility Optional volatility referring to the ESTVOL function which in itself may default to the
instrument or chronological data. If specified, if must be greater or equal to 0.
rate Optional risk free rate referring to the price of an instrument which nature is Rate. It
must be expressed as an annualised percentage and be greater or equal to 0 - default is
the price of the instrument (nature ‘Rate’) which default flag has been set and which
reference currency corresponds to the option one.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 149
4.3.130.5 Remarks
instr is optional only if the extended positions are loaded.
For OPT_IMPVOL, the arguments are the same as above except that the volatility is not
supplied and the option price (sixth argument) is supplied or found in the instrument price
table and must be greater or equal to 0. It also must be expressed in the option currency
For OPT_SENS, the arguments are the same as above except that the first argument is the
sensitivity. Possible values are:
1: Delta
2: Gamma
3: Omega
4: Kappa
5: Rho
6: Theta
7: with respect to ( carry - Risk free rate )
8: with respect to the strike price
For the OPT_SENS function the fourth argument is an optional force calculation flag. If it is
not set, the application checks the option data validity period - default is NO (0).
From R4.10, the binomial model is only supported for the equity or currency underlying
types. For other types, it is recommended to switch to the most common pricing model:
Black and Scholes.
4.3.130.6 Examples
OPT_PRICE ( instr_id , 2 , , , , , )
OPT_PRICE ( )
OPT_IMPVOL ( )
OPT_IMPVOL ( instr_id , 1)
4.3.131 PARAM
4.3.131.1 Description
Refers to the parameters in the Template elements of a Constraint Template.
4.3.131.2 Synopsis
PARAM(parameter, script)
4.3.131.3 Arguments
Argument Description
parameter Mandatory. The code of one of the template elements.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 150
4.3.131.5 Remarks
Only applies to constraint template script definitions.
4.3.131.6 Examples
CHECK_SUM(pos_val.ref_mkt_val_m/portfolio_id.mkt_val_m, LT, PARAM(“value”), ,
PARAM(”instrument_set”, instr_id))
Example of a holding constraint template. The value string is the code of an element with the
Value nature. The instrument_set string is the code of an element with the Instrument Set
nature.
IF(nature_e = 1 AND PARAM(“instr_code”, instr_id), 0, 1)
Example of a trading constraint template. The instr_code string is the code of an element
with the Attribute nature. The entity is instrument and the attribute code.
4.3.132 PERF_EFFECT_DEF
4.3.132.1 Description
This keyword allows you to determine a performance effect of a given rank. The performance
effects are placed on the market segments of a grid and are used for the intermediate
benchmark performance attribution. The rank depends on the level of the market segment in
the grid, and the rank of the effect in the performance effect links entity.
4.3.132.2 Synopsis
PERF_EFFECT_DEF(rank)
4.3.132.3 Parameters
Argument Description
rank The rank of the effect.
4.3.132.5 Examples
PERF_EFFECT_DEF(0)
4.3.133 PERF_INTER_BENCH
4.3.133.1 Description
This keyword is used in the context of the intermediate benchmark performance attribution
and returns data for the intermediate benchmarks, which are constructed during the
execution of the performance attribution analysis to calculate the performance effects on the
different levels of a grid.
4.3.133.2 Synopsis
PERF_INTER_BENCH(bench_id, effect_id)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 151
4.3.133.3 Parameters
Argument Description
bench_id Performance attribution benchmark identifier
4.3.133.5 Remarks
Initial Performance Effect: Attribute is initialised with the original perf_effect_def and
set only where the system start the computing of the effect.
Effect's market segment: Attribute defines the market segment where the effect is set.
Initialised where the system start the computing of the effect and on all children.
4.3.133.6 Examples
bench1_perf_attrib_id.PERF_INTER_BENCH[PERF_EFFECT_DEF(0).id].effect_n
Returns the value for the intermediate benchmark performance effect of rank 0 for the first
benchmark in the performance attribution.
PERF_INTER_BENCH(bench1_perf_attrib_id, PERF_EFFECT_DEF(0).id).weight_n
Returns the weight for the intermediate benchmark of rank 0 while executing the
intermediate benchmark performance attribution for the first benchmark.
4.3.134.1 Description
Returns a portfolio (or currency or third party) chronological data structure.
4.3.134.2 Synopsis
PORT_CHRONO( object , time_dim , nature , date [, curr] [,flag] )
CURR_CHRONO( object , time_dim , nature , date , underlying_curr [,flag] )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 152
THIRD_CHRONO( object , time_dim , nature , date [, curr] [,flag] )
4.3.134.3 Arguments
Argument Description
object Id or code of the portfolio (or currency or third party, depending on the keyword).
nature Refers to a chronological data type keyword - indicates which chronological data has to
be accessed. The different natures of portfolio (or currency or third party as the case may
be) chronological data are listed in the datamodel.
flag (Optional) If the flag is set to 1 and time_dim = LAST, only the valid chronological data
(depending on the relevant system parameter) is retrieved.
4.3.134.5 Remarks
PORT_CHRONO without the currency parameter should be used if there is only one chrono
per date and nature. If more than one chrono satisfies the above criteria, the returned
port_chrono could use either. This means that if two chronos have the same date and nature
but one is in USD and the other is in CHF, either could be returned if PORT_CHRONO is called
without the currency parameter.
4.3.134.6 Examples
PORT_CHRONO( portfolio_id , LAST ,"Investment", DOMAIN().calc_from_d ,
portfolio_id.currency_id ).value_n
Returns the value of the last available Investment for the current portfolio.
4.3.135 PORT_CHRONO_ARRAY
4.3.135.1 Description
Returns an array of portfolio chronological data.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 153
4.3.135.2 Synopsis
PORT_CHRONO_ARRAY( date , freq , unit , number , ptf , nature , curr )
4.3.135.3 Arguments
Argument Description
date Date until which the historical data occurs (the end date of the series).
freq The frequency at which the data is extracted according to the arg3, the frequency unit
(e.g., each day, every two days, etc.).
unit The frequency unit at which the data is extracted. Enumerated date unit keyword.
This argument has to be filled in between double quotes or replaced by the figure
preceding the value: "Week" or 3.
number The number of readings indicates how many periods or occurrences are to be selected.
nature Nature of the chronological data (e.g., market value, accrued interests). This argument
must be filled in between double quotes or replaced by the figure corresponding (e.g.,
"Market value" or 1).
curr Indicates the currency in which the chronological data should be. This implies the
conversion using the prevalent exchange rates.
4.3.135.5 Remarks
None.
4.3.135.6 Examples
STAT(PORT_CHRONO_ARRAY(DOMAIN().calc_from_d,1,4, 12,"PORT_TWR",
portfolio_id.currency)).mean
Computes the average monthly TWR on the last 12 months for the current portfolio.
4.3.136 PORT_SYNTH
4.3.136.1 Description
Returns a synthetic data for a specific portfolio.
4.3.136.2 Synopsis
PORT_SYNTH( port_dim , object1 , date , risk_nat [, validity_period ] [, instr_dim ] [,
object2] [, pps ] [, currency ] )
4.3.136.3 Arguments
Argument Description
port_dim Portfolio dimension entity. Currently, the only possible choice is "portfolio".
object1 Portfolio id or code from which the synthetic data has to be retrieved.
date Date at which the synthetic data is expected [final_d from port_synth].
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 154
Argument Description
risk_nat Risk level of the expected result. The only accepted value is 0.
validity_period Optional. Number of days that the synthetic data is considered as valid. If
validity_period = 4, the synthetic data from 31/03/1998 [=port_synthetic.final_d] is
valid with the argument date from 31/03/1998 until the 04/04/1998.
instr_dim Optional instrument dimension entity. Allows getting synthetic data on a specific
instrument or market segment. The only accepted value is NULL.
object2 Optional - not used. Specifies from which instrument or market segment the synthetic
data is expected if the previous argument is different from NULL.
currency Optional currency of the data. Currently, all the portfolio synthetic data is stored in the
portfolio reference currency.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 155
Name sqlname_c data_type
Final Market value final_market_value_m amount_t
4.3.136.5 Remarks
The synthetic data has to be previously stored before you can use the PORT_SYNTH function.
4.3.136.6 Examples
PORT_SYNTH("portfolio", portfolio_id, DOMAIN().calc_from_d, 0).unreal_curr_profit_m
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 156
Returns the unrealised currency profit of the current portfolio at the Initial Date specified in
the domain.
4.3.137 POWER
4.3.137.1 Description
Raises the val argument to a power specified by the power argument.
4.3.137.2 Synopsis
POWER( val , power )
4.3.137.3 Arguments
Argument Description
val A numeric expression to be raised to a power.
4.3.137.5 Remarks
None.
4.3.137.6 Examples
POWER(3,4)
returns 81.
POWER(9,1/3)
returns 2.08.
4.3.138.1 Description
transforms a price into a quote (quote into a price) following a price calculation rule.
4.3.138.2 Synopsis
PRICE_TO_QUOTE(instr, price [,date1] [,rule] [,date2] [,rate] [,quote])
4.3.138.3 Arguments
Argument Description
instr Instrument id or code.
date1 Optional price date. Default is the Initial Date specified in the domain.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 157
Argument Description
date2 Optional expiration date. This field is mandatory when the computation has to be
performed on a Money Market Instrument.
rate Optional rate percent. This field is mandatory when the computation has to be performed
on a Money Market Instrument.
quote Optional cost quote used when the market price is based on the cost price of the
instrument (price calculation rule).
4.3.138.5 Remarks
None.
4.3.138.6 Example
QUOTE_TO_PRICE(instr_id, quote_n, operation_d, price_calc_rule_e, expiration_d,
rate_p, quote_n)
4.3.139 PRINTF
4.3.139.1 Description
Returns a string build according to the formatstring argument in which the other optional
arguments may be substituted. It allows to mix constants and variables. It uses the same
principle as the C function ‘printf()’.
4.3.139.2 Synopsis
PRINTF( formatstring [, arg1 [, arg2 [, arg3 [, arg4 [, arg5 [, arg6 [, arg7 [, arg8 [, arg9 [,
arg10 ]]]]]]]]]]]] )
4.3.139.3 Arguments
Argument Description
formatstring A string in which the following string, floating number and integer number arguments are
respectively represented by %s (for strings), %f (for decimal numbers), %d (for
integers) or %D for dates.
4.3.139.5 Remarks
The carriage return operator CR can be used as an argument (%s) to introduce a carriage
return between previous and next arguments.
4.3.139.6 Examples
PRINTF("Instrument %s with quantity %8.2f", instr_id.code , quantity_n)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 158
Displays a string where the arguments preceded by % will be respectively replaced by the
code of the instrument; the held quantity six numbers on the left of the decimal separator
and two on its right.
PRINTF("Instrument %s%swith quantity %8.2f", instr_id.code, CR, quantity_n)
Displays the same previous string but separated with a carriage return immediately after the
code of the instrument.
4.3.140 PTF_DEF_ACCOUNT
4.3.140.1 Description
Returns the default account id based on the portfolio, currency, nature, type and sub-type
parameters of an operation. It lets you define the default account used in an operation and
takes into account the payment instructions associated with the portfolio.
4.3.140.2 Synopsis
PTF_DEF_ACCOUNT(portfolio, currency, opernat, opertype, opersubtype)
4.3.140.3 Arguments
Argument Description
portfolio Portfolio id or code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 159
4.3.140.5 Remark
The following hierarchy is applied to determine which record is the best match. Level 1 is the
best match and level 8 the worst:
4.3.140.6 Examples
PTF_DEF_ACCOUNT(portfolio_id,op_currency_id,1,type_id,sub_type).code
Defined as the default value of the account_id field of a Buy operation, this expression
returns the code of the cash account defined for buy operations in the current portfolio based
on the type and sub-type specified in the operation.
4.3.141 QUOTE_TO_PRICE
Refer to section PRICE_TO_QUOTE, QUOTE_TO_PRICE.
4.3.142 RATING_ATTRIB
4.3.142.1 Description
returns a rating attribution structure.
4.3.142.2 Synopsis
RATING_ATTRIB(entity , object , codification , date )
4.3.142.3 Arguments
Argument Description
entity Entity of the object whose rating is to be returned.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 160
Name sqlname_c data_type
Object Type entity_dict_id dict_t
4.3.142.5 Remarks
RATING_ATTRIB can also be used in indirect access. In this case, it requires two arguments
(the codification and the date) surrounded by square brackets ‘[ ]’.
4.3.142.6 Examples
RATING_ATTRIB("instrument", instr_id , S&P , 01/01/1996).rating_id.code
Returns the code of the rating S&P allocated to the current instrument at 1st January 1996
or earlier.
instr_id.RATING_ATTRIB[S&P, DOMAIN().calc_from_d].begin_d
Returns the date at which the rating S&P has been allocated to the current instrument at the
Initial Date specified in the domain or earlier.
4.3.143 REF_FUND_VALO
4.3.143.1 Description
Returns an element of the unit valuation previously calculated in memory with a smaller
account number.
4.3.143.2 Synopsis
REF_FUND_VALO (account_number )
4.3.143.3 Arguments
Argument Description
account_number String referencing an account code.
4.3.143.5 Remark
This function can only be used in accounting plan elements whose nature is set to Valuation.
4.3.143.6 Examples
REF_FUND_VALO ("9490") – REF_FUND_VALO ("9410") – REF_FUND_VALO ("9610")
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 161
4.3.144 REGR
4.3.144.1 Description
allows to perform a regression on two arrays of numerical data.
4.3.144.2 Synopsis
REGR( arrayfunct1 , arrayfunct2 )
4.3.144.3 Arguments
Argument Description
arrayfunct one of the following functions with their correct arguments:
INSTR_PRICE_ARRAY(…)
EXCH_RATE_ARRAY(…)
INSTR_CHRONO_ARRAY(…)
PORT_CHRONO_ARRAY(…)
THIRD_CHRONO_ARRAY(…)
4.3.144.5 Remarks
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 162
Formula name Formula
Beta (beta)
Alpha (alpha)
Covariance (covariance)
Determination Coefficient R2
(determination_coeff_r2)
4.3.144.6 Examples
REGR ( DIFF ( INSTR_PRICE_ARRAY ( DOMAIN().calc_from_d , 1 , 1 , 200 ,
instr_id.index_instr_id, fi_curreny), DIFF(INSTR_PRICE_ARRAY ( DOMAIN().calc_from_d ,
1 , 1 , 200 , instr_id , fi_currency ) ) ).beta
Computes the beta coefficient for the current instrument on 200 occurrences on a daily
basis.
4.3.145 RETURN
4.3.145.1 Description
Returns a return rate structure for a portfolio.
4.3.145.2 Synopsis
RETURN( date1, ret_type [,flag1][,flag2][,flag3][,rule][,date2] [,from_line] [,flag4] [,flag5]
[,flag6] [, SEL_SYNTH()][, meancap_f ][, ret_contrib_f] [,flag7] [,flag8])
4.3.145.3 Arguments
Argument Description
date1 End date.
ret_type Keyword indicating the return rate to be computed. Must belong to the return rates type
keywords.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 163
Argument Description
flag1 Optional gross effect flag indicating whether the return has to be computed either gross
or net.
1: gross
0: net
rule Optional annualising rule indicating the way the return rate is displayed. The possible
values are:
0: non annual (default)
1:annual
2: periodic returns that are computed on a period greater than 1 year
from_line Optional line of the report from which the return has to be computed (normally -1).
SEL_SYNTH Optional keyword that selects the port_synthetic data on which the return is calculated.
If the parameter is not used, the synthetic data linked to the current row is used by
default. Refer to section SEL_SYNTH keyword for more information.
More details on the the RETURN function flags are shown in the table below:
Flag [ ] = 0 Flag [] =1
Flag 1 Return including "fees with Rank <=10" Return without "fees with Rank <=10"
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 164
Flag [ ] = 0 Flag [] =1
Flag 4 Return including "fees with Rank >10 and Return without "fees with Rank >10 and Nature =
Nature = Portfolio Fee or nature = Portfolio Fee or Nature = position fee"
position fee"
Flag 5 Return including "fees with Rank >10 and Return without "fees with Rank >10 and Nature =
Nature = Portfolio Tax or Nature = Portfolio Tax or Nature = position tax"
position tax"
Flag 7 Fees with rank <=10 are not included in Fees with rank <=10 are included in the return
the return calculation (assuming that Flag calculation (assuming that Flag 1 has been set to
1 has been set to 1) 1)
Flag 8 Tax credits with rank <=10 are not Tax Credit with rank <=10 are included in the
included in the return calculation return calculation (assuming that Flag 1 has been
(assuming that Flag 1 has been set to 1) set to 1)
Note: If flag 1 is set to “0” (including “fees with rank <=10), the setting of flag 7 and/or flag
8 does not have any impact on the return calculation.
In the table above, the term "Return without […]" means "Return as if […] was reimbursed".
Example using flag 1, flag 2, flag 3, flag 4 and flag 5
Initial Final Initial Final Fees Tax Fees > Taxes Net
date date market market <= 10 Credit 10 > 10 invest-
value value s ments
31/12/199 31/01/199 20,000.0 17,348.7 -1,500.00 0 0.00 - 0.00
6 7 0 1 1,500.00
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 165
Initial Final RETURN( …, RET_TWR, Flag 1, Flag 2, …. , Flag 4, Flag 5 )
date date
28/02/1997 31/03/1997 -8.70% -8.24% -8.70% -7.88% -7.32% -8.24% -6.03%
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 166
Name sqlname_c data_type
Capital effect capital_effect number_t
4.3.145.5 Remarks
RETURN can also be used in an indirect access context, using the []. syntax.
mean_cap and flows_n only return values if the ret_type is set to ret_MWR.
All values in the return structure except mean_cap and flows_n are percentages in relation
to the mean capital, and not amounts. To retrieve the corresponding amounts, the attributes
of port_synthetics can be used.
The "_effect" attributes are aggregations (e.g., capital_effect is the sum of realised and
unrealised capital gain and loss).
The sum of the return contributions (at the market segment or instrument level) is equal to
the portfolio global return.
The mean invested capital does not take the uninvested period into account for the
calculation. On the contrary, the mean capital takes the entire period into account.
Consequently, the sum of market segment (or instrument) mean capitals equals the global
mean capital.
The following example shows the differences between the Mean Capital and the Mean
Invested Capital, and between the Return and the Return Contribution:
4.3.145.6 Examples
RETURN( DOMAIN( ).calc_till_d , RET_TWR , , , , 1, DOMAIN().calc_from_d ,
).total_return
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 167
Returns the return of the portfolio computed between the Initial Date and the Final Date of
the domain.
4.3.146 RIGHT
Refer to section LEFT, RIGHT.
4.3.147 RISK_RATIO
4.3.147.1 Description
Returns statistical financial ratios.
4.3.147.2 Synopsis
RISK_RATIO(date, freq, number, rule, ptf_expression, [bench_expression],
[risk_free_expression])
4.3.147.3 Arguments
Argument Description
date The date up to which the historical data occurs (the end date of the series).
freq Frequency unit at which the data is extracted. Enumerated date. Unit keyword.
This argument has to be entered between double quotes or replaced by the
figure preceding the value: "Month" or 4.
rule Annualising rule indicating the way the ratio rates are displayed. The possible
values are
0: non-annual (default)
1: annual
ptf_expression Any script language that refers to data for the portfolio. This expression can be
one of the STANDARD_PERF_DATA or PORT_CHRONO, INSTR_CHRONO, etc.,
keywords. A special keyword, FREQ_DATE(), must be used to specify the date
parameter when these keywords are used as an expression for RISK_RATIO.
bench_expression Any script language that refers to data for the benchmark. Same comments as
for ptf_expression.
risk_free_expression Any script language that refers to data for the risk free index. Same comments
as for ptf_expression.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 168
Name sqlname_c data_type
Arithm Mean of Bench Return bench_amean_n number_t
4.3.147.5 Remarks
If several ratios are required for the same data, it is recommended to always use the same
script parameters, even if some parameters are not required for the statistics.
If some data is missing for the portfolio, these periods are not used for the portfolio,
benchmark, and risk free statistics.
If an expression with STANDARD_PERF_DATA is used for the risk-free instrument, it is
required that a PSP is defined for the instrument, which will be used. It is not required that
data is actually stored for this instrument.
Formula
Geometric Mean
Volatility
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 169
Formula name Formula
Annualised Return
Annualised Volatility
Sharpe
or
Treynor
Tracking Error
Information Ratio
4.3.147.6 Examples
1)
RISK_RATIO(final_d, 4, 60, 0, STANDARD_PERF_DATA( entity_dict_id, object_id,
FREQ_DATE(), currency_id, 4, position_data_id).return_n , STANDARD_PERF_DATA(
entity_dict_id, object_id, FREQ_DATE(), currency_id, 4,
position_data_id).bench_id.return_n , STANDARD_PERF_DATA( entity_dict_id, object_id,
FREQ_DATE(), currency_id, 4, position_data_id).risk_free_id.return_n).sharpe_n
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 170
2)
RISK_RATIO(DOMAIN().calc_till_d, 4, 60, 1,
IF(IS_IN_LIST("portfolio",portfolio_id,"COMPOSITE_1",2,FREQ_DATE())=1,
STANDARD_PERF_DATA(“portfolio”, portfolio_id, FREQ_DATE()).return_n) ,
STANDARD_PERF_DATA(“strategy”, @strat_id, FREQ_DATE()).return_n ,
STANDARD_PERF_DATA(“instrument”, @instr_id, FREQ_DATE() ).return_n).tracking_error_n
Returns the annualised tracking error calculated for 5 years of monthly data for the periods
when the portfolio belongs to the COMPOSITE_1 list.
3)
RISK_RATIO(final_d, 4, 60, 0, PORT_CHRONO(portfolio_id, LAST, “TWR”,
FREQ_DATE()).value_n,
INSTR_CHRONO(@instr1_id, FREQ_DATE(), “Return”, , 0).value_n,
INSTR_CHRONO(@instr2_id, FREQ_DATE(), “Return”, , 0).value_n).treynor_n
Returns the Treynor ratio calculated for 5 years of monthly chronological data.
4.3.148 RNDAMT
4.3.148.1 Description
Rounds an amount expressed in a currency following its rounding parameters.
4.3.148.2 Synopsis
RNDAMT( amount , currency )
4.3.148.3 Arguments
Argument Description
amount Number, amount to be rounded.
4.3.148.5 Remarks
If the specified currency does not exist, the amount will not be modified.
4.3.148.6 Examples
RNDAMT(pos_val_id.ref_mkt_val_m, DOMAIN().currency_id)
Rounds the market value of the current position expressed in the reference currency
following its rounding parameters.
RNDAMT(pos_val_id.fi_mkt_val_m, fi_currency_id)
Displays a rounded amount of the market value expressed in the currency of the instrument
and following the rounding parameters of its currency.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 171
4.3.149 ROUND
4.3.149.1 Description
rounds a number with a precision and optionally using a method.
4.3.149.2 Synopsis
ROUND( val , precision [ , method ] )
4.3.149.3 Arguments
Argument Description
val A numeric expression giving the amount to be rounded.
4.3.149.5 Remarks
Precision can be greater than 1, for example it is possible to round to the ten or to the
hundred by specifying 10 or 100 as precision.
If precision or method arguments have the value NULL, the returned value is NULL.
If method is not specified, the Nearest method will be used.
See also the attribute round_rule_e of the entity currency for the method argument
explanations.
4.3.149.6 Examples
ROUND(pos_val_id.ref_mkt_val_m , 0.01)
Rounds the market value of the position with a precision of 0.01 (the rounding method is
Nearest).
ROUND(book_pf_amount_m , 1 , Down)
Rounds the book value of a position expressed in the portfolio currency with a precision of 1
(the rounding method is Down).
ROUND(pos_val_id.ref_mkt_val_m, 20, 3)
Rounds the market value of the position with a precision of 20 (the rounding method is Up).
4.3.150 SEARCH_BEST_EXTPOS
4.3.150.1 Description
returns the open positions at a specific date for an instrument and a portfolio. A filter and
sorting criterias can also be used.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 172
4.3.150.2 Synopsis
SEARCH_BEST_EXTPOS ( array [,filter ] [,sort_crit1] [, sort_criteria 1] [ , sort_crit2 ] [,
sort_criteria 2] [, sort_crit3] [, sort_criteria 3] [ , sort_crit4] [, sort_criteria 4] [ , sort_crit5]
[, sort_criteria 5] )
4.3.150.3 Arguments
Argument Description
array Array of extended positions returned by the function SEL_EXTPOS.
4.3.150.5 Examples
SEARCH_BEST_EXTPOS ( SEL_EXTPOS (portfolio_id, instr_id, operation_d) ,
&deposit_id=deposit_id).pos_net_amount_m
Returns the acquisition cost in position currency for a position having the same deposit than
the operation deposit.
4.3.151 SEARCH_BEST_OPER
4.3.151.1 Description
Searches the operation matching the provided arguments.
4.3.151.2 Synopsis
SEARCH_BEST_OPER( portfolio , instrument , oper_nat , min_stat , max_stat , date , margin
[,param1_attr , param1_margin] [,param2_attr, param2_margin] [, param3_attr,
param3_margin] [param4_attr , param4_margin] [, param5_attr , param5_margin])
4.3.151.3 Arguments
Argument Description
portfolio Id or code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 173
Argument Description
Instrument Id or code.
4.3.151.5 Remarks
This function is useful when entering an operation executing (or reversing) another operation
in batch mode. For example with the help of the function and the operation default values,
the attributes execut_oper_code execut_oper_status_e and execut_oper_nat_e of the
operation entity can be filled in automatically.
To use the function SEARCH_BEST_OPER the parameters SEARCH_BEST_OPER_GUI and
SEARCH_BEST_OPER_BATCH must be set.
4.3.151.6 Examples
IF (revers_oper_nat_e = 1 , SEARCH_BEST_OPER( portfolio_id , instr_id, 1, 2, 3, 2,
5,"quantity_n", 10).code )
Returns the code of an operation with the same portfolio and instrument as the entered
operation, the operation nature ‘1’ (Buy), the operation status between 2 and 3, the
accounting date should correspond with a 5 days margin and the first pair of optional
parameters indicates that the quantity should correspond with a margin of 10. This definition
could apply for a default value on the field "reversal code" of an operation.
4.3.152 SECTOR_ATTRIB
4.3.152.1 Description
Returns a sector attribution structure.
4.3.152.2 Synopsis
SECTOR_ATTRIB( entity , object , codification [ ,date ] )
4.3.152.3 Arguments
Argument Description
entity Entity of the object whose sector has to be returned.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 174
Argument Description
date Optional date at which the sector attribution is requested.
4.3.152.5 Remarks
SECTOR_ATTRIB also can be used in an indirect access context. In that case, it requires one
argument (the codification) surrounded by square brackets ‘[ ]’
4.3.152.6 Examples
SECTOR_ATTRIB("instrument", instr_id ,”NACE).sector_id.name
Returns the name of the sector of the current security following the Nace codification.
instr_id.SECTOR_ATTRIB[NACE].sector_id.name
4.3.153 SEL_EXTOP
4.3.153.1 Description
Returns an array of extended operations corresponding to the arguments. In other words, it
allows returning all the operations made on a specific security in a portfolio between two
dates.
4.3.153.2 Synopsis
SEL_EXTOP ( portfolio , instrument , date1 , date2 , nature )
4.3.153.3 Arguments
Argument Description
portfolio Id or code of the portfolio from which the extended operations must be retrieved.
instrument Id or code of the instrument on which the extended operations have been introduced.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 175
Argument Description
nature Nature of the operation to be taken into account. Possible values are:
0: All natures of operations
1: Buy
2: Sell
3: Income
4: Investment
5: Withdrawal
6: Fee
7: Adjustment
8: Unit Issue
9: Unit Redemption
10: Transfer
11: BP Transfer
12: Locking
13: Portfolio Transfer
14: Book Value Adjustment
4.3.153.5 Remarks
This function must be used in combination with the function GET_EXTOP_NUM.
4.3.153.6 Examples
None
4.3.154 SEL_EXTPOS
4.3.154.1 Description
Returns an array of extended positions at a specific date for a portfolio and, optionally, an
instrument.
4.3.154.2 Synopsis
SEL_EXTPOS (portfolio, instrument, date[, flag1 ] [, flag2 ],[min],[max])
4.3.154.3 Arguments
Argument Description
portfolio Id or code
instrument Id or code. If all positions in the portfolio must be returned, you can enter NULL. If you
specify NULL, the script function takes longer to run.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 176
Argument Description
flag1 Flag to specify if you want to
0: exclude the positions entered previously in the same transaction.
1: include the positions entered previously in the same transaction.
This flag is enabled when an order session is saved or Update Field is running from the
GUI on a set of operations. Note that in both cases, the system first saves/updates the
Sells and then saves/updates the other operations.
4.3.154.5 Remarks
This function must be used as the second argument of the GET_BALANCE function.
4.3.154.6 Examples
SEL_EXTPOS( portfolio_id , instr_id, operation_d)
SEL_EXTPOS( portfolio_id , NULL, operation_d)
4.3.155 SEL_FMTCHILDREN
4.3.155.1 Description
Selects all children of an element at all level and compute a script to build an array of values.
4.3.155.2 Synopsis
SEL_FMTCHILDREN (parent attribute, id attribute, element’s id, value, [,filter] [,maxlevel])
4.3.155.3 Arguments
Argument Description
parent attribute Attribute where the parent id is stored.
element’s id Id of an element.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 177
4.3.155.5 Remarks
It can only be used for format element definition. The keyword CURRENT_REC can be used
to access the current line values. It is also possible to reference other format element. It
must be used as an argument of other keywords like SUM(), STAT(), GEOSUM().
When using that key word for a definition element of format with a filter, to have correct
result, it’s important to add the format filter in the filter of SEL_FMTCHILDREN.
It can only be used in format based on entity with hierarchy between a parent_id element
and an id element. Actually this is possible on two tables, ext_strategy_element and
ext_ret_analysis.
4.3.155.6 Examples
SUM(SEL_FMTCHILDREN(parent_id, id, id, 1))
Calculates for leafs the sum of @account1 + @accont2, and for nodes and roots the sum of
leafs below the current element.
IF (IS_FMTLEAF(disp_parent_ext_strat_elem_id,id,id),@MK_V /
SUM(SEL_FMTCHILDREN(disp_parent_ext_strat_elem_id,id,
GET_FMTROOT(disp_parent_ext_strat_elem_id,id,id).id, @MK_V, @filter_f AND
IS_FMTLEAF(disp_parent_ext_strat_elem_id,id,id)))*100,NULL)
Calculates only for leaf a percentage: @MK_V (of current line) of @MK_V (of the root).
4.3.156 SEL_FT_RATE
4.3.156.1 Description
Returns the history id of a tax convention at a specific date. This function is used in
combination with the function GET_FT_RATE.
4.3.156.2 Synopsis
SEL_FT_RATE ( tax_convention , date )
4.3.156.3 Arguments
Argument Description
tax_convention Tax convention from which the history must be retrieved.
4.3.156.5 Examples
None
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 178
4.3.157 SEL_OP
4.3.157.1 Description
Returns an array of operations corresponding to the arguments. In other words, it returns all
the operations performed on a specific security in a portfolio between two dates.
4.3.157.2 Synopsis
SEL_OP ( portfolio , instrument, nature, date1 , date2 [, date type ])
4.3.157.3 Arguments
Argument Description
portfolio Id or code of the portfolio from which the operations must be retrieved.
instrument Id or code of the instrument on which the operations have been introduced.
nature Nature of the operation to be taken into account. Possible values are:
0: All natures of operations
1: Buy
2: Sell
3: Income
4: Investment
5: Withdrawal
6: Fee
7: Adjustment
8: Unit Issue
9: Unit Redemption
10: Transfer
11: BP Transfer
12: Locking
13: Portfolio Transfer
14: Book Value Adjustment
date type Optional date type indicating the date to be taken into account for the selection. Possible
values are:
1: operation date
2: accounting date
3: value date
4.3.157.5 Remarks
This function must be used in combination with the function GET_OP_NUM
4.3.157.6 Example
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 179
4.3.158 SEL_SYNTH
4.3.158.1 Description
Only used as an argument for the RETURN and MEAN_CAP script keywords. Returns an array
of port_synthetic data that is a summary of the selected synthetic data per time period. This
means that the function returns one line per period at the most.
4.3.158.2 Synopsis
SEL_SYNTH(port_dim, filter)
4.3.158.3 Arguments
Argument Description
port_dim Portfolio / market_segment / instrument: passes the type of port_synthetic data to be
summed to the function.
filter A script language conditional expression used to select the data. If you do not require a
filter, set this parameter to 1.
4.3.158.5 Remarks
You can use the ampersand character (&) to reference the rows in the port_synthetic table
that you want to select. Without the ampersand, the current row is returned.
4.3.158.6 Examples
RETURN(final_d, RET_MWR,0,0,0,0, initial_d,,,,, SEL_SYNTH("instrument",
CLASSIFY("instrument", instr_id, "classif_instr").list = CLASSIFY("instrument",
&instr_id,"classif_instr").list) ).total_return
Gives the total return of all the instruments that belong to the same market segment as the
current one.
RETURN(DOMAIN().calc_till_d,
RET_TWR,0,0,0,0,DOMAIN().calc_from_d,,,,,SEL_SYNTH("portfolio",
portfolio_id.comm_mgr_id=& portfolio_id.comm_mgr_id)).total_return
Gives the total return of the portfolios that are managed by the same portfolio (commercial)
manager as the current portfolio.
4.3.159 SIGN
4.3.159.1 Description
Determines the sign of its val argument. It returns 1 if val is positive, 0 if val is 0, and -1 if
val is negative.
4.3.159.2 Synopsis
SIGN( val )
4.3.159.3 Argument
Argument Description
val A numeric expression which sign must be returned.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 180
4.3.159.4 Return type
Returns a number.
4.3.159.5 Remarks
Related to the ABS function.
4.3.159.6 Examples
SIGN( quantity_n )
4.3.160 SQRT
4.3.160.1 Description
Returns the positive square root of the val argument.
4.3.160.2 Synopsis
SQRT( val )
4.3.160.3 Arguments
Argument Description
val A numeric expression which square root must be computed.
4.3.160.5 Remarks
val should be positive or 0.
If val is negative the value NULL is returned.
4.3.160.6 Examples
SQRT(81)
Returns 9.
4.3.161 STANDARD_PERF_DATA
4.3.161.1 Description
Retrieves data from the global performance table, standard_perf, when it is passed the
business key of a table. If the client has added user-defined fields the exact structure
returned may vary from site to site.
4.3.161.2 Synopsis
STANDARD_PERF_DATA (entity, object, date, [,currency] [,frequency] [,position_data])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 181
4.3.161.3 Arguments
Argument Description
entity Entity SQL name or id. The entity from which the data is retrieved. Can be one of:
portfolio, strategy, instrument, list.
object Code or id. Object of one of the above mentioned entities. Note that for the list entity,
only objects based on the portfolio entity are valid.
date The date at which the data is retrieved; corresponds to the final date (final_d) of
standard performance data occurences.
currency Optional parameter (id or code); the currency in which the data is returned. If no
currency is stated, the object system reference currency is used by default.
frequency Optional frequency unit parameter. It describes the frequency at which the data was
stored. The permitted values are
DAY
MONTH
I.e. a valid date keyword, or the enumerated values 1 or 4. The default is MONTH.
position_data Optional parameter which is the id of the position data. The default is NULL.
4.3.161.5 Remarks
None.
4.3.161.6 Examples
STANDARD_PERF_DATA(“portfolio”,“MyPortfolio”,
DOMAIN().calc_till_d).final_market_val_m
Returns the final market value of the portfolio MyPortfolio at the domain Final Date. The
value is calculated from data stored with a monthly frequency but with no position_data_id.
By default, the portfolio's reference currency is used.
IF(portfolio_freq_id<>NULL, SUM(GET_OBJECT_ARRAY(GET_ENTITY ("portfolio_freq"),
&initial_d=initial_d AND &freq_d=final_d, STANDARD_PERF_DATA("portfolio",
&portfolio_id, final_d).initial_market_val_m,1,0,1)))
Returns the sum of the initial market values of each portfolio in the list as recorded in the
standard_perf table. This script is delivered as the Default Value for standard_perf data when
structures are built for the Portfolio List Storage facility.
4.3.162 STAT
4.3.162.1 Description
computes statistics on a series of data.
4.3.162.2 Synopsis
STAT( arrayfunct )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 182
4.3.162.3 Arguments
Argument Description
arrayfunct One of the following functions with their correct arguments:
INSTR_PRICE_ARRAY(…)
EXCH_RATE_ARRAY(…)
INSTR_CHRONO_ARRAY(…)
PORT_CHRONO_ARRAY(…)
THIRD_CHRONO_ARRAY(…)
4.3.162.5 Remarks
'Entire Population' for the variance/standard deviation means that the calculation is
performed on the whole population (divided by n). Otherwise, the calculation is performed
on a sample of the population (divided by n-1).
Formulae
Mean (mean)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 183
Formula name Formula
Variance (variance)
4.3.162.6 Examples
STAT(EXCH_RATE_ARRAY(DOMAIN().calc_from_d, 1,4, 5, "CHF", "USD").std_deviation
Computes the standard deviation of the most recent CHF/USD exchange rates.
STAT(INSTR_CHRONO_ARRAY(DOMAIN().calc_from_d,1,1,100,instr,"Beta",fi_currency).mean
Computes the average value of the Beta coefficient over 200 days.
4.3.163 STRDATE
4.3.163.1 Description
Converts a string representing a date into a date.
4.3.163.2 Synopsis
STRDATE( str , mask )
4.3.163.3 Arguments
Argument Description
str String to be converted.
4.3.163.5 Examples
STRDATE ("13#05#97","DD/MM/YYYY")
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 184
4.3.164 STRLEN
4.3.164.1 Description
Returns the length of the str argument..
4.3.164.2 Synopsis
STRLEN( str )
4.3.164.3 Arguments
Argument Description
str String.
4.3.164.5 Remarks
None.
4.3.164.6 Examples
STRLEN( fi_currency_id.name )
4.3.165 STRNUM
4.3.165.1 Description
Converts a string to a number and returns the number.
4.3.165.2 Synopsis
STRNUM( str )
4.3.165.3 Arguments
Argument Description
str String to be converted.
4.3.165.5 Remarks
None.
4.3.165.6 Examples
STRNUM(123 )
Returns 123.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 185
4.3.166 SUBSTR
4.3.166.1 Description
Returns a substring made of a specific number of characters from the str argument, starting
at the position given by the start argument.
If the start argument is greater than the length of the str argument, SUBSTR returns the
value.
If the start argument is less than the length of the str argument, but the start argument plus
the num argument exceeds the length of the str argument, SUBSTR returns the characters
up to the end of the str argument.
4.3.166.2 Synopsis
SUBSTR ( str , start , num )
4.3.166.3 Arguments
Argument Description
Str String.
Start number giving the position where the extracted string starts.
4.3.166.5 Remarks
If the position of the substring to be extracted is greater than the length of the string, the
value NULL will be returned.
4.3.166.6 Examples
SUBSTR(ABCDEFGH , 4 , 3 )
Returns DEF.
SUBSTR( USER().code , 5 , 3)
4.3.167.1 Description
Computes the sum (or geometrical sum for GEOSUM) of a series of data.
4.3.167.2 Synopsis
SUM(arrayfunct)
GEOSUM(arrayfunct)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 186
4.3.167.3 Arguments
Argument Description
arrayfunct One of the following functions with their correct arguments:
INSTR_PRICE_ARRAY()
EXCH_RATE_ARRAY()
INSTR_CHRONO_ARRAY()
PORT_CHRONO_ARRAY()
THIRD_CHRONO_ARRAY()
4.3.167.5 Remarks
The GEOSUM formula is:
4.3.167.6 Examples
GEOSUM(PORT_CHRONO_ARRAY(DOMAIN().calc_from_d,1,4, 12,"PORT_TWR",
portfolio_id.currency))
Computes the geometrical sum of the monthly TWR on the last 12 months for the current
portfolio.
4.3.168.1 Description
Conditional expression used to define various behaviours when a value matches a specific
case.
The first argument of the SWITCH keyword defines how to compute the value that will
be used to decide which case must be applied.
From the 2nd to the 64th argument, two types of arguments can be used: case or
value. A case argument must use the CASE keyword; all other arguments without
CASE keywords are considered value arguments.
Multiple case arguments can be contiguous; they will all be applied to the next value
argument.
If a value argument follows another value argument, it is used as default. This applies to all
values not matching a previous CASE keyword.
4.3.168.2 Synopsis
SWITCH(condition, case/value arg. [,case/value arg.] [,case/value argument] . . . )
CASE(match)
Argument Description
condition Any script definition that returns a single value.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 187
Argument Description
Case arg. A script definition with only CASE() keyword.
Argument Description
match Any script definition that returns a single value (must be the same datatype as the first
argument of the SWITCH keyword).
4.3.168.6 Remarks
None
4.3.168.7 Examples
SWITCH(instr_id.nature_e, CASE(1), quote_n, CASE(4), quantity_n, CASE(6),CASE(7),
price_c * quantity_n, price_n)
For stocks, the quote will be displayed. For cash accounts, the quantity will be displayed. For
futures and forwards prices, the quantity will be displayed. For all other natures, the price
will be displayed.
4.3.169 SYNONYM
4.3.169.1 Description
Returns a synonym structure.
4.3.169.2 Synopsis
SYNONYM(entity, id, codification [, flag])
4.3.169.3 Arguments
Argument Description
entity Entity of the object.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 188
Name sqlname_c data_type
Object object_id id_t
4.3.169.5 Remarks
SYNONYM can also be used for indirect access. In that case, it takes only one argument (the
code of the codification) surrounded by square brackets as follows: [argument]. You can only
use the function with the following entity types: currency, geographic_area, sector, rating,
third_party, portfolio, manager, instrument, deposit.
4.3.169.6 Examples
SYNONYM("instrument", instr_id, "ISIN").code
Returns the code of the synonym of the current instrument according to the ISIN
codification. Note that you must use the instr_id form of the argument as the script
interpretor does not recognize the instr form.
instr_id.SYNONYM[ ISIN ].code
4.3.170 SYS_CURRENCY
4.3.170.1 Description
Returns a structure describing the system currency.
4.3.170.2 Synopsis
SYS_CURRENCY( )
4.3.170.3 Arguments
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 189
Name sqlname_c data_type
Last Exchange Rate Type last_exch_type_id id_t
4.3.170.5 Remarks
None.
4.3.170.6 Examples
SYS_CURRENCY( ).name
4.3.171 SYS_DEF_ACCOUNT
4.3.171.1 Description
Returns the default cash account for a defined currency. This function mainly allows
initialising the content of the field ‘Account’ in an operation following the payment currency.
4.3.171.2 Synopsis
SYS_DEF_ACCOUNT ( currency )
4.3.171.3 Arguments
Argument Description
currency Id or code of the currency.
4.3.171.5 Remarks
None.
4.3.171.6 Examples
SYS_DEF_ACCOUNT( instr_id.ref_curr_id ).code
If defined as default value of the field account_id of a buy operation, it will initialise that field
with the default account linked to the instrument currency. Notice that the default flag of the
cash account must be activated to specify that it is the default account for a currency.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 190
4.3.172 SYSDATE, WORKDATE
4.3.172.1 Description
SYSDATE returns the system date.
WORKDATE returns the working date according to the WORKDATE application parameter in
the table appl_param.
4.3.172.2 Synopsis
SYSDATE()
WORKDATE()
4.3.172.3 Arguments
None.
4.3.172.5 Remarks
None.
4.3.172.6 Examples
SYSDATE()
WORKDATE()
4.3.173 SYSTEM
4.3.173.1 Description
Returns the first script definition from system level, which is then substituted for the
keyword. Can only be used in default values and input controls. The underlying mechanism
is, in fact, a dynamic cut and paste of the returned script definition.
4.3.173.2 Synopsis
SYSTEM()
4.3.173.3 Arguments
None.
4.3.173.5 Remarks
Cannot be used for filters.
4.3.173.6 Examples
Given the following values:
System default value:
SYSDATE()
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 191
IF(dim_port_dict_id = “portfolio”, calc_till_d, SYSTEM())
4.3.174 TARGET_BOOK_VALUE
4.3.174.1 Description
Returns the target book value of a position based either on a book valuation rule
(val_rule_id) or on a computation rule (field eval_rule_e of table valuation rule element).
4.3.174.2 Synopsis
TARGET_BOOK_VALUE (date, book_val_rule, comp_rule, max_constr, op_exch_rate,
instr_exch_rate, syst_exch_rate )
4.3.174.3 Arguments
Argument Description
date Date at which the book value must be computed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 192
Name sqlname_c data_type
Operation Exch Rate op_exch_rate exchange_t
4.3.174.5 Remarks
It is important to point out that TARGET_BOOK_VALUE only returns the theoretical book
value, as if the specified arguments, such as the computation rule, maximum constraints,
were applied. This computed value is then returned for display in a format. In no way is the
"accounted" book value affected. If the user wants to update the stored book value in the
database, he/she is obliged to use either the book value adjustment function or to enter an
operation of nature 'Book value adjustment'. TARGET_BOOK_VALUE could be used for ‘What-
if’ analysis to measure the impact from different computation rules, pricing of illiquid
securities, amortization of money-market instruments, etc…
Either the book valuation rule (2nd argument) or the computation rule (3rd argument) must
be specified.
The rule can be a combination of two rules by giving a maximum constraint (field
max_constraint of table valuation rule element)
The application parameter USE_OF_BOOK_VALUE must be set in order to activate that function.
4.3.174.6 Examples
Target book value based on a computation rule (eval_rule_e):
TARGET_BOOK_VALUE( DOMAIN().calc_from_d,"TEST-RULE",LOWEST_COST_MARKET,
MAX_PAR_VALUE,,,).port_net_amount_m.
This expression returns the target book value of a position expressed in the portfolio
currency with computation rule being "lowest of cost and market, but maximum par value".
Target book value based on a book valuation rule attached to a portfolio:
TARGET_BOOK_VALUE(DOMAIN().calc_from_d,
portfolio_id.book_val_rule_id,,,,,).port_net_amount_m.
The above expression returns the target book value of a position, expressed in the portfolio
currency, the computation rule being found in the book valuation rule of the portfolio. The
system automatically retrieves the appropriate computation rule.
4.3.175 THIRD_CHRONO,
Refer to section PORT_CHRONO, CURR_CHRONO, THIRD_CHRONO.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 193
4.3.176 THIRD_CHRONO_ARRAY
4.3.176.1 Description
Returns an array of third party chronological data.
4.3.176.2 Synopsis
THIRD_CHRONO_ARRAY( date , freq , unit , number , third_party , nature , curr )
4.3.176.3 Arguments
Argument Description
date The date until which the historical data occurs (the end date of the series).
freq The frequency at which the data is extracted according to the arg3, the frequency unit
(e.g., each day, every two days, etc.).
unit The frequency unit at which the data is extracted. Enumerated date unit keyword.
This argument has to be filled in between double quotes or replaced by the figure
preceding the value: "Week" or 3.
number Number of readings indicates how many periods or occurrences are to be selected.
nature Nature of the chronological data (e.g., number of voting rights, share capital, etc.). This
argument must be filled in double quotes or replaced by the figure corresponding: "Total
number of voting rights" or 1.
curr Indicates the currency (id or code) in which the chronological data should be. This
involves a currency conversion using the prevalent exchange rates.
4.3.176.5 Remarks
None.
4.3.176.6 Example
STAT(THIRD_CHRONO_ARRAY(DOMAIN().calc_from_d,1,5,10,
third_id,1,third_id.currency_id).mean
Computes the average voting rights the third party has had over the last five years.
4.3.177 TOT_FIRST
4.3.177.1 Description
Returns the first value (TOT_FIRST) of a column from all the records matching a defined
condition following a sorting criteria.
4.3.177.2 Synopsis
TOT_FIRST( expr, filter, sort_criteria [, break_crit] [,order] )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 194
4.3.177.3 Arguments
Argument Description
expression Any script language.
4.3.177.5 Remarks
If null values appear in the data specified by the third argument, the corresponding records
will be automatically put at the end of the sorted data. Note that with all the TOT* keywords,
you can now embed several TOT* expressions in a TOT* statement. This does not work with
the Debt instrument nature.
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
4.3.177.6 Examples
TOT_FIRST( pos_val_id.ref_mkt_val_m , instr_id.nature_e=1 , operation_d )
Returns the market value of the first position in stocks in the portfolio.
TOT_FIRST( pos_val_id.ref_mkt_val_m, 1, operation_d, instr_id.nature_e )
This expression returns the market value of the the first position in the portfolio for each
instrument nature in the portfolio.
4.3.178 TOT_GEOM
4.3.178.1 Description
Returns the geometrically linked sum of all the data of the val argument matching the filter
argument.
4.3.178.2 Synopsis
TOT_GEOM (val, filter [, break_crit] )
4.3.178.3 Arguments
Argument Description
val A script language expression returning a numerical value. Note that the value is only
significant if it falls between -1 and +1.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 195
Argument Description
filter Script language conditional expression used to select the data. If no filter is required,
filter should set to 1.
Where the xi represent the parameter val. The totaliser SUMGEOM uses the same formula.
4.3.178.5 Remarks
The filter defined at format level has no effect on the processed data. If a computation is to
be performed on selected data, you can specify a filter in the filter argument of these
functions.
You cannot use the @ syntax to reference another column of the format table in the
arguments of these functions.
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
4.3.178.6 Examples
TOT_GEOM(RETURN(final_d, RET_MWR,,,,, initial_d,,,,,
SEL_SYNTH("market_segment",&market_segment_id.code <> "CASH").total_return,
market_segment_id = NULL)
Gives the total returns of the invested market segments linked geometrically.
4.3.179 TOT_REGR
4.3.179.1 Description
Performs a regression on two series.
4.3.179.2 Synopsis
TOT_REGR( expr1 , expr2 [, filter ][, break_crit ][, sort_crit ][, rule ][, order ])
4.3.179.3 Arguments
Argument Description
expr1 First object on which the regression has to be performed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 196
Argument Description
sort_crit Sorting criterion.
rule Specifying the way statistics have to be computed. Possible values are
1: default
2: return
3: log return
4.3.179.5 Remarks
References to other columns of the format using @ are not allowed in the arguments of
TOT_REGR.
NULL values are discarded.
There must be at least three valid occurrences.
Formulae
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 197
Formula name Formula
Beta (beta)
Alpha (alpha)
Covariance (covariance)
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
4.3.179.6 Examples
TOT_REGR(BENCH_RETURN("instrument",".DJI", final_d, initial_d), RETURN( final_d,
RET_TWR, , , , ,initial_d).total_return, instr_id=NULL AND market_segment_id=NULL, ,
initial_d, 1,"ASC").beta
Computes the beta coefficient resulting from the regression between the return of a portfolio
and the instrument whose code is ".DJI".
4.3.180 TOT_STAT
4.3.180.1 Description
Computes statistical data.
4.3.180.2 Synopsis
TOT_STAT( expr [, filter ][, break_crit ][, sort_crit ][, rule ][, order ])
4.3.180.3 Arguments
Argument Description
expr Data for which the statistics are computed.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 198
Argument Description
break_crit Break criterion.
sort_crit Sorting criterion. Determines the data on which the sorting should be based. Required
when "rule" is set to 1 or 2. See also "order".
rule Specifying the way statistics have to be computed. Possible values are
0: default: The statistics are based on the original data.
1: return: The statistics are based on the returns of 2 subsequent occurrences of the
data.
2: log return: The statistics are based on the log returns of 2 subsequent occurences
of the data..
order Sort order. Defines the sorting order of the values,which are specified in "sort_crit".
Required when "rule" is set to 1 or 2. The possible values are:
ASC or 1: ascending order (default)
DESC or 2: descending order.
4.3.180.5 Remarks
You cannot reference other columns in the format in TOT_STAT's arguments.
NULL values are discarded.
There must be at least three valid occurrences.
Formulae
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 199
Formula name Formula
Maximum (maximum) max(x1,…,xn)
Mean (mean)
Variance (variance)
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
4.3.180.6 Examples
TOT_STAT( pos_val_id.ref_mkt_val_m , 1 , instr_id.nature_e ).mean
Returns the average market value. A break is performed on the nature of the instrument.
4.3.181.1 Description
TOT_SUM, TOT_MAX, TOT_MIN, TOT_MEAN, TOT_GMEAN, TOT_WMEAN respectively return
the sum, the maximum value, the minimum value, the arithmetic mean value, the geometric
mean value, the weighted mean value of all the data of the val argument matching the filter
argument. For TOT_WMEAN, the data is weighted by the weight argument.
4.3.181.2 Synopsis
TOT_SUM( val, filter [, break_crit] )
TOT_MAX( val, filter [, break_crit] )
TOT_MIN( val, filter [, break_crit] )
TOT_MEAN( val, filter [, break_crit] )
TOT_GMEAN( val, filter [, break_crit] )
TOT_WMEAN( val, weight , filter [, break_crit] )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 200
4.3.181.3 Arguments
Argument Description
values A script language expression returning a numerical value.
filter A script language conditional expression used to select the data. If no filter is required,
filter should set to 1.
weight A script language expression returning a numerical value used as the weight.
4.3.181.5 Remarks
The filter defined at format level has no effect on the processed data. If a computation is to
be performed on selected data, you can specify a filter in the filter argument of these
functions.
You can use the @ syntax to reference another column of the format table in the arguments
of these functions.
For TOT_GMEAN: if the multiplied arguments return a negative value, it is converted into its
absolute value for the moment.
This function must not be used in a format called through TSL if the data to process is sliced
into multiple chunks and if the break criteria refer to more than a single entity.
Not following this rule will result in computation errors, because the function will only apply
to a subset of data (i.e., the content of a single chunk) instead of the whole data set.
For details, see section Using TOT… functions with TSL.
4.3.181.6 Examples
TOT_SUM(pos_val_id.ref_mkt_val_m, instr_id.nature_e=1)
Computes the total market value of all the instruments whose nature is Stock.
TOT_SUM(pos_val_id.ref_mkt_val_m, 1)
Returns the maximum quantity of all the instruments which nature is Cash account.
TOT_MIN(pos_val_id.ref_mkt_val_m, instr_id.nature_e=1)
Returns the minimum market value of all the instruments which nature is Stock.
TOT_MEAN(ref_net_amount_m,1)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 201
4.3.182 TRIMSTR
4.3.182.1 Description
Returns a copy of the str argument without leftmost spaces, rightmost spaces, or both
leftmost and rightmost spaces according to the optional edge argument.
4.3.182.2 Synopsis
TRIMSTR( str [ ,edge ] )
4.3.182.3 Arguments
Argument Description
str String to be trimmed.
edge an optional keyword LEFT or RIGHT. If edge is not specified, space characters will be
deleted on both left and right edges.
4.3.182.5 Remarks
None.
4.3.182.6 Example
TRIMSTR(" text ", LEFT)
4.3.183 TSL_CURRENT_LANGUAGE
4.3.183.1 Description
Returns the language for the current multilingual format element. In the main format
element, the domain's language is returned. If the domain's language is “none”, then the
user’s language is returned.
4.3.183.2 Synopsis
TSL_CURRENT_LANGUAGE( )
4.3.183.3 Arguments
None (empty argument list).
4.3.183.5 Remarks
It must be used only for a multilingual format element.
4.3.183.6 Example
instr_id.LABEL[TSL_CURRENT_LANGUAGE( )]
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 202
4.3.184 UNITACCRINT
4.3.184.1 Description
Computes the unitary accrued interest of a financial instrument.
4.3.184.2 Synopsis
UNITACCRINT( instrument , date [ , fusionrule ] [ , coupon ] [ , force ]
[ , income tax ])
4.3.184.3 Arguments
Argument Description
instrument Id or code of the financial instrument.
fusionrule String or number - optional fusion date rule to be used. Refers to the possible contents of
the attribute fus_date_rule_e. The possible choices are:
1 or Operation date
2 or Accounting date
3 or Value date
income tax Optional income tax rate. If the tax rate is 25%, the argument will be 25.
4.3.184.5 Remarks
None.
4.3.184.6 Examples
UNITACCRINT("COPENH-96-06_6.675", DOMAIN().calc_from_d )
Computes the unitary accrued interests for the specified security at the Initial Date of the
domain.
4.3.185 UNREALISED_PL
4.3.185.1 Description
Computes the unrealised profit or loss of a position.
4.3.185.2 Synopsis
UNREALISED_PL( id , nature , flag [, rule1 ][, rule2 ])
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 203
4.3.185.3 Arguments
Argument Description
id Identifier of the extended position on which the computation has to be performed.
nature Nature of the profit or loss to compute. Possible values are 0 for the total profit or loss, 1
for the capital profit or loss, 2 for the currency profit or loss.
flag Gross profit or loss flag; indicates if the computed profit or loss is
1: gross
0: net
rule1 Optional rule indicating how to assign the interaction effect between capital and currency
profit or loss. The default method is specified in the application parameter
PORT_PL_COMP_RULE. To compute the capital P&L, select:
rule2 Optional. Currency profit or loss computation rule. Indicates whether the capital gain is
computed in the instrument currency or the position currency. Default is the method
specified by the application parameter CURR_PL_COMP_RULE. The possible values are:
1: instrument currency
2: the position currency.
4.3.185.5 Examples
UNREALISED_PL(id, 0,1)
4.3.186 UPDATE_OBJECT_ARRAY
4.3.186.1 Description
Updates the database a set of data from any entity in the Triple'A Plus Core database. It can
only be used in data dependency's script definition.
4.3.186.2 Synopsis
UPDATE_OBJECT_ARRAY(entity, general_criteria, filter, def_val_f, expr1 [, expr2 ] [, ...] [,
expr20 ])
4.3.186.3 Arguments
Argument Description
Entity Name of the entity in which data is updated. To refer to this entity, you must use the
GET_ENTITY keyword.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 204
Argument Description
general_criteria Script expression that selects an initial array of data from the reference entity defined
in the first argument. The referenced attributes of the corresponding entity must be
preceded by the ampersand character (&). The filter criteria argument refers to this
array of data. The role of this argument is to limit calls to the database.
Filter Optional. Script expression that is applied to the records returned by the general
criteria. Note that the referenced attributes of the corresponding entity must be
preceded by the ampersand character (&). You can use any Triple'A Plus Core script
keywords in this expression.
Def_val_f Flag used to specify whether default values must be applied or not.
Expr1…expr20 Script expressions indicating the content of the fields to update. The syntax of these
arguments must be:
&attribute_name:= script_expression
4.3.186.5 Remarks
It can only be used in data dependency's script definition. The reference entity is the data
dependency's entity (entity_dict_id).
Batch input control is executed. If an error is reported, update is refused. If only warnings
are reported, update is accepted.
4.3.186.6 Examples
The following example updates the execution's remark when order is updated (entity in data
dependency is ext_order):
IF(remark_c != NULL, UPDATE_OBJECT_ARRAY(GET_ENTITY("execution"), &ext_order_id=id,
TRUE,FALSE,&remark_c:=remark_c), FALSE)
When the order's remark_c is not null, it sets its remark_c value into the execution's
remark_c field. Default value is not applied.
If you want to do it only for executions without remark_c, the following definition can be
used:
IF(remark_c != NULL, UPDATE_OBJECT_ARRAY(GET_ENTITY("execution"), &ext_order_id=id
AND &remark_c=NULL, TRUE,FALSE,&remark_c:=remark_c), FALSE)
4.3.187 UPPER
Refer to section LOWER, UPPER.
4.3.188 USER
4.3.188.1 Description
Returns a structure containing all the parameters of the current user.
4.3.188.2 Synopsis
USER( )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 205
4.3.188.3 Arguments
None.
Identifier id id_t
4.3.188.5 Remarks
None.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 206
4.3.188.6 Example
USER( ).name
4.3.189 USER_INPUT ()
4.3.189.1 Description
Lets you create an input box using a keyword.
4.3.189.2 Synopsis
USER_INPUT (input box title, mandatory [, default value])
4.3.189.3 Arguments
Argument Description
Input box title Specifies the title that is displayed in the input box.
4.3.189.5 Remarks
The USER_INPUT() keyword cannot be inserted into an AUTOCREATE expression if the field
on which the USER_INPUT() is based is part of the entity's business key.
The USER_INPUT() keyword can only be inserted into an AUTOCREATE keyword expression.
It cannot be used in any other way.
4.3.189.6 Example
IF(OLD().type_id<>type_id,
AUTOCREATE(GET_ENTITY("port_chrono"), INSERT_UPDATE,
&portfolio_id:=id,
¤cy_id:=currency_id,
&validity_d:=SYSDATE(),
&nature_e:=19,
&value_n:=type_id) AND
AUTOCREATE(GET_ENTITY("notepad"), INSERT_UPDATE,
&entity_dict_id.sqlname_c:="portfolio",
&object_id:=id,
¬e_d:=SYSDATE(),
&user_id:=USER().id,
&type_id.code:="CHANGE_COMPOSITE",
&title_c:=USER_INPUT("Note Title", 1, "Note title: "),
¬e_c:=USER_INPUT("Note Detail",1, " Please justify why you have changed the
portfolio type ")))
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 207
The above script can be used in an input control to watch for changes to the portfolio type. If
a user tries to change the portfolio type, a dialogue box is displayed, asking for the reason
for the change. The user must then enter a brief explanation in a Triple'A Plus Core notepad
entry.
4.3.190 VAL_RULE_COEF
4.3.190.1 Description
Returns the value of a coefficient for a given coefficient nature based on a lending valuation
rule id.
4.3.190.2 Synopsis
VAL_RULE_COEF (val_rule)
4.3.190.3 Arguments
Argument Description
val_rule Valuation rule coefficient nature. These natures must be defined on site. The permitted
values are not indicated.
4.3.190.5 Remarks
None.
4.3.190.6 Examples
VAL_RULE_COEF(1)
Returns the valuation rule coefficient, whose nature is 1, of the current position.
4.3.191 VAL_RULE_ELEM
4.3.191.1 Description
Displays the appropriate valuation rule element for an instrument for a given valuation rule
history.
4.3.191.2 Synopsis
VAL_RULE_ELEM ( val_rule [, instrument] [, curr] [, date] )
4.3.191.3 Arguments
Argument Description
val_rule Valuation rule history id.
date Optional.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 208
4.3.191.4 Return type
Returns the valuation rule element structure.
4.3.191.5 Remarks
None.
4.3.191.6 Examples
In the context of a book value adjustment operation:
VAL_RULE_ELEM (val_rule_history_id, instr_id, account_d).id
Returns the relevant valuation rule element for a given valuation rule history and a given
instrument at the accounting date.
VAL_RULE_ELEM(VAL_RULE_HIST(portfolio_id.book_val_rule_id,DOMAIN().calc_from_d).id,
instr_id).code
Returns the code of the list to which the current position has been allocated following the
book valuation rule linked to the portfolio.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 209
4.3.192 VAL_RULE_HIST
4.3.192.1 Description
Displays the valuation rule history of a given valuation rule at a certain date.
4.3.192.2 Synopsis
VAL_RULE_HIST( val_rule , date )
4.3.192.3 Arguments
Argument Description
val_rule Valuation rule history id.
date Optional.
4.3.192.5 Examples
VAL_RULE_HIST(portfolio_id.book_val_rule_id, DOMAIN().calc_from_d).begin_d
Returns the date at which the accurate valuation rule (based on the Domain Initial Date)
becomes valid.
4.3.193 WHERE_IN_GRID
4.3.193.1 Description
Returns the market segment structure to which an instrument belongs in a specific grid.
4.3.193.2 Synopsis
WHERE_IN_GRID( instrument , grid [, date enum ] [, date] [, level])
4.3.193.3 Arguments
Argument Description
instrument Instrument id or code.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 210
Argument Description
date enum specifies in wich context the user wants the data to be retrieved:
0: work on the Domain context
1: work on the current list
2: work on the historical list
date Date at which the user wants to perform the list historisation.
level Level to which you want to go back up to in the market segment tree (only used for the
denom attribute).
4.3.193.5 Remarks
If the date enum parameter is set to 2 and the data parameter is NULL, the keyword returns
the market segment structure at the domain Initial Date.
4.3.193.6 Examples
WHERE_IN_GRID(instr_id,"categcurr").name
Returns the name of the segment to which the current instrument belongs.
WHERE_IN_GRID(instr_id,"categcurr",2,"10/03/2001").name
Returns the name of the segment to which the current instrument belongs on the
10/03/2001.
WHERE_IN_GRID(instr_id,"FBA_PAA_TEST_BONDS", , ,2).denom
Returns the market segment path up to the second level for the FBA_PAA_TEST_BONDS
market structure.
4.3.194 WORKDATE
Refer to section SYSDATE, WORKDATE.
4.3.195 YTM
4.3.195.1 Description
returns the structure of a yield to maturity.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 211
4.3.195.2 Synopsis
YTM( [ instr ][, type ][, flag1 ][, flag2 ][, flag3 ][, date ][, flag4 ][, flag5 ][, rate ][, date ][,
price1 ] [,price2] [,income tax] [,capital tax])
4.3.195.3 Arguments
Argument Description
instr Optional instrument id or code on which the yield to maturity has to be computed. This
argument can be omitted only if the function is used in an extended position context.
flag1 Optional effective date flag indicating that all yield calculations are done on the effective
redemption if the effective redemption date has been passed. Default is YES (1).
flag2 Optional default to final flag indicating, in functions that require yield to call or yield to
put, whether in the case of no call or put redemptions the function should return 0 or
the yield to maturity. Default is YES (1)
date Optional reference date indicating the date at which the calculation is required. Default is
the Initial Date specified in the domain.
rate Optional coupon rate of the instrument overriding the rate specified at the instrument
level or describing the rate of a generic instrument if it is not in an extended position
context.
date Optional maturity date indicating the date on which the instrument is redeemed. That
date overrides the date specified at the instrument level or describes the date of a
generic instrument if it is not in an extended position context.
price1 Optional instrument price indicating the price of the instrument at the reference date. It
overrides the price retrieved at the instrument level.
income tax Optional income tax rate to be applied. Notice that this rate is 25%, the number 25 must
be specified and not 0.25.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 212
Name sqlname_c data_type
Yield-to-Maturity ytm_n number_t
4.3.195.5 Remarks
YTM can be used with the following natures: Money Markets, Discounts, Bonds, Option
Bonds, Convertible, Bonds, Miscellaneous.
The computation for Floating Rate Notes is:
It tries to determine y so that the result equals price + accrued interest where:
c is the next known coupon,
s the spread on the index (LIBOR, etc.)
ti the time between each coupon payment (and t1 the next known period)
R the redemption price
ni the period of time between the assesment and flow date, as a fraction of a year.
4.3.195.6 Examples
YTM ( ).ytm_n
Computes the yield to maturity on basis of the best call (lowest yield).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 213
Note that SQL format elements are only processed when the format is called through TSL
(Triple'A Plus Web). They will not be processed when displayed in the GUI.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 214
5 Keywords
Keywords are expressions used as arguments in several functions of the script language.
They specify the unit in which the results are expressed (date units) or which element must
be extracted (date parts).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 215
Type Keyword Used in function
Return computation methods RET_TWR (time weighted return rate) RETURN
RET_MWR (money weighted return rate)
RET_IRR (internal rate of return)
RET_ARC (arithmetic return chaining)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 216
Type Keyword Used in function
Enumerated price calculation rule 1 Quote
keywords
2 Quote/100
3 Partially Paid Stocks
4 Partially Paid Bonds
5 Stocks Quoted in %
6 Bonds Quoted in Unit
7 Actuarial Yield
8 Discounted
9 Add-On Rate
10 Quote/100 with AI
11 Quote in Unit with AI
12 TCN
13 Annualised Rate
14 Quote Life
15 Euro-Futures
16 FRA on Libor
17 Australian Future
18 Part. Paid Bonds in Unit
19 Part. Paid Stocks in Prct
20 Price Calculation Factor
21 In fine Yield
22 Basis Points
23 Quote in Unit
24 Australian Future (flexible)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 217
Type Keyword Used in function
Enumerated accrual rule keywords 1 30E/360
2 30/360 (Feb)
3 30/360 (Def)
4 30US/360
5 Actual/365
6 365/365
7 Actual/Actual
8 Actual/360
9 Actual+1/365
10 Actual/Actual (US)
11 30E/365
12 30/360
13 30E/Actual
14 30US/365
15 30US/Actual
16 Actual+1/Actual
17 Actual+1/360
18 30/360+1 (Italian BTP)
19 ACTACT
20 ACTLEAP
21 ACTAFB
22 ACTEUROBOND
23 ACTFRF
24 EU30360
25 EU30E360
26 EU30E365
27 US30360
28 US30E360
29 ACT365
30 ACTNL365
31 ACT360
32 EU30EP360
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 218
6 Script language for format elements
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 219
Format_element: n°10 n°15
rank_n: 10 15
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 220
7 Defining constrained lists
7.2 Examples
For a list of instruments:
ref_curr_id.code IN ("EUR","DKK","SEK","NOK")
which creates a list with all the instruments whose currency is "EUR", "DKK", "SEK" or
"NOK".
which creates a list with all the portfolios managed by the commercial manager ADR.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 221
8 Defining default values
To define default values on a field of any entity, go to Administration > Script > Default Values
from the main menu bar. Then, select the Entity and the Attribute for which you want to
define a default value.
The nature indicates the context in which the default value will be applied:
Nature Definition
System GUI This is a default value defined by Temenos. It cannot be modified. The script is
default value applied whenever data is input via the GUI interface and no User GUI default value is
defined.
User GUI default Default value defined by the user. It has priority over the System GUI default value.
value The script is applied whenever data is input via the GUI interface.
System Batch This is a default value defined by Temenos. It cannot be modified. The script is
default value applied whenever data is input via the batch interface and no User Batch default
value is defined.
User Batch Default value that has been defined by the user. It has priority over the System
default value Batch default value. The script is applied when data is input via the batch interface.
8.2 Examples
For a buy operation, the attribute acc_exch_rate has the following default value:
IF (acc_currency_id <> NULL,
IF ((fi_currency_id=acc_currency_id),
op_exch_rate,
IF (SYS_CURRENCY().id = acc_currency_id,
op_exch_rate / sys_exch_rate ,
EXCH_RATE(op_currency_id, operation_d, acc_currency_id,0,0,0).exch_rate)))
For a financial instrument, the attribute ref_curr_id has the following default value:
SYS_CURRENCY().id
For a sell operation, the attribute quote_n has the following default value:
IF (instr_id.nature_e = 7, EXCH_RATE(instr_id.underly_instr_id.ref_curr_id,
operation_d, instr_id.ref_curr_id, 0, 0, 0).exch_rate, INSTR_PRICE(instr_id,
operation_d, 1, 0,0,0, op_currency_id).quote_n)
8.3 Notes
The functions that are specific to the default values definition are:
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 222
ACCR_INTER
AUTOCREATE
GET_ENTITY
GET_RATE
NET_AMOUNT
NEW_INDEX
PTF_DEF_ACCOUNT
SYS_DEF_ACCOUNT
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 223
9 Defining input controls
To define an input control for a field in any entity, go to Administration > Script > Input Control
from the main menu bar. Then, select the entity for which you want to define an input
control from the Entity drop-down list.
The nature indicates the context in which the input control is to be applied:
Nature Definition
System GUI An input control defined by Temenos. It cannot be modified. The script is applied
control value when data is entered in the GUI screens and no User GUI control value has been
defined.
User GUI control An input control that has been defined by the user. It has priority over the System
value GUI control value. The script is applied when data is entered in the GUI screens.
System Batch An input control defined by Temenos. It cannot be modified. The script is applied
control value when data is entered via the batch interface if there is no User Batch control value
defined.
User Batch Default value defined by the user. It has priority over the System Batch default
control value value. The script is applied when data is entered via the batch interface.
9.2 Remarks
If more than one input control is applied to an entity, the script expressions must be
separated by a semi-colon (;). The functions specific to the input control are MSG,
GET_BALANCE and SEL_EXTPOS. MSG must only be used in combination with the conditional
keyword IF.
The functions that are specific to the input control definition are:
GET_BALANCE
GET_EXT_OP
GET_EXTOP_NUM
GET_OP_NUM
MSG
OLD
SEL_EXTOP
SEL_EXTPOS
SEL_OP
9.3 Examples
IF (USER().code = "aaa" AND sys_net_amount_m > 40000,
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 224
MSG(ERROR,"quantity_n",NULL, NULL,"You are not allowed to handle operations exceeding
40,000 CHF") )
MSG(ERROR,"quantity_n","User Message","amount_exceed",NULL) )
IF(GET_BALANCE(1,SEL_EXTPOS(portfolio_id,account_id,operation_d),&status_e=40)
<acc_net_amount_m, MSG(WARNING,"acc_net_amount_m",2, "Not enough cash on the
account",NULL))
If the above expression is defined as an input control for a Buy operation, it displays the
message "Not enough cash on the account" if the amount to be debited from the account is
greater than the current balance of the account at the operation date and the account status
is equal to 40 (Accounted).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 225
10 Defining rules
To define rules on fees and taxes fields of an operation, go to Administration > Script > Rule
from the main menu bar. Then, select the operation type in the field Entity. The second step
consists in the definition of a default value where the entity type corresponds to the one
defined previously and the attribute for the selected entity will be "rule_id".
10.2 Remark
Whenever a rule has to be defined on an operation type, a definition has to be specified on
the 10 balance position amounts corresponding to the fees and taxes. If a fees and taxes
field must not be influenced by the rule, its definition must be "NULL".
10.3 Examples
The field rule_id of the buy operation can have the following default value:
IF (intermed_third.code="PUILATCO" AND instr_id.nature_e=1,"rule1","rule2")
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 226
11 Defining constraints
You can define constraints for strategies whose nature is Constraints Set. To do this, you
must edit the Strategy (with the Constraints Set nature).
11.2 Examples
No instrument nature can be more than 20% of the total market value of the portfolio:
CHECK_SUM(pos_val_id.ref_mkt_val_m / portfolio_id.mkt_val_m, LT, 0.2, ,
,instr_id.nature_e)
The banking sector cannot be more than 15% of the total market value of the stock
category:
CHECK_SUM(pos_val_id.ref_mkt_val_m / TOT_SUM(pos_val_id.ref_mkt_val_m,
instr_id.nature_e=1), LT, 0.15, , instr_id.nature_e=1 AND
instr_id.SECTOR_ATTRIB["NACE"].sector_id.code = "BANKING")
(Note the empty parameter indicated by the second comma after the quantity 1000.)
No issuer can be more than 5% of the total market value of the portfolio:
CHECK_SUM(pos_val_id.ref_mkt_val_m / portfolio_id.mkt_val_m, LE, 0.05,
,instr_id.issuer_third_id <> NULL, instr_id.issuer_third.code)
The sum of all the issuers representing more than 5% of the portfolio cannot be greater than
40% of the total market value:
CHECK_SUM(100 * pos_val_id.ref_mkt_val_m / portfolio_id.mkt_val_m, GT, 5,,
instr_id.issuer_third_id <> NULL, instr_id.issuer_third.name, LT , 40)
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 227
12 Defining filters
Triple'A Plus Core lets you define the following kinds of filters:
Filters on foreign keys
Filters on Enumerated fields
Filters on Date fields
12.2 Example
The following expression is an example of a filter on a foreign key field. It could be the filter
linked to the Account field of a Buy operation:
&portfolio_id = portfolio_id AND &nature_e = 4 AND &ref_currency_id = acc_currency_id
This means that the content of the portfolio field in the target entity (instrument) must be
the same as the portfolio field in the Buy operation. The nature of the instrument to be
displayed must be Cash Account (4).
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 228
As a filter on an enumerated field, the following expression restricts the proposed choices for
the Payment Frequency Unit field to Quarter, Semester and Year.
ENUM_LIST( 3 , 4 , 5 )
IF (nature_e = 1 , ENUM_LIST( 1 ) )
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 229
13 Administration Rights Scripts
Administration Rights Scripts lets the user manage the availability and/or visibility of several
actions (such as Print and Copy to Clipboard through the use of buttons and menus) that are
usually not manageable via the Data Security Profiles and/or Function Security Profiles.
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 230
13.3 Managing Administration Rights Scripts
Administration Rights Scripts can be created or edited using the Administration Rights screen
(Administration > Function Script > Administration Rights).
The values for the attribute Function, Entity, and Action fields determine the Administration
Rights Scripts for the desired actions. You can create the following levels of scripts:
Specific function and specific entity
Specific function and all entities
All functions and all entities
Note: Only the more detailed script is evaluated according to the screen that you are
viewing (e.g., portfolio edition, valuation).
Example:
The Copy to Clipboard action must be invisible except in the Domain screen and in the
Valuation business function for users who have a user profile and whose code starts with
"ADM".
To implement this requirement, three Administration Rights Scripts must be created as
follows with Action = Copy to Clipboard:
18 June 2015 Triple’A Plus™ Core 15.06 - Script Language Reference Guide 231