diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..118d141 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..edfabe6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/streamlit-framework.iml b/.idea/streamlit-framework.iml new file mode 100644 index 0000000..92dcb66 --- /dev/null +++ b/.idea/streamlit-framework.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app.py b/app.py index e69de29..267fbd8 100644 --- a/app.py +++ b/app.py @@ -0,0 +1,61 @@ +import pandas as pd +import streamlit as st +from dotenv import load_dotenv +from alpha_vantage.timeseries import TimeSeries +import matplotlib.pyplot as plt +import altair as alt +import plotly.express as px +import requests +import os + +st.title('TDI Milestone Project') +st.header('Select Plot Parameters') +st.text('An interactive chart of stock closing prices using Streamlit and Plot.ly.') + +Ticker = st.selectbox('Ticker', options = + ['IBM', + 'TSLA', + 'AAPL']) +Year = st.selectbox('Year', options = + [2010, + 2011, + 2012, + 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021]) +Month = st.selectbox('Month:', options = + ['January', + 'February', + 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']) +@st.cache +def load_data(Tic, YEAR, MONTH): + load_dotenv() + api_key = '7BVCOMX48DYGXDOY' + ts = TimeSeries(key=api_key, output_format='pandas') + data, meta_dats = ts.get_daily(Tic, outputsize = 'full') + month_dict = {} + keys = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] + values = list(range(1, 13)) + i = 0 + for key in keys: + month_dict[key] = values[i] + i = i+1 + m_int = month_dict.get(MONTH) + data['date'] = data.index.time + s = (data['date'].index.year == YEAR) * (data['date'].index.month == m_int) + g = data[s]['4. close'] + return g + +#### Chart ### +fig = px.line(load_data(Ticker, Year, Month), + y='4. close', + ) +fig.update_layout( + xaxis_title="Timestamp", + yaxis_title="Closing Price", +) +st.plotly_chart(fig) + + + + + +