library(tidyquant)
library(ggplot2)
# 1. 삼성전자(005930.KS) 최근 1년 주가 수집
samsung <- tq_get("005930.KS", from = Sys.Date() - 365)
# 2. ggplot을 이용한 시각화 (autoplot 대신 사용)
samsung %>%
ggplot(aes(x = date, y = close)) +
geom_line(color = "darkblue", linewidth = 1) +
labs(title = "Samsung (recent 1 year)",
x = "Date",
y = "Close Price (KRW)") +
theme_tq() # 금융 데이터에 어울리는 깔끔한 테마
