ITQuants blog

By Philippe Bonneau on 10/11/2016 10:24 PM

I guess that everybody who uses Fusion Capital Sophis or Fusion Sophis already got the classic "Internal error on MFC message" dialog box that announciates that a crash, access violation or whatever, occured.

In most cases, unfortunately, classic logs are not sufficient to investigate why the problem occurs. The goal of this post is to propose a method that permits to dump the callstack when such an event occurs.

By Philippe Bonneau on 6/3/2016 2:13 PM

Before the v7, in order to serialize specific indicators calculated by the internal quant libraries, virtual methods like CSRInstrument::GetCalculationData and CSRInstrument::SetCalculationData were used. These methods are not deprecated and a specific implementation of the class CSRComputationResults should be used. The goal of this post is to explain how to declare such a class and to give a complete sample ready to use.

By Philippe Bonneau on 4/29/2016 11:35 AM

In my previous post, I've described how to update third parties using the API, as it was done by several Misys clients. This time, continuing on this subject, I will explain how to update third parties, using XML files. I remembered that I've implemented this solution at least one time by a client, in a web service. Third parties were updated using the Sophis xml definition, that you can find in the party.xsd file stored in the schema folder. The web service implementation is already described more in details in this post : "How to develop a IIS webservice using the API". Unfortunately, the C++ code is not anymore maintained in the v7: C++ header files that were present in the Low Level Toolkit folders are not delivered anymore. A workaround exists, this is the subject of this post of how to replace this code.

By Philippe Bonneau on 4/28/2016 6:11 PM

For clients on which the Sophis Risque or Sophis Value was already installed, during the migration, it is quite easy to detect which modifications have to be done when comparing the code. But this step is only one of the different tasks that have to be done. For example, almost nothing was changed on the interface CSRThirdParty (eq CSMThirdParty in C#) concerning the third parties (entities, depositaries, counterparties, brokers...). But unlucky, when trying to use some piece of code that permits to update the external reference, the domiciliation, the broker or whatever which field, you will got an exception in v7, indicating that the method is not implemented. This is a well known problem on each client migration.

By Philippe Bonneau on 3/8/2016 6:20 PM

Testing recently the calculations of some instruments (Convertible bonds) on the calculation servers, I've discovered that very old instruments which are not anymore in position were sent to calculation servers. By the way, these instruments are not valid too, and trying to calculate them today will generate some check error messages. These instruments were stored in position in some folios several years ago (trade date far away from the well-known REPORTING.DATE_DEB date), but are still loaded in memory and sent to calculation servers. The problem does not appear when calculating the folio locally, only when calculated by calculation servers, and the whole calculation of the folio is then rejected. The goal of this post is to propose a workaround that permits to calculate the folios which contain such instruments.

By Philippe Bonneau on 2/2/2016 1:49 PM

Some days ago, I talked about the possibility to use the Sophis.Core.Data, Sophis.Event.Core and Sophis.Event.Risque assemblies, in order to listen to specific events for toolkit columns performance optimizations. I've tried to use the same mechanism in a batch, using the following code :

class Program
    static void ProcessEvent(Sophis.Event.IEvent myEvent, ref bool bProcess)
    static void Main(string[] args)
        CSMApi _api = new CSMApi();
        catch (Exception e)
        Sophis.Event.SophisEventHandler _handler = new Sophis.Event.SophisEventHandler(ProcessEvent);
        Sophis.Event.SophisEventManager.Instance.AddHandler(_handler, Sophis.Event.Thread.MainProcess, Sophis.Event.Layer.Model);
        bool _stop = false;
        while (!_stop)

Unfortunately, this code does not work as is. Putting a break point in the ProcessEvents method shows that it is never called, even if messages are received and processed. The goal of this post is to explain how it works and what it is missing.

By Philippe Bonneau on 1/25/2016 4:26 PM

One client asked me to add some very visible message in Fusion Invest that permits to warn when the pricing date is not the current date. A good sample of such a message is the native toolbar that is displayed by the application when the simulation mode is selected. The expected result should be the following one:

By the way, the core code of Fusion Invest is still written in MFC/C++. Adding such a toolbar is possible by written some C++ code that uses the MFC classes. The goal of this post is to give the code that permits to activate such a functionality.

By Philippe Bonneau on 12/30/2015 6:37 PM

When overloading Sophis dialogs with the toolkit, you need the Win32 resource IDD of the dialog in order to get the resource template somewhere in the Sophis dll's (in most cases in the SophisRiskEn.dll), and customize it by adding new controls. In previous versions of Sophis, there was an option that permitted to display this IDD, by right double-clicking on the Sophis logo in the About box, and, after, by right clicking in the dialog.

Right-clicking it in the v7 About box does not enable it anymore, even if this option is still usefull. Looking at the code of the dialog, I've found finally the way to display it. The goal of this post is to share it.

By Philippe Bonneau on 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.

By Philippe Bonneau on 9/29/2014 2:05 PM

Using the Sophis toolkit, it is easy to save user data by filling the parameter columnName in the CSRElement constructor and the ones of its derivated classes. When overriding the CSRInstrumentDialog class, the data will be then stored in a field of the Sophis native Oracle table TITRES, on which you have to add the expected field. Prefixing the field to remember that the field was created by the client is the common rule used. For other user data on which an entire Oracle table needs to be created, it is safe to override the CSRFitDialog::Save method too. Now, if you have to store other data even when having no GUI open, when using batches for example, the best is to add an implementation of the CSRInstrumentAction class, and to save data on the callback NotifyCreated and NotifyModified. All these things are basic concepts explained in the Sophis documentation. There are some cases on which we need to save data after the Oracle commit. This post will explain how to implement it.

By Philippe Bonneau on 9/26/2014 4:58 PM

In my precedent articles that I've published concerning the memory leaks (C++ memory leak check on x64 platform and test of different tools and How to filter Intel XE Inspector results), I was talking about the fact that for huge programs like Sophis Risque, the debugging using such tools is quite difficult to do. In fact, in some cases, I've found no tool that can do the job as I wanted. Using a tool like Intel Inspector gives sometimes so many errors that it is quite difficult to detect the real problem. That's why I've developped one tool that permits to detect easy bugs without impacting the whole performance during all the test but just for a piece of code that could interest me. The goal of this post is to present this tool.

By Philippe Bonneau on 9/15/2014 5:07 PM

I was asked recently if I knew how to change the color of the titlebar on Sophis Risque in order to catch the user attention. At first, I've made a wrong answer: "Easy, you just need to paint on the WM_NCPAINT as Sophis Risque does it when the simulation mode is selected (and as I've developed it on the v4)" !! ...

