Re: [R] [R-pkgs] New package 'portfolio'

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Dirk Eddelbuettel

FYI -- maybe the audience on this list would have follow-up and comment?

Dirk

On 6 March 2006 at 13:21, Jeff Enos wrote:
| We would like to announce the availability of the 'portfolio' package
| in R for analysing equity portfolios.  Version 0.2-0 is now available
| on CRAN.  To take a look, you can:
|
| > install.packages("portfolio")
| ...
| > vignette("portfolio")
|
| and play around. Those who would just like to check out an
| introduction can simply look at:
|
| http://www.kanecap.com/R/portfolio/portfolio.pdf
|
| This is the first, very rough version of a package that we hope to
| build and extend over the coming months. Our ambitions for this
| project are not small. Hundreds of professionals around the world use
| R for portfolio analysis but, right now, we all use our own individual
| tools for doing so. That seems a shame.
|
| Of course, one reason for the lack of cooperation is that finance is
| largely a zero sum game. Every dollar that we make is a dollar that
| someone else loses. But, at least when it comes to analysis tools
| (rather than alpha generation). This conflict does not seem
| insurmountable. We will see.
|
| So, consider this e-mail a call for comment and cooperation. Are there
| others out there who would be interested in using this package? Are
| there others willing to contribute, if only in terms of bug fixes,
| test cases, documentation and the like? Please let us know and, in
| fact, let the whole list know.
|
| By releasing a rough version of the package, we are especially
| interested in recruiting other developers to the project. None of our
| design decisions are set in stone. Serious offers to contribute will
| earn a significant say in future development.
|
| Dave Kane
| Jeff Enos
|
| _______________________________________________
| R-packages mailing list
| [hidden email]
| https://stat.ethz.ch/mailman/listinfo/r-packages
|
| ______________________________________________
| [hidden email] mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
Hell, there are no rules here - we're trying to accomplish something.
                                                  -- Thomas A. Edison

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Roger J. Bos
Jeff/Dave,

The seven page summary doc looks nice and I would be interested in helping
out.  I use R for my alpha models and would like to start using the porfolio
class to test portfolio construction strategies.  You have a nice start.  I
would be happy to help by maybe adding a measure of turnover, maybe we could
have some sort of transaction cost measure that could be taken into account
when calculating returns.  But first I need to learn a lot more about the
library.  I can't even find the help page.  ?portfolio turns up nothing.

help.search("portfolioHistory") turns up the following, but I can't find
help using any of those names either:

Help files with alias or concept or title matching 'portfolioHistory'
using fuzzy matching:

 global.2004.history(portfolio)
                        portfolioHistory object formed from the
                        global.2004 dataset
portfolioHistory-class(portfolio)
                        Class "portfolioHistory"

 Type 'help(FOO, package = PKG)' to inspect entry 'FOO(PKG) TITLE'.

?portfolioHistory-class

?"portfolio"

help(portfolioHistory, package=portfolio)
None of the above attemps work for me.  Any hints you can give me.

Thanks,

Roger



On 3/7/06, Dirk Eddelbuettel <[hidden email]> wrote:

