Skip to content

About

The official Python client library for the Massive.com REST and WebSocket API.

Topics

Resources

Stars

1.5k stars

Watchers

41 watching

Forks

 
 

Repository files navigation

PyPI version Docs

Polygon Python Client - WebSocket & RESTful APIs

Python client for the Polygon.io API.

Getting started

Install

pip install polygon-api-client

Requires python version >= 3.7

Getting aggs

from polygon import RESTClient

client = RESTClient() # Uses POLYGON_API_KEY env var. Can optionally supply your key.
aggs = client.get_aggs("AAPL", 1, "day", "2005-04-01", "2005-04-04")

Getting trades

from polygon import RESTClient
from polygon.rest.models import Sort

client = RESTClient() # Uses POLYGON_API_KEY env var. Can optionally supply your key.

trades = []
for t in client.list_trades("AAA", timestamp="2022-04-20", limit=5, sort=Sort.ASC):
    trades.append(t)

Getting raw response

To handle the raw urllib3 response yourself, pass raw=True:

from polygon import RESTClient

client = RESTClient() # Uses POLYGON_API_KEY env var. Can optionally supply your key.
response = client.get_aggs("AAPL", 1, "day", "2005-04-01", "2005-04-04", raw=True)

About

The official Python client library for the Massive.com REST and WebSocket API.

Topics

Resources

Stars

1.5k stars

Watchers

41 watching

Forks

Releases

Packages

Used by

Contributors

Languages