Introducing

Simplifying Data Access with CSV Support

Mar 23, 2023

We are excited to announce the launch of CSV support for our REST APIs. You can now choose between JSON and CSV formats when making requests to our platform for Stocks, Options, Forex, and Crypto market data. With the addition of CSV support, you no longer need to transform or convert the data manually, which makes working with financial data more accessible. In this blog, we will walk you through the new feature, provide examples, as well as links to our docs for reference.

Getting Started

By default, all requests to our REST APIs are returned in JSON format. However, with the launch of CSV support anyone with a Starter Plan or above, will see an option to choose between JSON and CSV formats when making requests. Let's look at a few examples of how this works in practice.

When using the API documentation, there is a very useful feature where you can interactively make API requests to endpoints and see the responses. This feature has been updated with a select box where you can choose between JSON or CSV as the output format. After executing these requests you can see the formatted CSV data in a table view, view the raw response, or download the CSV file.

In addition to making requests via the web interface, you can also access data from our REST APIs via the command line. To retrieve data in CSV format, simply pass a header "Accept: text/csv" along with your request. This will change the output format from JSON to CSV, making it easy to retrieve financial data in the format that best suits your needs.

curl -H 'Accept: text/csv' "https://api.polygon.io/v2/aggs/grouped/locale/us/market/stocks/2023-03-01?adjusted=true&apiKey=XXXXX"

Here's what the output looks like when making a request to the Group Daily (Bars) API in CSV format. As you can see from the example below, the data is returned in a comma-separated format with each line representing a single data point. This makes it easy to process and analyze the data using tools like Excel or Python.

CHII,1,13.145,0,13.094,13.094,13.094,13.094,1677704400000,1,,0,,0,0,0,0,0,false
EZJ,0,0,0,29.2767,29.2767,29.2767,29.2767,1677704400000,0,,0,,0,0,0,0,0,false
GLCN,0,0,0,27.4634,27.4634,27.4634,27.4634,1677704400000,0,,0,,0,0,0,0,0,false
FIHD,0,0,0,206.4024,206.4024,206.4024,206.4024,1677704400000,0,,0,,0,0,0,0,0,false
BCIM,0,0,0,24.8964,24.8964,24.8964,24.8964,1677704400000,0,,0,,0,0,0,0,0,false
CRUZ,0,0,0,18.8461,18.8461,18.8461,18.8461,1677704400000,0,,0,,0,0,0,0,0,false
LD,0,0,0,46.93,46.93,46.93,46.93,1677704400000,0,,0,,0,0,0,0,0,false
MVV,0,0,0,54.27,54.27,54.27,54.27,1677704400000,0,,0,,0,0,0,0,0,false

This is just a small sample of what's possible with our new CSV support feature. With this capability, you can easily access, analyze, and process financial data in a format that best suits your needs.

Next Steps

We hope this blog post has provided you with a better understanding of our new CSV support feature and how it can help you streamline your workflow when working with financial data. With the option to choose between JSON and CSV formats, you now have more flexibility and accessibility when accessing market data via our REST APIs.

We encourage you to explore our new feature and see how it can save you time and effort when working with financial data. For more information and support, please visit our documentation and feel free to reach out to our support team with any questions or feedback.

From the blog

See what's happening at polygon.io

integration quantconnect Feature Image
featured

Integration: QuantConnect

We are excited to announce our integration with QuantConnect! This offering empowers users with state-of-the-art research, backtesting, parameter optimization, and live trading capabilities, all fueled by the robust market data APIs and WebSocket Streams of Polygon.io.