Random Walk Down Wall St.

About

Introduction

In Burton G. Malkiel’s investment classic A Random Walk Down Street, a general argument is made that investors - both individual and institutional - almost never consistently outperform “the market,” the S&P 500 index tracking the performance of about the 500 largest companies listed in U.S. stock exchanges. Malkiel claims that one is better off putting their money in an S&P 500 fund - which has yielded roughly 10% every year - rather than attempting to pick individual stocks that undergo “random walks”.

Several individuals have established track records of defying Malkiel’s claim: Warren Buffett, Jim Simons, Ray Dalio, George Soros, and others. Are they merely statistical outliers or is Malkiel underestimating the predictability of stock markets? Our goal is to ascertain if there is some truth behind the “random walk” description of the stock market and if some level of predictability exists within it. This project provides analytical tools to the user so they can historically backtest data and determine for themselves if one can in fact “beat the market.”

Our Project

Our terminal based project is an interactive analytical tool for the financially inclined user. Once compiling the file random_walk.py in the terminal, the user starts with 3 main options in a continuously running command line: (1) use analytical tools, (2) read a list of useful tickers, and (3) view charts. The Github link to our project is here.

Part 1: Analytical Tools

For the first main option, there are 5 additional prompts that the user can choose to pick an analytical tool which our program will compute for a desired company (or other financial data point) and desired time interval.

(1) Correlation Coefficient: The Pearson correlation coefficient analyzes movements of two data points and returns a number from -1 to 1 inclusive. The greater the absolute value of the correlation coefficient, the more strongly correlated the two data points are. A positive correlation coefficient indicates a positive correlation, a negative correlation coefficient indicates a negative correlation. In this function, the user is prompted to enter in two companies (or other financial data points) and a time interval to conduct analysis. The correlation coefficient can be used in a diversification strategy to hedge risk in a portfolio by pairing assets that have negative correlation.

(2) Volatility: Volatility is a measure of risk. Greater volatility means greater dispersion of outcomes, i.e, standard deviation. According to consensus financial thought, greater returns are only possible by assuming greater risk. Knowing how volatile a particular stock is during a given time interval and comparing it to its return over that time interval can help shed light on the relationship between a stock's risk and return. Constructing a portfolio of assets with varying degrees of risk is a common strategy for diversification. This function prints out both the mean and standard deviation of the entered company (or other financial data points) in the entered time interval.

(3) Stochastic Oscillator: The stochastic oscillator is a trading tool used to indicate how overbought or oversold a stock is. The range of values is from 0 to 100, with higher values indicating stronger signals of a stock being overbought. For rule of thumb, a stochastic oscillator value > 80 indicates overbought, while a value < 20 indicates oversold. In this function, the user is prompted to enter in a company and the current date. The time interval considered for this analysis is the last 14 trading days.

(4) Average Daily Percent Change: This simple statistic is self-explanatory and can be used to assess the volatility and momentum of a given company (or other financial data point) in the entered time interval. A high average daily percent change can indicate a risky investment or can also indicate a strong trend if a short time interval is considered. In this function, the user is prompted to enter in a company (or other financial data point) and a time interval on which to compute the average daily percent change. Here's a list of the largest daily changes in the S&P 500 Index.

(5) Exponential Moving Average The exponential moving average is a weighted average of a stock’s closing prices over a given time interval, with greater weight placed on more recent data points. As opposed to a simple moving average which places equal weight to all data points, an exponential moving average is more sensitive to recent data points. Greater weight on newer data may better reflect a stock’s current trend, but it may also overstate the significance of recent movements. In this function, the user is prompted to enter in a company (or other financial data point) and a time interval on which to compute the exponential moving average.

Part 2: List of Tickers

For the second main option, there are additional prompts the user can choose to read a list of useful tickers to enter into the analytical functions. Since this project depends on data retrieved from Yahoo! Finance, specific tickers must be entered for special financial data points that are not individual stocks. These tickers are not readily found on Yahoo Finance and are provided for the user to access should they be curious about analyzing data outside of individual stocks. In this option, the user will be prompted to enter in what kind of data they wish to seek, which include:

(1) U.S. Market sectors: Market indexes represent a particular segment of the financial markets (ex: U.S. large cap companies are represented by the S&P 500, U.S. small cap companies are represented by the Russell 2000, etc.). A list of important U.S. indexes and global indexes (such as the FTSE 100, Nikkei 225, etc.) are provided with their respective tickers that can be entered into the analytical and charting capabilities of our project.

(2) Market Indexes: The U.S. stock market is generally split into 11 sectors which include: Communication Services, Consumer Discretionary, Consumer Staples, Energy, Financials, Health, Industrials, Materials, Real Estate, Technology, and Utilities. A list of Vanguard ETFs that represent each of these sectors is provided in this option.

Notable Companies:

1. Alphabet (GOOGL)

2. Facebook (FB)

3. Verizon (VZ)

4. Netflix (NFLX)

5. AT&T (T)

6. Comcast (CMCSA)

7. Disney (DIS)

8. Charter Communications (CHTR)

9. T-Mobile US (TMUS)

10. Activision Blizzard (ATVI)

Notable Companies:

1. Amazon (AMZN)

2. Home Depot (HD)

3. McDonald’s (MCD)

4. Tesla (TSLA)

5. NIKE (NKE)

6. Lowe’s (LOW)

7. Starbucks (SBUX)

8. Booking Holdings (BKNG)

