Back to Browse

Polygon API Python REST Tutorial (Free Account): Get Aggregates & Grouped Daily Prices

5.6K views
Sep 26, 2024
10:49

@MattMacarty **Master the Polygon Data REST API to fetch stock market data using Python and Pandas!** This step-by-step tutorial is an essential guide for developers and financial analysts, demonstrating how to use the Polygon client library to access historical data, even with a **free account**. Learn to call the API, understand the response (Aggregates), and efficiently clean the raw data into a usable time-series Pandas DataFrame. We cover key functions for both single-ticker data and bulk data retrieval for the entire market. --- ### ⏱️ Video Chapters (Polygon REST API Masterclass) Use these detailed timestamps to quickly navigate the tutorial: 0:00 - Introduction to Polygon API and **Free Account Limitations** 1:39 - **Installation & Setup** (Importing the REST Client and Pandas) 2:21 - Calling the API: Using **`client.get_aggs()`** for Price Bars 3:57 - Understanding the **Aggregate Object** (Open, Low, High, Close, VWAP, Transactions) 6:03 - **Data Cleaning:** Converting Millisecond Timestamps to Date Index 6:59 - Example: Getting **Minute-by-Minute** Data (Running into the 50K Limit) 8:57 - Bulk Data: Using **`client.get_grouped_daily_aggs()`** to Get ALL Tickers 9:40 - Excluding OTC Markets from the Bulk Download --- ### 💻 Key Functions & Libraries: * **Library:** Polygon REST Client * **Endpoint:** `client.get_aggs()` (Aggregates/Price Bars) * **Endpoint:** `client.get_grouped_daily_aggs()` (Bulk Data) * **Library:** Pandas (`pd.DataFrame`, `pd.to_datetime`) ### 🔗 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) ✅ **Next Step: Master Polygon API for Options Data:** [https://youtu.be/0xOHf3UfZdY](https://youtu.be/0xOHf3UfZdY) ✅ **Learn how to use Quantstats as a stand-alone backtester:** [https://youtu.be/VzE2nV39cQg](https://youtu.be/VzE2nV39cQg) ✅ **Learn the algo trading basics here:** [https://youtu.be/Dek7sKHJ7Zw](https://youtu.be/Dek7sKHJ7Zw) ✅ **Visit Alphabench for more Excel, Python and MySQL tutorials:** [https://alphabench.com](https://alphabench.com)

Download

0 formats

No download links available.

Polygon API Python REST Tutorial (Free Account): Get Aggregates & Grouped Daily Prices | NatokHD