Skip to main content

Typed Python client for the Meteora DLMM Data API on Solana (pools, metrics, OHLCV, fees, APR/APY).

Project description

meteora-py

CI PyPI Docs Python License: MIT

Typed, read-only Python client for the Meteora DLMM Data API on Solana — list liquidity pools, read per-pool metrics (TVL, volume, fees, APR/APY), browse token-pair pool groups, and pull OHLCV candles and historical volume. Sync and async, backed by httpx with pydantic v2 models.

The Meteora DLMM Data API is public and keyless (rate-limited to 30 requests/second). This library covers the read endpoints; it does not build or sign transactions.

Install

pip install meteora-py

Quickstart

from meteora import MeteoraClient

with MeteoraClient() as client:
    # Protocol-wide aggregates
    stats = client.get_protocol_metrics()
    print(f"TVL ${stats.total_tvl:,.0f} across {stats.total_pools:,} pools")

    # Page through pools (sorted server-side; sort_by is "<field>:<asc|desc>")
    page = client.get_pools(page=1, page_size=10, sort_by="tvl:desc")
    for pool in page.data:
        print(f"{pool.name:16} TVL ${pool.tvl:,.0f}  APR {pool.apr:.2%}  APY {pool.apy:.0%}")

    # A single pool by its on-chain address
    sol_usdc = client.get_pool("5rCf1DM8LjKTw4YqhnoLcngyZYeNnQqztScTogYHAS6")
    print(sol_usdc.token_x.symbol, sol_usdc.token_y.symbol, sol_usdc.current_price)

    # OHLCV candles and historical volume
    candles = client.get_pool_ohlcv(sol_usdc.address)
    history = client.get_pool_volume_history(sol_usdc.address)
    print(candles.data[-1].close, history.data[-1].fees)

Async

import asyncio
from meteora import AsyncMeteoraClient

async def main() -> None:
    async with AsyncMeteoraClient() as client:
        stats = await client.get_protocol_metrics()
        print(stats.total_pools)

asyncio.run(main())

See examples/ for runnable scripts.

Covered endpoints

Base URL: https://dlmm.datapi.meteora.ag (override via MeteoraClient(base_url=...)).

Method Endpoint Client method
GET /stats/protocol_metrics get_protocol_metrics()
GET /pools get_pools(page, page_size, query, sort_by, filter_by)*
GET /pools/{address} get_pool(address)
GET /pools/groups get_pool_groups(page, page_size)
GET /pools/{address}/ohlcv get_pool_ohlcv(address, from_, to, resolution)
GET /pools/{address}/volume/history get_pool_volume_history(address)

*sort_by is a "<field>:<asc|desc>" expression (e.g. "tvl:desc"); a bare field name is rejected with HTTP 400. filter_by is a "<field>:<value>" filter expression passed through verbatim. Both were confirmed against the live API.

All endpoints were discovered and verified live against the public API. The Meteora docs also expose /portfolio, /positions, /wallets, and limit-order endpoints, plus separate DAMM v1/v2 APIs — these are out of scope for v1 and may follow in a later release.

Error handling

Every method raises MeteoraAPIError (a subclass of MeteoraError) on a non-2xx response. Network-level failures propagate as the underlying httpx exceptions.

from meteora import MeteoraClient, MeteoraAPIError

with MeteoraClient() as client:
    try:
        client.get_pool("not-a-real-address")
    except MeteoraAPIError as exc:
        print(exc.status_code, exc.message)

Models are configured with extra="allow", so fields Meteora adds over time are preserved rather than rejected.

Development

pip install -e ".[dev]"
ruff check . && ruff format --check .
mypy
pytest -q              # unit tests (respx-mocked, no network)
pytest -m integration  # one live test against the real API

License

MIT

Project details


Download files

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

Source Distribution

meteora_py-0.1.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

meteora_py-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file meteora_py-0.1.0.tar.gz.

File metadata

  • Download URL: meteora_py-0.1.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for meteora_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 112a43eaf31256c43f39af079de4950db91f56f60cc2ac60d283ecdd3a85caa2
MD5 c748554214bfd7a5c3dba6dee273f3b3
BLAKE2b-256 5683a94ff026c30d227e4e043d4b535e73306d1d35134461a8a3e77649f6e417

See more details on using hashes here.

File details

Details for the file meteora_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: meteora_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for meteora_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99fc73c7162aceecced21104ae430825cac4f87c8ba32a39f64f24a7b7caa8a6
MD5 03f17a89f55302cefacc5001b9d7ebb5
BLAKE2b-256 5de3ae9a70a1f23e0b3515075e3d7d5a6e981f481d9eb0bf6ef527dd2ec0b3e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page