PORTFOLIO
2021
In Progress.
There has been a massive uptick in retail investors globally throughout the recent pandemic in both the traditional financial markets and new age markets such as cryptocurrencies. This can be primarily attributed to: an increase in the ease of access to these markets, hype/popular trends, and more spare time due to lockdowns. The connectivity offered by the internet has again proved to democratise access to once inaccessible information and tools. This combined with more fintech companies than ever before have amounted to low-cost brokerage (sometimes even zero-fee brokerage), which is extremely attractive to retail investors.
The 24/7 social media/hype cycle means that it is almost impossible to be on the internet and not hear about the massive gains achieved by retail traders/investors. This then fuels the self-fulfilling loop as more people want a share of this wealth and sign up for accounts/more information, leading to more information and tools being created.
Investing in assets is not a new phenomenon and has been around for many thousands of years. Tracking these assets is also not a new phenomenon as it provides clarity to the investor on their total net worth and helps them make informed decisions for a prosperous financial future. Having started my personal investment education all the way back in 2015, it was not until the prevalence of low cost and easy to access brokers in 2018/19 that I was first able to buy and own securities. This led me to learn more about the traditional financial markets and invest more and more of my own capital. In 2020 as the COVID-19 pandemic hit the world and sent us all into lockdown I stumbled across the hidden world of derivatives. I initially wrote derivatives off as an investment as I believed them to be too risky. However, after spending time learning specifically about American style options and their use in not only making directional bets but also in delta hedging and betting on volatility, I realised this was a way to not only achieve leverage on capital without taking on margin but also to protect your downside and manage risk if used correctly. Thus I initiated my first options trade in 2021.
Current Works
A problem I quickly ran into was the fact that my portfolio was split across many different platforms with different brokers, this made it hard to track total returns and allocate capital efficiently. I realised it was necessary to create a comprehensive portfolio tracker which would not only help with visualising allocation, risk, and returns but also with record-keeping for tax purposes. Using google sheets and the built-in google finance API I was able to build out my portfolio, tracking stocks, deposits/FX rates, and also fees incurred. However, google finance did not offer data for stock options. Market data can be bought to be used to track stock options, however, this proves expensive and is more commonly used by institutions for quantitative analysis and is thus expensively priced. This price will likely follow the decreasing cost trend fintech is experiencing mentioned above.
Therefore it was necessary to build a tool to automatically track stock option prices. This tool is built using python, beautiful soup, and the google sheets API. The python script first makes a google API call with a given token/credentials.json pair which gives the script permission to read and write to and from the google sheet hosted in google cloud. This pulls the option data (ticker, strike, expiration date, call/put) from the transactions page. Using basic string manipulation the information is then parsed into a yahoo finance web address. Beautiful soup is to simply scrape the table data providing basic information such as bid/ask, open/close, and volume/open interest data. This data is then passed to the google API again using the token/credentials pair to update the google sheet.
Future Works
This simple concept can be used as I build up my portfolio. Eventually, when manually entering positions becomes tedious, this process can also be automated using a similar concept by pulling data from the broker’s trade export CSV file. Currently the web scrape also only happens when manually running the script but this can be easily modified to run as an executable file and timed using the windows runtime scheduler, such that it updates periodically or when a system event occurs.
This concept also serves as a base to expand on tracking different types of assets such as houses, liquid wealth, cryptocurrencies, and other alternative assets. By creating a comprehensive tool to track wealth it may even be possible to one day derive information about users spending/investing habits and provide advice based on what investments you own, what you want to buy, what can you afford, your financial health etc.