Learn R Programming

schwartz97 (version 0.0.6)

futures-plot: Visualization of Futures Data

Description

Visualization of historical commodity futures prices and remaining time to maturity. This function is intended to be fed with the futures data contained in this package (see futures-data).

Usage

futuresplot(futures, type = c("forward.curve", "ttm"), ...)

Arguments

futures
A list with elements price and ttm. Usually an element of futures.
type
What shall be plotted. "forward.curve" or "ttm" (time to maturity).
...
Optional arguments passed to plot.

See Also

futures-data

Examples

Run this code

# data(futures)
# 
# ## Plot time to maturity of corn data
# futuresplot(futures$corn, type = "ttm")
# 
# ## Plot forward curves of wheat data since Jan 2010
# wheat.2010 <- lapply(futures$wheat,
#                      function(x)x[as.Date(rownames(x)) > "2010-01-01",])
# futuresplot(wheat.2010, type = "forward.curve")

Run the code above in your browser using DataLab