Unfortunately, this mode does not work anymore as it was developed for Window 95/2000.... A lot of articles can be found on the Net (like codeproject or codeguru), but no one gives the code to run it with the themes that were developed on XP, or on Vista/7 when the Desktop Window Manager service is started. For example, when the Windows Desktop Manager is disabled, as best effort, and using the MS SDK functions ::DrawCaption and ::DrawFrameControl, the dialog will look like this one:

Note that the minimize, maximize and close buttons do not have the new style as expected.

The goal of this post is to describe how to do it.

By Philippe Bonneau on 7/29/2014 5:04 PM

One client, a fund asset manager, asked me recently if I didn't have any tool that permits to make non-regression tests or performance tests when migrating from a version of Risque or Value to another one.

The goal of this post is to provide such a tool, when doing non-regression performance tests. This is based on the fact that the SEC server linked to the Oracle server is the bottleneck of the Sophis architecture.

When each Sophis Risque/Value client receives a notification, in most cases on versions <5.2 and in some cases after on Sophis internal messages, it does a query on the Oracle server. On user events, it depends how it was developed.

By Philippe Bonneau on 7/16/2014 11:28 PM

I've decided to restore some posts that were published on the previous website. These posts are old and published between 2007 and 2008, but are still interesting. One of the most interesting post described how to build a IIS webservice in order to export some functions that can be used by Talend, which is now a well-known French ETL tool.

By Philippe Bonneau on 7/10/2014 8:47 AM

Some functions of the Sophis toolkit API are exported and stored in this dll. It contains at least the classes that permit to add contextual menus to the portfolio view, overloading the CFD deal input dialog, the portfolio headers (which correspond to the dialog in which the main sensitivities of the folio are displayed) and payment methods.

By the way, this dll implements some functionalities for the .Net toolkit, it means that it is linked to the MS C# .Net framework, loading other assemblies when it is loaded by dlls or executables linked to SphPortfolioGUI.lib.

I have the case where most of the dialog overloadings and Sophis toolkit calls are stored in one toolkit dll. Unfortunately, this dll exports a lot of functionalities that were used by night batches. It means that the night batches load the dll twice:

  • one using the static link, when MS starts the process
  • the second one, by the Sophis API, since it is declared as a toolkit/plugin dll and loaded dynamically when the CSRApi::Initialise method is called.

