-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
22 lines (19 loc) · 1013 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import yfinance as yf
import streamlit as st
import pandas as pd
import numpy as np
import plotly.express as px
from datetime import datetime, date
from dateutil.relativedelta import relativedelta
st.title('Crypto Currency Tracker')
# Sidebar
st.sidebar.title('Options')
crypto_mapping = st.sidebar.selectbox('Select a crypto currency', ['BTC-USD', 'ETH-USD', 'LTC-USD'])
start_date = st.sidebar.date_input('Start date', date.today() - relativedelta(months=1))
end_date = st.sidebar.date_input('End date', date.today())
st.sidebar.selectbox("Select a time period", ["1 day", "5 days", "1 month", "3 months", "6 months"])
selected_value = st.sidebar.selectbox("Select a value to display", ["Open", "High", "Low", "Close", "Volume"])
if st.sidebar.button('Track crypto currency'):
crypto_hystory = yf.download(crypto_mapping, start=start_date, end=end_date)
fig = px.line(crypto_hystory, x=crypto_hystory.index, y=selected_value, title=f"{crypto_mapping} {selected_value} price")
st.plotly_chart(fig)