Configuring and running FIA
FIA can be configured in two ways, depending on how you want to call the program:
Calling FIA from the command line
To run FIA in stand-alone mode from the command prompt, you must supply data files and a configuration file.
Calling FIA from code
To call FIA from code, the information required is almost exactly the same as for stand-alone mode. The main differences are
- data must be supplied as in-memory arrays rather than CSV files;
- configuration settings are carried out in code, rather than by assinging values in a configuration file.
- Some code is required to pull everything together.
Assigning data arrays in Python
The starting point for a data array in Python is a Flametree-defined data structure called a stringmatrix. This structure is defined in module FIA_python36 and allows the user to initialise it in terms of lists of lists.
For instance, to set up yield curve data using static declarations, we could write
y = FIA_python36.stringmatrix() y = [
["BASE_CURVE", "2010-Jan-01", "0.0", "0.050"], ["BASE_CURVE", "2010-Jan-01", "4.0", "0.050"], ["BASE_CURVE", "2010-Jan-01", "8.0", "0.050"], ["BASE_CURVE", "2011-Jan-01", "0.0", "0.045"], ["BASE_CURVE", "2011-Jan-01", "4.0", "0.045"], ["BASE_CURVE", "2011-Jan-01", "8.0", "0.045"], ["SECTOR_CURVE", "2010-Jan-01", "0.0", "0.055"]
This data can now be assigned as described in the following section. To assign data rather than indiviudal settings, we use a different function called FIA_set_matrix.
The following function does the same as setting
in a configuration file. Instead, we write
FIA_python36.FIA_set_matrix( FIA_API_constants.FT_MATRIX_YIELDCURVE, y );
Despite the additional apparent complexity of calling FIA in this way, it carries many advantages - speed, robustness, and ease of deployment. In particular, the ability to pass large quantities of data in memory rather than via disk files means you can process your portfolio much more quickly.
Values of the configuration constants are supplied in file FIA_API_CONSTANTS.py (for Python), FIA_API_CONSTANTS.cs (for C#), and FIA_API_CONSTANTS.java (for Java). These files are always supplied with the run-time files for FIA.
When using a set of constants, it is important to ensure that you are using the correct version. As FIA is developed and improved, the mapping of some constants can change and if you use an out-of-date file, the program may not work as intended.
The constants file therefore has a first line that reads as follows:
Auto-generated constants file for calling FIA from Python DO NOT MODIFY THIS FILE Version v2.4.0-9
Please ensure that the version number supplied on the third line matches the version of FIA that you are running. You can check this from the command line by typing