PortGraphs2020 - 2020 Shiny Contest Submission

PortGraphs2020

Authors: CodyStumpo
Working with Shiny for 1+ years

Abstract: Enter portfolio (ticker symbols and shares) - get lots of analytics you can use to analyze how your portfolio is performing and why - and what you can do about it.

Full Description: I've always been disappointed by stock tracking applications. They tend to just show you what each item in your portfolio did today. Unless you're an active trader, this is irrelevant. And unless you're a professional, you probably shouldn't be an active trader. Performance analytics, to the extent they exist, are focused mainly on how much each holding went up or down over time. I wanted analytics that showed how a portfolio performed over time on a risk-adjusted basis, what to attribute that to, and what to do to be able to expect higher performance going forward.

The point of having a portfolio is to achieve diversification, so this app measures that directly. How much of the risk of each holding is kept vs. diversified away by the portfolio. No matter how diverse your portfolio, you cannot diversify away all risk. There is systemic risk, which drives all asset prices to some degree or another. The market in theory compensates you for holding risk that no portfolio could diversify away, and that is where expected return comes from. We want to compare then this expected return against the risk that we keep in our portfolio net of its diversification benefits.


Category: Other
Keywords: portfolio performance analytics and optimization
Shiny app: https://codystumpo.shinyapps.io/portGraphs2020/
Repo: https://github.com/CodyStumpo/portGraphs2020
RStudio Cloud: https://rstudio.cloud/project/941965

Thumbnail:

Full image:

5 Likes

I had old code that did most of these calculations for years - and I really use it to manage my own portfolio. After attending the RStudio conference I got inspired to modernize it, make a shiny app, and share it with the world. So I did that. Moving the code to tidyverse also made it like 10 times faster, which is nice. And when I saw the contest, I thought I might as well publicize the app. I'll keep working on it, but it has all the basics now.
I've only made a handful of shiny apps. It's kind of amazing, as I never thought I could make an app at all, and it is relatively easy to do complex things. But on the other hand, it is pretty frustrating relative to the rest of R. One of the best things about R is the interpreter environment - you always know the value of every variable, and can run little tests with your functions and data or mock data. The error messages generally are helpful toward letting you know what to do. These are generally not true with Shiny (although I saw at the conference some more sophisticated de-bugging techniques which would help). This particular app though, I already had worked out most of the pieces in other apps so it came together pretty quickly (< one day).
I'll try to make a video walking through how I really use it and you can too.