Skip to main content

Use this tool to extract historical on-chain price data from an archive node. Shoutout to @bantg and @nymmrx for their awesome work on yearn-exporter that made this library possible.

Project description

ypricemagic

PyPI Monthly Downloads

Use this tool to extract historical on-chain price data from an archive node.

ypricemagic is built to work seamlessly with both sync and async Python codebases using the ez-a-sync framework.

Requirements

  • Python 3.9 or higher.
  • At least 16GB of RAM.

Prerequisites

  • First, you will need to bring your own archive node. This can be one you run yourself, or one from one of the common providers (Tenderly, Alchemy, QuickNode, etc.)
  • You will also need an auth token for Etherscan's API. Follow their guide to get your key, and set env var ETHERSCAN_TOKEN with its value.

Installation

ypricemagic is published on PyPI. Simply install it just as you would any other library.

pip install ypricemagic

Network Configuration

ypricemagic utilizes the Brownie framework for Ethereum smart contract interactions. As such, it's essential that users configure a Brownie network to use their chosen RPC. Ensure you have access to an Ethereum node (e.g., through Infura or Alchemy) and add the provided API endpoint to your Brownie network configuration.

Refer to the Brownie documentation on network management for detailed guidance on setting up your networks. This setup is critical, as without it, ypricemagic will not be able to communicate with your RPC.

Usage

There are 2 main entrypoints to ypricemagic, y.get_price and y.get_prices.

from y import get_price
price = get_price(token,block)

# OR

from y import get_prices
prices = get_prices(tokens, block)

You can also use ypricemagic asynchronously:

price = await get_price(token, block, sync=False)

# OR

prices = await get_prices(tokens, block, sync=False)

See the docs for more usage information.

Debug logging

If you need to spot long-running async calls, enable the y.stuck? logger at DEBUG to get periodic "still executing" messages. Details: y.stuck? logger.

Extras

You can also import protocol specific modules. For example:

from ypricemagic import uniswap
uniswap.get_price(token, block)
from ypricemagic.compound import get_price
get_price(compoundToken, block)

These are not 'supported' per se and are subject to change at any time. But they can come in handy. The not-very-organized docs site will be your friend here.

Enjoy!

Shoutouts

Shoutout to Banteg (@bantg) and nymmrx (@nymmrx) for their awesome work on yearn-exporter that made this library possible.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ypricemagic-5.2.11.tar.gz (280.2 kB view details)

Uploaded Source

Built Distributions

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

