Skip to main content

AGuAlpha Python Client (Overseas)

A Python library for accessing the AGuAlpha Investment Platform via the UK (eu-west-1) deployment at https://agualpha.com/api/.

Which package should I use?

  • agualpha (this one) — points to https://agualpha.com/api. Use this if you or your customers cannot reach the .cn domain (e.g. clients outside mainland China).
  • agualphacn — points to https://www.agualpha.cn/api. Use this for domestic (mainland China) deployments.

Both packages expose the same public API (AGuAlphaClient, AGuAlphaAsyncClient, identical method signatures). Only the default base_url differs.

Installation

pip install agualpha

For async support:

pip install agualpha[async]

For pandas integration:

pip install agualpha[pandas]

Configuration

Set your API key as an environment variable (recommended over passing it in code):

export AGUALPHA_API_KEY="sk-your-api-key-here"

Optional overrides:

# Point the client at a non-default gateway (e.g. staging).
export AGUALPHA_BASE_URL="https://agualpha.com/api"

No credentials other than the API key are required — the gateway handles database access on its side.

Quick Start

Synchronous Usage

from agualpha import AGuAlphaClient

with AGuAlphaClient(api_key="sk-your-api-key-here") as client:
    positions = client.get_positions(start_date="2025-01-01")
    for p in positions.data:
        print(p.date, p.outstanding, p.value)

Asynchronous Usage

import asyncio
from agualpha import AGuAlphaAsyncClient

async def main():
    async with AGuAlphaAsyncClient(api_key="sk-...") as client:
        rows = await client.get_adj_close(
            membership="csi300",
            start_date="2025-01-01",
            end_date="2025-12-31",
        )
        print(f"{len(rows)} rows")

asyncio.run(main())

API Surface

All methods mirror agualphacn exactly. List-returning methods auto-paginate when page=None (the default); pass page=int for a single page.

Method Returns Tier Notes
get_positions(...) PositionsResponse standard date filter optional
get_ideas(...) IdeasResponse standard status / direction optional
get_csi_weights(index=..., ...) list[dict] VIP index required
get_revision_fy2(...) list[dict] VIP date filter required
get_adj_close(membership=..., ...) list[dict] VIP membership + date required, supports cursor
get_p_cies(zone=...) list[dict] VIP zone required ("hk" or "cn")
get_sp_rolling_index(...) list[dict] VIP at least one filter required
get_sp_rolling_index_products() list[str] VIP no params
get_limit_evts(...) list[dict] VIP date filter required

Each list method has a _dataframe variant (get_csi_weights_dataframe, etc.) that returns a pandas.DataFrame.

CLI

A agualpha console-script is provided for quick one-off queries:

agualpha --api-key sk-... positions --start-date 2025-01-01
agualpha adj-close --membership csi300 --start-date 2025-01-01 --end-date 2025-12-31

License

MIT

Metadata

Release files for agualpha 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agualpha 0.3.1
File Size Uploaded Provenance
agualpha-0.3.1.tar.gz 18.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for agualpha 0.3.1
File Interpreter ABI Platform
agualpha-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 37.9 kB

Release files / agualpha-0.3.1.tar.gz

Download URL agualpha-0.3.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
84822d802068672e6b0b5fe9add63f9da5264e0af79f8fdb34bdfe2a9d27dd14
BLAKE2b-256 checksum
How to use checksums
43c2da76e1688a988abbe92f3e9c4d75e8b05b1bf43297c6d04bc196cd180ba5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / agualpha-0.3.1-py3-none-any.whl

Download URL agualpha-0.3.1-py3-none-any.whl
Size 19.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6c7671fb208f56a6f1b2d5af901a3a4114f10580506e85bdc9d5a31430b175c
BLAKE2b-256 checksum
How to use checksums
1f2064ba091c12f41d12fa679e0bf47c778c3ece207d57743d8ebf360396a525
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for agualpha 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page