# Stationary distribution of AMZN stock

## Question

You can use Markov Chains and stationary (steady-state) distributions to understand a system's tendencies and forecast the likelihood of a given event. Suppose you are trying to understand the tendencies of Amazon's stock (ticker AMZN). Using the daily stock data, build a simple Markov Chain and calculate the steady-state distribution.

You will want to think through the following when drafing your solution:

• Define the Markov Chain's events (e.g. open price on day X is higher than open price on day Y)
• Based on the event, you will need to calculate the probability of each event
• Calculate the steady-state distribution, you can do this by using linear algebra or creating a simulation

To help get you started, the code below installs yfinance to your Colab runtime and loads in the historical stock data. You can also make a copy of this Google Colab notebook to get started!

``````# import yahoo finance
!pip install yfinance

# import packages
import logging
import sys
import pandas as pd
import datetime
from time import sleep, strftime, time
import math
import yfinance as yf

# get dataframe -- the timeframe you analyze is up to you!