R Stocks

After some time of using R and loving it, I was wondering if there was any open source project combining some of my favourite packages to easily get financial data and have it displayed interactively in Shiny Dashboard.

Since I found nothing on Github, I decided to start it myself - This is how the R Stocks project started.

With such a project, you not only get the chance to create something cool but also to learn and discover great tools.

And of course I am also using Plotly and Shiny for the visualization and interactive dashboard building.

The App: R Stocks

  • More about R_Stocks:
    • R Stocks Project Details:
    • Disclaimer: ☝️
      • This is just a Shiny Dashboard sample that displays freely available financial information.
      • It’s important understand that the dashboard is NOT created to provide financial advice ❗.
  • 📊 Interactive Data Visualization:

    • I chose Shiny Dashboard for its ability to create interactive and dynamic visualizations of data, enhancing user the insights.
  • 🚀 Deployment:

    • Shiny Dashboard provides an easy deployment process, whether hosting on a server or sharing as a standalone application, ensuring accessibility for users.
And few other Reasons that made me user R Shiny👇
  • 🔄 Real-time Updates:

    • Shiny Dashboard enables real-time updates of the dashboard as new data becomes available, crucial for monitoring live data feeds.
  • 🎨 Customization:

    • Shiny Dashboard offers extensive customization options, allowing me to tailor the interface to meet specific user needs with custom styling and interactive elements.
    • Yes, I was playing a little bit with CSS 🙈
  • 🔗 Integration with R:

    • Shiny Dashboard seamlessly integrates with R Language, leveraging the language’s power for data manipulation, analysis, and visualization within the dashboard environment.

The R Stock App has right now six tabs:

Interactive Stocks Analysis with R

In the first tab, you will have available general information of the selected tickers:

The first panel is just using the yfR library to get the data displayed:

The panels below, are using QuanDL, so remember to have your API_key available:

Interactive Dividend Analysis with R

In the second tab of the dashboards, you can find information related to the historical dividends per selected ticker.

This panels have been possible thanks to QuantMod, where we can get access to historical dividen data and then create the following:

Also, thanks to QuanDL, we can have access to some interesting ratios concerning dividends:

Interactive Indexes Analysis with R

Once again, thanks to yfR we can query general market indexes, like SP500, DJ, Nikkei and check on how were the markets behaving globally at a given moment:

Interactive Commodities Analysis with R

Another interesting source of information can be created when comparing the price of commodities with the one of any of the indexes.

Thanks to yfR and this view, we can see the evolution in the relation of any pair index/commodity.


How Can I try the R Stocks Shiny App?

How Can I try the R Stocks Shiny App?

  • Ready to Try?: If you’ve read this far, you’re probably eager to give the app a try. I’ve deployed it using the latest Docker image.
    • Access my instance: I am making an effort to self-host at home at a Raspberry Pi
      • You can access it for free from any browser here
    • Docker Image: The Docker image I’m using is available on DockerHub: fossengineer/r_stocks

What if the site can’t be reached?

  • Temporary Unavailability: If the site can’t be reached, it might be because my Raspberry Pi isn’t powered on at the moment or I’ve decided to free up resources for other projects.
  • But don’t worry, you can also self-host R_Stocks on your own system.

How can I self-host R-Stocks?

Option 1👇
  • Self-hosting Effort: Host your own free and open-source version of this R Shiny App at home using Docker and Cloudflare tunnels.
    • Option 1:
      • Pros: Full control over the deployment process & can customize it to fit your needs perfectly.
      • Cons: Requires some technical expertise to set up and maintain the environment.
    • Option 2: You can use the Docker image I’ve already built:
      • Pros: Quick and easy to get started, no need to build the image yourself ✅
      • Cons: Less flexibility compared to self-hosting from source, may not be tailored to your specific requirements.
version: '3.8'
    image: fossengineer/r_stocks
    container_name: r_stocks
      - 3838:3838
    restart: unless-stopped 

How to deploy R Stocks with Docker and a GUI?

You can install Portainer with Docker and use the configuration above to self-host your own instance of RStocks with a GUI to manage the container.