Stocks Programming


I don’t know about you, but I’m a stock analysis junkie, which has its pros and cons. I can never buy a stock without having at least used some of my mathematical and machine learning expertise. However, I can not do so without a proper environment. In this lecture, we talk about stocks programming. I am not so sure that term exists, so let’s give a proper definition:

Stocks Programming

The process of writing computer programs with the intention of extracting patterns, features, or other kind of information from stocks.

Now, that we laid down a “formal” definition, we can now address the lecture. Whether you are looking for that alpha \alpha signal, or trying to compute a smoothed (ex. Moving Average) on the stock price vs time curve, you need to start with an appropriate environment. For this, I chose Jupyter notebook, which runs smoothly on my Google Chrome. We first prepare Jupyter on Google Chrome, and install all relevant modules that you will be using, such as Pandas. We extract stock prices from different APIs, such as GOOGLE and YAHOO. We plot different stock price curves (such as those by Tesla, Ford, and GM) using Pythons Matplotlib. Many stock analysis terms are introduced, such as Market Cap, Volume traded, opening and closing prices, volatility, cumulative return, daily price return, etc.. We talk about different plots such as Japanese candlestick charts, scatter plots, line charts, box plots, etc.

The lecture’s timestamps are outlined below:

00:00 Intro
02:24 Pandas
03:24 Data Readers
03:51 Jupyter Notebook
04:36 Reading GOOGLE stocks
06:03 Stock Price Visualization
09:21 Tesla x Ford x GM stocks
12:32 Opening Prices
13:44 Volume Traded & Interpretations
17:37 Market Cap
22:15 Moving Average
26:04 Correlation and Scatter Matrix
34:56 Daily Percentage Change
37:47 Volatility
41:59 Box Plots
44:57 Cumulative Return
52:42 Summary