For a deeper look into our Elektron API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
25 8 15 18

ATS command to replicate using WebSocket API JSON sample

Hello,
One of our clients reported the following use case :
They publish prices for instruments through ATS, and sometimes they "update" the fields that they publish for some instruments (Ex : Before ATS update command, they publish ASK for RIC_A= and after the command they publish ASK and BID for RIC_A=).
We asked them what is the ATS command they are using, they answered this :

Thank you for the call yesterday and as mentioned here is an example message which is sent to all consumer clients with a subscription open to a RIC when its FID structure is changed “on the fly”.
 
This message logged by the RTDS TestClient whilst subscribing to the RIC MRT_AU3SG0002710 which had an additional FID added. The consumer contribution command to add a FID was ATS_ADDFIELD_S.
 
Note that the RIC is not removed from the ATS service, meaning it is not deleted by the ATS, but the structure is updated. Once the consumer clients re-subscribe to the RIC they will receive the new RIC FID structure and associated data image.
 
--- --- --- --- --- sample message received by downstream consumer client --- --- --- --- ---
 
[Tue Sep 05 14:09:19.720 2023] <!-- rwfMajorVer="14" rwfMinorVer="1" -->
<statusMsg domainType="RSSL_DMT_MARKET_PRICE" streamId="6" containerType="RSSL_DT_NO_DATA" flags="0x28 (RSSL_STMF_HAS_MSG_KEY|RSSL_STMF_HAS_STATE)" dataState="RSSL_DATA_SUSPECT" streamState="RSSL_STREAM_CLOSED" code="RSSL_SC_NONE" text=""  dataSize="0">
    <key  flags="0x7 (RSSL_MKF_HAS_SERVICE_ID|RSSL_MKF_HAS_NAME|RSSL_MKF_HAS_NAME_TYPE)"  serviceId="305" name="MRT_AU3SG0002710" nameType="1"/>
    <dataBody>
    </dataBody>
</statusMsg>


So it seems that they use ATS_ADDFIELD_S command.

Now, on our side we would like to emulate such command with WebSocket API JSON sample.
The idea for us is to replicate what the client is doing using WebSocket API Try It Now ! tool, since we do not have an ATS service.

The purpose behind this is to improve our application. We would like to be notified whenever the publication is updated through a ATS_ADDFIELD_S command, to update our subscription to the Refinitiv service.

Could you please help us ?

Thanks,

#technologywebsocketsjsonATS
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi @henri.g ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

Upvotes
Accepted
79.2k 251 52 74

@henri.g

I checked and found that it may relate to the following ATS configuration.

#================================================================#
# DEACTIVATE_UPON_DEF_CHANGE . When record or model definitions
# are changed, ATS may need to deactivate (close) the concerned
# records, or to send a full image to notify the client users.
# This parameter allows to choose between deactivation and image
# notification.
# Note : This behaviour is not only related to editing records
# and models via ATS UI. It also impacts the records created or
# managed via SSL contributions (SSL inserts).
# The default value is TRUE
#================================================================#
DEACTIVATE_UPON_DEF_CHANGE        FALSE

The default value is TRUE.

After changing its value to FALSE, my WebSocket client can get the new added field in the refresh message.

RECEIVED:
[
  {
    "ClearCache":false,
    "Fields":{
      "ASK":451.6,
      "DSPLY_NAME":"TEST RIC",
      "RDNDISPLAY":67,
      "RECORDTYPE":209,
      "TIMACT":"08:44:59",
      "TRADE_DATE":"2023-09-21"
    },
    "ID":2,
    "Key":{
      "Name":"TEST.BK",
      "Service":"ATS"
    },
    "Qos":{
      "Rate":"TickByTick",
      "Timeliness":"Realtime"
    },
    "State":{
      "Data":"Ok",
      "Stream":"Open"
    },
    "Type":"Refresh"
  }
]
RECEIVED:
[
  {
    "Fields":{
      "ASK":451.6,
      "BID":451.55,
      "DSPLY_NAME":"TEST RIC",
      "RDNDISPLAY":67,
      "RECORDTYPE":209,
      "TIMACT":"08:45:08",
      "TRADE_DATE":"2023-09-21"
    },
    "ID":2,
    "Key":{
      "Name":"TEST.BK",
      "Service":"ATS"
    },
    "Qos":{
      "Rate":"TickByTick",
      "Timeliness":"Realtime"
    },
    "Solicited":false,
    "State":{
      "Data":"Ok",
      "Stream":"Open"
    },
    "Type":"Refresh"
  }
]

However, please contact the ATS support team directly to confirm the behavior of this configuration.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
24.7k 54 17 14

Hello @henri.g

I am understanding that you need the WebSocket API example that sends the "ATS_ADDFIELD_S" command to the ATS server? Please correct me if I am wrong.

There is the example code in the "add_field_post()" method of the market_price_postapp.rb available on GitHub https://github.com/Refinitiv-API-Samples/Article.WebSocketAPI.Ruby.Posting.ATS repository. Please note that the example code is written in the Ruby programming language, but the concept of the JSON structure is the same for other technologies (ex Java).

