2
# This library is free software; you can redistribute it and/or
3
# modify it under the terms of the GNU Library General Public
4
# License as published by the Free Software Foundation; either
5
# version 2 of the License, or (at your option) any later version.
7
# This library is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU Library General Public License for more details.
12
# You should have received a copy of the GNU Library General
13
# Public License along with this library; if not, write to the
14
# Free Foundation, Inc., 59 Temple Place, Suite 330, Boston,
19
# 1999 - Diethelm Wuertz, GPL
20
# 2007 - Rmetrics Foundation, GPL
21
# Diethelm Wuertz <wuertz@itp.phys.ethz.ch>
22
# for code accessed (or partly included) from other sources:
23
# see Rmetric's copyright and license files
26
################################################################################
29
# test.portfolioConstraints.Short
30
# test.portfolioConstraints.LongOnly
31
################################################################################
35
## Note, there is not yet a print function in the show-methods.R
38
# ------------------------------------------------------------------------------
45
getClass("fPFOLIOCON")
48
getSlots("fPFOLIOCON")
55
# ------------------------------------------------------------------------------
58
test.portfolioConstraints.Short <-
63
data = as.timeSeries(data(smallcap.ts))
64
data = data[, c("BKE", "GG", "GYMB", "KRON")]
68
spec = portfolioSpec()
69
setTargetReturn(spec) = mean(data)
75
Constraints = portfolioConstraints(data, spec, constraints)
83
# ------------------------------------------------------------------------------
86
test.portfolioConstraints.LongOnly <-
90
data = as.timeSeries(data(smallcap.ts))
91
data = data[, c("BKE", "GG", "GYMB", "KRON")]
95
spec = portfolioSpec()
96
setTargetReturn(spec) = mean(data)
99
constraints = "LongOnly"
102
Constraints = portfolioConstraints(data, spec, constraints)
110
################################################################################