下载安装包:https://github.com/lightfly-finance/lightfly-r/releases
打开 Rstudio 或者命令行,执行:
library(devtools)
install_github('lightfly-finance/lightfly-r')
library('lightfly')
stock <- new("Stock", app_id="xxx", secret_key="xxx")
data <- stock$hs300()
library(devtools)
install_github('lightfly-finance/lightfly-r')
install.packages("quantmod")
library(quantmod)
library('lightfly')
stock <- new("Stock", app_id="xxx", secret_key="xxx")
data <- stock$daily_history("sh000001", "2019-01-01", "2019-09-26")
result <- data[, 4:7]
result$Volume <- data$Volume
result$Date <- data$Date
ts <- as.xts(result[, 1:5], order.by = result$Date)
chartSeries(ts, name="上证指数")
addCCI()
addMACD()
addRSI()
addBBands()
完整文档: https://www.yuque.com/twn39/bb3s7k
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.