Sunday, July 12, 2015

Pilot: PSEI Stock Dashboard


Hello! Thanks for visiting my blog. I've been trying to setup a blog where I can follow the footsteps of data visualization gurus and jedis by making information more accessible and easy to understand. It has been a stagnant idea for a while, but I've finally gotten around to making something publish-worthy (I hope).

I have been collecting Philippine stock price data for certain stocks since mid-2014. I just take the current price (based on Bloomberg) every week for these stocks. It might sound like a lot of work, but I just take 3 minutes every weekend to do it. Not bad.

From the data I've collected, I created a simple dashboard hosted on Tableau Public. Feel free to use it to look at stocks that might interest you.

Enjoy!

P.S. Sorry about the awkward dashboard positioning and shoddy blog design. I'll fix this next time!

---

 
HOW TO INTERPRET THIS DASHBOARD

Watchlist Summary

This contains the list of stocks that I follow. You will immediately see their current price (as of the latest update), their price during the week prior to the latest update, and the % change of the stock.

Green -> the stock went up
Red -> the stock went down

Correlation Matrix

For the non-stats people: Broadly speaking, correlation is a measure (between -1 and 1) of the relationship of two sets of data. In this case, correlation measures whether Stock A moves with (positive correlation), opposite (negative correlation), or with no relation to (zero/no correlation) Stock B.

You can hover over the cells in the matrix to see the actual correlation values. The darker the color, the stronger the relationship.

Correlation can be useful when determining which stocks to invest in. You generally want to invest in stocks that are not strongly correlated to each other. For correlated stocks, when one goes up, the other is likely to go up as well. Great! But if one crashes, the other might crash with it. In short, don't put all your eggs in one basket and diversify your investments.

Time Series (Line Chart) and Other Measures

Aside from seeing how the stock moves over time, it is also to good look at the standard deviation (St. Dev) and coefficient of variance (CV). Both St. Dev and CV measure the stock price variation or how erratic the prices can be. Stocks with high variation are usually considered high risk options.

The CV is just a scaled measure of St. Dev. It is generally better to use the CV when comparing the "riskiness" of two stocks.




7 comments:

  1. Great post. Look forward to seeing more. I was just wondering, why are some of them from september, and the others from april?

    ReplyDelete
    Replies
    1. Thanks, Patrick! Good observation. That's because I wasn't collecting data for those stocks until September. They're late additions to my watchlist.

      Delete
  2. Hi, I'm a friend of Ken Abante; saw this on his FB timeline and I got intrigued.
    Was wondering if you have a visual way of representing non-correlation in your matrix. I see that you have positive and negative correlation as green and red respectively, but assuming this will be used in portfolio diversification, non-correlation might be an important factor to take note of :)

    ReplyDelete
    Replies
    1. Hi Timms, thank you for your comment! If by non-correlation, you mean a correlation close to 0, then look for gray-ish cells. A correlation of exactly 0 should be pure gray. Thanks for pointing that out -- I should probably add that to my description.

      Delete
    2. yes, one close to 0. Oh I thought your visual was a relative scale, didn't realize it was an absolute scale. Then yes your graph covers it then!

      Delete
  3. I think you should discard GLO, TEL and URC from your data. You can't correlate a stock with data starting only from April 2015 with another stock where you have data going back to Sept 2014. That's meaningless.

    I would have suggested creating another table with only GLO, TEL and URC but right now you only have around 15 data points each, which is too few to form any meaningful conclusions. I'm not even sure if the 45-ish data points you have for the other stocks are enough to correlate, especially since you're only collecting data points once a week.

    If you want a time series for the closing stock price per day rather than per week, you can access it for a 1-year period in JSON format here:
    http://www.bloomberg.com/markets/chart/data/1Y/PGOLD:PM (replace PGOLD:PM with whatever stock you want.) The time is in UNIX format.

    For example, data on stock prices per day for PGOLD and MER from 17 July 2014 to 15 July 2015, with a total of 238 data points, yield a correlation coefficient of 0.151, which is very different from the value of -0.929 on your chart - a very weak positive correlation rather than a strong negative correlation.



    ReplyDelete
    Replies
    1. Thanks for the comment, Arnold! You're absolutely right, I can't correlate two datasets of different sizes.

      I didn't mention this in the description, but before correlating, I filtered the data for the stocks to only include the dates wherein I had values for ALL stocks. So that would be starting the day I collected URC data. This is probably why we have different values for the PGOLD-MER correlation.

      There might only be a few data points for now, but this is all I had. Thanks for pointing me to the JSON files -- I'll come up with something to collect more granular data. This post will probably see an update because of that. :)

      Delete