https://github.com/quantopian/aqueduct-client
Python wrapper for Quantopian's Aqueduct API
https://github.com/quantopian/aqueduct-client
Last synced: 9 months ago
JSON representation
Python wrapper for Quantopian's Aqueduct API
- Host: GitHub
- URL: https://github.com/quantopian/aqueduct-client
- Owner: quantopian
- License: apache-2.0
- Created: 2019-05-10T18:14:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-04-07T02:37:25.000Z (almost 3 years ago)
- Last Synced: 2025-04-15T07:42:44.855Z (9 months ago)
- Language: Python
- Size: 59.6 KB
- Stars: 2
- Watchers: 12
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
``AqueductClient``
==================
``AqueductClient`` is a simple Python wrapper around Quantopian's Aqueduct API.
It lets you easily create Pipeline executions and load their results.
``AqueductClient`` supports Python 2.7 and Python 3.4+.
Installation
~~~~~~~~~~~~
.. code-block:: shell
$ pip install aqueduct-client
Configuration
~~~~~~~~~~~~~
To use ``AqueductClient``, you need a Quantopian API Key. Once you have it, there
are several ways to use it:
1) Use a credentials file: create ``~/.quantopian/credentials`` (Linux or OS X) or ``%UserProfile%\.quantopian\credentials`` (Windows) and put the following in it:
.. code-block:: shell
[default]
API_KEY = your_api_key
Users with Windows can follow the steps below in the Command Prompt:
a) cd %UserProfile%
b) mkdir .quantopian
c) cd .quantopian
d) echo [default] >> credentials && echo API_KEY = 'enter your api key here inside single quotes' >> credentials
2) Use an environment variable: set ``QUANTOPIAN_API_KEY`` to your API key.
3) Pass your API key directly into the ``create_client`` method (see below) using the ``api_key`` kwarg.
Usage
~~~~~
Note: Fuller documentation is available at https://factset.quantopian.com/docs/user-guide/tools/aqueduct.
To use ``AqueductClient``, create an instance. In this case, we are loading credentials from disk or environment variable.
.. code-block:: python
from aqueduct_client import create_client
from aqueduct_client.utils import load_api_key
API_KEY = load_api_key()
client = create_client(API_KEY)
To run a new pipeline execution, use ``submit_pipeline_execution``. Required parameters are ``code`` (string), ``start_date`` and ``end_date`` (date-like strings, dates, or Pandas timestamps). Optional parameters are ``name`` (string), ``params`` (a dict of parameters to pass to your pipeline), and ``asset_identifier_format`` (which can be "symbol", "sid", and "fsym_region_id"). ``submit_pipeline_execution`` returns an id, which you can pass to ``get_pipeline_execution`` to monitor this pipeline's execution status.
``get_all_pipeline_executions`` and ``get_pipeline_execution(id)`` let you load existing pipelines. Each pipeline has a ``status`` field, which can be ``IN-PROGRESS``, ``SUCCESS``, or ``FAILED``.
For a successful pipeline, ``get_pipeline_results_dataframe(id)`` loads that pipeline's results into a pandas DataFrame. For a failed pipeline, ``get_pipeline_execution_error(id)`` shows you the information about the error.