We receive corrupted bid/ask price

We switch from RFA to EMA. Sometimes, we receive corrupted bid/ask pricing. For example, when we subscribed AAPL, bid/ask is 240/260 and in the next update they are 40/56 which are nonsense price. it looks like some quotes are mixed from different RICs. we decode msg payload inside the callback onRefreshMsg() and onUpdateMsg() and sent decoded msg to an event listener.

Also, we store handle id into a symbol-handle map. when unsubscribing symbol, we remove the the entry from the map and unregister with handle id. But sometimes when we unsubscribe a symbol using the handle id, ADS still sends the streaming quote to our system.

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @fanghua.liu

    To investigate this kind of issue, you need to enable EMA log and tracing.

    1. To enable EMA log, please run the application with this parameter: -Djava.util.logging.config.file=logging.properties

    The content of logging.properites is:

    #This file contains log configuration for java logging API.


    # Level mapping between jdk and slf4j logging
    # jdk.util.logging SLF4J
    # OFF -> No Logger on
    # FINEST -> TRACE
    # FINER -> DEBUG
    # FINE -> DEBUG
    # CONFIG -> INFO
    # INFO -> INFO
    # WARNING -> WARN
    # SEVERE -> ERROR


    .level=FINEST


    #handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
    handlers=java.util.logging.ConsoleHandler


    java.util.logging.ConsoleHandler.level=FINEST
    java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter


    #java.util.logging.FileHandler.level=FINEST
    #java.util.logging.FileHandler.pattern=./emaj.log


    # Write 100000 bytes before rotating this file
    #java.util.logging.FileHandler.limit=50000000


    # Number of rotating files to be used
    #java.util.logging.FileHandler.count=20
    #java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
    # Format timestamp as date/time with millisecond
    java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$-7s %2$s %n%5$s


    2. To enable tracing, in the EmaConfig.xml set XmlTraceToStdout to 1 on the consumer

    <ConsumerGroup>
    <DefaultConsumer value="Consumer_1"/>
    <ConsumerList>
    <Consumer>
    <Name value="Consumer_1"/>
    <Channel value="Channel_1"/>
    <Dictionary value="Dictionary_2"/>
    <XmlTraceToStdout value="1"/>
    </Consumer>

    You need to add the application log with item names when the application subscribes and unsubscribes items. With this information, we can verify handles, streams and data retrieved by the application.

Answers

  • Hi @fanghua.liu,

    The best way to determine if it is a result of an issue in the server/back end, run a simple EMA consumer example application (packaged within the EMA download package) to observe the behavior.

    With regards to the handle ID, when you unsubscribe, it is possible that some updates may already be "in-flight" which may explain the behavior you are seeing.

  • @nick.zincone.1 we created two ommConsumerClient objects for AAPL and PLD separately, after AAPL is unsubscribed, the AAPL quote is still streamed using PLD ommConsumerClient. Is this class mutable or reused?

  • @fanghua.liu

    If you are creating 2 ommConsumerClient objects, you are creating 2 connections into the server and 2 subscription channels for AAPL and PLD - one for each consumer connection. You will have to unsubscribe to both channels.

  • @nick.zincone.1 I have more details on the example above. We subscribe and unsubscribe AAPL and PLD multiple times and in the last subscriptions, I get handle 10 for AAPL and handle 21 for PLD . Then I use handle 10 to unregister AAPL. But I found AAPL uses handle 21 to stream quote with PLD in onRefreshMsg and onUpdateMsg methods.

  • Hi @fanghua.liu,

    It is difficult to determine if your application has improperly reused the same stream handles or if EMA is responsible. If you believe EMA is responsible for the confusion, I would recommend you try to replicate the specific use case in a small example that can be reproduced and evaluated by the EMA dev team.

    That being said, your application opens and closes the same items multiple times across multiple connections. I'm not sure what the requirement is to do that but it appears you need to temporarily pause the stream of data and then resume at a later time. EMA has a feature called "Pause and Resume" which appears to do exactly what you may need - without the overhead and management of stream handles.

    Refer to the EMA documentation for more details.