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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
18 0 0 4

EikonDataAPI for .NET issue : data not received

Hi,

I have the following initialization code in F#:


open EikonDataAPI


let eikon =

try

let eikon = Eikon.CreateDataAPI()

eikon.SetAppKey("...")

eikon

with

_ -> invalidArg "Eikon" "Eikon could not be started"


First issue comes with the sample below :

let sd = DateTime(2022, 1, 1)

let ed = DateTime.Now

eikon.GetTimeSeries("EURRUBFIX=CBRF", sd, ed, interval=Interval.daily, fields=[TimeSeriesField.TIMESTAMP]) ;;

Will ont return data beyond January 25 while the fixings are available in Eikon. Thus, any request with a start date in April 2022 (for instance) will fail.


Second issue comes with GetData when fetching CF_LAST:

let scaling = eikon.GetData("EUR=", "SCALING", null).Rows //works OK, returns a result

let lastPrice = eikon.GetData("EUR=", "CF_LAST", null).Rows //raises an exception : Index was outside the bounds of the array.


What's going on with EikonDataAPI ? Are there some new data restrictions ?

eikon-data-apirefinitiv-realtime.net
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.

10 Answers

Upvotes
Accepted
53.2k 138 44 63

@anonymous954782

Thank you for sharing. I can replicate the issue by changing the decimal symbol to ','.


1650513976015.png


A solution could be enclosing a string that has comma characters in double quotation marks.

Therefore, CSV content looks like this:

Instrument,CF_LAST
IBM.N,"138,32"

With this method, the data type of the CF_LAST is still a number.

InstrumentCF_LAST
IBM.N     138,32


System.Single

I have published EikonDataAPI 0.4.9 to fix this issue.


1650513976015.png (9.3 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.

Upvote
53.2k 138 44 63

@anonymous954782

I can retrieve the data properly, as shown below. I am using EikonDataAPI -Version 0.4.8.

92344-1.png

The last data was available on 2022-03-23.

92344-2.png

You can use the GetTimeSeriesRaw or GetDataRow methods instead to verify retrieved data. Otherwise, you can also enable logging in the API. Please refer to the Logging section in the .NET Libraries for Eikon Data APIs Quick Start article.


92344-1.png (31.8 KiB)
92344-2.png (6.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
18 0 0 4

Hi,

I am linking : ..../.nuget/packages/eikondataapi/0.4.8/lib/net5.0/EikonDataAPI.dll

I set the debugging level and called GetData and GetdataRaw. In both cases, it seems the data is fetched (s we can se ethe last price in the data that is received), but GetData seems to raise an unexpected exception.

GetDataRaw seems to be ok :

1650359695029.png

vs. the exception with GetData (despite the info being there) :

1650359745029.png

Any idea what could be wrong ?

Thanks


1650359695029.png (50.1 KiB)
1650359745029.png (95.5 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
18 0 0 4

I am compiling to net 6.0 (and have an "open Micorsoft.Data.Analysis" statement at the top), if that info is of any use...

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
18 0 0 4

Here is the notebook view

1650362444421.png


1650362444421.png (115.6 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
53.2k 138 44 63

@anonymous954782

That is strange. I can run it properly.

1650427009637.png

I am using VS 2022 with NET 6.0.

The raw response is:

"{"responses":[{"columnHeadersCount":1,"data":[["EUR=",1.0816]],"headerOrientation":"horizontal","headers":[[{"displayName":"Instrument"},{"displayName":"CF_LAST","field":"CF_LAST"}]],"rowHeadersCount":1,"totalColumnsCount":2,"totalRowsCount":2}]}"

Are you using these versions?

1650427719595.png



1650427009637.png (111.5 KiB)
1650427719595.png (14.8 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
18 0 0 4

Hi,

I am using VS 2019 (but it shouldn't change anything since I tried the code both in Jupyter and in F# script interactive, which are both independent) and .net 6

There is a discrepancy for NewtonsoftJson

1650439177411.png

I have tried downgrading to 12.0.3, but to no effect.

Any chance I could send you the minimal F# project that doesn't work to see if it works on your end ?


1650439177411.png (6.2 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.

@anonymous954782

Is it macOS or Windows?


Upvotes
18 0 0 4

There's little doubt the issue comes form the parsing of the request.

The data itself is indeed fetched, see for instance with python (same app key)

1650473101473.png



1650473101473.png (26.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.

Upvote
18 0 0 4

Hi,

I have found where the issue comes form.

In the EikonDataAPI, It comes from :
stringBuilder.AppendLine(string.Join(",", datum.Select((JValue value) => value.Value)));

in CreateCSVFromDataResponse(DataResponse response)

In particular, it comes form the call to String.Join, which apparently does not use the InvariantCulture, resulting in a change of format of numbers. See below for a concrete example :

1650476904801.png

The conversion results in having multiple commas in the string before Microsoft.Data.Analysis tries to load the csv string, see here :

1650476974426.png

As a result, it raises an exception.

Any chance to raise a ticket to update the code and ensure the code is added with something like :

open System.Globalization

String.Format(CultureInfo.InvariantCulture,"{0}", value.Value)

Meanwhile, using :

CultureInfo.CurrentCulture <- CultureInfo.InvariantCulture

works as a workaround... but it has to be added in all projects, which is less than ideal.


1650476904801.png (2.6 KiB)
1650476974426.png (8.7 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
18 0 0 4

@Jirapongse, thanks for the API update !

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.