The project organizes data files in dedicated directories to keep the repository clean and separate code from data.
spx_option_chain_fetcher/
├── database/ # SQLite database files (gitignored)
│ └── option_chain_data.db # Main option chain database
│
├── json_exports/ # Exported JSON files (gitignored)
│ ├── spx_options_2025-10-06_*.json
│ ├── spx_options_2025-10-07_*.json
│ └── ...
│
├── *.log # Log files (gitignored)
│ ├── option_chain_fetcher.log
│ └── ...
│
├── option_chain_fetcher.py # Main data collection script
├── export_to_json.py # JSON export script
├── query_option_data.py # Database query helper
├── market_data.py # Market data interface
├── session.py # TastyTrade session management
│
├── OPTION_CHAIN_USAGE.md # Usage guide
├── JSON_EXPORT_GUIDE.md # Export documentation
├── CHANGES.md # Change log
│
├── requirements.txt # Python dependencies
├── .env # API credentials (gitignored)
├── config.ini # Configuration (gitignored)
└── .gitignore # Git ignore rules
The following directories are automatically created when needed:
- Created by:
option_chain_fetcher.py - Purpose: Stores SQLite database files
- Default file:
option_chain_data.db - Git status: Ignored (not committed)
- Created by:
export_to_json.py - Purpose: Stores exported JSON files
- Files: One JSON file per expiration date
- Git status: Ignored (not committed)
The following are excluded from version control:
# Database files
database/
*.db
*.db-journal
# JSON exports
json_exports/
# Log files
*.log
*.log.*
# Configuration
config.ini
.env
.secretsAll scripts use these default paths (can be overridden with CLI arguments):
--db_path database/option_chain_data.db--db_path database/option_chain_data.db
--output_dir json_exports--db_path database/option_chain_data.dbYou can specify custom paths for any script:
# Use custom database location
python option_chain_fetcher.py \
--max_dte 7 \
--min_strike 5800 \
--max_strike 6000 \
--db_path /path/to/my/data.db
# Export to custom directory
python export_to_json.py \
--db_path /path/to/my/data.db \
--output_dir /path/to/exports- Clean repository: Data files don't clutter the codebase
- Version control: Only code and documentation are committed
- Easy cleanup: Delete entire folders to start fresh
- Organized: Clear separation between code and data
- Portable: Move/backup data directories independently
If you have existing database files from previous versions:
# Create database directory
mkdir -p database
# Move existing database
mv option_chain_data.db database/
# Scripts will now find it automatically
python export_to_json.py