Exercise

# Calculate simple returns

If you denote by \(P_t\) the stock price at the end of month \(t\), the simple return is given by:

$$R_t = \frac{P_t - P_{t-1}}{P_{t-1}},$$

the percentage price difference.

Your task in this exercise is to compute the simple returns for every time point \(n\). The fact that R is vectorized makes that relatively easy.
In case you would like to calculate the price **difference** over time, you can use

```
sbux_prices_df[2:n,1] - sbux_prices_df[1:(n - 1),1]
```

Think about why this indeed calculates the price difference for all time periods. The first vector contains all prices, except the price on the first day. The second vector contains all prices except the price on the last day. Given the fact that R takes the element-wise difference of these vectors, you get \(P_t - P_{t-1}\) for every \(t\).

Instructions

**100 XP**

Assign to `sbux_ret`

the simple returns for the Starbucks stock.