From 1ccaab92371332c5f0f5608e9d051364189fd991 Mon Sep 17 00:00:00 2001 From: Terence Lim Date: Mon, 23 Mar 2026 16:21:20 +0800 Subject: [PATCH] Add cursor parameter --- README.md | 6 ++++++ cli/commands/realtime.py | 29 ++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dcb27fd..3c92c67 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,12 @@ allium realtime prices history \ --start-timestamp 2026-01-01T00:00:00Z --end-timestamp 2026-01-07T00:00:00Z \ --time-granularity 1d +# Historical price series with cursor +allium realtime prices history \ + --chain solana --token-address So11111111111111111111111111111111111111112 \ + --start-timestamp 2024-08-17T13:00:00Z --end-timestamp 2025-08-17T20:00:00Z \ + --time-granularity 5m --cursor eyJzb2xhbmEiOiAiZXlKc1lYTjBYM1JwYldWemRHRnRjQ0k2SUNJeU1ESTBMVEV5TFRJeUlEQTJPalF3T2pBd0luMD0ifQ== + # 24h/1h price stats (high, low, volume, trade count, percent change) allium realtime prices stats \ --chain solana --token-address So11111111111111111111111111111111111111112 diff --git a/cli/commands/realtime.py b/cli/commands/realtime.py index e74361d..b74d790 100644 --- a/cli/commands/realtime.py +++ b/cli/commands/realtime.py @@ -131,6 +131,11 @@ def build() -> dict[str, Any]: type=click.Choice(["15s", "1m", "5m", "1h", "1d"]), help="Aggregation interval for price data.", ) +@click.option( + "--cursor", + default=None, + help="Cursor for pagination.", +) @click.pass_context @async_command async def prices_history( @@ -140,6 +145,7 @@ async def prices_history( start_timestamp: str, end_timestamp: str, time_granularity: str, + cursor: str | None, body: str | None, ) -> None: """fetch historical price series for tokens over a time range. @@ -159,7 +165,12 @@ def build() -> dict[str, Any]: return payload payload = load_body_or_build(body, build) - resp = await client.post("/api/v1/developer/prices/history", json=payload) + params: dict[str, Any] = {} + if cursor is not None: + params["cursor"] = cursor + resp = await client.post( + "/api/v1/developer/prices/history", json=payload, params=params + ) output_response(ctx, resp) @@ -337,6 +348,11 @@ def build() -> list[dict[str, str]]: type=click.IntRange(1, 5000), help="Max results (up to 5000).", ) +@click.option( + "--cursor", + default=None, + help="Cursor for pagination.", +) @click.pass_context @async_command async def balances_history( @@ -346,6 +362,7 @@ async def balances_history( start_timestamp: str, end_timestamp: str, limit: int | None, + cursor: str | None, body: str | None, ) -> None: """fetch historical token balance snapshots (raw) over a time range.""" @@ -362,6 +379,8 @@ def build() -> dict[str, Any]: params: dict[str, Any] = {} if limit is not None: params["limit"] = limit + if cursor is not None: + params["cursor"] = cursor resp = await client.post( "/api/v1/developer/wallet/balances/history", json=payload, params=params ) @@ -387,6 +406,11 @@ def build() -> dict[str, Any]: type=click.IntRange(1, 1000), help="Max results (up to 1000).", ) +@click.option( + "--cursor", + default=None, + help="Cursor for pagination.", +) @click.pass_context @async_command async def transactions( @@ -396,6 +420,7 @@ async def transactions( activity_type: str | None, lookback_days: int | None, limit: int | None, + cursor: str | None, body: str | None, ) -> None: """fetch transaction activity for wallets. @@ -415,6 +440,8 @@ def build() -> list[dict[str, str]]: params["lookback_days"] = lookback_days if limit is not None: params["limit"] = limit + if cursor is not None: + params["cursor"] = cursor resp = await client.post( "/api/v1/developer/wallet/transactions", json=payload, params=params )