Learn R Programming

partialCI (version 1.2.0)

yhedge.pci: Hedge portfolio for a stock price series

Description

Computes the hedge of a stock price series fetched form Yahoo! using one or more other stock price series also fetched form Yahoo!

Usage

yhedge.pci(target, factors, start, end, na.rm=FALSE, ...)

Arguments

target

The ticker symbol of the stock price series that is to be modeled.

factors

A list of ticker symbols of stock price series to be used in modeling target

start

The starting date for which data is to be fetched, given in the format YYYYMMDD. Default: 2 years ago today.

end

The ending date for which data is to be fetched, given in the format YYYYMMDD. Default: today.

na.rm

If TRUE, then NA's will be removed from the data.frame of fetched prices. A heuristic approach is used to decide between deleting securities versus deleting days.

...

Additional optional parameters to be passed to fit.pci

Value

An S3 object of class pci.hedge representing the best fit that was found.

See Also

fit.pci

Examples

Run this code
# NOT RUN {
# Compute the best hedge of Coca-Cola using sector ETFS.
# sectorETFS <- c("XLB","XLE","XLF","XLI","XLK","XLP","XLU","XLV","XLY")
# hedge <- yhedge.pci("KO", sectorETFS)
# hedge
# test.pci(hedge$pci)
# plot(hedge)
# }

Run the code above in your browser using DataLab