portfolioSim-class {portfolioSim} | R Documentation |
When beginning a new simulation, the first step is to
construct an object of class portfolioSim
which will contain
all the information required by the simulator. An instance of class
portfolioSim
represents a unique simulation, which can then
be run at any time by calling the runSim
method.
Objects can be created by calls of the form new("portfolioSim",
...)
.
periods
:period
,
start
, and end
. The period
column contains
labels which are used throughout the simulator to represent each
period. The start
and end
columns are used to
differentiate between saved data from before and after the trades are
performed in each period. Generally, these columns should contain the
actual dates corresponding to each period. freq
:trades.interface
:simTradesInterface
. The
trades interface represents the implementation of the trading stategy
to be tested in the simulation. Based on the current portfolio and
the data available for a given period, the trades interface contains
some mechanism for determining a set of trades to make. These trades
are encapsulated in a simTrades
object which the interface
returns to the simulator. data.interface
:simDataInterface
. The data
interface serves to transform the raw data used in the simulation into
an object of class simData
, containing information on a
single period. summary.interface
:simSummaryInterface
. The summary interface allows the user to
specify information to be saved out during the simulation beyond that
supported by the result classes instantData
and
periodData
. start.holdings
:portfolio
package for information on
constructing a portfolio. fill.volume.pct
:"numeric"
describing the maxiumum percentage of the daily
trading volume of a stock that the simulator is allowed to trade in
a single period. The default is 15. If set to Inf
, all
trades produced by the trades interface will be done, regardless
of whether some of the associated securities are absent in sim
data or have an NA market data for the period. exp.var
:"character"
listing
additional variables to be used when analyzing the exposures for
each period. contrib.var
:"character"
listing
additional variables to be used when analyzing the contributions
for each period. out.loc
:"character"
describing
the location at which to save the results of the simulation. out.type
:"character"
listing
the types of data to be saved out. signature(.Object = "portfolioSim")
:
Checks for and initializes preset type combinations.signature(object = "portfolioSim")
: Run the
simulation.Jeff Enos jeff@kanecap.com