Upgrade from Eikon -> Workspace. Learn about programming differences.

For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
20 0 1 6

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?

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

Hi @d.fecher

Please share code snippets you are using

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

Hello @d.fecher ,

Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

-AHS

1 Answer

· Write an Answer
Upvotes
Accepted
79.1k 250 52 74

@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



1654748167320.png (16.4 KiB)
1654749726101.png (24.9 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.

Thanks a lot, this works better

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.