Skip to main content

Aperiodic Tool

This tool connects LlamaIndex agents to Aperiodic: point-in-time market microstructure, liquidity and order-flow data for perpetual futures on Binance, OKX and Hyperliquid (crypto, tokenized stocks, indices and commodities, delisted contracts included). It uses the aperiodic Python client.

Each tool answers with a compact JSON summary (row count, first and last interval, per-column statistics and the last few rows), not the full series, so a result fits in a model's context.

Usage

pip install llama-index-tools-aperiodic
export APERIODIC_API_KEY="your-api-key"  # make a key at https://aperiodic.io/home/api

Without a key the tools use Aperiodic's public preview, which serves only a small fixed sample (see https://aperiodic.io/catalog#preview). A free account key covers a fixed sample of markets and dates; plans are listed at https://aperiodic.io/pricing.

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.aperiodic import AperiodicToolSpec

tool_spec = AperiodicToolSpec()  # reads APERIODIC_API_KEY

agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4.1"),
)

print(await agent.run("How did BTC funding on Binance move in May 2025?"))

Tools

AperiodicToolSpec exposes four tools, with the same names and arguments as langchain-aperiodic:

Tool What it returns
aperiodic_symbol_search Symbol ids for an asset across the three venues, with the first and last day Aperiodic holds data for each.
aperiodic_ohlcv OHLCV bars for one contract and date range.
aperiodic_derivatives funding, open_interest, basis or derivative_price for one contract.
aperiodic_metrics Order flow, liquidity and microstructure metrics (flow, impact, slippage, l1_liquidity, l2_imbalance and others).

Symbols are Atlas ids such as perpetual-BTC-USDT:USDT (Binance, OKX), perpetual-BTC-USDC:USDC (Hyperliquid) or perpetual-XYZ:TSLA-USDC:USDC (a Hyperliquid HIP-3 market). Dates are UTC days, end_date inclusive.

Errors from the API (an unknown symbol, a request outside the key's plan, a preview refusal) and invalid arguments are returned as the tool's text, so the agent can correct its next call. Unexpected errors are raised.

Options

AperiodicToolSpec(
    api_key=None,        # else APERIODIC_API_KEY, else the key saved by aperiodic.login()
    preview=None,        # None: key if found, else preview. True: always preview. False: require a key
    max_bars=250_000,    # refuse requests that would return more rows than this
    cache_seconds=3600,  # how long symbol lists are reused
)

To work with the full data, call the client directly (aperiodic.get_ohlcv, aperiodic.get_derivative_metrics, aperiodic.get_metrics).

Development

uv run -- pytest

The unit tests replace the client with a fake and make no network calls.

Metadata

Release files for llama-index-tools-aperiodic 0.1.0

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

Source distribution (sdist)

Source distribution for llama-index-tools-aperiodic 0.1.0
File Size Uploaded Provenance Actions
llama_index_tools_aperiodic-0.1.0.tar.gz 15.6 kB With provenance Details for llama_index_tools_aperiodic-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-aperiodic 0.1.0
File Interpreter ABI Platform Actions
llama_index_tools_aperiodic-0.1.0-py3-none-any.whl Python 3 none any Details for llama_index_tools_aperiodic-0.1.0-py3-none-any.whl

Total release size: 33.3 kB

Release files / llama_index_tools_aperiodic-0.1.0.tar.gz

Download URL llama_index_tools_aperiodic-0.1.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
be9277379c1c7bc56d38827c06d2d615598e548de1062c8d29ecd078d31494e7
BLAKE2b-256 checksum
How to use checksums
f2373eff634c90ce27948ef8a27b7e40336ad046971d49f0612a6ae7e98a23eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / llama_index_tools_aperiodic-0.1.0-py3-none-any.whl

Download URL llama_index_tools_aperiodic-0.1.0-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdb8e870f01dd1bec3245d8737948a5fc409c82ed1dadc3888501395b8990eee
BLAKE2b-256 checksum
How to use checksums
d74cb1378eefb4b2e1bab0574db7a9bb0233d3d06b5c31c613dfdf46dcbf0c64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for llama-index-tools-aperiodic 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llama_index_tools_aperiodic-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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