Fusion Invest: how to increase performance using the Sophis Risk Management module?
Mar
12
Written by:
3/12/2015 5:30 PM
In the last version provided by Misys concerning their product Fusion Invest and Fusion Banking Sophis (v7.1.3.x), new functionalities were added to the SRM module (for Sophis Risk Management, ex-"VAR" module), that permits to calculate asynchronously data on calculation servers, to retrieve the results and store them in a Reference Price server, and finally to display them on the client screens.
I think that it is one of the most powerful enhancement done by Misys on this version. For clients having problems when using toolkit columns, this permits to increase the performance when, for example, aggregation is done on a very large perimeter, with lot of dependencies between columns.
The goal of this post is to explain the architecture of this component and how to use it.
Architecture
Briefly, the architecture is as follow: a workflow of tasks on a list of folios/positions is scheduled. In one of these tasks, calculations are done, calculating a list of native indicators using some preferences of calculations (user to be defined in the scenario configuration). Other sensitivities/indicators can added using toolkit scenario. The Sophis data/API is loaded by the Sophis.RM.FOManager process, and calculations of the user indicators are done in this process. Using calculation servers, financial instruments calculations (theoretical values using Monte-Carlo algorithms for example) can be dispatched on a grid too, or not, depending on the configuration made in the workflow . Once calculated, data is stored in database and pushed to a memory cache server, the Reference Price Server (RPS). Client GUI are connected to this cache. The schema is the following one:
Specific API are available and permits to calculate user sensitivities. For example, for some instruments, the Credit Exposure could correspond to a certain value of Duration and for other instruments, some other Duration + added value, depending on the requirements of the business.
C++ Implementation
User sensitivities are calculated by a user scenario, loaded in one toolkit dll. The toolkit dll implementing the scenario needs to be developed in C++ (in v7.1.3), not in C#, due to some residual bugs done by a bad implementation of the C# wrapper. In order to be called, the scenario should at least implement the following methods: CSRScenario::AvailableForCalculationServer when calculation servers are neeeded, CSRScenario::AvailableForReport (that should return true). In this case, CSRScenario::GetReportResult is called by Sophis.RM.FOManager.exe and indicators can be filled using methods of the CSRReportStrategy class.
class
CITQScenarioIndicator :
public
CSRScenario
{
public
:
....
virtual
bool
AvailableForCalculationServer()
const
{
return
true
; }
virtual
bool
AvailableForReport()
const
{
return
true
; }
virtual
void
Run();
virtual
bool
GetReportParameter(CSRReportStrategy& strategy)
const
;
virtual
void
SetReportData(
const
sophis::scenario::CSRInputStrategy& inputStrategy);
virtual
void
GetReportResult(sophis::scenario::CSRReportStrategy &strategy)
const
;
...
};
Note that the CSRScenario::Run method needs to call ProcessPositions as follow:
void
CITQScenarioIndicators::Run()
{
ProcessPositions(0);
}
The way to fill results using the SRM API is the following one, where position is either an integer index when using a flat view, or a CSRPosition object when using a tree view. The size of tAllScalarAnalytics is not indicated, but this parameter should correspond to vector of the same size than the one set as parameter on "indicator" axis:
//Describe the axis
strategy.InitResultAxis(GetFolioCode(), CSRReportStrategy::erOneValue);
strategy.AddResultAxis(
"indicator"
, tAllScalarAnalytic_NameList);
strategy.AddResultAxis(
"folioident"
, 1, (
const
long
*)&folioCode, erlStandard);
strategy.AddResultAxis(
"mvtident"
,1,&mvtIdent, erlStandard);
// add the position scalar result
// the API is unsafe. we could have a size in the name list different from the size of the array of double
// the try/catch is there to prevent any potential crash
try
{
if
(tAllScalarAnalytics.size()>0)
strategy.ResultPosition(position, &tAllScalarAnalytics[0]);
}
catch
(...)
{
}
The CSRReportStrategy::AddResultAxis should add at least the “indicator” field, which is setted in the Oracle configuration of the sensitivity too.
Calculations can be made either by re-calculating Sophis native indicators (greeks, theoretical value..) when bumping some market-data or using the ones delivered by the scenario that delivers native Sophis indicators (named Central Scenario). In order to retrieve the calculations of the Central Scenario, a key need to be created as follow:
CSRGlobalComputationKey keyCalc(instrument->GetCode(), position->GetMetaModelId());
CSRComputationResults* results = (CSRComputationResults*) CSRComputationResults_Global::GetInstance().Get(keyCalc);
Configuration
On the server side, the user scenario has to be declared as analysis in the FO Risk configuration dialog. Note that for having results stored as is , the Result Level field has to be configured as Position instead of instrument, otherwise results will be divided by the quantity and multiplied again after. When choosing such a configuration, the folios need to be parsed using the tree view methods and cannot be parsed using the flat view.
Since the analysis is declared as Position, sensitivities should be declared as Position in the field storage format too:
The attribute name indicator defined there is used in the AddResultAxis method. Once the sensitivities are declared, the XML serialization of the scenario needs to be added in the scenario.xsd file, present in the schema folder of the shared API. The following entry needs to be added:
and the C# assembly used by the serializer needs to be generated again:
The perimeter is defined then by adding a scenario using the FO risk configuration and by adding a workflow that uses the scenario.
<
xs:complexType
name
=
"ITQAnalyticIndicators"
>
<
xs:annotation
>
<
xs:documentation
xml:lang
=
"en"
></
xs:documentation
>
</
xs:annotation
>
<
xs:complexContent
>
<
xs:extension
base
=
"tns:ScenarioParameters"
/>
</
xs:complexContent
>
</
xs:complexType
>
On client side, we need to add the indicators in portfolio columns by clicking on the Front Office Risk portolio columns entry in the Administration ribbon bar:
The following screen appears then, that permits to map FO Risk results to user portfolio columns. Once defined, these user columns can be added to the portfolio columns configuration like other columns.
That'all, folks, enjoy!