Calling the API
This page describes how to call the Flametree attribution engine from within another application, using the Appllication Programming Interface (API).
The Flametree API is a collection of function calls and related constants that allow the FIA attribution engine to be called from within another program, rather than as a stand-alone application.
The library is written in C++ and is compiled into a 64-bit DLL (Dynamic Link Library). Wrapper files are alsp available that allow the engine to be called from other languages, including as C#, Python and Java.
The API was substantially redesigned in 2015 to use a data–driven interface (also known as a message-passing, or event-based API). Instead of using a large collection of method calls, the API depends on a much smaller number of calls and a data dictionary of arguments. The advantages of using a data-driven API for the Flametree engine are that
- it is simple to understand and use;
- it is future-proof, in that planned additions to the engine’s functionality in future releases will not break existing code that calls the library.
In addition to the usual types of parameter such as integer and boolean-valued switches, FIA uses vector and matrix types to pass data to and from the host program.
A vector type is defined as
typedef vector <string> VECTOR_MATRIX;
A matrix type is defined as
typedef vector <vector<string> > STRING_MATRIX;
Please refer to the appropriate language section to see how to instantiate and use these data structures in non-C++ environments.
The following functions are available to the user:
int FIA_set_integer ( const int parameter_ID, const int value )
int FIA_set_long ( const int parameter_ID, const long value )
int FIA_set_double ( const int parameter_ID, const double value )
int FIA_set_bool ( const int parameter_ID, const bool value )
int FIA_set_string ( const int parameter_ID, string value )
int FIA_set_vector_string ( const int parameter_ID, VECTOR_MATRIX value )
int FIA_set_matrix ( const int parameter_ID, STRING_MATRIX value )
STRING_MATRIX FIA_get_matrix ( const int parameter_ID )
int FIA_run ( void )
Symbolic constants for data structures
|FT_MATRIX_SECURITY||Security master data||2|
|FT_MATRIX_YIELDCURVE||Yield curve data||3|
|FT_MATRIX_STRESS||Stress scenario data||4|
|FT_MATRIX_MAP||Security mapping data||5|
|FT_MATRIX_CPI||CPI and index data||7|
Symbolic constants for carry settings
|FT_STRING_CARRY_ALLOCATION_SECTORS||Carry allocation settings||101|