Skip to content

Latest commit

 

History

History
531 lines (285 loc) · 4.28 KB

File metadata and controls

531 lines (285 loc) · 4.28 KB

SPX 0DTE Bull Put Spread Screener

Version: 1.0

Objective

Develop a production-quality Python application that scans the SPX/SPXW option chain in real time and notifies the user only when a high-quality 0DTE Bull Put Spread opportunity exists.

This application DOES NOT place trades.

Its only responsibility is:

  • Scan market
  • Score trades
  • Send alerts

The application must be modular, configurable and production ready.


Design Goals

  • Clean Architecture
  • SOLID principles
  • Fully typed Python
  • Unit tested
  • Docker compatible
  • Easy to extend
  • Provider independent

The data provider should be replaceable without changing business logic.


Python Version

Python 3.12+


Folder Structure

spx_trader/

app.py

config/
    config.yaml
    logging.yaml

data/
    provider.py
    longbridge_provider.py
    tradier_provider.py
    mock_provider.py

market/
    market_regime.py
    support_resistance.py
    breadth.py
    vix.py

indicators/
    ema.py
    atr.py
    vwap.py
    rsi.py

options/
    option_chain.py
    spread_builder.py
    greeks.py

scoring/
    trade_score.py
    scoring_engine.py

alerts/
    telegram.py
    discord.py
    email.py

dashboard/
    dashboard.py

utils/
    logger.py
    time.py

models/
    option.py
    spread.py
    market.py
    signal.py

tests/

Architecture

Use dependency injection.

Never instantiate providers directly.

Everything depends upon interfaces.

Example

MarketScanner

IDataProvider

LongbridgeProvider


Required Libraries

pandas

numpy

pandas-ta

httpx

pydantic

apscheduler

pyyaml

rich

loguru

python-dotenv

pytest


Data Provider Interface

Must expose

get_spx_quote()

get_vix()

get_option_chain(expiration)

get_market_breadth()

get_intraday_bars()


Market Regime

Calculate

20 EMA

50 EMA

VWAP

ATR

Trend

Expected Move

Score:

0-25


Volatility

Use

VIX

Expected Move

IV

IV Percentile (if available)

Score

0-15


Option Scanner

Scan entire chain.

Reject

Low Open Interest

Wide Bid Ask

Poor liquidity

Find

Delta

0.08-0.15


Spread Builder

Default

10 point width

Allow

5

10

15

20

point widths.


Trade Filters

Reject trades if

SPX below VWAP

Trend bearish

VIX below threshold

Major economic event

Poor liquidity

Late afternoon (configurable)


Trade Score

Maximum

100

Trend

25

Volatility

15

Option Premium

20

Support Distance

15

Liquidity

10

Time

5

Risk Events

10

Only alert

Score >= 90


Dashboard

Display

Market Regime

Trend

VIX

Expected Move

Best Strategy

Recommended Delta

Trade Score

Recommended Spread

Use Rich library.


Alerts

Telegram

Discord

Email

Message example

🔥 SPX Opportunity

Score 94

Sell

6450P

Buy

6440P

Credit

1.45

POP

89%

Delta

0.11

Reason

Trend

VWAP

Support

Premium


Scheduler

Run every

60 seconds

Configurable.


Configuration

Everything configurable.

Never hardcode.

Use YAML.

Examples

EMA lengths

Delta range

Credit minimum

Alert threshold

Trading hours

Spread width

VIX thresholds


Logging

Loguru

Daily rotating logs.

Separate

errors

alerts

scanner


Error Handling

Retry network requests.

Exponential backoff.

Graceful shutdown.

Never crash because provider unavailable.


Testing

Unit tests

Provider mocks

Scoring tests

Alert tests

Dashboard tests

Minimum

80% coverage


Future Features

Machine Learning score

Kelly sizing

Iron Condor

Bear Call Spread

Backtesting

Trade Journal

Performance Analytics

Expected Move prediction

Gamma Exposure

Market Breadth

SPY correlation


Coding Standards

PEP8

Type hints everywhere

No global variables

No duplicated logic

No magic numbers

Dependency injection

Small functions

Single responsibility


Deliverables

The coding agent shall generate

Complete project

Dockerfile

docker-compose.yml

requirements.txt

README.md

.env.example

Sample config.yaml

Complete tests

Example Telegram configuration

Mock provider

Working dashboard

Working scheduler

Production-ready logging

No placeholder files.

The application should run immediately after adding API credentials.