Metadata-Version: 2.4
Name: defipipe
Version: 0.1.1
Summary: Per-block, point-in-time DeFi contract state as pandas DataFrames: Aave rates, Uniswap prices, Lido supply, aligned onto one time axis.
Project-URL: Homepage, https://defipipe.io
Project-URL: Documentation, https://defipipe.io/docs
Author: defipipe
License-Expression: MIT
Keywords: aave,blockchain-data,defi,ethereum,historical-data,lido,pandas,quant,time-series,uniswap
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial :: Investment
Requires-Python: >=3.9
Requires-Dist: pandas>=1.5
Requires-Dist: requests>=2.28
Description-Content-Type: text/markdown

# defipipe: per-block DeFi state as pandas DataFrames

**What read functions actually returned at every Ethereum block**: Aave borrow
rates, Uniswap slot0 prices, Lido total staked ETH. Reconstructed historically,
indexed live, and aligned onto one clean time axis.

Most DeFi data is built from *events*. defipipe serves *state*: the result of
calling a contract's read functions at a specific block. If you need to know
what the Aave WETH borrow rate actually was at block 19,000,000, not an hourly
average from a dashboard, this is the API for it.

## Install

```bash
pip install defipipe
```

## Five lines to an aligned DataFrame

```python
from defipipe import Client

df = Client().aligned([
    "eth:aave:v3:0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2/weth:call:getreservedata[currentvariableborrowrate]",
    "eth:lido:v2:0xae7ab96520de3a18e5e111b5eaab095312d7fe84:call:gettotalpooledether",
], freq="1h", since="2026-01-01")

df.corr()
```

No API key needed for recent data at hourly bars. Full history and per-block
granularity: get a key at https://defipipe.io/pricing and set
`DEFIPIPE_API_KEY` (or pass `api_key=`).

## Why quants use this

- **Point-in-time correctness.** Every value is the last observation **at or
  before** each interval boundary, resolved through the block↔timestamp map.
  No interpolation, no lookahead bias: safe for backtests.
- **Exact raw values.** `client.series(id)` returns `value_raw` as the exact
  on-chain string (uint256-safe) alongside the unit-scaled float.
- **One key for everything.** Canonical series IDs
  (`{chain}:{protocol}:{version}:{instance}[/{scope}]:{kind}:{metric}`) name
  every series across protocols; browse them at https://defipipe.io/datasets.
- **Per-block granularity** back to each pool's deployment, from our own
  archive node, not sampled snapshots.

## Raw per-block rows

```python
raw = Client(api_key="dp_...").series(
    "eth:uniswap:v3:0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640:call:slot0[sqrtpricex96]",
    since="2026-06-01",
)
raw.head()  # block_number → ts, value_raw, value
```

## Coverage

Aave V3, Uniswap V3, Lido today; Morpho, GMX V2, Uniswap V4, Ethena, Maple
next. Request a pool at https://defipipe.io/feature-requests; approved
requests ship with full backfilled history.
