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

# NOT RUN {
# 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')

# creating index
bank_index = pq_index(bank_dat, x='close', w='cap_total')
# pq_plot(bank_index)

# }