mock Refresh/UpdateMsg ?

Is there any possible way that I can construct my own Refresh or Update Msg as callback argument so that I can construct my data for test, without waiting market open for real quotes from ema sdk ?

I tried construct FieldList like this:

emaaccess::FieldList fl;

fl.addInt(FID_US_QUOTIM_MS, 3 * 3600);
fl.addUInt(FID_US_OPINT_1, 2000);
fl.complete();

But when iterate the field entries using forth() method, program will be terminated with signal 11 which generates coredump.

Best Answer

  • Hi @wangfugen

    The recommended way to test with mock data matching your specific FID requirement etc is to modify one of the IProvider Examples that comes with EMA.

    You could then run the IProvider and the consumer on the same machine and set the Consumer to connect to localhost. This way the Consumer will connect to the IProvider, send the data request to the Provider - which will then publish the data as per your modifications.

    The most basic IProvider example is 100__MarketPrice__Streaming, and a slightly more advanced one is 200__MarketPrice__Streaming

    You can off course run the IProvider on a different PC if required and configured the Consumer accordingly.

    I recommend reading this article by my colleague for a good high-level explanation of publishing custom data - the code is Java-based, however, the concepts are the same.

Answers

  • That's exactly what I needed, Many thanks. @""umer.nalla

  • @""umer.nalla Hi, I tried the method you mentioned above by compiling example 100__MarketPrice__Streaming and run both IProv100 and my application on the same host. I also modified EmaConfig Channel_2's Host & Port settings to point to IProv100.

    By adding some stdout logging in IProv100, I found when I start my application, MMT_LOGIN message is successfully processed. But I could not see more MMT_MARKET_PRICE request to be processed. I checked the log from my application, it has such output from onStatusMsg:

    onStatusMsg: [2020-10-16 19:52:37 744970][6093:140521547265792]
    Service Name: ELEKTRON_DD
    Item State: Closed / Ok / None / 'Service name of 'ELEKTRON_DD' is not found.'


    ELEKTRON_DD is the service name I originally request normal feed. So How to resove this problem ? I found no place where IProv100 could configure its supported service name. Thanks.

  • Hi @wangfugen

    The easiest solution would be to change your consumer to request data from the service 'DIRECT_FEED'

    Or if you prefer you can change your EMAConfig.xml (or override the default value) that is being used by the IProvider to publish data on ELEKTRON_DD. This will require to amend your EMAConfig.xml (or if you are not using one, then copy the default one that comes with ElektronSDK).

    If you refer to the default EMAConfig.xml you will note the default IProvider config is

    <DefaultIProvider value="Provider_1"/>

    and the above config refers to the source directory

    <Directory value="Directory_2"/>

    If you then refer to Directory_2 config you will note that the service name is 'DIRECT_FEED' which you can change to ELEKTRON_DD if required:

    image

    All the above is assuming the EMAConfig.xml is the default one and you have not already made changes to it.

    Note : even if you are not presently using an EMAConfig.xml file, then EMA will use default values for all the parameters as detailed in EMACPP_ConfigGuide.pdf that is included in the ElektronSDK. To override these you can either supply an EMAConfig.xml in the working directory of your application OR use programmatic config within your code. Programmatic config is briefly covered in my EMA Config article and in more detail in the EMACPP_ConfigGuide.pdf



  • @umer.nalla I copied one EmaConfig.xml with IProv100, now my application can receive Refresh & UpdateMsg normally. Many thanks again.