# Earnings per Share Growth

Hi Optuma,

I am trying to write a script for calculating earnings per share (EPS) growth to use in a watchlist, however I have some uncertainty as to if I am getting the previous period EPS and if I am using the script caching [] function correctly.

It is my understanding that the "Earnings per Share - Fiscal Period" fundamental data in Optuma is for the fiscal 12 month period, the fiscal period can not be overridden, and is updated every six months as companies report. That is, the EPS data is for the trailing 12 month period and the data updates every 6 months.

On this understanding, I am using the following script to calculate EPS growth % for a one year period.

// Earnings per Share - Fiscal Period as updated every 6 month period
EPS=DATAFIELD(Month(PERIODAMOUNT=6), FEED=FD, FIELD=EPS);

// to calculate the most recent period EPS
EPS1=EPS[1];

// to calculate the EPS for the pervious 12 month period i.e. [1] is current period, [2] would be previous data update 6 months ago, [3] is 12 months ago
EPS3=EPS[3];

// to calculate EPS (Earnings per share) growth 1 yr (%)
EPSgrowth1yr%=(( (EPS1-EPS3)/EPS3)*100);
EPSgrowth1yr%

Appreciate any comments or corrections.

Kind regards,

Daniel

Hi Daniel,

The following script should provide the results youâ€™re trying to produce:

EPS = DATAFIELD(FEED=FD, FIELD=EPS);
// Find the signal when the EPS changes
ChangeSignal = EPS <> EPS[1];
// Only return EPS value when the signal changes. Leave the rest as zero.
EPSPerPeriod = IF(ChangeSignal > 0, EPS, 0);
// NonZero() is to shorten the data list by removing the zero. So each bar in EPSOnly contains each fascal period value.
EPSOnly = NONZERO(EPSPerPeriod);
// EPSOnly return current fiscal period value
// EPSOnly[1] return the previous fiscal period value
EPS1 = EPSOnly[1];
EPS3 = EPSOnly[3];
EPSgrowth1yr = (( (EPS1-EPS3)/EPS3)*100);
EPSgrowth1yr

There are some comments in the script describing each step.