Directly Apply Functions to Time Series
Retrieve time series of daily closing prices for Microsoft stock and IBM stock for 2015.
show complete Wolfram Language input
In[2]:=
msft = TemporalData[TimeSeries, {CompressedData["
1:eJxdUgk0lWkYlhSVtK+MCuX+y/dfzVAjyiNCWqRyW4Q73TSSMJUSNUZpzzom
KkulaLEdutq0SZtOkqUha7TQRkeWGpq5ndP//+fMd8533vO9y/O83/s+k1b7
LfZUV1NT66O6PapreXpXR0gSC1mltr81x2LdS3e5TI2FnvyVRbczC/Xfw42s
JQTKtBcJlSMIgqXXvSKnExzO3WrnSggMNn4Juq4jviPDkZ/pR6DjeebAWUuC
IXmV73NPEsjWOr71+0zQcsx08IGvBAl3Du6e9Iag58ye3qQSVV2d/4TLFQS6
ie1L9C4S+DmkqBsbElS8C5XJ5So7M+ey910C/zd9H1i0EmQZ6lTBgENBvXTt
vAgi2BpFi82YMIJWfwtTVibmr17g6Vw5mBPweTw+TyvqhELzJUGzo8a5kHgV
non8gcsnsW77E33pqb6c0H9R2r087bEciseoJqLFCf+YNiljanM6gVnJ9uJa
O4KTR2PSb1sTdM6Z7VqcwcLhUJJrcw4Ly87c5Qc0CNSJ261pBSxWWTgPH+5M
4GXgExjkKfb3zzLZ0VhvEff/Nq97pFrTNpGH5+X/uf2PDw+PJBKh/6HLzS/c
9+VQcrm6o7Scg2ugOz0tj4O69sNkv3YOo70XtEcwUuwyVTzZPEWKw9bKW/u7
ObR+DcxaOUkKl5RlfWPdpciS635cs1eKa+n7+11Xlwr1qx5EhENPCn/jYc89
lkqRsk3tYM9GKdzG32hz3CmFRiazNuyGFFr69XVm2WJe9h3fZJcPIr9X9tn2
MyZSGKj93PmuStXf1aOWnuEczvQ+XRi7hoNl2MeyS485eI/qPXEkjkNnWcjT
nkAOoTHqg+QrOTTdJa9ep3KoOd7patHCYdS4H6LC7nACD/+vsws1c5KKOCjN
DMZq1ovz4XFsVnR/WWks7pmf49OIRr0AlhN0zeuG3x8/d34/s7Xuxy26RbBu
U0J12EOC50aPJp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Y90gjGuL3NwEIwRWexGVDCc+wr8SCEnV5KT
e48jJ+O6nWHevW3R/k5L+1nkZNx37UfeP3J+y1JycnlMTq4kJ9dQMY1qgnFv
lwRj9CEYVxKM0fdZ/pZOMEYHwRidBONKgnFvDM005hCMMUIwLhYIxpUEY8zd
0bdMgjGmCMY9QgjGPZ0IxtzVhd88RhLmcZJwb+IvEv4Civ5Waw==
"], 1, {
"Continuous", 1}, {"Discrete", 1}, 1, {
ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}},
True, 314.1];
show complete Wolfram Language input
In[4]:=
ibm = TemporalData[TimeSeries, {CompressedData["
1:eJxFVXlYjtkbblGNSp8lFaFFlgYhbZRft+0rEmrCtOA97zlffFkyU8nSYoym
KcXQIpSiUkqiwiAtGO1RWjTKRY2m7WpqlBmtv9fMdU1/nOtc57zP85z7eZ77
uV893tNRIicjIyMrrCFhieffPTF3L8Wioyly3TModq26eHtPNo/MmElvZkXy
sGqoCAsY5OF25nF/6kSKpa5ZXz7O4zHOpzRRu5THq0nB+3TTecgZFUdLgnhE
7t6pZlnDoym6WGF3JQ/TC713HZfzOFTg80vYZR4GC/JVxRk8yJBJt30uD6qy
Sq1UyiNw77wNj+fzCPVJ89t8hUeNzVtR/k4eU1uG7Of/yENtd4Cp0jCP/cN9
8XeEuEF+L7IbOnn8L/Nwx6R2wd5fxlG7jEd+XbK4TY+ixNfQp0SDQlY6Kn9D
l2JZU2dSngtFVVa3jso+YW+1uDf+HMUqydBg2DOKxuPPRbPzKfKSlrrYpFIo
/qzrGt1C4SE9ELQkmSJaMcBpjZTCyet+4ZZQCqWOSBvzHRTGo22XTA5Q3Jqh
J3/EimKHeXJu3bcUh6aNvJwgvPvT68XxC90pjFY4ezxSppicqxceKuBuKdR4
OCyi8JSEVGbF8TBR63+4pI9HYkRy3bEeHnYuvROCbOl/+7RnTbouKRQZDqKq
PU0U8TriL0TpFPXB/eIMUwrvnLQ5cdxYns4F4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
62P0u19lGUIOyxAyLEN40H6E0X6ksgxRwjJEDcPJE7Sf4rSfaizD1oFl2BVh
OJlJ+1lO+9nGMuQoy1Ca9FsW9PtqBmQoy1ApTOPeRo+coN8+zjK0GMvQKkyj
vei3I+m301mGe78+spVpzGn6nVeQj9RgGbYaLMO4MpzdkLQ/VbQ/HSzDDEm4
XzOE40dJwl1OknChSRL6CZLQz7WmkE0S+hmS0OWQhC5CErqoIxyXIAn3EUno
rxWCbEcarkIS+o3JRypJ6Gok4e71YBpaJOFKkvAinXHwkIR+8/iRRhL6Li/9
mpOEvlsUZfDdVyiD32h/yx1I+5s7yrB8IhjdNRnOUoT2PQnGlQSj32fIW25S
9BtKEnoYSbiSJPTwYhpRJOFSkyT0GJJwJUnor2ggjSTcYpCEnkESriQJPbOZ
Rg5J6HVIQi8hCX3fkGXYDclwKkjCZQpJ6Lt9WYbqwzJUD8NpIRj9ProfaQTj
HjgE48phOF0E474hweg9BKPPIRj9viM80ghG3zem/QmCcR8RjD51GM593fgt
4xyCMY4QjHtmEoxx9uKTkEkSximSMO6LzCNHkEaIkITbG5IwxEjCECcJr0sP
0ggpkjCkScI92EnC/UgS7q5SpqFGMO7uJRjj1XXIJBhDy1CG0CEY47p9YvCe
8yhDXDc5zHvdtzCvBcEY10nPwUUwxnWIct492zCvK8EY93XykUYwbjEIxriw
gnn3/Wl/C037Wzt24+oK5r3vrY90gjGuL3NwEIwRWexGVDCc+wr8SCEnV5KT
e48jJ+O6nWHevW3R/k5L+1nkZNx37UfeP3J+y1JycnlMTq4kJ9dQMY1qgnFv
lwRj9CEYVxKM0fdZ/pZOMEYHwRidBONKgnFvDM005hCMMUIwLhYIxpUEY8zd
0bdMgjGmCMY9QgjGPZ0IxtzVhd88RhLmcZJwb+IvEv4Civ5Waw==
"], 1, {
"Continuous", 1}, {"Discrete", 1}, 1, {
ValueDimensions -> 1, DateFunction -> Automatic,
ResamplingMethod -> {"Interpolation", InterpolationOrder -> 1}}},
True, 314.1];
In[5]:=
DateListPlot[{msft, ibm}, PlotLegends -> {"MSF", "IBM"},
PlotTheme -> "Detailed"]
Out[5]=
Compute and visualize ratio of stock prices.
In[6]:=
DateListPlot[msft/ibm, PlotTheme -> "Detailed"]
Out[6]=
Compute the binary logarithm of one of the time series.
In[7]:=
blog = Log2[msft/msft["FirstValue"]]
Out[7]=
In[8]:=
DateListPlot[blog, PlotTheme -> "Detailed"]
Out[8]=