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.
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.
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.
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.
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.
If you prefer to test manually using cURL to access the REST API, you can add the
option which adds the
header to enable gzip compression. To do this, include the following flag in your cURL request (optionally add
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.
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.
See what's happening at polygon.io
Discover the newly launched Universal Snapshots API, a powerful tool providing streamlined and consistent market data across Stocks, Options, Indices, Forex, and Crypto assets, all in one API call - enhancing your market analysis and decision-making process.