R Quantmod 图表_来自 yahoofincer 的股票历史系列

问题描述 投票:0回答:1

我正在使用 R yahoofinancer 包,因为它可以检索当日最后完成的股票历史记录。

要使用 yahoofinancer 获取股票历史记录:

AAPL <- Ticker$new('AAPL')
AAPL = AAPL$get_history(start = Sys.Date()-84, interval = "1d")

然后我可以使用 Quantmod ChartSeries 来获取股票图表:

chartSeries(AAPL,theme="white",major.ticks="months",minor.ticks = F)

但是如果我使用图表_系列:

chart_Series(AAPL,theme="white",major.ticks="months",minor.ticks = F)

我遇到错误“主题 $col 中的错误:$ 运算符对于原子向量无效”

chart_Series 很好,因为它支持 par 函数。

如何解决chart_Series中的错误? 感谢您阅读我的帖子:)

r quantmod
1个回答
0
投票

chart_Series()
chartSeries()
没有相同的参数,因此它们并不意味着可以相互替代。
chart_Series()
默认使用白色背景,因此如果您想要的话,无需更改
theme

library(quantmod)
aapl <- getSymbols("AAPL", auto.assign = FALSE, from = "2023-01-01")
chart_Series(aapl)

© www.soinside.com 2019 - 2024. All rights reserved.