>
>
> FYI -- maybe the audience on this list would have follow-up and comment?
>
> Dirk
>
> On 6 March 2006 at 13:21, Jeff Enos wrote:
> | We would like to announce the availability of the 'portfolio' package
> | in R for analysing equity portfolios.  Version 0.2-0 is now available
> | on CRAN.  To take a look, you can:
> |
> | > install.packages("portfolio")
> | ...
> | > vignette("portfolio")
> |
> | and play around. Those who would just like to check out an
> | introduction can simply look at:
> |
> | http://www.kanecap.com/R/portfolio/portfolio.pdf
> |
> | This is the first, very rough version of a package that we hope to
> | build and extend over the coming months. Our ambitions for this
> | project are not small. Hundreds of professionals around the world use
> | R for portfolio analysis but, right now, we all use our own individual
> | tools for doing so. That seems a shame.
> |
> | Of course, one reason for the lack of cooperation is that finance is
> | largely a zero sum game. Every dollar that we make is a dollar that
> | someone else loses. But, at least when it comes to analysis tools
> | (rather than alpha generation). This conflict does not seem
> | insurmountable. We will see.
> |
> | So, consider this e-mail a call for comment and cooperation. Are there
> | others out there who would be interested in using this package? Are
> | there others willing to contribute, if only in terms of bug fixes,
> | test cases, documentation and the like? Please let us know and, in
> | fact, let the whole list know.
> |
> | By releasing a rough version of the package, we are especially
> | interested in recruiting other developers to the project. None of our
> | design decisions are set in stone. Serious offers to contribute will
> | earn a significant say in future development.
> |
> | Dave Kane
> | Jeff Enos
> |
> | _______________________________________________
> | R-packages mailing list
> | [hidden email]
> | https://stat.ethz.ch/mailman/listinfo/r-packages
> |
> | ______________________________________________
> | [hidden email] mailing list
> | https://stat.ethz.ch/mailman/listinfo/r-help
> | PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> --
> Hell, there are no rules here - we're trying to accomplish something.
>                                                  -- Thomas A. Edison
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Roger J. Bos
Ok, I found it on cran.  I thought the RSiteSearch searched cran too.
Thanks.

http://cran.r-project.org/doc/packages/portfolio.pdf


On 3/9/06, roger bos <[hidden email]> wrote:

>
>  Jeff/Dave,
>
> The seven page summary doc looks nice and I would be interested in helping
> out.  I use R for my alpha models and would like to start using the porfolio
> class to test portfolio construction strategies.  You have a nice start.  I
> would be happy to help by maybe adding a measure of turnover, maybe we could
> have some sort of transaction cost measure that could be taken into account
> when calculating returns.  But first I need to learn a lot more about the
> library.  I can't even find the help page.  ?portfolio turns up nothing.
>
> help.search("portfolioHistory") turns up the following, but I can't find
> help using any of those names either:
>
> Help files with alias or concept or title matching 'portfolioHistory'
> using fuzzy matching:
>
>  global.2004.history(portfolio)
>                         portfolioHistory object formed from the
>                         global.2004 dataset
> portfolioHistory-class(portfolio)
>                         Class "portfolioHistory"
>
>  Type 'help(FOO, package = PKG)' to inspect entry 'FOO(PKG) TITLE'.
>
> ?portfolioHistory-class
>
> ?"portfolio"
>
> help(portfolioHistory, package=portfolio)
> None of the above attemps work for me.  Any hints you can give me.
>
> Thanks,
>
> Roger
>
>
>
> On 3/7/06, Dirk Eddelbuettel <[hidden email]> wrote:
> >
> >
> > FYI -- maybe the audience on this list would have follow-up and comment?
> >
> > Dirk
> >
> > On 6 March 2006 at 13:21, Jeff Enos wrote:
> > | We would like to announce the availability of the 'portfolio' package
> > | in R for analysing equity portfolios.  Version 0.2-0 is now available
> > | on CRAN.  To take a look, you can:
> > |
> > | > install.packages ("portfolio")
> > | ...
> > | > vignette("portfolio")
> > |
> > | and play around. Those who would just like to check out an
> > | introduction can simply look at:
> > |
> > | http://www.kanecap.com/R/portfolio/portfolio.pdf
> > |
> > | This is the first, very rough version of a package that we hope to
> > | build and extend over the coming months. Our ambitions for this
> > | project are not small. Hundreds of professionals around the world use
> > | R for portfolio analysis but, right now, we all use our own individual
> > | tools for doing so. That seems a shame.
> > |
> > | Of course, one reason for the lack of cooperation is that finance is
> > | largely a zero sum game. Every dollar that we make is a dollar that
> > | someone else loses. But, at least when it comes to analysis tools
> > | (rather than alpha generation). This conflict does not seem
> > | insurmountable. We will see.
> > |
> > | So, consider this e-mail a call for comment and cooperation. Are there
> >
> > | others out there who would be interested in using this package? Are
> > | there others willing to contribute, if only in terms of bug fixes,
> > | test cases, documentation and the like? Please let us know and, in
> > | fact, let the whole list know.
> > |
> > | By releasing a rough version of the package, we are especially
> > | interested in recruiting other developers to the project. None of our
> > | design decisions are set in stone. Serious offers to contribute will
> > | earn a significant say in future development.
> > |
> > | Dave Kane
> > | Jeff Enos
> > |
> > | _______________________________________________
> > | R-packages mailing list
> > | [hidden email]
> > | https://stat.ethz.ch/mailman/listinfo/r-packages
> > |
> > | ______________________________________________
> > | [hidden email] mailing list
> > | https://stat.ethz.ch/mailman/listinfo/r-help
> > | PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> >
> > --
> > Hell, there are no rules here - we're trying to accomplish something.
> >                                                  -- Thomas A. Edison
> >
> > _______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> >
>
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Jeff Enos
In reply to this post by Roger J. Bos
Roger,

