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)"));
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
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.
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
x <- get_data(instruments,["TR.TURNOVER(Frq = FY, SDate = FY2008, EDate = FY2008, Curn=USD)"]); #for FY2008
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:
Can you produce a screenshot of the request and output?
Also, can you confirm what failed with this command:
For example, if I try the above syntax, this is what is returned (for my instrument):
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.
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.