1 / Options trader
70pher703's picture
Create Options trader
d765348 verified
requirements.txt
yfinance
streamlit
import streamlit as st
import yfinance as yf
from datetime import datetime, timedelta
st.set_page_config(page_title="Options Scanner", layout="wide")
st.title("Naked Options Play Finder")
ticker = st.text_input("Enter Ticker Symbol (e.g. GME, SPY, TSLA)", "GME")
max_price = st.slider("Max Option Price ($)", 5, 200, 50)
days_out = st.slider("Days Until Expiration", 1, 14, 7)
if st.button("Find Options"):
stock = yf.Ticker(ticker)
today = datetime.today().date()
try:
expirations = stock.options
st.success(f"Found {len(expirations)} expirations")
for exp in expirations:
exp_date = datetime.strptime(exp, "%Y-%m-%d").date()
if (exp_date - today).days > days_out:
continue
calls = stock.option_chain(exp).calls
puts = stock.option_chain(exp).puts
cheap_calls = calls[calls['lastPrice'] <= max_price]
cheap_puts = puts[puts['lastPrice'] <= max_price]
if not cheap_calls.empty:
st.subheader(f"Calls under ${max_price} expiring {exp}")
st.dataframe(cheap_calls[['strike', 'lastPrice', 'volume', 'impliedVolatility']])
if not cheap_puts.empty:
st.subheader(f"Puts under ${max_price} expiring {exp}")
st.dataframe(cheap_puts[['strike', 'lastPrice', 'volume', 'impliedVolatility']])
except Exception as e:
st.error(f"Error: {e}")