question

Upvotes
Accepted
1 0 0 1

Query Prices adjustes and unadjusted for time series.

I am looking for a way to get the prices of a instrument adjusted and unadjusted,
I am looking how to do this with a field or parameter is possible because i am doing this in C#.


I tried this in python in the code book, but i cannot seem to get it correct


import refinitiv.data as rd
rd.open_session()
df = rd.get_data(
    ['4816.T'],
    [
        'TR.PriceClose', 
        'TR.PriceCloseDate'
    ],
    {
        'SDate': '2024-03-29',
        'EDate': '2024-02-25',
        'Adjusted': 0
    }
)

display(df)


Here is my C# code


Frame<int, string> frame = privateEikon.GetData(
   securities,
   fields,
   new Dictionary<string, string> { { "SDate", startDate }, { "EDate", endDate }, { "Frq", "D" } }
);


How can i do this? i need to get both the adjusted and unadjusted price.

If this is not possible then how can i get all stock splits on a given instrument?
I tried this and i only got one


import refinitiv.data as rd
rd.open_session()
df = rd.get_data(
    ['AAPL.O'],
    [
        'TR.AdjmtFactorAdjustmentDate',
        'TR.AdjmtFactorAdjustmentFactor',
        'TR.AdjmtFactorAdjustmentType',
        'TR.AdjmtFactorIsApplied',
        'TR.AdjmtFactorUnderlyingEventId'
    ]
)

display(df)

And it only return the adjustment on 2020-08-31 when i am sure there was another on 2014-06-09

#contenttime-seriesunadjusted
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
87.1k 294 53 79

@felix.roberto.read

You can use the Refinitiv Data Library for .Net. Please refer to the 2.8.01-FundamentalAndReference-Basics example.

 // Reference data
 var response = FundamentalAndReference.Definition().Universe("4816.T")                  
     .Fields("TR.ClosePrice(Adjusted=1)", "TR.ClosePrice(Adjusted=0)", "TR.ClosePrice.Date")
     .Parameters(new Newtonsoft.Json.Linq.JObject()
     {
         ["SDATE"] = "2024-02-25",
         ["EDATE"] = "2024-03-29",
         ["FRQ"] = "D"
     }).GetData();


 foreach(var rec in response.Data.Records)
 {
     Console.WriteLine(rec.Fields.ToString());
     foreach(var data in rec.Data)
     {
         Console.WriteLine(data.ToString());
     }
     
 }

The rec.Fields will return the fields' names and titles.

1726632238199.png


1726632238199.png (23.4 KiB)
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
87.1k 294 53 79

@felix.roberto.read

Thank you for reaching out to us.

The TR.PriceClose field doesn't suppor the Adjusted parameter. You can use the Data Item Browser tool to check for the supported parameters.

However, the TR.ClosePrice field suppor the Adjusted parameter. Thel code looks like this:

df = ld.get_data(
    ['4816.T'],
    [
        'TR.ClosePrice(Adjusted=1)',
        'TR.ClosePrice(Adjusted=0)',
        'TR.ClosePrice.Date'
    ],
    {
        'SDate': '2024-03-29',
        'EDate': '2024-02-25'
    }
)
df

The output is:

1726544424348.png



1726544424348.png (15.4 KiB)
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 0 0 1

Perfect, is there a way to change the title of the returned field, because i get a error of duplicate parameter key, when i run the 2 fields in c#

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.