Registry / data / ypricemagic

ypricemagic

JSON →
library5.2.24pypypiunverified

A Python library for extracting historical on-chain price data from an archive node, supporting a wide range of tokens and protocols including Yearn, Curve, Balancer, Uniswap, and more. Current version 5.2.16, actively maintained with frequent releases.

pip install ypricemagic
INSTALL
IMPORT
SIG · YPRICEMAGIC
Y
ypricemagic
datapythonv5.2.24
Install
32.0s avg
Import
Disk
234MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.2.24 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 32.0s · import 0.000s · 232MB
234MB installed
● package 234MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

get_price
from ypricemagic import get_price
from ypricemagic.magic import get_price
get_price is exposed at the top-level package
Price
from ypricemagic import Price
from ypricemagic.price import Price
Price class is also top-level

Fetch the price of WETH at block 15,000,000. Set ETH_RPC_URL environment variable to your archive node endpoint.

import os from ypricemagic import get_price # Requires an Ethereum archive node RPC URL rpc_url = os.environ.get('ETH_RPC_URL', 'https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY') # Get ETH price in USD at a specific block price = get_price('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', block=15000000, fail_on_multiple_locators=True) print(f'Price at block 15000000: {price}')
Debug
Known issues
gotchaRequires an archive node; non-archive nodes will fail with missing state errors.
fix
Use an archive node RPC (e.g., Alchemy, Infura archive plan, or local archive node).
affects: all
deprecatedThe old import path `from ypricemagic import magic` is deprecated and will be removed.
fix
Use `from ypricemagic import get_price` directly.
affects: >=5.0.0
breakingIn v5.0.0, the internal price fetching API was restructured; custom locator classes may break.
fix
Ensure any custom price locators inherit from the new base classes; consult migration guide.
affects: >=5.0.0
Upgrade
Version history
5.2.24latest on PyPI · released Jun 19, 2026
Audit
Dependencies
web3requiredCore dependency for Ethereum node interaction
dank_midsoptionalMiddleware for efficient multi-call and batch requests
eth-brownieoptionalUsed for ABI management and contract interaction
Agent activity
54 hits · last 30 days
node
48
OpenAI (training)
1
Resources
ypricemagic — pip install ypricemagic · libregistry