Skip to main content

Client for consuming Accern data feeds.

Project description

Accern Data Library

Python Checks Latest release Python versions Downloads

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


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.0.4.tar.gz (514.1 kB view details)

Uploaded Source

Built Distribution

accern_data-0.0.4-py3-none-any.whl (536.5 kB view details)

Uploaded Python 3

File details

Details for the file accern_data-0.0.4.tar.gz.

File metadata

  • Download URL: accern_data-0.0.4.tar.gz
  • Upload date:
  • Size: 514.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for accern_data-0.0.4.tar.gz
Algorithm Hash digest
SHA256 287cad1f88158971f2e0e42ce909549431b0750355225235b1c70b287dd9f3fe
MD5 07673d37c38905ef9782a60ae528a054
BLAKE2b-256 ef474e7227346eb6b5fab3cb8dc2b9399f9e10ba506329f1e86c516c638c2002

See more details on using hashes here.

File details

Details for the file accern_data-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: accern_data-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 536.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for accern_data-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9ff49c4d5c95bca56e0439a81adc4427fd4559b0659aaa786b15d76f3d616add
MD5 4e3f060d8d1169317b24313f50e1ec99
BLAKE2b-256 573e6de58fac5477558d082572802a41de46dac4bb9c7a96c0197f33f98e1afb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page