Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

Copy link

Copilot AI commented Oct 29, 2025

Enhanced stocks-trades.py to download all trades for a ticker across a date range and export to Parquet format. Configured for IREN ticker over calendar year 2025.

Changes

  • Date range iteration: Processes trades day-by-day from configurable start/end dates (2025-01-01 to 2025-12-31)
  • Pagination handling: Leverages client's automatic pagination at max limit (50,000 records/request)
  • Parquet export: Converts Trade objects to DataFrame and outputs compressed Parquet file
  • Progress tracking: Reports per-day trade counts and total statistics
  • Dependencies: Added pandas (2.3.3) and pyarrow (22.0.0) with Python >=3.10 constraint for pyarrow

Usage

# Configuration at top of stocks-trades.py
TICKER = "IREN"
START_DATE = "2025-01-01"
END_DATE = "2025-12-31"
OUTPUT_FILE = f"{TICKER}_trades_{START_DATE}_to_{END_DATE}.parquet"

# Run with API key
export POLYGON_API_KEY="your_key"
python stocks-trades.py

Output: IREN_trades_2025-01-01_to_2025-12-31.parquet containing all trade fields (price, size, timestamps, conditions, etc.)

See examples/rest/STOCKS_TRADES_README.md for full documentation.

Original prompt

On stocks-trades.py, I want to create a python script using the rest client to download all of the trades for a specified ticker given a specified date range. For now we can output the file to a parquet format. For testing I want to use the ticker IREN and for the period all trades in 2025. You'll have to deal with some kind of pagination or request pause due to the api limit of 50000 records per call.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits October 29, 2025 07:33
…format

Co-authored-by: CCLNTN <24383619+CCLNTN@users.noreply.github.com>
Co-authored-by: CCLNTN <24383619+CCLNTN@users.noreply.github.com>
Co-authored-by: CCLNTN <24383619+CCLNTN@users.noreply.github.com>
Copilot AI changed the title [WIP] Add script to download trades for specified ticker Add trade downloader script with Parquet export for date ranges Oct 29, 2025
Copilot AI requested a review from CCLNTN October 29, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.