Through this code we try to plot the closing prices of major European stock indices in the years of 1991 to 1998.
Daily Closing Prices of Major European Stock Indices, 1991-1998
Description
Contains the daily closing prices of major European stock indices: Germany DAX (Ibis), Switzerland SMI, France CAC, and UK FTSE. The data are sampled in business time, i.e., weekends and holidays are omitted.
Format
A multivariate time series with 1860 observations on 4 variables. The object is of class "mts".
Source
The data were kindly provided by Erste Bank AG, Vienna, Austria.
library(plotly)
library(tidyr)
library(dplyr)
data("EuStockMarkets")
stocks <- as.data.frame(EuStockMarkets) %>%
gather(index, price) %>%
mutate(time = rep(time(EuStockMarkets), 4))
plot_ly(stocks, x = ~time, y = ~price, color = ~index, mode = "lines")