From db40a4dd9dc4cf2f60a994c20ba03decdb4c1a02 Mon Sep 17 00:00:00 2001 From: marci1364 Date: Wed, 30 Jun 2021 23:40:12 -0700 Subject: [PATCH 1/2] commit message --- .idea/.gitignore | 3 + .../inspectionProfiles/profiles_settings.xml | 6 + .idea/misc.xml | 4 + .idea/modules.xml | 8 ++ .idea/streamlit-framework.iml | 8 ++ .idea/vcs.xml | 6 + app.py | 54 +++++++++ requirements.txt | 113 ++++++++++++++++-- 8 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/streamlit-framework.iml create mode 100644 .idea/vcs.xml 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..984726c 100644 --- a/app.py +++ b/app.py @@ -0,0 +1,54 @@ +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 plotly.graph_objects as go +import requests +import os +#st.title('TDI Milestone Project') +#st.header('Select Plot Parameters') + +Ticker = st.selectbox('Ticker', options = + ['IBM', + 'TSLA', + ]) +Year = st.selectbox('Year', options = + ['Select',2010, + 2011, + 2012, + 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021]) +Month = st.selectbox('Month:', options = + ['Select','January', + 'February', + 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' + ]) +while Year == 'Select' or Month == 'Select': + continue +load_dotenv() +api_key = '7BVCOMX48DYGXDOY' +ts = TimeSeries(key='7BVCOMX48DYGXDOY', output_format='pandas') +data, meta_data = ts.get_daily(Ticker, outputsize = 'full') +print(meta_data) +month_dict = {} +keys = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] +values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12] +i = 0 +for key in keys: + month_dict[key] = values[i] + i = i+1 +y = 2021 + +m_int = month_dict.get(Month) +data['date'] = data.index.time +s = (data['date'].index.year == Year) * (data['date'].index.month == 4) +g = data[s]['4. close'] +st.write(g) +st.line_chart(g) +plt.show() + + + + + + diff --git a/requirements.txt b/requirements.txt index 0b576ce..4cf42c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,106 @@ -pandas -streamlit -plotly -python-dotenv -altair -bokeh -requests +aiohttp==3.7.4.post0 +alpha-vantage==2.3.1 +altair @ file:///tmp/build/80754af9/altair_1599835197802/work +argon2-cffi==20.1.0 +astor==0.8.1 +async-generator==1.10 +async-timeout==3.0.1 +attrs @ file:///tmp/build/80754af9/attrs_1620827162558/work +backcall==0.2.0 +base58==2.1.0 +bleach==3.3.0 +blinker==1.4 +bokeh==2.3.2 +Bottleneck @ file:///C:/ci/bottleneck_1607557040328/work +brotlipy==0.7.0 +cachetools==4.2.2 +certifi==2021.5.30 +cffi @ file:///C:/ci/cffi_1613247431367/work +chardet @ file:///C:/ci/chardet_1607706937985/work +click==7.1.2 +colorama==0.4.4 +cryptography @ file:///C:/ci/cryptography_1616769504165/work +cycler==0.10.0 +debugpy==1.3.0 +decorator==5.0.9 +defusedxml==0.7.1 +entrypoints==0.3 +gitdb==4.0.7 +GitPython==3.1.18 +idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work +importlib-metadata @ file:///C:/ci/importlib-metadata_1617877477759/work +ipykernel==6.0.0 +ipython==7.25.0 +ipython-genutils==0.2.0 +ipywidgets==7.6.3 +jedi==0.18.0 +Jinja2 @ file:///tmp/build/80754af9/jinja2_1624781299557/work +jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work +jupyter-client==6.1.12 +jupyter-core==4.7.1 +jupyterlab-pygments==0.1.2 +jupyterlab-widgets==1.0.0 +kiwisolver==1.3.1 +MarkupSafe @ file:///C:/ci/markupsafe_1621528502553/work +matplotlib==3.4.2 +matplotlib-inline==0.1.2 +mistune==0.8.4 +mkl-fft==1.3.0 +mkl-random @ file:///C:/ci/mkl_random_1618854182866/work +mkl-service==2.3.0 +multidict==5.1.0 +nbclient==0.5.3 +nbconvert==6.1.0 +nbformat==5.1.3 +nest-asyncio==1.5.1 +notebook==6.4.0 +numexpr @ file:///C:/ci/numexpr_1618856728739/work +numpy @ file:///C:/ci/numpy_and_numpy_base_1620831398996/work +packaging==20.9 +pandas @ file:///C:/ci/pandas_1624465767060/work +pandocfilters==1.4.3 +parso==0.8.2 +pickleshare==0.7.5 +Pillow==8.2.0 +plotly @ file:///tmp/build/80754af9/plotly_1610565580232/work +prometheus-client==0.11.0 +prompt-toolkit==3.0.19 +protobuf==3.17.3 +pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work +pydeck==0.6.2 +Pygments==2.9.0 +pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work +pyparsing==2.4.7 +pyrsistent @ file:///C:/ci/pyrsistent_1607359751294/work +PySocks @ file:///C:/ci/pysocks_1605307512533/work +python-dateutil @ file:///home/ktietz/src/ci/python-dateutil_1611928101742/work +python-dotenv==0.18.0 +pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work +pywin32==301 +pywinpty==1.1.3 +PyYAML==5.4.1 +pyzmq==22.1.0 +requests @ file:///tmp/build/80754af9/requests_1608241421344/work +retrying==1.3.3 +Send2Trash==1.7.1 +six @ file:///tmp/build/80754af9/six_1623709665295/work +smmap==4.0.0 +streamlit==0.83.0 +terminado==0.10.1 +testpath==0.5.0 +toml==0.10.2 +toolz @ file:///home/linux1/recipes/ci/toolz_1610987900194/work +tornado==6.1 +traitlets==5.0.5 +typing-extensions==3.10.0.0 +tzlocal==2.1 +urllib3 @ file:///tmp/build/80754af9/urllib3_1615837158687/work +validators==0.18.2 +watchdog==2.1.3 +wcwidth==0.2.5 +webencodings==0.5.1 +widgetsnbextension==3.5.1 +win-inet-pton @ file:///C:/ci/win_inet_pton_1605306162074/work +wincertstore==0.2 +yarl==1.6.3 +zipp @ file:///tmp/build/80754af9/zipp_1615904174917/work From cd505a4733c6124e06d3cb4492509051c0837b5d Mon Sep 17 00:00:00 2001 From: marci1364 Date: Thu, 1 Jul 2021 20:25:28 -0700 Subject: [PATCH 2/2] Initial Commit --- app.py | 69 ++++++++++++++++------------- requirements.txt | 113 +++-------------------------------------------- 2 files changed, 45 insertions(+), 137 deletions(-) diff --git a/app.py b/app.py index 984726c..267fbd8 100644 --- a/app.py +++ b/app.py @@ -3,49 +3,56 @@ from dotenv import load_dotenv from alpha_vantage.timeseries import TimeSeries import matplotlib.pyplot as plt -import plotly.graph_objects as go +import altair as alt +import plotly.express as px import requests import os -#st.title('TDI Milestone Project') -#st.header('Select Plot Parameters') + +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 = - ['Select',2010, + [2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021]) Month = st.selectbox('Month:', options = - ['Select','January', + ['January', 'February', - 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' - ]) -while Year == 'Select' or Month == 'Select': - continue -load_dotenv() -api_key = '7BVCOMX48DYGXDOY' -ts = TimeSeries(key='7BVCOMX48DYGXDOY', output_format='pandas') -data, meta_data = ts.get_daily(Ticker, outputsize = 'full') -print(meta_data) -month_dict = {} -keys = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] -values = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12] -i = 0 -for key in keys: - month_dict[key] = values[i] - i = i+1 -y = 2021 - -m_int = month_dict.get(Month) -data['date'] = data.index.time -s = (data['date'].index.year == Year) * (data['date'].index.month == 4) -g = data[s]['4. close'] -st.write(g) -st.line_chart(g) -plt.show() + '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) diff --git a/requirements.txt b/requirements.txt index 4cf42c1..0b576ce 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,106 +1,7 @@ -aiohttp==3.7.4.post0 -alpha-vantage==2.3.1 -altair @ file:///tmp/build/80754af9/altair_1599835197802/work -argon2-cffi==20.1.0 -astor==0.8.1 -async-generator==1.10 -async-timeout==3.0.1 -attrs @ file:///tmp/build/80754af9/attrs_1620827162558/work -backcall==0.2.0 -base58==2.1.0 -bleach==3.3.0 -blinker==1.4 -bokeh==2.3.2 -Bottleneck @ file:///C:/ci/bottleneck_1607557040328/work -brotlipy==0.7.0 -cachetools==4.2.2 -certifi==2021.5.30 -cffi @ file:///C:/ci/cffi_1613247431367/work -chardet @ file:///C:/ci/chardet_1607706937985/work -click==7.1.2 -colorama==0.4.4 -cryptography @ file:///C:/ci/cryptography_1616769504165/work -cycler==0.10.0 -debugpy==1.3.0 -decorator==5.0.9 -defusedxml==0.7.1 -entrypoints==0.3 -gitdb==4.0.7 -GitPython==3.1.18 -idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work -importlib-metadata @ file:///C:/ci/importlib-metadata_1617877477759/work -ipykernel==6.0.0 -ipython==7.25.0 -ipython-genutils==0.2.0 -ipywidgets==7.6.3 -jedi==0.18.0 -Jinja2 @ file:///tmp/build/80754af9/jinja2_1624781299557/work -jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work -jupyter-client==6.1.12 -jupyter-core==4.7.1 -jupyterlab-pygments==0.1.2 -jupyterlab-widgets==1.0.0 -kiwisolver==1.3.1 -MarkupSafe @ file:///C:/ci/markupsafe_1621528502553/work -matplotlib==3.4.2 -matplotlib-inline==0.1.2 -mistune==0.8.4 -mkl-fft==1.3.0 -mkl-random @ file:///C:/ci/mkl_random_1618854182866/work -mkl-service==2.3.0 -multidict==5.1.0 -nbclient==0.5.3 -nbconvert==6.1.0 -nbformat==5.1.3 -nest-asyncio==1.5.1 -notebook==6.4.0 -numexpr @ file:///C:/ci/numexpr_1618856728739/work -numpy @ file:///C:/ci/numpy_and_numpy_base_1620831398996/work -packaging==20.9 -pandas @ file:///C:/ci/pandas_1624465767060/work -pandocfilters==1.4.3 -parso==0.8.2 -pickleshare==0.7.5 -Pillow==8.2.0 -plotly @ file:///tmp/build/80754af9/plotly_1610565580232/work -prometheus-client==0.11.0 -prompt-toolkit==3.0.19 -protobuf==3.17.3 -pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work -pydeck==0.6.2 -Pygments==2.9.0 -pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work -pyparsing==2.4.7 -pyrsistent @ file:///C:/ci/pyrsistent_1607359751294/work -PySocks @ file:///C:/ci/pysocks_1605307512533/work -python-dateutil @ file:///home/ktietz/src/ci/python-dateutil_1611928101742/work -python-dotenv==0.18.0 -pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work -pywin32==301 -pywinpty==1.1.3 -PyYAML==5.4.1 -pyzmq==22.1.0 -requests @ file:///tmp/build/80754af9/requests_1608241421344/work -retrying==1.3.3 -Send2Trash==1.7.1 -six @ file:///tmp/build/80754af9/six_1623709665295/work -smmap==4.0.0 -streamlit==0.83.0 -terminado==0.10.1 -testpath==0.5.0 -toml==0.10.2 -toolz @ file:///home/linux1/recipes/ci/toolz_1610987900194/work -tornado==6.1 -traitlets==5.0.5 -typing-extensions==3.10.0.0 -tzlocal==2.1 -urllib3 @ file:///tmp/build/80754af9/urllib3_1615837158687/work -validators==0.18.2 -watchdog==2.1.3 -wcwidth==0.2.5 -webencodings==0.5.1 -widgetsnbextension==3.5.1 -win-inet-pton @ file:///C:/ci/win_inet_pton_1605306162074/work -wincertstore==0.2 -yarl==1.6.3 -zipp @ file:///tmp/build/80754af9/zipp_1615904174917/work +pandas +streamlit +plotly +python-dotenv +altair +bokeh +requests