quantstrat package stock function: Error: C stack usage is too close to the limit

quantstrat package stock function: Error: C stack usage is too close to the limit

我是金融数学的新手,正在尝试用 R 做一个关于回测的作业:

library(FinancialInstrument)

start.date <- '2017-01-01'
end.date <- '2019-12-30'

HSI <- getSymbols(Symbols="^HSI",src="yahoo",from=start.date,to=end.date,index.class="POSIXct",adjust=T, auto.assign = F)
HSI <- HSI %>% na.omit()

currency(primary_id='HKD')

stock(primary_id=HSI,currency='HKD',multiplier=500,tick_size=0.05)

但我收到以下错误:C 堆栈使用 7971792 太接近限制

我的 R 会话:

Cstack_info()
  size    current  direction eval_depth 
  7969177      13136          1          2 

我看到有类似的 post 但没有人回答: Error: C stack usage is too close to the limit in R

有没有人可以就 Cstack 错误提出建议?

不要使用 auto.assign。

getSymbols(Symbols="2800.HK",src="yahoo", from=start.date,to=end.date,index.class="POSIXct",adjust=T)

`2800.HK` <- `2800.HK` %>% na.omit()

currency(primary_id='HKD')

stock(primary_id='2800.HK',currency='HKD',multiplier=500,tick_size=0.05)