ypricemagic-5.2.11-cp313-cp313-win_amd64.whl (470.8 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.11-cp313-cp313-win32.whl (443.0 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.11-cp313-cp313-musllinux_1_2_x86_64.whl (713.2 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (716.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ypricemagic-5.2.11-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (740.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.11-cp313-cp313-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.11-cp312-cp312-win_amd64.whl (470.4 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.11-cp312-cp312-win32.whl (443.1 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.11-cp312-cp312-musllinux_1_2_x86_64.whl (718.1 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (722.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ypricemagic-5.2.11-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.11-cp312-cp312-macosx_11_0_arm64.whl (526.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.11-cp311-cp311-win_amd64.whl (469.0 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.11-cp311-cp311-win32.whl (441.1 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.11-cp311-cp311-musllinux_1_2_x86_64.whl (705.5 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (700.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ypricemagic-5.2.11-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (706.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.11-cp311-cp311-macosx_11_0_arm64.whl (524.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.11-cp310-cp310-win_amd64.whl (469.2 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.11-cp310-cp310-win32.whl (441.3 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.11-cp310-cp310-musllinux_1_2_x86_64.whl (711.9 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (706.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

ypricemagic-5.2.11-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (713.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.11-cp310-cp310-macosx_11_0_arm64.whl (527.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file ypricemagic-5.2.11.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.11.tar.gz
  • Upload date:
  • Size: 280.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ypricemagic-5.2.11.tar.gz
Algorithm Hash digest
SHA256 0e54a1cd506a00be2c66e89ac1a28045e3e2250012fbc2d2acca1ff0f8133f80
MD5 b604138a1bb7ccba09d0938618f16a18
BLAKE2b-256 aeb866ace7313aaaed435cd473d37a168b2694741fc83ea969da9770550c47ef

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 598859aa9363c3dbca9514ec1864883826ab8b4e22d3df65035971cc908b5e97
MD5 f2d94f1ddee5e192dc9c635ddc3d1d73
BLAKE2b-256 d591cc41c408865e2862070f250ef5b658304297a6919b2a09eeb261a8212b5f

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-win32.whl.

File metadata

  • Download URL: ypricemagic-5.2.11-cp313-cp313-win32.whl
  • Upload date:
  • Size: 443.0 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 8194c27993d521de6852d945ea118bcf5c7c1fe6a76157284846c0fc62a7ce28
MD5 74a9aac45b5f627935f9cd2e09df28cd
BLAKE2b-256 f77d43c261e92df9908ed33a3838884cb9418335827f7289d9f91c259181ba9f

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e17234eaed245894a92e64ace4055683298e7d3c061baf9a652dda4364da3f5c
MD5 43fb0ef13fbc224f3061b2c13cb5cbd7
BLAKE2b-256 1eb58da254899384c85fbcae84491607ea246333bf5759b494c5b64cebba329c

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3922d4ab2c474dbf197b4fba618cc841b0d1a1f496d98f7a2b57a902682d0f6d
MD5 75ff0dbc2e1e073835dcc90873a0a6fb
BLAKE2b-256 ba556cc900f2eeb55cd5ff1edac51d29370addcc49eb79744c6e3792a7c42065

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 eb169c48bb8650f488f13e6fcb6abdf4ba2acd2289473fcae8c19e932bc61ece
MD5 11fa39993832dea06173df9eb73a7ef2
BLAKE2b-256 ad0f88ccc1d4bab3849151aab0522a4a5246d518e4d8868d32a44646afb5f5cf

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 db3ce316e7134ce66b97db2058b2428570b6386c02b9795fff210e91444c3010
MD5 bc3aae6b9c5486d3e077dfc335f704a5
BLAKE2b-256 5cca4bee149e733c2363aa803eeecca6817c1e3c7f20b7a232394edd8767e020

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 883ba6ff46b0c4dd9385800125a8ddab53fc1e65090e26a6d52c87010de74843
MD5 16f80936e6c077576c33146cd489f068
BLAKE2b-256 d955b5618dff14545bcfae8bd432783b0f8b6b83cc859e06a62b38fcea0ffc30

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-win32.whl.

File metadata

  • Download URL: ypricemagic-5.2.11-cp312-cp312-win32.whl
  • Upload date:
  • Size: 443.1 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 0f83cbbd9ac95dcb6eebfff92c7516ba608c20f3c7f6215653381246e802a596
MD5 42973c8299e1b29d7141b14614d3435e
BLAKE2b-256 39b134928b87cbe041c3b2959473033f824e7d4f8ad02d5b4001267af716cd0f

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ce748476a8cf204dbe92e990d7fcbabe6d69d592fadfc93f5350627c0f27f3ce
MD5 1c16674cd959505231a36652b70dcd9f
BLAKE2b-256 28e817a951b15a73df9e56945834e22a627a764ae4ce7bcb0824769f38d79f26

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b320e5f42f4fc413b46ef289b2234c44f2919f99a3cb098daba18518749726d
MD5 703bf027bf4ecd1191fe44342c8b8677
BLAKE2b-256 87219f853a2a8b0870d0ac2855529e4044bfd47a212e56c9ff14dabf7fb217e0

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 fc7f96a1f0f4c97dcf5d405154d36e81e1b86ed0513efd1c9a93f0e51c15ea37
MD5 81c0f3bde6ce42cb73278176c6a8553d
BLAKE2b-256 10b66ac706ecd541e2e33da4bc6c5b3fdf8d05efcb04606879a0cc06a5271df8

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ea41d4cbd39fb73cd776d8503825294241babb759b9c29469391d1fdbe25236
MD5 30e3afd5035be21c6fbe7c10512d34da
BLAKE2b-256 a45e5d9d76ffea16b6ddbae5408b8738620fc2b974d9fbc3e792610bf89a52cd

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5695d0666c8462fe6fe2b29ac2f8e2d6cde9e9a33ee692f43fccd93f10e836e7
MD5 bd45d7eb580cc3b6bb2fac2d439110cb
BLAKE2b-256 1992c76fef56d43b2b2052231b763d9e13073a5e1a380459807f486f234ecf6b

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-win32.whl.

File metadata

  • Download URL: ypricemagic-5.2.11-cp311-cp311-win32.whl
  • Upload date:
  • Size: 441.1 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 76d6fb53f9f044cf597185d31ca5bedc74e5406038fe50ba48698fe530941419
MD5 ca9592ba98b7343f8b6f8b58d70dbecf
BLAKE2b-256 6e741e1425c6ac51909c53c71c16bc6ec5d8bd4b86df12dd473eb6a166c1b022

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2c5a66062a39cd62f236769ef2941964c9134e300cc5f8da66160b8a048ddb0e
MD5 7f5a16c19684cf9e9673fefd32d7e04f
BLAKE2b-256 b0af81427ed732b6ac9841707ca786d88979b4256997f510c0d5ded36bfe6d44

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 429ba8b8be4c4742339af89689e50d8c34925e0eed2231df6c1edafdad8feef1
MD5 6de71cee4a7d8d18b12ecad02df32157
BLAKE2b-256 d19b58ed1cd7d8c8ca247eb282ba16af398b07b0fbcd17c10899a7a3e9748704

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 b648ce16ac8e6876c7406c0b6853bb4424a201fa09602b7b7990af3abdcb023c
MD5 c36563ad278451bf8fea6b0469bb36ee
BLAKE2b-256 fe3275fc956bee29b081d832e2ab1721c21a23bae3ec9db28129c900b88628a5

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 78c378b5e669d62accbbf8937a2b723c20c153df71ddfb015e7d60488b4e233a
MD5 8ccc0798af25871581bf3c1e7b68e272
BLAKE2b-256 6535c60854dc8e8f555858f92825d4299841ed2deb67de99073e7803be780af6

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 84be665327758831f0b659b3185522e5cd937d1d6e0ff9b892cdcd3ca1c39882
MD5 43f8ff149de9cbd66a470f6160fa9391
BLAKE2b-256 4f13a93a90d27f5a6538b15095c646cf20c9bb3f52395ce26e77a43b892dd7bc

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-win32.whl.

File metadata

  • Download URL: ypricemagic-5.2.11-cp310-cp310-win32.whl
  • Upload date:
  • Size: 441.3 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 9e215ac565aac660dd61362aae63c8b1138553e7e8b6e355b35aa3b0069cf067
MD5 6bfac980f593583e516d1cb92b439f8a
BLAKE2b-256 604d912acdca07de55efe930036071ec125f0147ab24798dad3142dafb7b7ca9

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9ab472af06ec175af1f81ddf947e161222975b7d281c16f7db71a6d97f6594c8
MD5 b054ca28d8b7d38ced3b21efeb927231
BLAKE2b-256 d6f41d68d825d1f78f238ac4e23239e9024fbd68c36c0ea91537be3421a8bfc1

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5a64889f1ef0f0be40c6b52d6bd031e23ebf30cb477421bed0587085b78879f4
MD5 5a184359ffedfca644b57fdf64a01986
BLAKE2b-256 841afee0163eac603ce8a95974da3bd97686292be2051d3d4f6b1185fec9a6a0

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 0c870fc3609f1f5f5341cde13f58f2c74cc6ad272046d2126832967ef6c27349
MD5 df05c6477d886557c9ce5c37243a6483
BLAKE2b-256 20be49150398ffcca2cdd9cb45e289cde7b1eae8961ea4757ad0dce49ae4b62c

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ypricemagic-5.2.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa73899a72c986168dd82712594761af4f2001576acb42da22a14d298d860268
MD5 af5c4e123cd3ffcc2adcdab1d8de7c7f
BLAKE2b-256 f6e4b028eef85542a40c2aba59ad530e299558dfa8582289d0c8fb3b9546c30b

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