Get startedGet started for free

Compute simple monthly returns

For the remaining exercises, consider a one-month investment in two Northwest stocks: Amazon and Costco.

Suppose you buy Amazon and Costco at the end of September at \(P_{A, t-1} = 38.23, P_{C, t-1} = 41.11\) and then sell at the end of October for \(P_{A, t} = 41.29, P_{C, t} = 41.74\). Compute the simple monthly returns for the two stocks.

Note that the above prices were the actual closing prices for 2004 taken from Yahoo!.

This exercise is part of the course

Intro to Computational Finance with R

View Course

Exercise instructions

  • Assign to PA a vector that contains the prices of the Amazon stock.
  • Assign to PC a vector that contains the prices of the Costco stock.
  • Compute the simple monthly return on the Amazon stock and assign it to RA.
  • Compute the simple monthly return on the Costco stock and assign it to RC.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Vectors of prices
PA <- 
PC <- 

# Simple monthly returns
RA <- 
RC <- 
Edit and Run Code