valuation.portfolBurSt {PortfolioProbe}R Documentation

Find the Monetary Values of a Portfolio or Trade

Description

Returns various concepts of value.

Usage

## S3 method for class 'portfolBurSt'
valuation(x, prices = x$prices, trade = FALSE, 
	weight = is.logical(collapse) && !collapse, 
	collapse = is.array(prices), type = "gross", cash = NULL, 
	all.assets = FALSE, returns = NULL, cumulative = FALSE, 
	drop.factor = FALSE)
## Default S3 method:
valuation(x, prices, 
	weight = is.logical(collapse) && !collapse, 
	collapse = is.array(prices), type = "gross", cash = NULL,
	all.assets = FALSE, returns = NULL, cumulative = FALSE, 
	drop.factor = FALSE)

Arguments

x

required. An object of class "portfolBurSt" created by trade.optimizer (for the "portfolBurSt" method). Or a named vector (for the default method).

prices

a named vector of asset prices that includes at least the assets in the object being evaluated; or a matrix with column names for the assets (rows are for times); or a three-dimensional array with rows corresponding to times, columns to assets, and slices to different scenarios.

This is a required argument for the default method.

trade

logical value. If TRUE, then the results are for the trade. If FALSE, then the results are for the optimal portfolio.

weight

logical value; if TRUE and collapse is FALSE, then the result includes a component named weight which contains the weights of the assets (that is, position values divided by the gross value).

If weight is TRUE and collapse represents categories, then the results are weights within the categories (or category combinations).

collapse

logical value, or an object representing categories. If TRUE, then the result will be a number (or a vector if prices was a three-dimensional array) containing results for the portfolio rather than individual assets.

Categories can be represented by a named character vector or factor, or a list of these (for combinations of categories). The list can be in the form of a data frame where the row names are the asset identifiers.

type

this is only used when collapse is not FALSE.

A character string that (partially) matches one of: "gross", "net", "long", "short", "nav", "cash". When this has value "nav", then the result is the net value plus cash. When this has value "short", the result is non-negative numbers. The "cash" type lets you see the value of cash that is computed.

cash

this is only used when type="nav" and collapse is TRUE (which includes return calculations).

A single number, a numeric vector with as many elements as there are rows in prices, or NULL. If this is NULL, then the amount of cash is such that the initial value of the portfolio is equal to the gross value minus the net value at the first time point.

all.assets

a logical value. If TRUE, then the weight and individual components will have the same assets (in the same order) as prices.

returns

either NULL or a single character string that is (an abbreviation of) "log", "simple", "geometric", or "arithmetic". This fails if prices is not a matrix or array. This is two types of returns with two names each.

cumulative

a logical value. If TRUE, then the returns are cumulative – that is, relative to the prices at the first time point. If FALSE, then the return at each time point is relative to the immediately previous time point.

This is ignored if returns are not produced.

drop.factor

a logical value. If TRUE, then (combinations of) categories in collapse that do not occur are not represented in the result.

Value

if collapse is TRUE, then an object with dimension one less than prices. The order of the dimensions is: time (if any), and scenarios (if any).

If collapse represents categories, then an object with the same number of dimensions as prices (and currently prices is not allowed to be three-dimensional in this case). The order of dimensions is: time (if any) and categories.

The above include the attributes timestamp and call like the descriptions given below.

If collapse is FALSE, a list with the following components:

individual

the amount of money in individual assets.

total

length 4 vector containing the gross value, the net value, the long value and the short value.

weight

only present if the weight argument was TRUE. A numeric vector containing the weights of the assets.

timestamp

character string giving the time and date of the evaluation.

call

the call that created the object.

Details

These are methods for the generic function valuation.

Revision

This help was last revised 2013 April 17.

See Also

trade.optimizer, summary.portfolBurSt, valuation.randportBurSt.

Examples

op1 <- trade.optimizer(eq.prices, varian, long.only=TRUE, 
	gross.value=1e6)
valuation(op1)

valuation(op1, new.prices) # valuation with new prices

valuation(op1, rbind(eq.prices, new.prices)) # two gross values

valuation(op1, trade=TRUE) # valuation for the trade
valuation(op1$trade, eq.prices) # same thing

# get weight vector corresponding to full universe of assets
valuation(op1, pricevec, all.assets=TRUE)$weight  

# log returns over some time period
valuation(op1, price.matrix, returns="log")

[Package PortfolioProbe version 1.06 Index]