Wolfram Language

Time Series Processing

Cumulative Fractional Change

Compute the cumulative fractional change for the SBUX stock price for 2015 from the corresponding time series of fractional change of SBUX stock price.

show complete Wolfram Language input
In[1]:=
Click for copyable input
ts = TimeSeries[ FinancialData["SBUX", "FractionalChange", {"2 Jan 2013", "31 Dec 2015"}, "Value"], {"3 Jan 2013", "31 Dec 2015", "BusinessDay"}, HolidayCalendar -> {"UnitedStates", "NYSE"}];
In[2]:=
Click for copyable input
ts = TemporalData[TimeSeries, {CompressedData[" 1:eJw9Vwk0lV243oYifyIkSaWBUJlS8Zf2yZTUQWQOxxwajJnZ5nkeMhUVihAZ kmifSsVfEaUiiaJoIkWi4b7ddddtrRbrHN/+9n7eZ9pr7U8YOXEihDjg/9e/ v9wJj1ycEoRR0eF9fJV+GOXuWGZwYQ9Ggl6u9S7WdCjg5/45tQyKlgQmcv22 pKRFJom/LByjiC1yXw0DKGIlKNj5H6VoxdMB5SQHis6FC30ucMboi22ewwFY z824WP2dG2aMS26Ta42kSPEdz/tEFh7i2MPQ5i7FbA9y/2ZgEiU8wTfiGkIp 2j4x3ugXglHlEa63yXYYGZlw63EkYlTzevPH64kUre3cX+0D6/5i7T760oki i8+i823uFCUcb7h2JQKTbrUAx0YPiu4GudVG2GGy/BY11A+jKLx550CCD2Wt P352qX4ORT0DOprZLMyu4tI54pFNkYzqropsXYzK0l+5B6ZiQnbwX5WCc9cc 97uVbILZlRmtM//lYlRhfm83ty9G6Erb3tEdGCnZht+cS8HoiKK6dnsyRot2 6b6zi8bIQWWyoCgLI1LOjoyD85gnLlW/aUhRUsTMjIAfRZwreNI7YJ2kwjTB rlSKxmwvbri2nRLrOvOGT/EUVe9IZ907/HefmoZF0Zj0JHAriwfBPjMKPGv9 MPkurlpaHEfR4vOtDzkDMbo4+vSwuCNFhu2+Mrx7MVoXos3NbUbRotXDmCcP MziDrAMvA/6y60ZfiMN+BLwinvf5Ai6ynnuqTsL+KuNuc8N7nbOeMR4DH5Zk JSueB9yflDZ7PQnH5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LtmiQXgc6z8VTMW2yi6 5F7YtgD64LuFElOfCyg7zvKD3vtz4CPct4ozwBc3tZ2MGPTErPa8vNENcG/a wJHDuSIWe2wQ0Z6cgRxlNbmEOEBvHCi6O+sCvSTm6jsrLZi/bX1Jhhz0P50P m25+h/xwMVLdIgT7b2t2Xz4NPvPoqN/lUbj3KdoUC1+DfXgG5LVdsKNkb8KX yflUuOe+Eo+6Azjw5z4RyE+g/wNF8pwH "], { TemporalData`DateSpecification[{2013, 1, 3}, {2015, 12, 31}, "BusinessDay", "DayRange"]}, 1, {"Continuous", 1}, { "Discrete", 1}, 1, { ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}, HolidayCalendar -> {"UnitedStates", "NYSE"}}}, True, 314.1];

The time series is regularly sampled on business days.

In[3]:=
Click for copyable input
ts["MinimumTimeIncrement"]
Out[3]=
In[4]:=
Click for copyable input
RegularlySampledQ[ts]
Out[4]=

The cumulative fractional change is calculated using the following formula.

In[5]:=
Click for copyable input
fun := (Exp[Accumulate[Log[# + 1]]] - 1) &

Apply the cumulative fractional change formula to the stock time series.

In[6]:=
Click for copyable input
res = fun[ts];
show complete Wolfram Language input
In[7]:=
Click for copyable input
DateListPlot[{ts, res}, PlotTheme -> "Detailed", PlotLegends -> {"fractional change", "calculated cumulative fractional change "}]
Out[7]=

Related Examples

de es fr ja ko pt-br ru zh