-
Notifications
You must be signed in to change notification settings - Fork 0
/
StockPriceApp.py
50 lines (29 loc) · 1012 Bytes
/
StockPriceApp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Showing the Apple Stock Price (AAPL) in a web browser using Python and Streamlit.
# Streamlit is a Python library which enables a development of Data Science apps and provides an interactive web app
#pip install streamlit
#pip install yfinance
import yfinance as yf
import streamlit as st
import pandas as pd
# App header
st.write("""
# Apple Stock Price
Shown are the stock **closing price** and ***volume***!
""")
# ticker symbol
ticker = 'AAPL'
# get data
data = yf.Ticker(ticker)
# get historical prices
ticker_hist = data.history(period='1d', start='2010-1-31', end='2021-1-31')
st.write("""
## Closing Price
""")
st.line_chart(ticker_hist.Close)
st.write("""
## Volume
""")
st.line_chart(ticker_hist.Volume)
# Open Command Prompt: conda activate dp
# cd C:\Users\user\GitHub\apps
# streamlit run StockPriceApp.py -> runs the app in your browser