pq_index creates a sector/industry index using the method of weighted geometric mean, based on a set of data and corresponding weights.

pq_index(dt, x = "close|value", w = "cap_total", base_value = 1,
  base_date = NULL, name = NULL)

Arguments

dt

a list/dataframe of time series dataset

x

the name of column to create index. Default is 'close|value'

w

the name of weights column. Default is 'cap_total'. If x is not available or is NULL, then using equal weights.

base_value

the base value of index. Default is 1.

base_date

the base date of index. Default is the minimum date.

name

the name of index. Default is NULL, then using 'index'.

Examples

# \donttest{ # Example I bank share index # load data bank_symbol = c('601988', '601288', '601398', '601939', '601328') bank_dat = md_stock(bank_symbol, source='163', date_range = 'max')
#> 1/5 601988 #> 2/5 601288 #> 3/5 601398 #> 4/5 601939 #> 5/5 601328
# creating index bank_index = pq_index(bank_dat, x='close', w='cap_total') # pq_plot(bank_index) # }