adjusted_ohlc: Adjusted closing prices

Description Usage Arguments Value Examples

View source: R/market_utils.R

Description

Adjusted closing prices

Usage

1
adjusted_ohlc(values, factors, adjust = c("qfq", "hfq"))

Arguments

values

a data.table, keyed by date/time column. Can be obtained from eod market functions.

factors

a data.table, keyed by date/time column. Can be obtained from adj_factor().

adjust

following Tushare Pro convention, qfq adjusts previous closing prices w.r.t last closing prices, hfq adjusts closing prices w.r.t first traded price.

Value

data.table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
#query prices and adjust factors
pab <- daily(ts_code = "000001.sz")
pab_af <- adj_factor(ts_code = "000001.sz")
#post-adjusted
pab_adjusted <- adjusted_ohlc(pab, pab_af, "hfq")
#pre-adjusted
pab_adjusted <- adjusted_ohlc(pab, pab_af, "qfq")

## End(Not run)

imlijunda/TushareR documentation built on Dec. 2, 2019, 3:25 a.m.