Client for consuming Accern data feeds.
Project description
Accern Data Library
Client library for consuming Accern data feed API.
PyPI page: Click here
Installation:
pip install accern-data
Sample snippet:
import accern_data
# Create a data client.
client = accern_data.create_data_client("https://api.example.com/", "SomeRandomToken")
# Set a data format/mode in which the data has to be downloaded.
# Split dates lets you divide files on the basis of dates.
client.set_mode(mode="csv", split_dates=True) # Other modes: {"df", "json"}
Set filters:
client.set_filters({
"provider_id": 5,
"entity_name": "Hurco Companies, Inc.",
"event": "Governance - Product Development, R&D and Innovation",
"entity_ticker": "HURC",
"entity_accern_id": "BBG000BLLFK1",
})
Set parameters to the download function:
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data",
end_date="2022-03-04")
Note: To download single day's data, set end_date=None
or can leave that unset:
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data",
end_date=None)
OR
client.download_range(
start_date="2022-01-03",
output_path=".",
output_pattern="data")
One-liner download:
accern_data.create_data_client("https://api.example.com/", "SomeRandomToken").download_range(start_date="2022-01-03", output_path=".", output_pattern="data", end_date="2022-03-04", mode="csv", filters={"entity_ticker": "HURC"})
Getting data using iterator:
for res in client.iterate_range(
start_date="2022-01-03",
end_date="2022-03-04"):
do_something(res)
Error logging:
While downloading the data any critical error will get raised.
Any non-critical errors, such as API timeouts, get silenced and API calls are repeated. To see a list of the last n
errors use:
client.get_last_silenced_errors()
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
accern_data-0.2.0rc1.tar.gz
(551.6 kB
view details)
Built Distribution
File details
Details for the file accern_data-0.2.0rc1.tar.gz
.
File metadata
- Download URL: accern_data-0.2.0rc1.tar.gz
- Upload date:
- Size: 551.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9cd4be551473eb73ef43a753fca26827ac47e38702e198f79c04a5fcf9c7f0f |
|
MD5 | 3d48bab27f8abeb3e96a2b2dc0863099 |
|
BLAKE2b-256 | 901b7d1a35350f497a1ea4daed34c2f56168d8c9ff7991222f0916df0db44f3e |
File details
Details for the file accern_data-0.2.0rc1-py3-none-any.whl
.
File metadata
- Download URL: accern_data-0.2.0rc1-py3-none-any.whl
- Upload date:
- Size: 574.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1d9da0800c54deed495b221e32b33a7f24d93bd0dfaad1fd9c0f12daad0a8a |
|
MD5 | 44627bdc52203bb9c69c67e64ef3f107 |
|
BLAKE2b-256 | 21e2bca40c4f3a6afd1d05bf9692a9f63b0949b2ea79799d3a25ae8be4ab808c |