periodReturn 是包装器的基础功能:
- allReturns: 计算所有可用的回报期
- dailyReturn: 计算每日回报
- weeklyReturn: 计算每周回报
- monthlyReturn: 计算每月回报
- quarterlyReturn: 计算季度回报
- annualReturn: 计算年度回报
- library(tidyquant)
- Ra <- c("BABA", "VIPS", "BIDU", "JD", "MOMO", "NTES", "ATHM", "WUBA", "WB") %>%
- tq_get(get = "stock.prices",
- from = "2010-01-01",
- to = "2018-05-22") %>%
- group_by(symbol) %>%
- tq_transmute(select = adjusted,
- mutate_fun = periodReturn,
- period = "monthly",
- col_rename = "Ra")
- Ra


雷达卡


京公网安备 11010802022788号







