High performance asyncio REST client for polygon.io
Project description
Upoly
An Asyncio based, high performance, REST client libary for interacting with the polygon REST api.
Abstract
The two main python rest-client libs for polygon.io(alpaca-trade-api, polygonio) do not provide an effective means to gather more than 50,000 trade bars at once. This library aims to address that by providing an easy and performant solution to getting results from timespans where the resultset exceeds 50,000 trade bars.
Installation
This library makes use of some high performance packages written in C/Rust
(uvloop, orjson) so it may require sudo apt install python3-dev on Ubuntu or similar on
other OS's. It is currently only compatible with Python 3.8.x but aims to be
compatible with 3.9 once it's dependendencies support 3.9
and all future CPython versions moving forward.
pip/poetry w/ venv
#!/bin/env bash
python3.8 -m venv .venv && source .venv/bin/activate
poetry add upoly
# or
pip install upoly
Usage
Reccomend to create a copy of ./env.sample as ./env. Make sure .env is listed
in .gitignore.
# ./.env
POLYGON_KEY_ID=REPACEWITHPOLYGONORALPACAKEYHERE
Many alternatives to .env exist. One such alternative is exporting
like so:
#!/bin/env bash
export POLYGON_KEY_ID=REPACEWITHPOLYGONORALPACAKEYHERE
or adding to your shell startup script, either .zshrc or .bashrc to have
it be globally available to all projects.
#/home/youruseraccount/.bashrc
...
export POLYGON_KEY_ID=REPACEWITHPOLYGONORALPACAKEYHERE
...
# ./yourscript.py
import pytz
from dotenv import load_dotenv
import pandas as pd
# load Polygon key from .env file
load_dotenv()
# alternatively run from cli with:
# POLYGON_KEY_ID=@#*$sdfasd python yourscript.py
# Not recommend but can be set with os.environ["POLYGON_KEY_ID"] as well
from upoly import async_polygon_aggs
NY = pytz.timezone("America/New_York")
# Must be a NY, pandas Timestamp
start = pd.Timestamp("2015-01-01", tz=NY)
end = pd.Timestamp("2020-01-01", tz=NY)
df = async_polygon_aggs("AAPL", start, end)
TODO
- unit tests
- regression tests
- integration tests
-
/tradeendpoint functionality for tick data
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file upoly-0.1.34.tar.gz.
File metadata
- Download URL: upoly-0.1.34.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03b42c18fe50b9a2b313650df18e2b9edd6d7cbd04b28fea1d104c0009af9cbf
|
|
| MD5 |
07330136994c920f9380d1b635a8fd8e
|
|
| BLAKE2b-256 |
6f09d546b098acc7d1406e645c61c1caee6845b19e3def2d491f289bd0e16788
|
File details
Details for the file upoly-0.1.34-py3-none-any.whl.
File metadata
- Download URL: upoly-0.1.34-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.2 CPython/3.8.7 Linux/5.4.0-1039-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
233bb4cdadab10a8f1775455594fb7c95079eba504567c390ffabbc5d8a0bb4d
|
|
| MD5 |
2ff8d526ad57acc98a305c5115c9305d
|
|
| BLAKE2b-256 |
d9fa5ec80b8a019f32eef7711a6afa3b904861828aaf52b8061277839873f813
|