Update app.py
Browse files
app.py
CHANGED
@@ -88,7 +88,12 @@ def filter_stocks_by_indicators(stocks, start_date, end_date, rsi_threshold, sto
|
|
88 |
(indicator_choice == 'StochRSI' and stoch_rsi_value < stoch_rsi_threshold) or \
|
89 |
(indicator_choice == 'OBV' and obv_change > obv_threshold) or \
|
90 |
(indicator_choice == 'All' and rsi_value < rsi_threshold and stoch_rsi_value < stoch_rsi_threshold and obv_change > obv_threshold):
|
91 |
-
filtered_stocks.append(
|
|
|
|
|
|
|
|
|
|
|
92 |
st.info(f"{ticker} - RSI: {rsi_value:.2f}, StochRSI: {stoch_rsi_value:.2f}, OBV Change: {obv_change:.2f}%")
|
93 |
else:
|
94 |
st.info(f"{ticker} - RSI: {rsi_value:.2f}, StochRSI: {stoch_rsi_value:.2f}, OBV Change: {obv_change:.2f}% (doesn't meet criteria)")
|
@@ -133,15 +138,17 @@ def main():
|
|
133 |
|
134 |
if filtered_stocks:
|
135 |
st.success(f"Found {len(filtered_stocks)} stocks meeting the criteria:")
|
136 |
-
|
137 |
-
|
|
|
|
|
138 |
st.download_button(
|
139 |
label="Download CSV",
|
140 |
-
data=
|
141 |
file_name=output_filename,
|
142 |
mime='text/csv',
|
143 |
)
|
144 |
-
st.success(f"Click the button above to download the filtered stocks.")
|
145 |
else:
|
146 |
st.warning(f"No stocks found meeting the selected criteria.")
|
147 |
|
|
|
88 |
(indicator_choice == 'StochRSI' and stoch_rsi_value < stoch_rsi_threshold) or \
|
89 |
(indicator_choice == 'OBV' and obv_change > obv_threshold) or \
|
90 |
(indicator_choice == 'All' and rsi_value < rsi_threshold and stoch_rsi_value < stoch_rsi_threshold and obv_change > obv_threshold):
|
91 |
+
filtered_stocks.append({
|
92 |
+
'Ticker': ticker,
|
93 |
+
'RSI': rsi_value,
|
94 |
+
'StochRSI': stoch_rsi_value,
|
95 |
+
'OBV_Change': obv_change
|
96 |
+
})
|
97 |
st.info(f"{ticker} - RSI: {rsi_value:.2f}, StochRSI: {stoch_rsi_value:.2f}, OBV Change: {obv_change:.2f}%")
|
98 |
else:
|
99 |
st.info(f"{ticker} - RSI: {rsi_value:.2f}, StochRSI: {stoch_rsi_value:.2f}, OBV Change: {obv_change:.2f}% (doesn't meet criteria)")
|
|
|
138 |
|
139 |
if filtered_stocks:
|
140 |
st.success(f"Found {len(filtered_stocks)} stocks meeting the criteria:")
|
141 |
+
df = pd.DataFrame(filtered_stocks)
|
142 |
+
st.dataframe(df)
|
143 |
+
|
144 |
+
csv_data = df.to_csv(index=False).encode('utf-8')
|
145 |
st.download_button(
|
146 |
label="Download CSV",
|
147 |
+
data=csv_data,
|
148 |
file_name=output_filename,
|
149 |
mime='text/csv',
|
150 |
)
|
151 |
+
st.success(f"Click the button above to download the filtered stocks with RSI, StochRSI, and OBV Change data.")
|
152 |
else:
|
153 |
st.warning(f"No stocks found meeting the selected criteria.")
|
154 |
|