How to get the values for Turnover for a specific FY and CY using Eikon API?

Hi,

I'm trying to get the values of Turnover for a list of industries for a specific calendar year and fiscal year. However, I obtained the values which are absolutely identical for CY and FY.

Is it the right way I used to get the values or something is missing?

x <- get_data(instruments,list("TR.TURNOVER(Frq = FY, SDate = FY2008, EDate = FY2008, Curn=USD)")); #for FY2008
x <- get_data(instruments,list("TR.TURNOVER(Frq = CY, SDate = '2008-01-01', EDate = '2008-12-31', Curn=USD)"));


Best Answer

  • @Iana

    TR.TURNOVER field provides timeseries of daily turnover for the stock. Setting Frq parameter to an annual value does not result in aggregating daily turnover into annual turnover, it will just return the daily turnover for the last day of the year, which I'm guessing is not what you're looking for. To return aggregated turnover for a year use aggregation functions, e.g. for total turnover between two dates use

    get_data(instruments,"SUM(TR.TURNOVER(SDate=20190101,EDate=20191231))")

    Timeseries of price history do not respect parameters representing fiscal periods. To get total turnover for a fiscal year use start and end date of the fiscal year. To find out fiscal year end date for a company use TR.ISPeriodEndDate field.

Answers

  • Hi @Iana,

    The 2nd parameter in the get_data() function call can be either a single field or an array of fields. When you apply the list() function with a string, it will create an array of individual characters which isn't what you want. In your case, you are only specifying 1 field,

    So try something like this:

    x <- get_data(instruments,"TR.TURNOVER(Frq = FY, SDate = FY2008, EDate = FY2008, Curn=USD)"); #for FY2008

    or this

    x <- get_data(instruments,["TR.TURNOVER(Frq = FY, SDate = FY2008, EDate = FY2008, Curn=USD)"]); #for FY2008
  • Thanks for your comment. I tried the following code:

    get_data(instruments,"SUM(TR.TURNOVER(SDate=20190101,EDate=20191231))")

    However, it did not return any values "No data available in table".

    BUT this worked!

    get_data(instruments,list("TR.TURNOVER(CALCMETHOD=SUM, SDate=20080101,EDate=20081231,Frq=CY, Curn=USD)"));
  • Hi @Iana,

    Can you please confirm what specifically works? When you apply the list() function to a string, as you did in the code segment that works for you, it will tokenize the string into individual characters and as a result, throw an error. For example:

    image

    Can you produce a screenshot of the request and output?

    Also, can you confirm what failed with this command:

    get_data(instruments,"SUM(TR.TURNOVER(SDate=20190101,EDate=20191231))")

    For example, if I try the above syntax, this is what is returned (for my instrument):

    image

    In the first part of this, I decided to do a small test with a short period to show the breakdown of TURNOVER values and the sum() to show the total. I then use the SUM() within the field to demonstrate the value is the same.

  • @nick.zincone.1

    Judging by the syntax of the code snippets in the original post, @Iana is using R. In R the "list" function with a single string argument returns a list with a single element that is the input string.
    I do second the second part of your question. It would be interesting to find out why the syntax I provided didn't work for @Iana. My guess is that the request timed out. Eikonapir library has not been updated to use asynchronous Datagrid endpoint. In any case the method that did work for @Iana is actually better than the one I suggested.

  • Hi @nick.zincone.1! I used R instead of Python. Overall, I tried these two ways for 2008 CY.

    The first one:

    TurnoverTexAp081<- get_data(instruments,list("SUM(TR.TURNOVER(SDate=20080101, EDate=20081231, Frq=CY, Curn=USD))"))

    It gives the following results:

    image

    The second way:

    TurnoverTexAp082 <- get_data(instruments,list("TR.TURNOVER(CALCMETHOD=SUM, SDate=20080101, EDate=20081231, Frq=CY, Curn=USD)"));

    The output is as follows:

    image

    It's a bit strange that the results are that much different, despite the fact that the sum is used in both options.

  • @Iana

    If you're using SUM aggregation function, then as an argument for this function you need to provide daily turnover timeseries. Since you include Frq=CY parameter, instead of timeseries of daily turnover you're passing to the SUM function a single value representing the daily turnover on the last day of the calendar year. For most of the stocks in your list this value does not exist, as these stocks are not very liquid and most of them did not trade on 31-Dec-2008. For stocks that did trade on 31-Dec-2008 the value returned is the turnover for the day of 31-Dec-2008, not for the whole year of 2008. This explains why you got no values for most of the stocks when you used the SUM function, and where you did get a value, the value did not match the value you got when using CALCMETHOD=SUM parameter. If you drop Frq=CY parameter from your request using SUM aggregation function, then the values you retrieve will match those returned when you use CALCMETHOD=SUM parameter.