How to process MarketByPrice update message

There is an example of several messages:
RefreshMsg

streamId="82"

domain="MarketByPrice Domain"

solicited

RefreshComplete

state="Open / Ok / Unsupported view type / 'hash4Astatus-All is well'"

itemGroup="00 54"

permissionData="03 03 86 67 19 c0"

name="WINJ21"

nameType="1"

serviceId="902"

serviceName="hEDD"

Payload dataType="Map"

Map

MapEntry action="Add" key dataType="Buffer" value="3131 3532 3235 2E30 41 115225.0A"

dataType="FieldList"

FieldList

FieldEntry fid="3428" name="ORDER_SIDE" dataType="Enum" value="2"

FieldEntry fid="3427" name="ORDER_PRC" dataType="Real" value="115225.0"

FieldEntry fid="4356" name="ACC_SIZE" dataType="Real" value="279.0"

FieldEntry fid="3430" name="NO_ORD" dataType="UInt" value="56"

FieldEntry fid="6529" name="LV_DATE" dataType="Date" value="26 MAR 2021"

FieldEntry fid="6527" name="LV_TIM_MS" dataType="UInt" value="60772165"

FieldListEnd

MapEntryEnd

MapEntry action="Add" key dataType="Buffer" value="3131 3635 3535 2E30 41 116555.0A"

dataType="FieldList"

FieldList

FieldEntry fid="3428" name="ORDER_SIDE" dataType="Enum" value="2"

FieldEntry fid="3427" name="ORDER_PRC" dataType="Real" value="116555.0"

FieldEntry fid="4356" name="ACC_SIZE" dataType="Real" value="29.0"

FieldEntry fid="3430" name="NO_ORD" dataType="UInt" value="4"

FieldEntry fid="6529" name="LV_DATE" dataType="Date" value="26 MAR 2021"

FieldEntry fid="6527" name="LV_TIM_MS" dataType="UInt" value="60762531"

FieldListEnd

MapEntryEnd

MapEntry action="Add" key dataType="Buffer" value="3132 3531 3030 2E30 41 125100.0A"

dataType="FieldList"

FieldList

FieldEntry fid="3428" name="ORDER_SIDE" dataType="Enum" value="2"

FieldEntry fid="3427" name="ORDER_PRC" dataType="Real" value="125100.0"

FieldEntry fid="4356" name="ACC_SIZE" dataType="Real" value="1.0"

FieldEntry fid="3430" name="NO_ORD" dataType="UInt" value="1"

FieldListEnd

MapEntryEnd

MapEnd

PayloadEnd

RefreshMsgEnd



UpdateMsg

streamId="82"

domain="MarketByPrice Domain"

updateTypeNum="0"

name="WINJ21"

serviceId="902"

serviceName="hEDD"

Payload dataType="Map"

Map

SummaryData dataType="FieldList"

FieldList

FieldEntry fid="14269" name="TIMACT_NS" dataType="Time" value="16:52:52:961:000:000"

FieldEntry fid="17" name="ACTIV_DATE" dataType="Date" value="26 MAR 2021"

FieldEntry fid="13490" name="ORDBK_DEPH" dataType="Enum" value="1"

FieldListEnd

SummaryDataEnd

MapEntry action="Update" key dataType="Buffer" value="3131 3530 3235 2E30 42 115025.0B"

dataType="FieldList"

FieldList

FieldEntry fid="3428" name="ORDER_SIDE" dataType="Enum" value="1"

FieldEntry fid="3427" name="ORDER_PRC" dataType="Real" value="115025.0"

FieldEntry fid="6529" name="LV_DATE" dataType="Date" value="26 MAR 2021"

FieldEntry fid="4356" name="ACC_SIZE" dataType="Real" value="33.0"

FieldEntry fid="3430" name="NO_ORD" dataType="UInt" value="6"

FieldEntry fid="6527" name="LV_TIM_MS" dataType="UInt" value="60772961"

FieldListEnd

MapEntryEnd

MapEnd

PayloadEnd

UpdateMsgEnd


As you can see there is MapEntry with Update action and key "3131 3530 3235 2E30 42 115025.0B". The question is what is the correct way to process such an entry? Should we add new entry into our local book with price 115025.0 and size 33.0? If yes, why action is "Update" and not "Add"?

Best Answer

  • chavalit-jintamalit
    Answer ✓

    Hi @vasiliev.nett

    I believe that you received multiple fragmented Refresh Messages.


    In the case that every information can fit into one Refresh Message.

    This should be information inside the message header:

    RefreshMsg
        streamId="5"
        domain="MarketByPrice Domain"
        solicited
        RefreshComplete
        state="Open / Ok / None / '**All is well'"
        itemGroup="00 a5"
        permissionData="03 01 01 32 28 c0"
        name="ACE.NZ"
        nameType="1"
        serviceId="257"
        serviceName="ELEKTRON_DD"
        Payload dataType="Map"
            Map
                SummaryData dataType="FieldList"
                    FieldList FieldListNum="32767" DictionaryId="1"
                        ... FieldEntry...
                        ... ... ...
                        ... FieldEntry...
                ... MapEntry ...
                ... ... ...
                ... MapEntry ...

    So it should include Summary Data in the same Refresh Message.


    However, when the Refresh Message is very large, Datafeed can decide to do Refresh Message fragmentation.

    Only on the first fragment of the Refresh Message comes with "SummaryData" data and (Map) "totalCountHint" value.

    Only on the last fragment of the Refresh Message comes with "RefreshComplete" flag


    I think for this issue, you may not be aware of the former Refresh Message fragment.

    And you only put the last Refresh Message fragment (with RefreshComplete flag) on the question.

    The map entry key(115025.0B) in the Update Message should already be in one of the Refresh Message fragments.

Answers

  • Hi @vasiliev.nett,

    Update is not the same as Add. It means there is an existing order in the book with the same key, which should now be replaced by this new message.

    Please start by reading this article on how to process order book data.

  • Thank you, but the problem is that as you can see there was no "existing order in the book with the same key".
    I have highlight key values for comfortable search.

  • The market data infrastructure will never send an update for a brand new order - most likely your application missed an Add order. To debug, turn on EMA logging showing all the OMM Refresh and Update message traces.

  • Nice explanation. Thanks for the help.