A package accompanying, FRAPO
Loading required package: fOptions
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics
> vignette("sos")
Warning messages:
1: package ‘fOptions’ was built under R version 3.5.2
2: package ‘timeDate’ was built under R version 3.5.1
3: package ‘timeSeries’ was built under R version 3.5.1
4: package ‘fBasics’ was built under R version 3.5.2
> findFn("Portfolio")
Error in findFn("Portfolio") : could not find function "findFn"
> findFn()
Error in findFn() : could not find function "findFn"
> library(ctv)
Error in library(ctv) : there is no package called ‘ctv’
> install.packages("ctv")
Installing package into ‘C:/Users/ADMIN/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.5/ctv_0.8-5.zip'
Content type 'application/zip' length 427975 bytes (417 KB)
downloaded 417 KB
package ‘ctv’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\ADMIN\AppData\Local\Temp\RtmpohMC6p\downloaded_packages
> library(ctv)
Warning message:
package ‘ctv’ was built under R version 3.5.2
> library (FRAPO )
Loading required package: cccp
Loading required package: Rglpk
Loading required package: slam
Using the GLPK callable library version 4.47
Financial Risk Modelling and Portfolio Optimisation with R (version 0.4-1)
Warning messages:
1: package ‘FRAPO’ was built under R version 3.5.2
2: package ‘cccp’ was built under R version 3.5.2
3: package ‘Rglpk’ was built under R version 3.5.2
4: package ‘slam’ was built under R version 3.5.2
> data(StockIndexAdj)
> R <- returnseries(StockIndexAdj, method = "discrete",trim = TRUE)
> P <- PGMV(R, optctrl = ctrl(trace = FALSE))
> p
Error: object 'p' not found
> class(P)
[1] "PortSol"
attr(,"package")
[1] "FRAPO"
> showClass("PortSol")
Class "PortSol" [package "FRAPO"]
Slots:
Name: weights opt type call
Class: numeric list character call
Known Subclasses: "PortCdd", "PortAdd", "PortMdd"
> showMethods(classes = "PortSol", inherited = FALSE)
Function ".DollarNames":
<not an S4 generic function>
Function "complete":
<not an S4 generic function>
Function "coredata":
<not an S4 generic function>
Function "coredata<-":
<not an S4 generic function>
Function "formals<-":
<not an S4 generic function>
Function "functions":
<not an S4 generic function>
Function "prompt":
<not an S4 generic function>
Function "scale":
<not an S4 generic function>
Function: show (package methods)
object="PortSol"
Function: Solution (package FRAPO)
object="PortSol"
Function: update (package stats)
object="PortSol"
Function: Weights (package FRAPO)
object="PortSol"
> p
Error: object 'p' not found
> showMethods(classes = "PortSol", inherited = FALSE)
Function ".DollarNames":
<not an S4 generic function>
Function "complete":
<not an S4 generic function>
Function "coredata":
<not an S4 generic function>
Function "coredata<-":
<not an S4 generic function>
Function "formals<-":
<not an S4 generic function>
Function "functions":
<not an S4 generic function>
Function "prompt":
<not an S4 generic function>
Function "scale":
<not an S4 generic function>
Function: show (package methods)
object="PortSol"
Function: Solution (package FRAPO)
object="PortSol"
Function: update (package stats)
object="PortSol"
Function: Weights (package FRAPO)
object="PortSol"
> P
Optimal weights for porfolio of type:
Global Minimum Variance
SP500 N225 FTSE100 CAC40 GDAX HSI
36.6719 13.9499 49.3782 0.0000 0.0000 0.0000
> showMethods("Weights", inherited = FALSE)
Function: Weights (package FRAPO)
object="PortSol"
> selectMethod(f = "Weights", signature = "PortSol")
Method Definition:
function (object)
{
ans <- slot(object, "weights")
return(ans)
}
<bytecode: 0x0000000021af7d08>
<environment: namespace:FRAPO>
Signatures:
object
target "PortSol"
defined "PortSol"
> Weights(P)
SP500 N225 FTSE100
3.667185e+01 1.394991e+01 4.937824e+01
CAC40 GDAX HSI
-5.526138e-07 -6.809098e-07 -7.415764e-07
> slot(P, "weights")
SP500 N225 FTSE100
3.667185e+01 1.394991e+01 4.937824e+01
CAC40 GDAX HSI
-5.526138e-07 -6.809098e-07 -7.415764e-07
> P@weights
SP500 N225 FTSE100
3.667185e+01 1.394991e+01 4.937824e+01
CAC40 GDAX HSI
-5.526138e-07 -6.809098e-07 -7.415764e-07
0 Comments