Q1 Import Walmart for the last one year. Save the result under stock and print it.

Hint: Use tq_get() from the tidyquant package.

Q2 Calculate 20-day moving averages and 20-day running standard deviation. Save the result under stock and print it.

Hint: Take stock, pipe it to tidyquant::tq_mutate to calculate 20-day moving averages, pipe it to tidyquant::tq_mutate to calculate 20-day running standard deviation, pipe it to rename() to rename value to SD, and assign the result to stock. To calculate the running standard deviation, use runSD in place of SMA. You can see all the available functions in tidyquant::tq_mutate using tq_mutate_fun_options().

Q3 Calculate the Bollinger Bands. Save the result under stock and print it.

Hint: Take stock, pipe it to mutate(sd2up = SMA + 2 * SD, sd2down = SMA - 2 * SD), and assign the result to stock.

Q4 Keep variables to build the Bollinger Bands. Save the result under stock_selected and print it.

Hint: Take stock, pipe it to dplyr::select to keep date, close, SMA, sd2up, and sd2down, and assign the result to stock_selected.

Q5 Transform data to long form from wide form for graphing.Save the result under stock_long and print it.

Hint: Take stock_selected, pipe it to gather(key = type, value = price, close:sd2down), and assign the result to stock_long.

Q6 Visualize data.

Hint: Take stock_selected and pipe it to ggplot(). Map date to the x-axis, price to the y-axis, and type to color in the line chart.

Q7 If you had invested $1 million on the day of the first buying point and sold all the shares on the following selling point, how much would you have won or lost?

On November 20th it was the first buying point and it sold all shares on the oppisite selling point. If we invest a million dollars we can buy 10,616 stocks for $94.20 each. We can sell those stocks on Feburary 15th for $99.99 an make a profit of $61,916.

Q8 Hide the messages, the code, and its results on the webpage.

Hint: Use message, echo and results in the chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.