







Advanced Risk and Portfolio Management
Code libraries
ARPM Lab coding environments
The ARPM Lab contains one coding environment for each programming language made available to its users.In the ARPM Lab Coding Environments, code can be created, edited and executed interactively by the user from the browser, without any software installation.
To access the code, browse the contents on the navigation panel to the left, or click on the code icon

The ARPM Lab Code is composed of scripts, functions and usage example scripts.
The scripts implement the ARPM Lab Case Studies and toy examples, following the ARPM Lab Theory.
The functions, which are called by the scripts, gather the most frequently used sequences of instructions that perform specific tasks, implementing the algorithms described in the ARPM Lab Theory. The ARPM functions are divided by topic, see below.
Each of the usage example scripts implement a simple use case of a given function: for a given function, they show how the function is called and how to assign what it returns.
Python
The Python implementation of ARPM's scripts and functions is available to the ARPM users in the ARPM Lab Python Coding Environment.In the Python Coding Environment users find two main directories: one for the code (scripts and functions) and one for the databases.
The code is in the
Python
directory, which has two sub-directories, one for the scripts, and one for functions:-
the scripts are grouped in the
scripts
directory, which in turn has two sub-directories:
sources
containing the actual Python scripts created from the ARPM Lab Code Documentation;notebooks
containing the Jupyter Notebook implementation of the scripts in thesources
directory;
-
the functions are grouped in the
functions
directory, which in turn has sub-directories for the various topics;
- usage example scripts for functions are stored in the
usage-examples
sub-directory of thefunctions
directory.
- usage example scripts for functions are stored in the
databases
directory, which in turn has two sub-directories:global-databases
containing the files hosted in the common databases repository;temporary-databases
containing the files hosted in the Python specific repository.
-
Python
-
functions
- estimation
- portfolio
- pricing
- statistics
- tools
- views
- usage-examples
-
scripts
- notebooks
- sources
-
functions
-
databases
- global-databases
- temporary-databases
MATLAB
The MATLAB implementation of ARPM's scripts and functions is available to the ARPM users in the ARPM Lab MATLAB Coding Environment.In the ARPM Lab MATLAB Coding Environment users find two main directories: one for the code (scripts and functions) and one for the databases.
The code is in the
MATLAB
directory, which has two sub-directories, one for the scripts, and one for functions:-
the scripts are grouped in the
scripts
directory, which in turn has two sub-directories:
sources
containing the actual MATLAB scripts created from the ARPM Lab Code Documentation;live-scripts
containing the Live Script implementation of the scripts in thesources
directory;
-
the functions are grouped in the
functions
directory, which in turn has sub-directories for the various topics;
- usage example scripts for functions are stored in the
usage-examples
sub-directory of thefunctions
directory.
- usage example scripts for functions are stored in the
databases
directory, which in turn has two sub-directories:global-databases
containing the files hosted in the common databases repository;temporary-databases
containing the files hosted in the MATLAB specific repository.
-
MATLAB
-
functions
- estimation
- portfolio
- pricing
- statistics
- tools
- views
- usage-examples
-
scripts
- live-scripts
- sources
-
functions
-
databases
- global-databases
- temporary-databases
ARPM Lab databases
The ARPM Lab contains databases with market data, in CSV format, which are processed by scripts and functions, described above.Databases are logically split in two sets:
- Global databases: containing static data that is used as input of scripts;
- Temporary databases: containing dynamic data that is the output of a script and the input of, at least, another script.
Every ARPM Lab Coding Environment has its own set of temporary databases.
ARPM Lab code documentation
The ARPM Lab contains detailed documentation for all scripts and functions.To access the documentation, browse the contents on the navigation panel to the left, or click on the documentation icon

This documentation contains comprehensive details of the steps needed to implement all the scripts and functions, inclusive of pseudo-code algorithms.
The purpose of using pseudo-code is twofold:
- it is easier for users to understand than conventional programming language code, thus eliminating the language barrier for users;
- it is an efficient and language-independent description of the key principles of an algorithm, that can be implemented in a variety of programming languages.
Names of scripts, functions, variables and other identifiers are coherent among all the channels of the ARPM Lab, including Theory, Code Documentation, pseudo-code and Code to facilitate the learning process.
The ARPM Lab Code Documentation is heavily cross-referenced, and thus provides the bridge between the ARPM Lab Code and the rest of the ARPM Lab.
The ARPM Lab Code Documentation for scripts is divided in chapters, following the ARPM Lab Theory, and contains the following sections:
- Theoretical context
- Summary
- Data (optional)
- Parameters
- Outcomes and figures
- Implementation
- See also
- estimation
- portfolio
- pricing
- statistics
- tools
- views
- Summary
- Input
- Output
- Implementation
- Tips (optional)
- Example
- Case studies
- References
- See also
