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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agualpha-0.3.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agualpha-0.3.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file agualpha-0.3.0.tar.gz.

File metadata

  • Download URL: agualpha-0.3.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agualpha-0.3.0.tar.gz
Algorithm Hash digest
SHA256 11413d1041e567a4a6d413f323a8a7c33a78ee90e266172b01478d5436480110
MD5 daba16941a1e90103a40a18f76bd59d5
BLAKE2b-256 169d658da5ea0261c9db2f318299d4b3f8d2fa51bf9af95c57d5904338906492

See more details on using hashes here.

File details

Details for the file agualpha-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: agualpha-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agualpha-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b54a9fbac177df2657309c016ddd94b479b305516aff2b84ec213bb96a674a7
MD5 bb5948eefc5d05b53dfc3034c349df3e
BLAKE2b-256 cf39fb067edfe16da0d195ede104fe1a1d1992cd9fa75e8ca01188301f4f4dc7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

0.2.0

2 files

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