This Streamlit app allows users to view real-time stock options data, including visualizations for Open Interest, Volume, and Gamma Exposure. The app fetches stock data, calculates technical indicators like RSI and moving averages, and presents interactive charts like treemaps, donut charts, and bar charts.
- Display of stock price and volume in real-time.
- Technical Indicators: Includes RSI, 50-day and 200-day moving averages, and Delta (a placeholder for options Greeks).
- Interactive visualizations:
- Treemaps: Showing the relationship between options (Strike Price vs Open Interest vs Volume).
- Donut charts: Visualize the volume ratio between Calls and Puts.
- Bar charts: Display Open Interest and Volume by Strike Price.
- Filtering: Select different expiration dates, and view only the data where Volume > Open Interest.
Follow these steps to set up the project on your local machine.
Clone this repository to your local machine.
git clone https://github.com/yourusername/my_streamlit_project.git
cd my_streamlit_project
It's recommended to use a virtual environment to manage dependencies.
# For macOS/Linux
python3 -m venv venv
source venv/bin/activate
# For Windows
python -m venv venv
venv\Scripts�ctivate
Install the required libraries listed in requirements.txt
:
pip install -r requirements.txt
This project requires the following dependencies:
- Streamlit: The web framework to build and run the app.
- yfinance: To fetch stock data and options chain data from Yahoo Finance.
- Plotly: For interactive visualizations like treemaps, donut charts, and bar charts.
- TA-Lib: For calculating technical indicators like RSI and moving averages.
- Pandas: For data manipulation.
To install these dependencies, run the following command:
pip install streamlit yfinance plotly talib pandas
- After setting up the virtual environment and installing dependencies, run the Streamlit app:
streamlit run app.py
- This will launch the app in your browser, where you can interact with the various features.
-
Enter a Stock Ticker:
- Enter a valid stock ticker symbol (e.g.,
AAPL
,TSLA
) in the input field to fetch real-time data for that stock.
- Enter a valid stock ticker symbol (e.g.,
-
View Key Metrics:
- The app will display key metrics like Current Price, Volume, and Technical Indicators (RSI, moving averages, etc.) using
st.metric
at the top.
- The app will display key metrics like Current Price, Volume, and Technical Indicators (RSI, moving averages, etc.) using
-
Select Expiry Date(s):
- You can choose multiple expiry dates for the options data by selecting from the expiry date dropdown.
-
Interactive Visualizations:
- Donut Chart: Displays the Call vs Put Volume Ratio. The size of the donut segments corresponds to the total volume of calls and puts.
- Treemap: A hierarchical visualization where the size of each box represents Volume and the color represents Open Interest.
- OI and Volume Bar Charts: Displays the Open Interest and Volume by Strike Price.
-
Apply Filters:
- You can filter options data by selecting the option to only show data where Volume > Open Interest.
-
View Top 10 Calls/Puts by Volume:
- The app will display tables of the top 10 calls and puts by volume, with filtering and sorting options.
- Current Price: Displays the latest price of the stock.
- Volume: Displays the latest volume for the stock.
- Technical Indicators: Shows RSI, 50-day moving average, and 200-day moving average.
Example Output:
Current Price: $150.25
Current Volume: 5.1M
RSI: 58.6
50-day MA: $148.30
200-day MA: $140.45
Delta: 0.45
- This chart shows the Call vs Put Volume Ratio. The size of the donut segments corresponds to the total volume of calls and puts.
Visual Example:
- A Treemap visualization showing:
- Hierarchy: Option Type → Expiry → Strike.
- Size: Volume.
- Color: Open Interest (with continuous color scale).
Visual Example:
- Bar Charts showing Open Interest and Volume by Strike Price.
Visual Example:
- Display of the top 10 calls and puts sorted by volume, with a clean tabular format showing strike prices, volumes, open interest, bid sizes, and ask sizes.
Visual Example:
Ticker | Strike | Volume | Open Interest | Bid Size | Ask Size |
---|---|---|---|---|---|
AAPL | 150.00 | 2000 | 1500 | 100 | 50 |
AAPL | 155.00 | 1500 | 1400 | 80 | 60 |
... | ... | ... | ... | ... | ... |
This project is licensed under the MIT License - see the LICENSE file for details.
- Make sure to replace the visual example URLs with actual image URLs if needed, or you can skip them if you're not including images in the README.
- If you want to include more technical indicators or advanced features, you can expand on the instructions and examples here.
By following the steps in the README, users will be able to set up and run the app seamlessly!