TR.SharesOutstanding API rounding

Hello,
I am trying to fetch TR.SharesOutstanding for RIC FKR.MI^E22 via eikon API (C#), but it seems results are rounded by thousands comparing results from eikon excel. Could you advise how to disable rounding please?

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @d.fecher

    Eikon Data API .NET uses the DataFrame.LoadCSV function to create a DataFrame from CSV content.

    The DataFrame.LoadCSV function uses System.Single for the values of TR.SharesOutstanding which causes the data to be rounded.

    1654748167320.png

    I have submitted this issue to the Microsoft.Data.Analysis team to investigate and fix this issue.

    For the workaround, you need to call the GetDataRaw method to get the raw data and then convert the raw data to the data frame. The code looks like this:

    List<string> fields = new List<string> {
    "TR.SharesOutstanding",
    "TR.SharesOutstanding.date"
    };

    Dictionary<string, string> parameters = new Dictionary<string, string> {
    {"SDate", "1D"},
    {"EDate", "-7AY"},
    {"RH", "IN"}
    };

    List<string> RICs = new List<string> { "FKR.MI^E22" }; // more RICs in the original code

    var fetchedData = eikon.GetDataRaw(RICs, fields, parameters);
    var dataResponses = JsonConvert.DeserializeObject<DataResponses>(fetchedData, new JsonSerializerSettings
    {

    });
    var response = dataResponses.responses[0];
    var col1 = response.data.Select(x => x[0]).ToList();
    var col2 = response.data.Select(x => x[1]).ToList();
    var col3 = response.data.Select(x => x[2]).ToList();

    StringDataFrameColumn ric = new StringDataFrameColumn(response.headers[0][0].displayName,col1.Select(x => x.ToObject<string>()).ToList());
    PrimitiveDataFrameColumn<int> data = new PrimitiveDataFrameColumn<int>(response.headers[0][1].displayName, col2.Select(x => x.ToObject<int>()).ToList());
    PrimitiveDataFrameColumn<DateTime> date = new PrimitiveDataFrameColumn<DateTime>(response.headers[0][2].displayName, col3.Select(x => x.ToObject<DateTime>()).ToList());
    var df = new DataFrame(ric, data, date);
    Console.WriteLine(df);

    The output is:

    1654749726101.png


Answers

  • Hi @d.fecher

    Please share code snippets you are using

  • d.fecher
    d.fecher Newcomer

    when I use the following formula in excel API for the RIC - FKR.MI^E22 :


    =TR(P5,"TR.SharesOutstanding, TR.SharesOutstanding.date","SDate=1D EDate=-7AY RH=IN")


    it brings me for the first row:


    Instrument Outstanding SharesDate

    FKR.MI^E22 289203891 17/05/2022 00:00:00


    and using eikon API code below:

    IEikon eikon = Eikon.CreateDataAPI()
    eikon.SetAppKey("XXXXXXXXX");

    List<string> fields = new List<string> {
    "TR.SharesOutstanding",
    "TR.SharesOutstanding.date"
    };

    Dictionary<string, string> parameters = new Dictionary<string, string> {
    {"SDate", "1D"},
    {"EDate", "-7AY"},
    {"RH", "IN"}
    };

    List<string> RICs = new List<string> { "FKR.MI^E22" } // more RICs in the original code

    var fetchedData = eikon.GetData( RICs , fields, parameters);

    Console.WriteLine(fetchedData);
    Console.WriteLine(fetchedData[0,1]); // just to see the value separately (it is still rounded)


    I get the following result for the first row (the values are also rounded in the following rows) :


    Instrument Outstanding SharesDate

    FKR.MI^E22 289203900 17/05/2022 00:00:00


    I also tried to add a setting for Scale in the parameters Dictionary (with different values for scale), but still did not get the exact value as in excel API

    { "Scale", "0" }