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.15.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.15-cp313-cp313-win_amd64.whl (478.2 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.15-cp313-cp313-win32.whl (449.1 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.15-cp313-cp313-musllinux_1_2_x86_64.whl (741.2 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.15-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (745.5 kB view details)

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

ypricemagic-5.2.15-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (770.5 kB view details)

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

ypricemagic-5.2.15-cp313-cp313-macosx_11_0_arm64.whl (539.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.15-cp312-cp312-win_amd64.whl (478.0 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.15-cp312-cp312-win32.whl (449.3 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.15-cp312-cp312-musllinux_1_2_x86_64.whl (747.0 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.15-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (752.3 kB view details)

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

ypricemagic-5.2.15-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (773.3 kB view details)

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

ypricemagic-5.2.15-cp312-cp312-macosx_11_0_arm64.whl (540.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.15-cp311-cp311-win_amd64.whl (476.3 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.15-cp311-cp311-win32.whl (446.7 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.15-cp311-cp311-musllinux_1_2_x86_64.whl (720.7 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.15-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (726.7 kB view details)

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

ypricemagic-5.2.15-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (733.0 kB view details)

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

ypricemagic-5.2.15-cp311-cp311-macosx_11_0_arm64.whl (537.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.15-cp310-cp310-win_amd64.whl (476.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.15-cp310-cp310-win32.whl (447.2 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.15-cp310-cp310-musllinux_1_2_x86_64.whl (728.0 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.15-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (732.9 kB view details)

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

ypricemagic-5.2.15-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.5 kB view details)

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

ypricemagic-5.2.15-cp310-cp310-macosx_11_0_arm64.whl (540.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.15.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.15.tar.gz
Algorithm Hash digest
SHA256 de1426bb99ee0aaed0e63684f3f04cbf0e729f8981b0591fd8f5cc459565f3d4
MD5 7a1f5ea01072262332e09b46877c473e
BLAKE2b-256 ea828acaca521552ee78b10cb57be2317151d94d27e74093122738652736e483

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8a8e24c46e54424b29df5832a15539b8e1b8c370dedb31cf2537acc17fcc9b2f
MD5 45af08f0ca31a49c9963c4c7917b6e75
BLAKE2b-256 3156ef994cb804c9e001a190dd6dcacfea0a0a8d53a22da2dfa79831dbcecb89

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.15-cp313-cp313-win32.whl
  • Upload date:
  • Size: 449.1 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.15-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 f1a989ae1ca0fe323be0005f16bd09b2fefc95c829ed04941c2be9097e26edcd
MD5 c7193fe1c131e7f6645899172f9b1a95
BLAKE2b-256 510c455df20b2a993c4da8d84bccae3f2851d8b4668c6e5ac10b399f5dbf5882

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fcced1e5f17cb6af41c78de61bdf7b10a66cb1ffd308f7cc5a5d6e30368950ee
MD5 92d72832b17cb5113a66a32296ac3302
BLAKE2b-256 12c2cda8680858b16c202eb45efb301c750bc5294c1d2cfbc8e99e01bc5bb908

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.15-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.15-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54983e7033161aaf3b2605371af30061a18628cff4105529329e2d7ec000eca3
MD5 14fa42f6c5f5cfe80cae869cc8e0cb83
BLAKE2b-256 2092810d4e78491dd8117ee36df2f87e5c0c732f24c6d9b1058bace218c0e257

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 903b34644ac47aae94c3c6805fb2e8180d3f958bac759a9058022219bff89111
MD5 21cd41e6a92e080ca3e3c41833bc5f26
BLAKE2b-256 bcd2148a30ea3e313c41ef351a986829d853361b0c7847b2b8272f228f31cae8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee3676a28337a2926aea3ea8f3b5948f841775d4e2617d6f96f8d09b2b5a7391
MD5 2fdf6d3ebe98e9b5c792f8f826345f37
BLAKE2b-256 0a668e5ba2b19a11185ce0ccf1cbcd601d1cbf485762c7af8f12a5b244b88a66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a3367bcf92b60d5ff330bb08c7b8bf7283ead216558347621b55621c9ecd8301
MD5 4a8806240088ed7a747d683e28a5de2c
BLAKE2b-256 aa05ed81ce92008daaee07f10e982761bf7ac54decba22cf983dbf99ac7e5479

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.15-cp312-cp312-win32.whl
  • Upload date:
  • Size: 449.3 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.15-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 31e8ebf8e02bfb2f234747bcb6e16fee00fb3340f26125f1ea43700d627872a2
MD5 a58ff5351cd75dc59ce3668a8d3e0639
BLAKE2b-256 42615a7ce3362e29b29cfa24e41a605fb5dee009d0050223a85370ee3a87389b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0bd456f45146a6846513ec65f7b7a5ff6b960676f468120ad00a2c2c4962a3b1
MD5 c13342e0443275600665d7a7accb3132
BLAKE2b-256 9795910302dc5d5e12e62edc908b1eaffb5b9285d2053f2e9b184eb28379be91

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.15-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.15-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0011e5d96f98074169d84a87cb7c69bb2b904d9810e66ac9149f5149ef824ec0
MD5 a80b4b8fd0f3045f71010313e3ac9f5d
BLAKE2b-256 6136b81dbd3d547905fe6a7127e5153094e9084693a7d3061745c0da3f4abc17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 1aa156d713da2c63855f467a690d5096c189bab73e8ea6b3f3a8a8d0e0327770
MD5 b60ed2a3b2108a9ed52cad57e4c2755a
BLAKE2b-256 1322785ab6e39af0627ed0080d1c9d72e33273c4aa50dfcf3ba1620b96965322

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90c40866f178149d6038667541fb8b352964d62ce9f64a05008dbe56bb5781bf
MD5 d505decaf5fd2a592514ebbdc7dd3f9c
BLAKE2b-256 4c88aa8e5a9bcf08f38a70cbf47802e997e617a9463f68ad35f4c33a7bf5b288

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 34cab8e1a513fc9966d4ee33680ea18efb61a5320406ee18c5f2cf2bfd9355be
MD5 04278822c73f19610741338be83b56d7
BLAKE2b-256 123f6ffa1bdce1b26cde71b06bc0ef446c0942d15933a22f22754e4cf7af0ff7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.15-cp311-cp311-win32.whl
  • Upload date:
  • Size: 446.7 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.15-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 b3714dbae3da7fc5713966a71a8320e1526745b9b2dfd0bd6eb45857dc37312a
MD5 9f135afa6b5baff0d90ac1de35222b56
BLAKE2b-256 977789cf96032aa111d745920ca1608087cf0698486f5872b16d8f9302c9358f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7dbe16d64de02a74b845219c604f0d7f5c20918ba159c792567a3d78eee0f5f5
MD5 c40f9d54a11a3b4f3fbf453805702654
BLAKE2b-256 e4e11d0065094544d0c7b0410e42fe11e58deeafacbb39abdb258c11581a271c

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.15-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.15-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bd6a5a01ad81e5b32659b8554431cd5219e17ab47f5441cc5bb2aa15f5bc665e
MD5 e0c061e20491ca8a1cac5713293569a1
BLAKE2b-256 2bcafade0fe8f8b0f6ef685e4be355524114f581c92578b4364865b5ebf0bdb2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 086da5abca6ebecfaf454bcfab3dc0132e9b0bb7e67f263828fe49d1c7fb00d4
MD5 95050183f547fae0bd7b07f263d7f079
BLAKE2b-256 dd00afcdf0a10bf9717e46376dad0b90fb0300b293765b94def8c07b5b8ffcea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fd062a6e8b33e453672e887119e7a0893b9fc70b839211f9d083622eb5b13a4a
MD5 2dbdafec4c5f3244cf751f725c8ff790
BLAKE2b-256 4ba06d9e42886310a63e8dcfcee12db361788d422e739365d71178a4a6408deb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a001c27ff5eb1eb0669a1402077a47f53439249cfe42031e57dc994c05f80347
MD5 9d83e46554227f79c14f108dff2bedab
BLAKE2b-256 5f63170e746e2f257ed90327f97fc4bef414d0e88acb997600bfc5a82003cce2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.15-cp310-cp310-win32.whl
  • Upload date:
  • Size: 447.2 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.15-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 0516353425008f3a9d928a7d1924f9245647c038c5ea602a8ad8c54a1222c83d
MD5 9c637ae737785cfbf6da5f1b2c717f16
BLAKE2b-256 3d326ffe4231d976ec9b7e09b659743d76eac3ea7e0125f9a41bd172f751b608

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 134e1bc1cf85592a45a6b26207575518658b6c0a9bb0738962a692cb32ea737c
MD5 8296f9b0dce5be3cfcfbd39ac1638aca
BLAKE2b-256 a951d085e309dc20dc3e74f58ebfa6e690866dbfb3655db086dad1192331aaca

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.15-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.15-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e121dc80e15f52fdfa01317503d8237d6c6ca3d47ae79473ec763157f8fde54
MD5 c8fb396e74e4f3a69eaef0dfc6884de1
BLAKE2b-256 b3e2e45e6c42ed157015fc7b2c6d43372aee7a6466234963c19c71b89d95fed6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 9b2873a69e9a3399cc886e5652cba399d641a7bd83ad723123c09a9275a1db6f
MD5 86b08fec512cd4964acdb55ac91a77b7
BLAKE2b-256 5c57f508a0505c0077e4e31160130be5dc12d8fbbade193c84b0420baba79547

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80c298c3506c34bf28c358310d5c79f4e86d03db2d4c4894fa1984584db05a35
MD5 d798317a026cb3b76e2272e748ce3a28
BLAKE2b-256 0d43f51047385f8300b216d3d887bdfd272a7531a60ccabe4343043e28b653aa

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