9. TJX Companies (TJX)

10. Target (TGT)

Notable Companies:

1. Procter & Gamble (PG)

2. PepsiCo (PEP)

3. Coca-Cola (KO)

4. Walmart (WMT)

5. Philip Morris International (PM)

6. Costco (COST)

7. Mondelez International (MDLZ)

8. Altria Group (MO)

9. Colgate-Palmolive (CL)

10. Kimberly-Clark (KMB)

Notable Companies:

1. Exxon Mobil (XOM)

2. Chevron (CVX)

3. ConocoPhillips (COP)

4. Phillips 66 (PSX)

5. EOG Resources (EOG)

6. Kinder Morgan (KMI)

7. Schlumberger (SLB)

8. Marathon Petroleum (MPC)

9. Valero Energy (VLO)

10. Williams Companies (WMB)

Notable Companies:

1. JPMorgan Chase (JPM)

2. Berkshire Hathaway (BRK.A)

3. Bank of America (BAC)

4. Citigroup (C)

5. Wells Fargo (WFC)

6. BlackRock (BLK)

7. S&P Global (SPGI)

8. American Express (AXP)

9. Goldman Sachs (GS)

10. CME Group (CME)

Notable Companies:

1. Johnson & Johnson (JNJ)

2. UnitedHealth (UNH)

3. Merck (MRK)

4. Pfizer (PFE)

5. AbbVie (ABBV)

6. Abbott Laboratories (ABT)

7. Thermo Fisher Scientific (TMO)

8. Eli Lilly and Co. (LLY)

9. Amgen (AMGN)

10. Bristol-Myers Squibb (BMY)

Notable Companies:

1. Union Pacific (UNP)

2. Honeywell (HON)

3. Boeing (BA)

4. Raytheon Technologies (RTX)

5. Lockheed Martin (LMT)

6. 3M (MMM)

7. United Parcel Service (UPS)

8. Caterpillar (CAT)

9. General Electric (GE)

10. Illinois Tool Works (ITW)

Notable Companies:

1. Linde PLC (LIN)

2. Air Products and Chemicals (APD)

3. Ecolab (ECL)

4. Newmont (NEM)

5. Sherwin-Williams (SHW)

6. DuPont de Nemours (DD)

7. Dow Inc. (DOW)

8. PPG Industries (PPG)

9. Ball Corp. (BLL)

10. Corteva (CTVA)

Notable Companies:

1. Vanguard Real Estate II Index Fund (VRTPX)

2. American Tower (AMT)

3. Crown Castle International (CCI)

4. Prologis (PLD)

5. Equinix (EQIX)

6. Digital Realty Trust (DLR)

7. SBA Communications (SBAC)

8. Public Storage (PSA)

9. Equity Residential (EQR)

10. AvalonBay Communities (AVB)

Notable Companies:

1. Apple (AAPL)

2. Microsoft (MSFT)

3. Visa (V)

4. Mastercard (MA)

5. Intel (INTC)

6. NVIDIA (NVDA)

7. Adobe (ADBE)

8. Cisco Systems (CSCO)

9. PayPal Holdings (PYPL)

10. Salesforce.com (CRM)

Notable Companies:

1. NextEra Energy (NEE)

2. Dominion Energy (D)

3. Duke Energy (DUK)

4. Southern Co. (SO)

5. American Electric Power (AEP)

6. Exelon (EXC)

7. Sempra Energy (SRE)

8. Xcel Energy (XEL)

9. WEC Energy Group (WEC)

10. Eversource Energy (ES)

(3) Commodities: Commodities are assets with notoriously volatile markets. Commodities markets can be catalysts for movements in stocks, which makes trends in commodities trading important enough to consider. Some commodities, most notably gold, are often sought after by investors during periods of stock market volatility as a hedging strategy. A list of important commodities ranging from metals, energy, and agriculture are provided to the user with their respective tickers that can be entered into our program.

(4) Currency exchange rates and U.S. Treasuries: Bond markets and the forex markets are also important financial data points to consider for analysis. U.S. Treasury bonds in particular are valued as safe havens for investors and generally, bond yields move inversely to stock prices. Movements in currency exchange rates affect multinational companies and the forex market is more relevant than ever due to the increasing globalization of world economies. A small list of U.S. Treasury bonds with varying maturities and important currency exchange rates are provided to the user as tickers.

Part 3: Graphing Tools

For the third main option, the user can view two charts for an entered company and time interval: (1) price over time and (2) volume over time. These are basic tools that can be used in conjunction with the analytical functions given which can ultimately help the user visualize trends over a certain time interval.


Team Members

William Hong is an applied math and finance student at Fordham University. William is particularly interested in data science and quantifying statistical trends, and naturally his greatest passions are in the financial markets and sports analytics.

Github Linkedin

Daniel Han is an applied mathematics student at Vanderbilt University, also minoring in scientific computing. He is pursuing a career in data science, with a regard for neuroscience. Daniel is interested in finding meaningful statistics and quantifiable human behavior patterns.

Github Linkedin

Aaron Chen is currently a rising junior at NYU and has experience in web development and web design. He strives to learn more about machine learning, software engineering and data science. A few of his interests include reading up about geopolitical issues and learning about the financial markets.

Github Linkedin

Farhan Azad is a math student at Fordham University pursuing a double concentration in applied and pure mathematics. Coding and mathematical research are two of Farhan's greatest interests.

Github Linkedin

Github