半導体指数、レーザーテックと10年債利回り

SOX指数と米国10年債利回り、デイトレ銘柄レーザーテックの時系列の関係をプロットした。

library(tidyquant)
library(dplyr)
library(ggplot2)
soxlt <- tidyquant::tq_get(c("^SOX","6920.T","^TNX"))
soxlt.tail <- soxlt %>% group_by(symbol) %>%  do(tail(., n=60))
ggplot(soxlt.tail[!is.na(soxlt.tail$close),], aes(x=date, y=close, group=symbol,color=symbol,fill=symbol))+
    geom_point() + geom_line() + geom_smooth(method = "loess") + facet_grid(symbol~., scales="free_y") + theme_minimal()