ITQuants blog

Misys Risque/Value toolkit: how to detect that the instrument displayed at screen is in audit mode?

Oct 10

Written by:
10/10/2012 2:29 PM  RssIcon

Imagine that the instrument dialog was overloaded by toolkit, and that the sicovam is required to make some SQL query when opening the insturment dialog. If there is no test on the fact that the instrument is displayed in audit mode, this will certainly fail since the sicovam given by the CSRInstrument will correspond to the "new" sicovam and not the one used in current mode.

The right question is then how to detect that the CSRInstrument returned by a CSRInstrumentDialog::new_CSRInstrument is in audit mode?

Quite easy: the toolkit provides a wrapper that gives the opportunity to do some treatment around the audit: CSRInstrumentHistory. All the audit information is stored on the Sophis internal structure DTitre. Since this structure is not exported, using the wrapper is the right solution.

For instance, the following code permits  detected in which mode is  displayed the instrument:

1.CSRInstrument* _item = new_CSRInstrument();
2.bool _isHisto = CSRInstrumentHistory::IsHistorical(_item->GetDTitre());
3.long _ident = 0;
4.double _date = 0.;
5.CSRInstrumentHistory::GetCodeToLoad(_item->GetDTitre(),_ident,_date);

Search blog