# Add fields to ATS's contribution RIC by simple Market Price post
def add_fields_post(ws)
  mp_post_json_hash = {
    'ID' => 1,
    'Type' => 'Post',
    'Domain' => 'MarketPrice',
    'Ack' => true,
    'PostID' => $post_id,
    'PostUserInfo' =>  {
      'Address' => $position, # Use the IP address as the Post User Address.
      'UserID' => Process.pid
    },
    'Key' => {
        'Name' => 'ATS_ADDFIELD_S', # RIC name for add fields to ATS server contribution RIC
        'Service' => $ats_service # ADS Service ID that connects to ATS server
    },
    'Message' => {
      'ID' => 0,
      'Type' => 'Update',
      'Domain' => 'MarketPrice',
      'Fields' => {'X_RIC_NAME' => 'CREATED.RIC' ,'HIGH_1' => 22,'LOW_1' => 3 }
      #'Fields' => {'X_RIC_NAME' => 'CREATED.RIC' ,'UDM_VER_N' => 10}
    }
  }
  ws.send mp_post_json_hash.to_json.to_s
  puts 'SENT:'
  puts JSON.pretty_generate(mp_post_json_hash)


  $post_id += 1
end

Additionally, there are the following RTSDK and WebSocket API with ATS interaction resources that might help you too as follows:

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25 8 15 18

Hello,

Thanks a lot for the help.
"I am understanding that you need the WebSocket API example that sends the "ATS_ADDFIELD_S" command to the ATS server? Please correct me if I am wrong."

That is right.

I did the below test on our own infra :

1 - Publishing ASK & BID for EUR= into PUB service
2 - Updating EUR= to publish only HIGH_1

Here is the json that we sent to update 2- : Can you please confirm it is correct ?

{
    "ID": 1,   
    "Domain": "MarketPrice",
    "Type": "Post",
    "PostID": 1,
    "Ack": true,
    "Key": {
        "Name": "EUR=",
        "Service": "PUB"
    },
    "Message": {
        "ID": 0,
        "Type": "Update",
"Domain": "MarketPrice",
        "Fields": {
            "HIGH_1": 10
        }
    }
 
}

Then we retrieved the below JSON answer into our application :

[{
    "ID":4,
    "Type":"Refresh",
    "Key":{"Service":"PUB","Name":"EUR="},
    "State":{"Stream":"Open","Data":"Ok"},
    "Qos":{"Timeliness":"Realtime","Rate":"TickByTick"},
    "ClearCache":false,
    "Solicited":false,
    "Fields":{"HIGH_1":10}
}]


But, on client case the behavior is different when they run "ATS_ADDFIELD_S" command to the ATS server in the logs they provided to us we can only see this :

    [{
        "ID":3,
        "Type":"Status",
        "Key":{"Service":"LNDEVDTS1","Name":"MRT_AU3SG0002710"},
        "State":{"Stream":"Closed","Data":"Suspect"}
    }]

Is it expected ? Also we did not receive any new JSON related to this ric (MRT_AU3SG0002710) anymore whereas they said it has been udpated.

Does it make sense ?
Thanks,

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
24.7k 54 17 14

Hello @henri.g

Could you please clarify the "Publishing ASK & BID for EUR= into PUB service" message? Does it mean you are posting the data to the RTDS infrastructure cache? I noticed that you mentioned "we do not have an ATS service." in the question.

The (2) message format is valid for the Off-Stream Post (via the Login stream message) to RTDS. Did you get the ACK message response? However, I do not think you can replicate the "ATS behavior" with the RTDS cache behavior.

About the stream close message response for the ATS_ADDFIELD_S command, that message is generated from the server side. I highly recommend your client contact the ATS support team directly to verify the issue. They can contact the ATS support team via https://my.refinitiv.com/content/mytr/en/helpandsupport.html website.

contact-ats-support.png



icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
25 8 15 18

Hello,

"Could you please clarify the "Publishing ASK & BID for EUR= into PUB service" message? Does it mean you are posting the data to the RTDS infrastructure cache? I noticed that you mentioned "we do not have an ATS service." in the question."

Yes indeed, we have an ATS like service configured (PUB service) but not a real ATS.

"Did you get the ACK message response? However, I do not think you can replicate the "ATS behavior" with the RTDS cache behavior."

We received only these two :
The first one for the first event, the second for the update.

 [{"ID":4,"Type":"Refresh","Key":{"Service":"PUB","Name":"EUR="},"State":{"Stream":"Open","Data":"Ok"},"Qos":{"Timeliness":"Realtime","Rate":"TickByTick"},"Fields":{"BID":26,"ASK":27}}]
 [{"ID":4,"Type":"Refresh","Key":{"Service":"PUB","Name":"EUR="},"State":{"Stream":"Open","Data":"Ok"},"Qos":{"Timeliness":"Realtime","Rate":"TickByTick"},"ClearCache":false,"Solicited":false,"Fields":{"HIGH_1":10}}]

"About the stream close message response for the ATS_ADDFIELD_S command, that message is generated from the server side. I highly recommend your client contact the ATS support team directly to verify the issue. They can contact the ATS support team via"

So you mean this is not the expected behaviour when there is fileds update on a publication ?

Thanks,

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @henri.g

Please check my colleague @Jirapongse answer about the ATS configuration.

Upvotes
25 8 15 18

Hello,

Sorry to jump again on this topic.

We check again with our client about this field :

  1. DEACTIVATE_UPON_DEF_CHANGE FALSE

They do not want to change it and for consequence we wonder what we are expected to do when we retrieve this kind of message ?

  [{
        "ID":3,
        "Type":"Status",
        "Key":{"Service":"LNDEVDTS1","Name":"MRT_AU3SG0002710"},
        "State":{"Stream":"Closed","Data":"Suspect"}
    }]        "ID":3,


To remember, the client use case is to "update" the publication of an instrument by adding/removing fields.
Should we just resubscribe again to the instrument ? Like this :


{
"Type":"Request",
"ID":3,
"Domain":"MarketPrice",
"View":["BID","ASK"],
"Key":
{
"Service":"LNDEVDTS1",
"Name":"MRT_AU3SG0002710"
}
}


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.