format_id_prices: Make an intra day price list

Description Usage Arguments Details Value See Also Examples

View source: R/format_id_prices.R

Description

Reformats a data frame of index prices into a format compatible with optimise_schedule.

Usage

1

Arguments

pricetable

a data frame with columns of price data. The order of the rows is assumed to be chronological. One row represents one hour.

colnames

a vector of strings. describes the names and order of columns that contain the price data. The first element represents the price one hour before market closure, the second element describes the price two hours before market closure and so on. The names cannot be repeated, so each hour needs to be coded into a separate column.

Details

Price data is typically formatted so that each row represents a product for a certain time. For each row there could a column describing the volume weighted average for the last hour, the last three hours and so on.

With this function, this data is transformed into a list format, where each element represents a time and contains the current prices at that point in time for the next hours. The current hour is assumed to be untradeable and therefore an NA is inserted for that time.

Value

the original data frame with the new price list as a further column

See Also

optimise_schedule

Examples

1
2
3
4
5
6
7
some_prices <- data.frame(
  time = c(1, 2, 3),
  id_1 = c(20, 30, 40),
  id_2 = c(22, 28, 39),
  id_3 = c(25, 27, 41)
)
format_id_prices(some_prices, c("id_1", "id_2", "id_3"))

henobe/flexoptr documentation built on March 11, 2021, 6:04 p.m.