create.trade.data {tradeCosts}R Documentation

User-level function to create a trade data.frame for use in trade.costs

Description

This function requires five vectors: period, id, side, exec.qty, and exec.price. It combines these five vectors and optional vectors into a single data.frame ready for use in the trade.costs function.

Usage

create.trade.data(period, id, side, exec.qty, exec.price, ...)

Arguments

period The column of periods in which trades occured.
id The column of security identifiers traded.
side What side the security was traded in.
exec.qty How much was traded.
exec.price The price per share of the trade.
... Additional vector arguments of the same length to be incorporated into the resulting data frame

Details

This helper function makes creating a trade data.frame easier.

Value

A data.frame is returned for use in the trade.costs function.

Author(s)

Daniel Suo

Examples

data(trade.mar.2007)
create.trade.data(trade.mar.2007$period, trade.mar.2007$id,
trade.mar.2007$side, trade.mar.2007$exec.qty, trade.mar.2007$exec.price)

[Package tradeCosts version 0.3-0 Index]