swapCOM: Commodity Calendar Month Average Swaps

View source: R/swapCOM.R

swapCOMR Documentation

Commodity Calendar Month Average Swaps

Description

Commodity swap pricing from exchange settlement

Usage

swapCOM(
  futures = futs,
  futuresNames = c("CL0M", "CL0N"),
  pricingDates = c("2020-05-01", "2020-05-30"),
  contract = "cmewti",
  exchange = "nymex"
)

Arguments

futures

Wide data frame of futures prices for the given swap pricing dates. tibble

futuresNames

Tickers of relevant futures contracts. character

pricingDates

Vector of start and end pricing dates. See example. character

contract

Contract code in data(expiry_table). sort(unique(expiry_table$cmdty)) for options. character

exchange

Exchange code in data(holidaysOil). Currently only "nymex" and "ice" supported. character

Value

Data frame of histocial swap prices. tibble

Author(s)

Philippe Cote

Examples

## Not run: 
c <- paste0("CL0", c("M", "N", "Q"))
futs <- getPrices(
  feed = "CME_NymexFutures_EOD", contracts = c, from = "2019-08-26",
  iuser = username, ipassword = password
)
swapCOM(
  futures = futs, futuresNames = c("CL0M", "CL0N"),
  pricingDates = c("2020-05-01", "2020-05-30"), contract = "cmewti", exchange = "nymex"
)

## End(Not run)


risktoollib/RTL documentation built on April 17, 2024, 1:35 p.m.