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.2.0.tar.gz (17.1 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.2.0-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agualpha-0.2.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agualpha-0.2.0.tar.gz
Algorithm Hash digest
SHA256 94e095ded2b212f29d1a1b1e7db73de61a3b6af78a05fae38a74d110209b2303
MD5 9357584e58f102b61a7978f04da837eb
BLAKE2b-256 c659c0417856538aa47525b69f0349dea79bd821929d4d79c77bf5da714d16c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for agualpha-0.2.0.tar.gz:

Publisher: publish.yml on yvasseur33/agualpha-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: agualpha-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for agualpha-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca7c4920c3dbd744e605a7be5c67e8ca7fc1c395380556dd4f91eda4d1c4a9d
MD5 ac5d8fbff626ef25b220b0d141b6917a
BLAKE2b-256 17cf451e1f89b2df59e83d107729f2a6cbd61be94022ba250dacc855893315ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for agualpha-0.2.0-py3-none-any.whl:

Publisher: publish.yml on yvasseur33/agualpha-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.0 This release

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