roger bos writes:
 > Jeff/Dave,
 >
 > The seven page summary doc looks nice and I would be interested in helping
 > out.  I use R for my alpha models and would like to start using the porfolio
 > class to test portfolio construction strategies.  You have a nice start.  I
 > would be happy to help by maybe adding a measure of turnover, maybe we could
 > have some sort of transaction cost measure that could be taken into account
 > when calculating returns.

Thanks for your interest.  I recommend taking a look at the
documentation, examples (especially in the help for
'portfolioBasic-class' and 'portfolioHistory-class'), and the code
itself; the two package vignettes you'll find include the intro doc
you've already mentioned.  Then we could discuss ways in which
measures of turnover and transaction costs could be incorporated into
the package.

 > But first I need to learn a lot more about the
 > library.  I can't even find the help page.  ?portfolio turns up nothing.

There is no help alias for 'portfolio', but calling

help(package = "portfolio")

should list the 15 help files available.

 > help.search("portfolioHistory") turns up the following, but I can't find
 > help using any of those names either:
 >
 > Help files with alias or concept or title matching 'portfolioHistory'
 > using fuzzy matching:
 >
 >  global.2004.history(portfolio)
 >                         portfolioHistory object formed from the
 >                         global.2004 dataset
 > portfolioHistory-class(portfolio)
 >                         Class "portfolioHistory"
 >
 >  Type 'help(FOO, package = PKG)' to inspect entry 'FOO(PKG) TITLE'.
 >
 > ?portfolioHistory-class
 >
 > ?"portfolio"
 >
 > help(portfolioHistory, package=portfolio)
 > None of the above attemps work for me.  Any hints you can give me.

Have you loaded the package?  Calls to 'help' with only a package
argument and calls to 'help.search' as above will return information
even if you haven't.  I have not included S4 class name aliases in the
package, so

?portfolioHistory

will not succeed while

?portfolioHistory-class
class?portfolioHistory

should.

Hope that helps,

Jeff

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Roger J. Bos
Jeff,

Thanks.  ?portfolioHistory-class gives me help for arithmetic operators (the
-) while ?"portfolioHistory-class" works.  Not sure why I didn't try that
earlier.  I have a few questions to get started:

1) I see that summary(p) shows you the first few names in a portfolio.  Is
there a way to see all the holdings (say all 50)?

2) Is there a way to creat a long only portfolio.  If I have a dataframe of
20 stocks and tell it to make a portfolio of size 20, it tells me there are
not enough stocks becaue it wants to go long 20 and short 20.  I only want
long portfolios.

3) Also, how best to cap weight the portfolio?

