kishan-1721 commited on
Commit
903b80e
·
verified ·
1 Parent(s): ebdd381

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +17 -11
src/streamlit_app.py CHANGED
@@ -66,7 +66,6 @@ def main():
66
  index=0
67
  )
68
 
69
-
70
  with col2:
71
  global brokerages
72
  brokerages = st.number_input(label="Brokerages",step=0.01,value=0.2644 ,format="%.4f")
@@ -106,7 +105,7 @@ def main():
106
  # symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select")
107
  symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select", help="Search for a symbol by typing in the box")
108
  symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0, key="exchange_select", help="Search for an exchange by typing in the box")
109
-
110
 
111
  # symbol = st.selectbox("Select Symbol", symbol, index=0)
112
  # symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0)
@@ -118,17 +117,21 @@ def main():
118
  else:
119
  from main6 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals, data_collection
120
 
121
- HISTORICAL_DATA = data_collection(symbol = symbol, exchange = symbol_exchange)
122
 
123
- # st.divider()
124
- if HISTORICAL_DATA is not None:
125
- df = HISTORICAL_DATA.copy()
126
- try:
127
- df = df[['Date','Open','High', 'Low', 'Close']]
128
- except:
129
- df = df[['Date','Open','High', 'Low', 'Price']]
130
 
131
- if st.button("Start Analysis"):
 
 
 
 
 
 
 
 
 
132
  # Data preprocessing
133
  df.columns = df.columns.str.strip()
134
  df['Date'] = parse_date(df['Date'])
@@ -575,6 +578,9 @@ def main():
575
  file_name=f"Analysis of {file_name_}.xlsx",
576
  mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
577
  )
 
 
 
578
 
579
  if __name__ == "__main__":
580
  main()
 
66
  index=0
67
  )
68
 
 
69
  with col2:
70
  global brokerages
71
  brokerages = st.number_input(label="Brokerages",step=0.01,value=0.2644 ,format="%.4f")
 
105
  # symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select")
106
  symbol = st.selectbox("Select Symbol", symbol, index=0, key="symbol_select", help="Search for a symbol by typing in the box")
107
  symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0, key="exchange_select", help="Search for an exchange by typing in the box")
108
+
109
 
110
  # symbol = st.selectbox("Select Symbol", symbol, index=0)
111
  # symbol_exchange = st.selectbox("Select Exchange", exchange_list, index=0)
 
117
  else:
118
  from main6 import get_buy_signal, parse_date, get_sell_signal, year_wise_analysis, calculate_yearly_returns, calculate_mtf_returns, crypto_year_wise_analysis, crypto_calculate_mtf_returns, crypto_calculate_yearly_returns, find_sequences, generate_trade_signals, data_collection
119
 
 
120
 
121
+ if st.button("Start Analysis"):
122
+ HISTORICAL_DATA = data_collection(symbol = symbol, exchange = symbol_exchange)
123
+
 
 
 
 
124
 
125
+
126
+ # st.divider()
127
+ if HISTORICAL_DATA is not None:
128
+ df = HISTORICAL_DATA.copy()
129
+ try:
130
+ df = df[['Date','Open','High', 'Low', 'Close']]
131
+ except:
132
+ df = df[['Date','Open','High', 'Low', 'Price']]
133
+
134
+ # if st.button("Start Analysis"):
135
  # Data preprocessing
136
  df.columns = df.columns.str.strip()
137
  df['Date'] = parse_date(df['Date'])
 
578
  file_name=f"Analysis of {file_name_}.xlsx",
579
  mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
580
  )
581
+
582
+ else:
583
+ st.error("No historical data found for the selected symbol and exchange. Please check the inputs and try again.")
584
 
585
  if __name__ == "__main__":
586
  main()