Introducing

Speed Up Downloads: Gzip Compression for Polygon's API

Mar 28, 2023

In our continuous effort to improve user experience, we've enabled gzip compression by default in our latest Python and Golang client libraries. In this blog, we'll explore the advantages of using gzip compression, and how you can implement it using Python, Go, and cURL.

Why It Matters

Gzip compression significantly reduces the amount of data transferred during downloads, resulting in quicker and more efficient downloads. By compressing your market data, you can save bandwidth and reduce the latency of your data processing pipeline. It's a win-win situation for developers and traders alike.

Getting Started with Python

To take advantage of gzip compression in Python, simply update to the latest version of the Polygon's Python client library. You can do this by running:

pip install polygon-api-client --upgrade

With the updated library, gzip compression will be enabled by default, allowing you to experience faster downloads without making any code changes.

Getting Started with Go

For Golang users, update to the latest version of the Polygon's Go client library to enable gzip compression by default. To update, run:

go get github.com/polygon-io/client-golang

With the latest library, you'll enjoy the benefits of gzip compression without having to modify your existing code.

Getting started with JVM

For those using Polygon's client libraries with JVM languages like Java, Kotlin, or Scala, we have great news! Gzip compression support has already been added and is enabled by default. This means you don't have to worry about any additional setup or configuration to take advantage of faster downloads and reduced latency. Simply use the latest version of the JVM client library and enjoy the benefits of gzip compression with no extra effort.

Adding the Header Manually via cURL

If you prefer to test manually using cURL to access the REST API, you can add the

--compressed
option which adds the
"Accept-Encoding: gzip"
header to enable gzip compression. To do this, include the following flag in your cURL request (optionally add
-v
to show the headers):

curl --compressed [API_ENDPOINT]

Replace [API_ENDPOINT] with the desired API endpoint. The curl command will decompress the response on-the-fly, allowing you to process the data as usual.

Next Steps

We hope you found this guide useful in optimizing your market data downloads. Staying up-to-date with the latest versions of our client libraries ensures you have access to the most recent features and improvements. Enjoy faster downloads, lower latency, and an overall better experience with gzip compression on Polygon.io's REST API.

From the blog

See what's happening at polygon.io

polygon plugin for chatgpt Feature Image
announcement

Announcing the Polygon ChatGPT Plugin

Introducing the Polygon plugin for ChatGPT, a powerful tool that simplifies financial research by providing easy access to real-time and historical market data for Stocks, Options, Indices, Forex, and Crypto.

Team Polygon Profile Photo

editor

Team Polygon

indices data has arrived Feature Image
announcement

Indices Data Has Arrived

We are excited to announce the launch of the Indices API endpoints, offering real-time and historical market data for over 11,400+ Indices, including the S&P 500, Dow Jones Industrial Average, Nasdaq-100, and the VIX. With access to comprehensive market data, businesses and individual investors can make informed decisions in today's rapidly evolving financial markets. We have brought the same low-latency and developer-centric API design of our

Team Polygon Profile Photo

editor

Team Polygon