How can I return the corresponding dates in a timeseries query using Refinitiv Data Platform in p...

...ython?

Let s say I want to query the field TR.PriceClose on FRX.TO over the period 2019-05-31 and 2019-07-15. What should I do to get the timeseries of prices along with the corresponding dates?

When query ["TR.PriceCloseDate", "TR.PriceClose"] together the results do not seem to be aligned. I observe a very unstable behavior of the results depending of the time range I query. Sometimes I get duplicated dates with different prices. And sometimes the prices are shifted leaving NaN at the end of the time series.

Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    @jjacquey

    Thank you very much for the code sample. And apologies for the confusion, I didn't realize you were using Datagrid endpoint on RDP, as it's not officially launched yet.

    I see two issues here. One is duplicate rows returned for some dates like 2019-06-04. This issue is not specific to Datagrid service on RDP, and it is being investigated by Refinitiv Support as the case number 09625208.

    The other issue is specific to Datagrid service on RDP and the situation when there are NULL values at the top of the result set. These values are being erroneously pushed to the bottom of the result set, and this is how you get the dates and the values misaligned in the response to the request with parameters2. This issue is a bug in the Datagrid service on RDP. I'm reporting it to the development team that owns the service. However, since the service is not officially launched and is not yet supported by Refinitiv Helpdesk, there's no case number for this issue.

Answers

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭

    I'm afraid I haven't been able to reproduce the dates and close prices not aligning or returning different values for duplicate dates when requesting

    ek.get_data('FRX.TO',['TR.PriceCloseDate','TR.PriceClose'],
                         {'SDate':'2019-07-15','EDate':'2019-05-31'})

    If you have a specific example, where the dates and prices are not aligned or where different prices are returned for duplicate dates, it would be very helpful if you could share it.

    What I have been able to reproduce is numerous duplicate rows returned in response to the above request. For this issue I opened a support case on your behalf with Refinitiv Helpdesk. Refinitiv Support will investigate the issue and keep you informed of the results of their investigation. For you reference the case number is 09625208.

  • I am using Refinitiv Data Platform Python API.



    Here is the code I am using. You get different results for 2019-06-13 and 2019-06-14 for example depending on the timeframe requested (parameters1 or parameters2)


    import pandas as pd
    import requests
    import json
    import rdpToken

    RDP_version = '/beta1'
    base_URL = 'https://api.refinitiv.com';
    category_URL = '/data/datagrid'
    endpoint_URL = '/'
    url = base_URL + category_URL + RDP_version + endpoint_URL


    parameters1 = {
    'SDate': '2019-05-31',
    'EDate': '2019-07-15',
    'Frq': 'D',
    }
    parameters2 = {
    'SDate': '2019-06-10',
    'EDate': '2019-06-14',
    'Frq': 'D',
    }

    requestData = {
    'universe': ['FRX.TO'],
    'fields': ['TR.PriceCloseDate', 'TR.PriceClose'],
    'parameters': parameters2
    }

    accessToken = rdpToken.getToken()
    headers = {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + accessToken
    }

    response = requests.post(url, headers=headers, data=json.dumps(requestData))
    if response.status_code == 200:
    jResp = json.loads(response.text)
    columns = [x['name'] for x in jResp['headers']]
    df = pd.DataFrame(jResp['data'], columns=columns)
    print(df)