70pher703 commited on
Commit
e635c27
·
verified ·
1 Parent(s): d765348
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import yfinance as yf
3
+ from datetime import datetime, timedelta
4
+
5
+ st.set_page_config(page_title="Options Scanner", layout="wide")
6
+
7
+ st.title("Naked Options Play Finder")
8
+
9
+ ticker = st.text_input("Enter Ticker Symbol (e.g. GME, SPY, TSLA)", "GME")
10
+ max_price = st.slider("Max Option Price ($)", 5, 200, 50)
11
+ days_out = st.slider("Days Until Expiration", 1, 14, 7)
12
+
13
+ if st.button("Find Options"):
14
+ stock = yf.Ticker(ticker)
15
+ today = datetime.today().date()
16
+
17
+ try:
18
+ expirations = stock.options
19
+ st.success(f"Found {len(expirations)} expirations")
20
+
21
+ for exp in expirations:
22
+ exp_date = datetime.strptime(exp, "%Y-%m-%d").date()
23
+ if (exp_date - today).days > days_out:
24
+ continue
25
+
26
+ calls = stock.option_chain(exp).calls
27
+ puts = stock.option_chain(exp).puts
28
+
29
+ cheap_calls = calls[calls['lastPrice'] <= max_price]
30
+ cheap_puts = puts[puts['lastPrice'] <= max_price]
31
+
32
+ if not cheap_calls.empty:
33
+ st.subheader(f"Calls under ${max_price} expiring {exp}")
34
+ st.dataframe(cheap_calls[['strike', 'lastPrice', 'volume', 'impliedVolatility']])
35
+
36
+ if not cheap_puts.empty:
37
+ st.subheader(f"Puts under ${max_price} expiring {exp}")
38
+ st.dataframe(cheap_puts[['strike', 'lastPrice', 'volume', 'impliedVolatility']])
39
+
40
+ except Exception as e:
41
+ st.error(f"Error: {e}")