Metadata-Version: 2.4
Name: coinalyze
Version: 0.1.0
Summary: Unofficial Python client for coinalyze.net REST API
Project-URL: Homepage, https://github.com/ivarurdalen/coinalyze
Project-URL: Source, https://github.com/ivarurdalen/coinalyze
Project-URL: Changelog, https://github.com/ivarurdalen/coinalyze/blob/main/CHANGELOG.md
Author-email: Ivar Soares Urdalen <ivar.urdalen@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: httpx
Requires-Dist: httpx-retries
Requires-Dist: pyrate-limiter
Provides-Extra: pandas
Requires-Dist: pandas; extra == 'pandas'
Description-Content-Type: text/markdown

# coinalyze

[![Ruff][ruff-badge]](https://github.com/astral-sh/ruff)
[![PyPI][pypi-badge]](https://pypi.org/project/coinalyze/)
[![Python versions][python-versions-badge]](https://github.com/ivarurdalen/coinalyze)
[![MIT License Badge][license-badge]][license]

This is an unofficial Python client for [coinalyze.net REST API](https://api.coinalyze.net/v1/doc/).

## Features

- Implementation of all endpoints.
- Uses [httpx](https://www.python-httpx.org/) for making HTTP requests
- Uses [pyrate-limiter](https://github.com/vutran1710/PyrateLimiter/tree/master) for maintaining [40 API calls per minute](https://api.coinalyze.net/v1/doc/).
- Uses [httpx-retries](https://github.com/will-ockmore/httpx-retries) for handling retries.
- Provides convenience functions to get results as pandas DataFrames

## Installation

```bash
pip install coinalyze
```

## Usage

1. Add your API key from [coinalyze.net](https://coinalyze.net/account/api-key/) to your environment variables as `COINALYZE_API_KEY`.
2. Then use the client as shown in the example below.

See more examples in the [coinalyze_client notebook](https://github.com/ivarurdalen/coinalyze/tree/main/examples/coinalyze_client.ipynb).

```python
import os
from coinalyze import CoinalyzeClient, HistoryEndpoint, Interval, response_to_df, history_response_to_df

client = CoinalyzeClient(api_key=os.getenv("COINALYZE_API_KEY"))

# Get exchange information as a list of dictionaries
client.get_exchanges()

# Get the supported future markets as a DataFrame
future_markets_df = response_to_df(client.get_future_markets())

# Get the current predicted funding rate
response = client.get_current_predicted_funding_rate("BTCUSDT_PERP.A")

# Get the open interest history as a DataFrame for a symbol
oi_df = client.get_history_df(
        endpoint=HistoryEndpoint.OI,
        symbols="BTCUSDT_PERP.A",
        interval=Interval.H4,
        start="2025-06-01",
        end="2025-06-20",
    )
```

[ruff-badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[license]: ./LICENSE
[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg
[python-versions-badge]: https://img.shields.io/pypi/pyversions/coinalyze.svg
[pypi-badge]: https://img.shields.io/pypi/coinalyze.svg
