question

Upvotes
Accepted
1 2 2 3

MarketPrice response Fields metadata

MarketPrice response contains the "Fields" tag for all requested fields. But it doesn't have field metadata. Is there any separate request we need to make to get field metatadata. We need to know whether the field is date or datetime or number etc to parse it correctly.

treprdp-apiwebsocketsrrtofields
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
Accepted
86.2k 292 53 79

You can use a dictionary request to get field definitions.

def send_dict_request(ws):
    dict_json = {
        'ID': 3,
        'Domain': 'Dictionary',
        'Key':{
            'Name': 'RWFFld',
            'Filter': 3
            }
        }
    ws.send(json.dumps(dict_json))
    print("SENT:")
    print(json.dumps(dict_json, sort_keys=True, indent=2, separators=(',', ':')))

The response contains a series of element lists. For example:

        {
          "Elements":{
            "FID":{
              "Data":3,
              "Type":"Int"
            },
            "LENGTH":16,
            "NAME":"DSPLY_NAME",
            "RIPPLETO":{
              "Data":0,
              "Type":"Int"
            },
            "RWFLEN":16,
            "RWFTYPE":19,
            "TYPE":{
              "Data":5,
              "Type":"Int"
            }
          }
        },

"RWFTYPE" specifies the type of field. You can find the meaning of RWFTYPE from rsslDataTypeEnum.h. For example, the RWFTYPE of DSPLY_NAME is 19 which is RSSL_DT_RMTES_STRING.

RSSL_DT_RMTES_STRING        = 19, 
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.8k 64 15 21

Hi @krishna muppavarapu, the fields are defined in the data dictionary file. You can see the RDMFieldDictionary file here: https://github.com/Refinitiv/Elektron-SDK/tree/master/Java/etc


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
19k 86 39 63

Hi @krishna muppavarapu,


As far as I know, there is no schema / metadata provided for the WebSocket service. Since json only supports basic types, you can certainly use a parsing library to assist in determining the type of field, i.e. string, number (float, integer), boolean. Date and Time fields come in as strings. Within the Fields object you would only find Date fields, not datetime. Time fields will be available in other fields.

Depending on which programming language, I would encourage you to use an existing json library that will parse the native json fields appropriately for you.


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.