Fusion Invest: how to get the inflation values?
Sep
30
Written by:
9/30/2014 2:15 PM
I've got a question today on how to get the values displayed in the Inflation Curve Numerical Results dialog, as described below. This dialog can be displayed by clicking on the menu Data\Inflation and then by double-clicking on one index, and then on the toolbar button which appears on the right of the RIC one.
The goal of this post is to describe how to get the values and the ones retrieved from the quotes too.
First, the displayed results are based on the ones stored into the database. In order to get the values used, the following query will give the results:
select
gp.x, gp.y, gp.type, gp.item, gp.ident, gp.courbe
from
GR_POINTS gp, GR_INFOSCOURBE gic, histotaux h
where
gp.courbe = gic.ident
and
gic.graphe = h.graphe
and
h.CODEDEV = mycode
and
h.DATEGRAPHE = (
select
max
(DATEGRAPHE)
from
HistoTaux
where
CODEDEV = mycode)
The code to use corresponds to the one stored in the INFLATION_RULE table. This will give in y the rate used, and using x and type, the maturity of the yield curve.
In order to get the calibrated values - the ones displayed in the above dialog -, we need in fact to use the following C++ code:
const
sophis::inflation::CSRInflationCurve* _curve = sophis::inflation::CSRInflationCurve::GetInstance(181);
sophis::inflation::CSRInflationCurve::RateMap _map;
_curve->GetCalibratedPoints(_map);
sophis::inflation::CSRInflationCurve::RateMap::const_iterator _it = _map.begin();
for
(;_it!=_map.end();_it++)
{
long
_year = _it->first /12;
long
_month = _it->first % 12;
double
_value = _curve->GetValue(_it->first);
double
_rate = _it->second * 100.;
int
_break = 0;
}
By the way, if the USING_SOPHIS_NAMESPACE preprocessor command is selected, it has no impact on the naming space of this class, it means that we always have to declare it. In order to compile the code the following headers have to be included:
#include "SphInc/inflation/SphInflation.h"
#include "SphInc/inflation/SphInflationCurve.h"
and SphInflation.lib has to be added on the link.