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

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

License

Notifications You must be signed in to change notification settings

massive-com/client-python

Open more actions menu
 
 

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)

Packages

No packages published

Contributors 35

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