Skip to content

Instantly share code, notes, and snippets.

@dataprofessor
Last active September 2, 2020 05:25
Show Gist options
  • Save dataprofessor/dbd6976cf9b1bdb18eb1d0e2e055e2bf to your computer and use it in GitHub Desktop.
Save dataprofessor/dbd6976cf9b1bdb18eb1d0e2e055e2bf to your computer and use it in GitHub Desktop.
myapp2.py from "How to Build Your First Data Science Web App in Python" at https://www.youtube.com/watch?v=ZZ4B0QUHuNc
import yfinance as yf
import streamlit as st
st.write("""
# Simple Stock Price App
Shown are the stock **closing price** and ***volume*** of Google!
""")
# https://towardsdatascience.com/how-to-get-stock-data-using-python-c0de1df17e75
#define the ticker symbol
tickerSymbol = 'GOOGL'
#get data on this ticker
tickerData = yf.Ticker(tickerSymbol)
#get the historical prices for this ticker
tickerDf = tickerData.history(period='1d', start='2010-5-31', end='2020-5-31')
# Open High Low Close Volume Dividends Stock Splits
st.write("""
## Closing Price
""")
st.line_chart(tickerDf.Close)
st.write("""
## Volume
""")
st.line_chart(tickerDf.Volume)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment