Back to Browse

Polygon API for Options Data: Python Tutorial to Get Aggregates & Strike Prices

3.9K views
Oct 16, 2024
14:33

@MattMacarty **Master the Polygon API to quickly and reliably fetch options data using Python and Pandas!** This step-by-step tutorial walks you through everything you need to get options data, from understanding the complex options ticker format to efficiently converting the raw API response into a clean, time-series Pandas DataFrame. You will learn how to: 1. **Format Option Symbols** correctly for Polygon. 2. Use the `get_aggs` endpoint for options price bars. 3. Fetch data for **multiple strikes** around the current price. --- ### ⏱️ Video Chapters (Polygon Options API Guide) Use these detailed timestamps to quickly navigate the tutorial: 0:00 - Introduction to Polygon API Options Data 1:01 - **Understanding Option Ticker Symbols** (The Polygon Format) 1:46 - Calling the API: Using `client.get_aggs()` for Option Price Bars 4:38 - Writing a **Python Function to Create a Pandas DataFrame** 6:10 - Cleaning the Data: Converting Millisecond Timestamps to Date Index 7:22 - Strategy: How to Get Multiple Strike Prices (Dealing with API Limits) 9:48 - Fetching the Last Close Price for **At-The-Money (ATM)** Calculation 12:18 - **Automating Symbol Creation** for Multiple Strikes (F-Strings) 13:48 - Final Code: Fetching Data for a List of Option Symbols --- ### 🔗 Resources & Next Steps ✅ **Please SUBSCRIBE:** [https://www.youtube.com/subscription_center?add_user=mjmacarty](https://www.youtube.com/subscription_center?add_user=mjmacarty) ✅ **Get the code:** [https://github.com/mjmacarty/algorithmic-trading](https://github.com/mjmacarty/algorithmic-trading) ✅ **Watch the first part (Polygon API Overview):** [https://youtu.be/mhUKp-VMJXk](https://youtu.be/mhUKp-VMJXk) ✅ **Learn basic algo trading here:** [https://youtu.be/Dek7sKHJ7Zw](https://youtu.be/Dek7sKHJ7Zw) ✅ **Learn how to use Quantstats as a stand-alone backtester:** [https://youtu.be/VzE2nV39cQg](https://youtu.be/VzE2nV39cQg) ✅ **Visit Alphabench for more Excel, Python and MySQL tutorials:** [https://alphabench.com](https://alphabench.com)

Download

0 formats

No download links available.

Polygon API for Options Data: Python Tutorial to Get Aggregates & Strike Prices | NatokHD