Description Author(s) Examples
The strand package provides a framework for performing discrete (share-level) simulations of investment strategies. Simulated portfolios optimize exposure to an input signal subject to constraints such as position size and factor exposure.
For an introduction to running simulations using the package, see
vignette("strand")
. For details on available methods see the
documentation for the Simulation
class.
Jeff Enos jeffrey.enos@gmail.com and David Kane dave.kane@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Load up sample data
data(sample_secref)
data(sample_pricing)
data(sample_inputs)
# Load sample configuration
config <- example_strategy_config()
# Override config file end date to run a one-week sim
config$to <- as.Date("2020-06-05")
# Create the Simulation object and run
sim <- Simulation$new(config,
raw_input_data = sample_inputs,
raw_pricing_data = sample_pricing,
security_reference_data = sample_secref)
sim$run()
# Print overall statistics
sim$overallStatsDf()
# Access tabular result data
head(sim$getSimSummary())
head(sim$getSimDetail())
head(sim$getPositionSummary())
head(sim$getInputStats())
head(sim$getOptimizationSummary())
head(sim$getExposures())
# Plot results
## Not run:
sim$plotPerformance()
sim$plotMarketValue()
sim$plotCategoryExposure("sector")
sim$plotFactorExposure(c("value", "size"))
sim$plotNumPositions()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.