R:quantmod包抓取股票數據

> library(quantmod)

> GBIA<-getSymbols("600004.ss",from = "2016-06-01",to = Sys.Date(),src = "yahoo",auto.assign=FALSE)

# 600004爲股票代碼,ss表示上證

> tail(GBIA,n=8)    #查看最近8天的數據

輸入圖片說明

> chartSeries(GBIA,theme='white',up.col='green',dn.col='white',TA="addVo();addMACD();addSMA(n=20)")

#分別設置上漲和下跌柱體顏色,並添加20日移動平均線

效果以下:code

輸入圖片說明

(End)圖片

相關文章
相關標籤/搜索