Returned fields in datagrid api different from python api and also not consistent

Hi I am confused about how GetData fields are returned from the datagrid api

I have made the following request:

POST https://api.refinitiv.com/data/datagrid/beta1/

BODY:

{
 "universe": [
   "AAPL.O"
 ],
 "fields": [
   "TR.IssueMarketCap(Scale=6,ShType=FFL)",
   "TR.FreeFloatPct()/100/*FreefloatWeight*/",
   "TR.IssueSharesOutstanding(Scale=3)/*shares outstanding*/",
   "TR.CLOSEPRICE(Adjusted=0)/*close*/"
 ],
 "parameters": {
   "Curn": "USD",
   "SDate": "2020-10-27",
   "EDate": "2020-12-01"
 }
}


See also the resulting screenshot: Screenshot 2023-11-23 114750.png

the returned headers for field:

"TR.IssueSharesOutstanding(Scale=3)/*shares outstanding*/",

are

"TR.IssueSharesOutstanding"

also IssueMarketCap and IssueSharesOutstanding are simplified in a similar manner

While on the other hand field returns for:

"TR.FreeFloatPct()/100/*FreefloatWeight*/"

are as they have been supplied.

How can I make sure that the headers return the fields as previously supplied to them?

Best Answer

  • raksina.samasiri
    Answer ✓

    Hi @laurens ,

    Can you try this

    {
    "universe": [
    "AAPL.O"
    ],
    "fields": [
    "TR.IssueMarketCap(Scale=6,ShType=FFL)",
    "Setlabel(TR.FreeFloatPct()/100,FreefloatWeight)",
    "Setlabel(TR.IssueSharesOutstanding(Scale=3),SharesOutstanding)",
    "Setlabel(TR.CLOSEPRICE(Adjusted=0),close)"
    ],
    "parameters": {
    "Curn": "USD",
    "SDate": "2020-10-27",
    "EDate": "2020-10-28"
    }
    }

    The result is as below

    1701238489601.png

    Hope this helps and please let me know in case you have any further questions

Answers

  • Hi @laurens,


    DataGrid does support parameters similar to the ones you are showing in your question, but "TR.FreeFloatPct()/100” is not using a parameter, instead it is deriving a new fields with division. As datagrid considers this as a new calculated field it won’t show in return the same base data item field in response but will show the request as sent.

    You can apply a custom label function to get desired label, e.g .: Setlabel(TR.FreeFloatPct/100,"FreeFloatPct")

  • Thanks a lot, this makes it already a lot easier, can you please rewrite the body of the json request so that I can understand where to apply the SetLabel command as this is not entirely clear to me.
  • thanks a lot. I was a little bit confused how to apply the setlabel annotation. Now it is perfectly clear!