4) Can you give me an example of how to view/modify the code?



On 3/9/06, Jeff Enos <[hidden email]> wrote:

>
> Roger,
>
> roger bos writes:
> > Jeff/Dave,
> >
> > The seven page summary doc looks nice and I would be interested in
> helping
> > out.  I use R for my alpha models and would like to start using the
> porfolio
> > class to test portfolio construction strategies.  You have a nice
> start.  I
> > would be happy to help by maybe adding a measure of turnover, maybe we
> could
> > have some sort of transaction cost measure that could be taken into
> account
> > when calculating returns.
>
> Thanks for your interest.  I recommend taking a look at the
> documentation, examples (especially in the help for
> 'portfolioBasic-class' and 'portfolioHistory-class'), and the code
> itself; the two package vignettes you'll find include the intro doc
> you've already mentioned.  Then we could discuss ways in which
> measures of turnover and transaction costs could be incorporated into
> the package.
>
> > But first I need to learn a lot more about the
> > library.  I can't even find the help page.  ?portfolio turns up nothing.
>
> There is no help alias for 'portfolio', but calling
>
> help(package = "portfolio")
>
> should list the 15 help files available.
>
> > help.search("portfolioHistory") turns up the following, but I can't find
> > help using any of those names either:
> >
> > Help files with alias or concept or title matching 'portfolioHistory'
> > using fuzzy matching:
> >
> >  global.2004.history(portfolio)
> >                         portfolioHistory object formed from the
> >                         global.2004 dataset
> > portfolioHistory-class(portfolio)
> >                         Class "portfolioHistory"
> >
> >  Type 'help(FOO, package = PKG)' to inspect entry 'FOO(PKG) TITLE'.
> >
> > ?portfolioHistory-class
> >
> > ?"portfolio"
> >
> > help(portfolioHistory, package=portfolio)
> > None of the above attemps work for me.  Any hints you can give me.
>
> Have you loaded the package?  Calls to 'help' with only a package
> argument and calls to 'help.search' as above will return information
> even if you haven't.  I have not included S4 class name aliases in the
> package, so
>
> ?portfolioHistory
>
> will not succeed while
>
> ?portfolioHistory-class
> class?portfolioHistory
>
> should.
>
> Hope that helps,
>
> Jeff
>
>

        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
Reply | Threaded
Open this post in threaded view
|

Re: [R] [R-pkgs] New package 'portfolio'

Jeff Enos
Roger,

 > 1) I see that summary(p) shows you the first few names in a portfolio.  Is
 > there a way to see all the holdings (say all 50)?

The number of stocks to display in summary() hasn't yet been
parameterized, so the easiest way for now is to work with the data
frames in the 'weights' and 'shares' (for objects of class
'portfolio') slots.

 > 2) Is there a way to creat a long only portfolio.  If I have a dataframe of
 > 20 stocks and tell it to make a portfolio of size 20, it tells me there are
 > not enough stocks becaue it wants to go long 20 and short 20.  I only want
 > long portfolios.

Setting the 'sides' slot to c("long") will allow you to create a
long-only portfolio.  There's an example of a simple long-only
portfolio in class?portfolioBasic and in the beginning of
vignette("portfolio").

 > 3) Also, how best to cap weight the portfolio?

Right now the user must supply all required data to the 'data' slot of
portfolioBasic objects.  So, if you wanted to create a cap-weighted
portfolio you'd need to have a measure of cap already in your data
frame.

A portfolio created with type = "relative" will interpret the column
of the 'data' slot specified by the 'in.var' slot as position
proportions.

Here's a simple example using one of the package's data sets:

data(dow.jan.2005)
p <- new("portfolioBasic",
         size   = "all",
         type   = "relative",
         id.var = "symbol",
         in.var = "cap.bil",
         data   = dow.jan.2005)

 > 4) Can you give me an example of how to view/modify the code?

Let's discuss this off-list.

Jeff

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance