How To Be A Successful Investor: Simple Portfolio Analysis with Python
By: Jere Xu
Tags: Investing, Python, Analytics, Data Analysis, Data Visualization

How To Be A Successful Investor: Simple Portfolio Analysis with Python

Reading this article is a worthy investment

It’s amazing what you can do with this

You know that place you go to where you dump exorbitant amounts of money and give up a whopping four years (or more) of your precious time, and in exchange you get to live in a cramped space (that you also have to pay for) with a bunch of other people your age you’ve never met before, attend a bunch of gatherings where you sit and watch older people talk and write stuff on a whiteboard (or use PowerPoint), spend many nights without sleep and learn what is the bare minimum of nutrition, all in the hopes of getting a little piece of paper or electronic document?

Feels bad…

Did I just give you an existential crisis by accident? College/university is the perfect example of an investment in which the actual return is not fixed or set. Far from it. In fact, the return from the investment is almost ENTIRELY based on how much effort and time the student puts in.

That’s all an investment is. It’s simply giving up something with the hope that after some time you’ll get something back. In the world of finance, it’s giving up money with the hope that you’ll get more money back. This very simple concept is what drives a large portion of commerce and the economy in general. Banks are constantly loaning and/or taking loans. Why would anyone give me a bunch of money unless they knew that they were going to get it back, plus more?

One fairly common way that retail investors (people who invest for themselves and not a firm like professional investors) invest is by putting their money into a savings account. They put in some money, and then over time the interest rate compounds their money, and then eventually when they get their money back it will have grown slightly.

The problem with doing this is that your money grows too slowly. There are many, MANY other ways to invest and things to invest in. Quick definition, those things that you invest in are called assets. Assets can be things like: stocks, bonds, treasury bills, savings accounts, anything that will ultimately generate money for you. If you want to maximize your returns, you need to have a plan that takes into account all the assets you will invest in and HOW MUCH of each you will invest. Once you list out all of your assets and your weights, which are the percentages of your total money you invest into the individual assets, you get your investment portfolio.

Just like mixing ingredients for cooking, you want the best mix for your delicious investment portfolio

Quick example, let’s say that Amber has $100 she just earned from working at her local Subway. She wants to invest this money so that she’ll get some good returns. She decides that she’ll put some money into a savings account, and some into buying stocks. She decides to put $40, or 40%, into a savings account with 3% interest. She uses the other $60, or 60%, to buy a share of Exxon Mobile stock (XOM). After a year, her $100 turns into $107. That’s a return of 7%. That might look small, but imagine if instead of investing $100, Amber invested $100,000?! The return percentage is the same, but the actual gains are tremendous! After one year, Amber will have $107,000. If Amber reinvests all of her gains over the next five years, she could potentially net over $150,000! And if she keeps doing this for the next 15 years? That’s over $300,000! (By the way, this is all assuming that Amber doesn’t put any extra money into her portfolio and only reinvests her gains.)

Now that I’ve piqued your interest, let’s take a look at a simple way to find the optimal investment portfolio using Python.

IMPORTANT DISCLAIMER: Most of what follows will be highly technical in content, so if there terms and concepts you don’t understand, please refer to the Resources section at the bottom. Also, the main purpose of this article is to provide an entrance into portfolio analysis, not to provide actual investment advice so please don’t use these techniques for your own investment decisions.