AmirTrader commited on
Commit
3a4a122
·
verified ·
1 Parent(s): a023d86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -194,12 +194,20 @@ put_call_volume_range = st.sidebar.slider(
194
  step=0.1,
195
  )
196
 
 
 
 
 
 
 
 
 
197
  put_call_oi_range = st.sidebar.slider(
198
  "Put/Call OI Ratio Range", min_value=0.0, max_value=10.0, value=(0.0, 3.0), step=0.1
199
  )
200
 
201
  if st.sidebar.button("Filter"):
202
- # Filter the dataframe with the range
203
  filtered_df = DF_options[
204
  (DF_options["volume"] >= volume_range[0])
205
  & (DF_options["volume"] <= volume_range[1])
@@ -212,13 +220,15 @@ if st.sidebar.button("Filter"):
212
  & (DF_options["Put_Call_OI_Ratio"] <= put_call_oi_range[1])
213
  & (DF_options["Volume_OpenInterest_Ratio"] >= vol_oi_ratio_range[0])
214
  & (DF_options["Volume_OpenInterest_Ratio"] <= vol_oi_ratio_range[1])
 
215
  ]
216
 
217
  st.write(f"Filtered records: {len(filtered_df)} rows")
218
 
219
  interestedColumns = [
220
  "contractSymbol",
221
- "volume",
 
222
  "openInterest",
223
  "impliedVolatility",
224
  "Volume_OpenInterest_Ratio",
 
194
  step=0.1,
195
  )
196
 
197
+ # Add expiration date filter
198
+ expiration_dates = sorted(DF_options['expirationDate'].unique())
199
+ selected_expiry = st.sidebar.multiselect(
200
+ "Select Expiration Dates",
201
+ options=expiration_dates,
202
+ default=expiration_dates[:3] # Default to first 3 dates
203
+ )
204
+
205
  put_call_oi_range = st.sidebar.slider(
206
  "Put/Call OI Ratio Range", min_value=0.0, max_value=10.0, value=(0.0, 3.0), step=0.1
207
  )
208
 
209
  if st.sidebar.button("Filter"):
210
+ # Filter the dataframe with the range and expiry dates
211
  filtered_df = DF_options[
212
  (DF_options["volume"] >= volume_range[0])
213
  & (DF_options["volume"] <= volume_range[1])
 
220
  & (DF_options["Put_Call_OI_Ratio"] <= put_call_oi_range[1])
221
  & (DF_options["Volume_OpenInterest_Ratio"] >= vol_oi_ratio_range[0])
222
  & (DF_options["Volume_OpenInterest_Ratio"] <= vol_oi_ratio_range[1])
223
+ & (DF_options["expirationDate"].isin(selected_expiry))
224
  ]
225
 
226
  st.write(f"Filtered records: {len(filtered_df)} rows")
227
 
228
  interestedColumns = [
229
  "contractSymbol",
230
+ "expirationDate",
231
+ "volume",
232
  "openInterest",
233
  "impliedVolatility",
234
  "Volume_OpenInterest_Ratio",