I wanted to add contextual menus to the porfolioview. It causes no problem when the toolkit dll is loaded by Sophis Risque, but does not work when night batches are launched, since it tries to load assemblies without initialilzing the .Net security as SphRisque does it (creating specific AppDomain for example). I got an access violation as below:

I will explain in this post how to resolve this problem.

By Philippe Bonneau on 7/8/2014 11:07 AM

In one of my previous posts that can be found there:, I've detailed a method that works fine on the following OS: Windows XP and Windows 8, with or without Citrix, using the MS CreateJobObject method. 

Unfortunately, Microsoft has changed the behaviour of the jobs on Windows 7, and limit the creation to one job on this OS. Citrix is using already one job to control the limitations that can be driven through their configuration manager. For example, we will consider the case where the memory consumption is configured per Sophis user. The goal of this post is to explain the solution that could be retained, without exporting the rights to the Citrix configuration and let keeping Risque/Value manage the memory consumption as before.

By Philippe Bonneau on 4/3/2014 2:29 PM

More than one year ago, I wrote an article on what to do when a process is frozen, and how to dump the memory and registers into a .dmp file in order to use it after with Visual Studio (whatever the version).

But, unfortunately, sometimes the process crashes and disappears from the task of processes provided by taskmgr.

By chance, there is a way in Windows to declare an executable, known as JIT Debugger, that will be called when an unhandled exception is detected. The executable procdump mentioned in the previous post can be used. This post will describe how to install it and will show how to use the resulting .dmp file.

By Philippe Bonneau on 3/14/2014 6:10 PM

On Sophis Risque and Value, it is possible to add specific user rights, by adding tabs on user/group configuration. Tabs and fields are added using the Oracle table USER_RIGHT_TABLE. On previous versions of Sophis, such rights were defined using C++ toolkit and the obsolete class CSRUserRights.

By Philippe Bonneau on 1/21/2014 2:06 PM

Since it is not really clearly indicated in the documentation provided by Intel, it is possible to use the code coverage function provided by Intel XE Composer 2011 with VS2005. The only problem is that the results generated by the tool are not very user-friendly (html pages), and that some operations have to be done manually once the execution tests are finished.

By Philippe Bonneau on 11/25/2013 7:15 PM

I 've got today the following message, when I've tried to compile a dll that compiled fine before any change:

“LINK : fatal error LNK1561: entry point must be defined”

During my investigations for resolution, I've tried several tests that all failed:

By Philippe Bonneau on 7/27/2013 11:40 AM

It's an old well-known subject, but since I've seen recently developers who were using the STL vector::clear method and who believed that this method make some deallocation, this post is to remember which method to use in such a case.

By Philippe Bonneau on 2/14/2013 5:26 PM

When developing an executable, there are several solutions to follow the memory consumption on a process. A third party performance monitor could be used in order to store the information and follow the memory growth on the time. I know some like Sysload, provided by Orsyp.

Another solution is to dump the memory used at different steps of the process in some log files and using this log files to make some statistics.

By Philippe Bonneau on 1/10/2013 4:48 PM

It's one of my best usual case: people are coming to me to see what happened when some server process on production is frozen. Of course, even if logs are written and dumped somewhere, in most cases, they are not enough to detect what happens really.

The same scenario occurs when an access violation is followed by a crash of the process, when we need a post-mortem analysis.

Everybody could tell me that we just have to write such a treatment in C# or Java to get the call stack at this moment, but the subject of this post is not what development language to use but what to do when something like that occurs on a production server.

By Philippe Bonneau on 1/7/2013 3:16 PM

Intel Inspector is a C++ development tool that can be used to detect memory leaks and corruption.

Using this tool and when trying to detect memory leaks in our library, which uses the Misys Sophis toolkit, a lot of memory leaks are found, due to the fact that memory cache used by Sophis or our toolkit library are not correctly released: about 4000 are displayed after analysis. Using existing filters provided by the tool is not sufficient in order to detect which are relevant or not.

The subject of this post is then to provide methods which permit to filter memory leaks which are not due to a cache or static data allocated in the loaded dll's.

By Philippe Bonneau on 3/21/2012 3:53 PM

This is possible with the Platform toolset available on the General tab of the project configuration. By default, you can target either VS2010 (platform target v10) or VS2008 (platform target v9).

The platform toolset selection is available as follow:

By Philippe Bonneau on 3/14/2012 10:33 AM

After a migration from x86 to x64 on Misys Risque, one of the biggest deal was to find a tool able to check the memory leaks and access violations (buffer overrun and so on..). This was done one year ago, but I think that nothing has been changed since. I tested different tools and this is the results of my analysis:

Search blog