question

Upvotes
Accepted
23 0 0 3

requestData for the funds API

In the python starter code for RDP the following can be used for the funds API:

EDP_version = "/v1"
base_URL = "https://api.refinitiv.com"
category_URL = "/data/funds"
endpoint_URL = "/assets"
RESOURCE_ENDPOINT = base_URL + category_URL + EDP_version + endpoint_URL
lipperID = "40003333"

requestData = {
"symbols": lipperID,
"properties": "names"
}

dResp = requests.get(RESOURCE_ENDPOINT, headers = {"Authorization": "Bearer " + accessToken}, params = requestPayload)



What kind of `requestData` should I use for prices/filter NAV, with start and end prices ? as follows:

https://api.refinitiv.com/data/funds/v1/assets?properties=prices[start:2023-01-09%3Bend:2023-01-10%3Bfilter:nav]&symbols=SPY.N,QQQ.N,FCNTX

I tried:

symbols = "SPY.N,FCNTX"
requestData = {
"symbols": symbols,
"properties": "prices",
"filter": "MID",
"start": "2018-02-01",
"end": "2018-05-05"
}

but that did not take into account start end or the filter

and

symbols = "SPY.N,FCNTX"
requestData = {
"symbols": symbols,
"properties": "prices[start:2023-01-09%3Bend:2023-01-10%3Bfilter:nav]",
"start": "2018-02-01",
"end": "2018-05-05"
}

which gave an error





rdp-api#contentfunds
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 @kdayri

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


Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,
AHS

Upvotes
Accepted
23 0 0 3

hi @bob.lee I looked into the starter code and used another example for the post syntax. The post header is different from the get header and that made it work. for future reference this is the code (you also forgot a {} in the dict:

requestData = {
 "universe": {
  "symbols": ['SPY.N', 'FCNTX']
  },
  "properties": [{
  "name": "prices",
  # "filter": "MID",
  "period": {
   "startDate": "2023-08-13",
   "endDate": "2023-08-15"
   }
  }]
 }
accessToken = rdpToken.getToken()
# POST
hdrs = {
'Authorization': "Bearer " + accessToken,
'Content-Type': "application/json",
'cache-control': "no-cache"
}

dResp = requests.post(RESOURCE_ENDPOINT, headers=hdrs, data = json.dumps(requestData))


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
1.6k 3 2 3

@kdayri , I guess you meant to ask what is the format for requesting data using POST method rather than the GET method. If so, the JSON object for the POST request may use slightly different terms from the GET for start and end dates. You can try the sample data below to see if that works.


{
    "universe": {
        "symbols": ['SPY.N', 'FCNTX']
    },
    "properties": [
        "name": "Prices",
        "filter": "NAV",
        "period": {
            "startDate": "2018-02-01",
            "endDate": "2018-05-05"
        }
    ]
}
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
23 0 0 3

thanks @bob.lee .

I am using `requests.get not `post`. the start code uses it as well and that works. Where can I find a guide on how to structure the call? the request data you suggested did not work unfortunately with this error:


"code": "400",
"status": "BadRequest",
"message": "No Adapter Found",
"errors": [
{
  
"key": "name",
"reason": "Invalid Property"
}
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.