Data Interview Qs - Stationary distribution of AMZN stock


Stationary distribution of AMZN stock

Python Data Analysis Pandas Markov Chain Stochastic Processes Modeling

Forward this email to a friend or colleague and challenge them to solve it.


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!

data ="AMZN", start="2020-01-02", end="2020-06-01").reset_index()

Solution will be written in Python for premium users.


You’ve accumulated 322 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.

Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Key phrases

Older messages

Total revenue by location

Wednesday, July 20, 2022

SQL, Database Querying, Joining Tables, InterviewQs Total revenue by location SQL Database Querying Joining Tables Forward this email to a friend or colleague and challenge them to solve it. Hi,

Cost per customer acquisition

Monday, July 18, 2022

Python, CDF, PDF, Data Analysis, Pandas, Data Manipulation, External Dataset, InterviewQs Cost per customer acquisition Python CDF PDF Data Analysis Pandas Data Manipulation External Dataset Forward

Clock angle problem

Friday, July 15, 2022

Python, Algorithms, Data Structures, Arrays, InterviewQs Clock angle problem Python Algorithms Data Structures Arrays Forward this email to a friend or colleague and challenge them to solve it. Hi,

Efficacy of a classifier

Thursday, July 14, 2022

Statistics, Machine Learning, ROC Curve, InterviewQs Efficacy of a classifier Statistics Machine Learning ROC Curve Forward this email to a friend or colleague and challenge them to solve it. Hi,

Tree structures in SQL

Monday, July 11, 2022

SQL, Database Querying, Self-join, InterviewQs Tree structures in SQL SQL Database Querying Self-join Forward this email to a friend or colleague and challenge them to solve it. Hi, Suppose you have a

[Python Mastery] Learn Python in 21 days!!!!11 (what a lie)

Thursday, August 18, 2022

Hey there, One of the first programming books I ever bought was "Teach Yourself C in 21 Days." This four pound tome came with a CD-ROM that included an ancient version (3.1) of the Borland

[Python Dependency Pitfalls] How to set the world on fire

Thursday, August 18, 2022

Hey there, #1 on my list of dependency management pitfalls is there for a good reason: It lead to a single developer causing mayhem and breaking thousands of open-source projects around the world in

Laravel + WordPress, Silver Play Button and More

Thursday, August 18, 2022

Hey hey, So today is an important day for me, as I have unboxed my Youtube Silver Play button for 100000 subscribers, still can't believe it. Meanwhile, business as usual, will still keep putting

Migrate your Elasticsearch data across clusters with zero downtime

Thursday, August 18, 2022

Deep dive on migrating data effectively using CCS and CCR elastic | Search. Observe. Protect Cloud migration workflow using CCS and CCR Register now Date & Time September 8, 2022 1:30 pm SGT, 3:30

Physical buttons outperform touchscreens in new cars, test finds — RavynOS – Finesse of macOS, freedom of FreeBSD — and VPNs on iOS are a scam

Wednesday, August 17, 2022

Issue #862 — Top 20 stories of August 18, 2022 Issue #862 — August 18, 2022 You receive this email because you are subscribed to Hacker News Digest. You can open it in the browser if you prefer. 1

Google will unplug its IoT Core service in August 2023

Wednesday, August 17, 2022

TechCrunch Newsletter TechCrunch logo The Daily Crunch logo By Christine Hall and Haje Jan Kamps Wednesday, August 17, 2022 Hellooo, Crunchy McCrunchface! (What we're calling the readers of the

Explained | The Relationship Between Climate Change and Wildfires 🔥

Wednesday, August 17, 2022

More carbon in the atmosphere is creating a hotter world—and gradually fueling both climate change and instances of wildfires. View Online | Subscribe FEATURED STORY The Relationship Between Climate

New Webinar! SIMULIA Structural Simulation in Consumer Electronics Design

Wednesday, August 17, 2022

Streamline design cycles and get to market faster View this email in your browser Robust Mobile Devices: SIMULIA Structural Simulation in Consumer Electronics Design Live Webinar -

JSK Daily for Aug 17, 2022

Wednesday, August 17, 2022

JSK Daily for Aug 17, 2022 View this email in your browser A community curated daily e-mail of JavaScript news Implementing Route Protection in Angular using CanActivate In any complex web application,

JSK Weekly - August 17, 2022

Wednesday, August 17, 2022

Sometimes less is more and this week Coding Beauty shows us "14 Sensational JavaScript One-Liners That Will Show Your Wizardry", why not give them a bash? Other popular stories this week