Not same fields available from .Net vs Python for get_history

Hello,

It seems that we cannot query the same fields for historical prices from Python and .Net.

We would like to query TR.TotalReturn in the .Net C# API as such :

var response = Summaries.Definition(new List<string>() {"0001.HK"})
.Fields(new List<string>() {"TR.TotalReturn"})
.Interval(Summaries.Interval.P1D)
.GetData();

But it seems this is not in the available fields

From Python we are able to do it using the get_history

Can you please help to check how we can get the TR.TotalReturn history via C# .Net API?

Thanks.

Best Answer

  • Jirapongse
    Answer ✓

    @cleesikyee

    Thank you for reaching out to us.

    To get the TR fields, you can use the FundamentalAndReference. Please check these examples.

    The code looks like this:

    var sdate= "2024-06-01";
    var edate = "2024-06-30";
    response = FundamentalAndReference.Definition().Universe("0001.HK")
                                                   .Fields("TR.TotalReturn.Date","TR.TotalReturn")
                                                   .Parameters(new Newtonsoft.Json.Linq.JObject()
                                                   {
                                                       ["SDATE"] = sdate,
                                                       ["EDATE"] = edate,
                                                       ["FRQ"] = "D"
                                                   }).GetData();

    You can use the Data Item Browser tool to search for fields and parameters.

Answers

  • Hello Jirapongse,

    Thanks for your reply.

    I tried the above and it does give values but it seems that sometimes some duplicated values.

    var sdate = "2023-08-30";
    var edate = "2023-09-10";
    response = FundamentalAndReference.Definition().Universe("0001.HK")
    .Fields("TR.PriceClose.Date","TR.PriceClose")
    .Parameters(new Newtonsoft.Json.Linq.JObject()
    {
    ["SDATE"] = sdate,
    ["EDATE"] = edate,
    ["FRQ"] = "D"
    }).GetData();

    This is what we observe for example.

    data.png

    Can you check if you see the same?

    From the Python API, the data is not duplicated.

    Thanks.




  • I checked in the Workspace Excel with the following formula.

    =@RDP.Data("0001.HK","TR.PriceCloseDate;TR.PriceClose","Frq=D SDate=2023-08-30 EDate=2023-10-09 CH=Fd RH=IN",E2)

    It also returns the duplicated entries.

    1722851633357.png

    Please contact the helpdesk directly via MyAccount to verify the retrieved data.