# Log of time series evaluated

I'm new to Mathematica and am trying to plot log-returns of a stock as a timeseries object. However, the following code gives me back elements of the form "Log[151.23\$]" unevaluated. What am I doing wrong?

Differences[Log[FinancialData["GE", {2018, 1, 1}, "All"]]]


I know you can get it to work if you use the "values" of the time series, but this removes the dates and I need them for a DateListPlot.

The QuantityMagnitude command does the work.

ts = Differences[Log[QuantityMagnitude[FinancialData["GE", {2018, 1, 1}, "All"]]]]
DateListPlot[ts]


• Thank you so much! Commented Dec 11, 2021 at 9:43
• As returns, technically they should be plotted as a histogram. By contrast, a time series (index) makes sense as a line plot. Commented Dec 11, 2021 at 20:01
• It's interesting how your answer is working with time series. Some unobvious semantics going on, such as Log knows not to operate on the dates. Seems quite specific and a bit black box. Commented Dec 11, 2021 at 20:17
a = FinancialData["GE", {2018, 1, 1}, "All"];
b = Normal[a];

DateListPlot[Transpose[{b[[2 ;;, 1]],
Differences@Log[b[[All, 2, 1]]]}], Joined -> False, Filling -> Axis]


alternatively

a = FinancialData["GE", {2018, 1, 1}, "All"];
b = Normal[a];

c = Rest@b[[All, 1, 1, ;; 3]];
d = Differences@Log[b[[All, 2, 1]]];
DateListPlot[Transpose[{c, d}], Joined -> False]


note

b[[All, 2, 1]] == QuantityMagnitude@b[[All, 2]]


True