[R-SIG-Finance] Portfolio management in R for private use

Johannes Lips johannes.lips at gmail.com
Thu Jan 12 13:55:10 CET 2017


On 12.01.2017 11:32, Brian G. Peterson wrote:
> On 01/12/2017 02:16 AM, Johannes Lips wrote:
>> Hi all,
>>
>> I've just wanted to share some code I've written to keep track of my
>> small portfolio in R, since I couldn't find anything suitable on the
>> internet.
>> https://github.com/hannes101/myRportfolio/
>> I would be glad if someone could offer me some nice documents on good
>> ways to keep track on the performance of the whole portfolio and
>> possible summaries one could easily obtain. I couldn't really find a lot
>> of documentation on all these packages and most of it was rather
>> academic and not really suited for a portfolio, mainly following a
>> Buy&Hold strategy.
>> If you have any suggestions or additional comments, please let me know.
>
> Johannes,
>
> Thanks for sharing your code.  It is always useful to see how other 
> people are using the packages.
>
> I'm a little unclear on what your question is.
>
> I'm also not clear what you are referring to when you discuss 'not 
> really suited for a portfolio', since among other things we use 
> blotter for reconciliation of accounts doing many thousands of trades 
> per day, which is not quite 'buy and hold' nor 'academic'. Perhaps you 
> could provide links to what you've referenced so far?
>
> Anyway, I'll guess at what you might be asking, and see if that 
> clarifies things.
>
> You're using addTxns() to load your trades into blotter, which is as 
> expected for trade accounting on actual trades.
>
> After you've called updatePortf() and updateAcct(), you have all the 
> 'tracking' and 'performance' data for your portfolio.
>
> I don't see calls to tradeStats(), perTradeStats(), dailyStats(), or 
> dailyEqPL(), which might give you more of the 'tracking' information 
> you're looking for.
>
> I also don't see a call to PortfReturns(), which would extract 
> %-returns from your blotter portfolio, and make all the standard 
> portfolio analysis of packages such as PerformanceAnalytics or 
> PortfolioAnalytics, which generally expect %-returns, available.
>
Thanks for your response Brian!
I didn't want to imply that blotter is not up to the task or anything 
like that. I just meant that most tutorials and examples, I could find 
are on a more advanced level, which is not really necessary for the task 
of managing and keeping track of a small ETF portfolio in R. So I 
basically tried to boil it down to the most basic commands, but at the 
same time offering the possibility using the powerful tools provided.
I was specifically looking for something like these commands, so that 
you can get a quick overview on the portfolio. I will try to experiment 
around with the commands you've mentioned.
Basically I just tried to write a basic tutorial, so that one could more 
easily use R to keep track of a small portfolio and I was asking on 
feedback on how to improve that.

Regards,
Johannes

> So, maybe this answers your question, and maybe it doesn't.  If I 
> haven't answered your question, could you please be more specific 
> about what you want to do?
>
> Regards,
>
> Brian
>



More information about the R-SIG-Finance mailing list