riteshcp commited on
Commit
88b1a24
·
verified ·
1 Parent(s): 7844be9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -3,12 +3,15 @@
3
  # Import required libraries
4
  import streamlit as st
5
  import yfinance as yf
6
- from datetime import date
7
  import pandas as pd
8
  import numpy as np
9
  import matplotlib.pyplot as plt
10
  import io
11
 
 
 
 
12
  # Set Streamlit page configuration
13
  st.set_page_config(
14
  page_title='📈 Indian Stock Data Downloader and Volume Analyzer',
@@ -50,7 +53,8 @@ if uploaded_file is not None:
50
  )
51
 
52
  # Date input widgets for date range selection
53
- start_date = st.sidebar.date_input('📅 Start Date', date(2021, 1, 1))
 
54
  end_date = st.sidebar.date_input('📅 End Date', date.today())
55
 
56
  # Ensure that start_date is before end_date
@@ -72,7 +76,7 @@ if uploaded_file is not None:
72
  ['OBV (Amount)', 'RSI', 'MACD']
73
  )
74
 
75
- # Download button
76
  if st.sidebar.button('📥 Download and Analyze Data'):
77
  if selected_stocks:
78
  for company_name in selected_stocks:
 
3
  # Import required libraries
4
  import streamlit as st
5
  import yfinance as yf
6
+ from datetime import date, timedelta
7
  import pandas as pd
8
  import numpy as np
9
  import matplotlib.pyplot as plt
10
  import io
11
 
12
+ # Optional: Install 'ta' library for technical indicators (uncomment if needed)
13
+ # !pip install ta
14
+
15
  # Set Streamlit page configuration
16
  st.set_page_config(
17
  page_title='📈 Indian Stock Data Downloader and Volume Analyzer',
 
53
  )
54
 
55
  # Date input widgets for date range selection
56
+ default_start_date = date.today() - timedelta(days=365) # Past year
57
+ start_date = st.sidebar.date_input('📅 Start Date', default_start_date)
58
  end_date = st.sidebar.date_input('📅 End Date', date.today())
59
 
60
  # Ensure that start_date is before end_date
 
76
  ['OBV (Amount)', 'RSI', 'MACD']
77
  )
78
 
79
+ # Download and Analyze Data button
80
  if st.sidebar.button('📥 Download and Analyze Data'):
81
  if selected_stocks:
82
  for company_name in selected_stocks: