Hi, Really unformed question here. Sorry about that but I'm just poking around looking for answers/ideas. Thanks in advance. In the last year I've put some money in some a few managed accounts for long term investing. Current these accounts hold 70-80 different stocks & ETFs. While the investments themselves are going OK I'm not very happy with the information the brokers give me in terms of how the portfolios are doing against their respective benchmarks. To that end I'm starting looking around for how I could get a little better view. In the 1980s I suppose I might have been doing a very simple version of this in Quicken, but that program seems quite disliked by people who buy it on Amazon. Additionally, I'm Linux-based and find it distasteful to spend money on M$ Windows apps VM unless they are really good at what they do. I suspect the professional folks use tools that the rest of us never will. Things from Bloomberg or the like. There's also a lot of online portfolio trackers. Maybe one of them is actually good but I haven't found it yet and I'm reticent to put too much private info on yet another web site. This whole area seems like a natural for something done in R. Maybe keep the trades in an Excel spreadsheet or CSV file and then load them into R, get data from Yahoo, create graphs, do correlations, etc. Does anything like this exist? Or am I wrong headed and there's a better way to do this? I'm not thinking of much more than an account balance, trade info - date, number of shares, prices, etc., and then aggregate the results into a few numbers for the portfolio. Comments? Thanks, Mark
Simple portfolio management - anything in R?
6 messages · Peter Carl, Mark Knecht, Radek Maciaszek
Consider blotter, which is specifically for calculating P&L from trades
and prices (for generating returns for analysis in PerformanceAnalytics).
install.packages("blotter", repos="http://R-Forge.R-project.org")
pcc
Peter Carl http://www.braverock.com/peter > Hi, > Really unformed question here. Sorry about that but I'm just poking > around looking for answers/ideas. Thanks in advance. > > In the last year I've put some money in some a few managed accounts > for long term investing. Current these accounts hold 70-80 different > stocks & ETFs. While the investments themselves are going OK I'm not > very happy with the information the brokers give me in terms of how > the portfolios are doing against their respective benchmarks. To that > end I'm starting looking around for how I could get a little better > view. > > In the 1980s I suppose I might have been doing a very simple > version of this in Quicken, but that program seems quite disliked by > people who buy it on Amazon. Additionally, I'm Linux-based and find it > distasteful to spend money on M$ Windows apps VM unless they are > really good at what they do. > > I suspect the professional folks use tools that the rest of us > never will. Things from Bloomberg or the like. There's also a lot of > online portfolio trackers. Maybe one of them is actually good but I > haven't found it yet and I'm reticent to put too much private info on > yet another web site. > > This whole area seems like a natural for something done in R. Maybe > keep the trades in an Excel spreadsheet or CSV file and then load them > into R, get data from Yahoo, create graphs, do correlations, etc. > > Does anything like this exist? Or am I wrong headed and there's a > better way to do this? > > I'm not thinking of much more than an account balance, trade info - > date, number of shares, prices, etc., and then aggregate the results > into a few numbers for the portfolio. > > Comments? > > Thanks, > Mark > > _______________________________________________ > R-SIG-Finance at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-finance > -- Subscriber-posting only. If you want to post, subscribe first. > -- Also note that this is not the r-help list where general R questions > should go. >
On Fri, Oct 25, 2013 at 8:48 AM, Peter Carl <peter at braverock.com> wrote:
Consider blotter, which is specifically for calculating P&L from trades
and prices (for generating returns for analysis in PerformanceAnalytics).
install.packages("blotter", repos="http://R-Forge.R-project.org")
pcc
--
Peter Carl
http://www.braverock.com/peter
Hi Peter, Yes, I think the solution, if it exists or needs to be written, probably revolves around blotter and PerformanceAnalytics. However every time I start looking at those things I glaze over for lack of documentation. Nothing in there seems oriented toward teaching how to use the packages so I was hoping maybe someone has already written some example code of something like this: 1) Have a list of stocks & download EOD data from Yahoo for that list (Easy) 3) Read a list of transactions in any human writable format. I.e. - I'll get the trades from my broker and enter them in some reasonable file format. 4) Generate some simple data from those transactions: equity curve for each stock, for the portfolio I suspect that if this much existed that a programmer with my meager skills might be able to go forward. However I can't find the starting point in the blotter or PerformanceAnalytics help pages. Maybe I just haven't found the right page yet though. Cheers, Mark
every time I start looking at those things I glaze over...
I recommend a double espresso. Then: library(blotter) ?blotter In the example provided, you can see your starting point: ?getSymbols ?initPortf ?addTxns ?updatePortf ?initAcct ?updateAcct ?updateEndEq pcc
Peter Carl http://www.braverock.com/peter > On Fri, Oct 25, 2013 at 8:48 AM, Peter Carl <peter at braverock.com> wrote: >> Consider blotter, which is specifically for calculating P&L from trades >> and prices (for generating returns for analysis in >> PerformanceAnalytics). >> >> install.packages("blotter", repos="http://R-Forge.R-project.org") >> >> pcc >> -- >> Peter Carl >> http://www.braverock.com/peter >> > > Hi Peter, > Yes, I think the solution, if it exists or needs to be written, > probably revolves around blotter and PerformanceAnalytics. However > every time I start looking at those things I glaze over for lack of > documentation. Nothing in there seems oriented toward teaching how to > use the packages so I was hoping maybe someone has already written > some example code of something like this: > > 1) Have a list of stocks & download EOD data from Yahoo for that list > (Easy) > 3) Read a list of transactions in any human writable format. I.e. - > I'll get the trades from my broker and enter them in some reasonable > file format. > 4) Generate some simple data from those transactions: equity curve for > each stock, for the portfolio > > I suspect that if this much existed that a programmer with my > meager skills might be able to go forward. However I can't find the > starting point in the blotter or PerformanceAnalytics help pages. > Maybe I just haven't found the right page yet though. > > Cheers, > Mark >
On Fri, Oct 25, 2013 at 10:21 AM, Peter Carl <peter at braverock.com> wrote:
every time I start looking at those things I glaze over...
I recommend a double espresso. Then: library(blotter) ?blotter In the example provided, you can see your starting point: ?getSymbols ?initPortf ?addTxns ?updatePortf ?initAcct ?updateAcct ?updateEndEq pcc -- Peter Carl http://www.braverock.com/peter
Peter, Thanks for the pointers. I've made a little bit of headway this Friday afternoon and likely can make more progress over the weekend. One quick question, mostly out of curiosity. How/where are blotter portfolios stored? The initPortf function seems to create something lasts beyond my current run of R. If I exit R-Studio, reenter and rerun my code that created the portfolio in the first place it tells me:
initPortf(name="Mark1",symbols="StockList")
Error in initPortf(name = "Mark1", symbols = "StockList") : Portfolio Mark1 already exists, use updatePortf() or addPortfInstr() to update it. I do see it's in the blotter environment:
ls(envir=.blotter)
[1] "portfolio.Mark1" I'm on Linux, ran updatedb and attempted to locate both portfolio and Mark1 but didn't find anything meaningful. Thanks, Mark
5 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20131031/b010bbdd/attachment.pl>