A Bookmap-style visualization tool for displaying real-time market depth data from ThinkorSwim's RTD server.
This is a rough v1. Improvements coming.
marketdepth.mp4
- Real-time market depth visualization in Bookmap style
- Stores RTD data in SQLite database for persistence and analysis
- Python 3.11+
- ThinkorSwim desktop application
- Windows OS (COM components are Windows-specific)
- Clone the repository
git clone https://github.com/2187Nick/tos-market-depth-rtd.git
cd tos-market-depth-rtd
- Create a virtual environment
python -m venv venv
venv\Scripts\activate
- Install dependencies
pip install -r requirements.txt
-
Make sure ThinkorSwim is running and you're logged in
-
Start the application
python app.py
- Enter an option symbol in the interface:
Examples:
Stock options: .SPY250417C550
E-mini S&P 500 Index Future Options: ./EWJ25C5725:XCME
Nasdaq 100 Index Options: .NDX250417C20000
Oil Future Options: ./LO4H25C70:XNYM
10-Year Us Treasury Note Futures Options: ./ZN2J25C110.75:XCBT
To get the symbol:
Go to the option chain page.
Right click on any option and then click "copy" on symbol name.
-
Click "Start" to begin visualization
-
Use the controls to:
- Pause/Resume the visualization
- Update the symbol
- Zoom in/out of specific areas
- RTD Client (
src/rtd/client.py): Interfaces with the ThinkorSwim RTD server via COM to receive market data - Database (
src/db/database.py): SQLite implementation for storing market depth data - Bookmap Visualization (
src/utils/bookmap_viz.py): Creates and updates the heatmap visualization - Dash App (
dash_app.py): Web interface built with Dash and Plotly
- The RTD Client connects to ThinkorSwim and subscribes to market depth data for specified symbols
- Data is captured and stored in the SQLite database
- The visualization module pulls data from the database and creates the heatmap
- The Dash web app provides the user interface and refreshes the visualization at regular intervals
You can adjust settings in the config/settings.json file:
- RTD server settings
- Database configurations
- Visualization parameters
- Update intervals
Backend:
- This does not capture all trades or all market liquidity.
- The API version captures more market liquidity(A combo version might be coming..).
- This is experimental and mainly just for exploring what's possible.
