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
    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