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 ?

Best Answer

  • Jirapongse
    Answer ✓

    @anonymous954782

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


    image


    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.

Answers

  • @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.

  • 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

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

  • Here is the notebook view

    1650362444421.png

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


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

  • @anonymous954782

    Is it macOS or Windows?


  • 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


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

  • @Jirapongse, thanks for the API update !