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.28.tar.gz (281.0 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.28-cp313-cp313-win_amd64.whl (465.4 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.28-cp313-cp313-win32.whl (437.3 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.28-cp313-cp313-musllinux_1_2_x86_64.whl (713.1 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.28-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (716.1 kB view details)

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

ypricemagic-5.2.28-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (740.5 kB view details)

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

ypricemagic-5.2.28-cp313-cp313-macosx_11_0_arm64.whl (529.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.28-cp312-cp312-win_amd64.whl (464.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.28-cp312-cp312-win32.whl (437.4 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.28-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.28-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (722.2 kB view details)

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

ypricemagic-5.2.28-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.3 kB view details)

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

ypricemagic-5.2.28-cp312-cp312-macosx_11_0_arm64.whl (530.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.28-cp311-cp311-win_amd64.whl (462.3 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.28-cp311-cp311-win32.whl (435.1 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.28-cp311-cp311-musllinux_1_2_x86_64.whl (705.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.28-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (700.4 kB view details)

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

ypricemagic-5.2.28-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (706.0 kB view details)

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

ypricemagic-5.2.28-cp311-cp311-macosx_11_0_arm64.whl (527.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.28-cp310-cp310-win_amd64.whl (462.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.28-cp310-cp310-win32.whl (435.7 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.28-cp310-cp310-musllinux_1_2_x86_64.whl (711.8 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.28-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (706.7 kB view details)

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

ypricemagic-5.2.28-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (713.2 kB view details)

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

ypricemagic-5.2.28-cp310-cp310-macosx_11_0_arm64.whl (530.2 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.28.tar.gz
  • Upload date:
  • Size: 281.0 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.28.tar.gz
Algorithm Hash digest
SHA256 f9fda611345d4f5f8fa60fdb26793f7bb8c90e834de518b2999e6e7f75beaf0a
MD5 6b151e50691bf46fce1abde4f205fe05
BLAKE2b-256 072f1e6c53a14ec5f16c81b5c3f89a952f16b344046577f1ac8ba2762346eac5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dc07fac6ebea761cae7ece4d650a21dd37d37ec7981a1a8b8263dc9b5a45a5e5
MD5 bf7ab2d3212431868b25b2bddc7308fb
BLAKE2b-256 378ed02c062b2fd76d4b3307c0126cb8b8f0a2eb1a1e33c00cb1a2d55a0389e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.28-cp313-cp313-win32.whl
  • Upload date:
  • Size: 437.3 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.28-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 6453c15af3c8e3446c7cae2c3086c40df20c62066ef0d8e6281b4c3fb06a588f
MD5 80793eeabac0bf399f016c21c25cccae
BLAKE2b-256 901c54acad8ceb0fda5e196db257b95b44c6d9f51c597a1e199e8785bd43b621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d61355458de35ce200b606eb0c36f9b3d2c9b7b41c3e982bd129f4ce5737720e
MD5 34bc908963e2f28e45b27d23eeb0d7b9
BLAKE2b-256 61d9dab4452b65ec7a6b6f82181b3299fef66fa92cb7a38c782c1d4f01cad79a

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.28-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.28-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7de7d15661aa022261fa1dcb25c9ff850c08e93f00bbf666702d1ac22f1610b6
MD5 d7f6541e6c4852174e6f8cee05b73516
BLAKE2b-256 5da77497f34e8ab4f924b00dbb1af6f9b6531f94d68414c7ce8e4f867bd721fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3cc0b7fe8c31505bb2f77d7de49fa9fdb7bb36a78667dd10daf0408bca72edec
MD5 4bab5226b77d60cafe2daab374848c47
BLAKE2b-256 07ea24b4dfc6bb289376cf5fa0cfd03c9767f726365e21ed56070433341e085c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f962e3b5f6f86f906b1c9097170d631bfffc5484e543f3f4e203e25a341130a
MD5 47ee347a751db597e788ea22f48ea2af
BLAKE2b-256 254e6149e2eeeb870a62c3d0fea9350e645fca600cc0bc8d0e3f5957425627e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ff112a5c60a44054156ef87c9ba23f33b362329bf67f12c8601ccee4fe5eed47
MD5 334cb9c4d118a6314f1f4f7db6883374
BLAKE2b-256 cdda7f469f5c8d72245956ba81e353a69abf84aca54398443f3d705d6bf63836

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.28-cp312-cp312-win32.whl
  • Upload date:
  • Size: 437.4 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.28-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 159e95fadacb0e295d771b9f50343d56032c3f4487ecca528b9dc0a23c4c982f
MD5 74382d05f471c1931b057902c34f398b
BLAKE2b-256 9f511f0606caea1715ea22f05067b1ecb87a5794acc8d5d9e9ae7f8624e56337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ab67e27681ed12a8a2ea8f6bdc129e4f077def1ad4db56f3bb08488d1ad1f103
MD5 44112a16f11cfc808ce2fec9a9b9b2ba
BLAKE2b-256 def626b82dd619c2cb687ea86c87d66d64324e2c07024410c348fd1d1dbdd9cb

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.28-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.28-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dcfb45c8322c435c36287bd5062e227a9197999fe90c87e030025c7a9ffaf694
MD5 9c654523891563166256e670a3e75c15
BLAKE2b-256 f21da9ecfcd17ea898f1c629cf3cd12ecd7d04c998a991e8b2d9aa8c27e2939a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 73e604f8c04d189ed009e68758ac4eb3bba5b857ce584d48346a75c9fda8ca0f
MD5 f6b56228ae9c85166c1acd3443bc15f6
BLAKE2b-256 5e3562ab82edf9e8295d24a1340340b0d791980ae36327659990965e9f50dd8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 15464514f417ccfd8f63092b36d01e051e4934184592a4819e68453bd7705dcb
MD5 a62e7e35873e09f5cf3a1e6fb2c697a9
BLAKE2b-256 d14c37c5ae211fbc4c8d6204136fe4f7b47b223dfcaa136d78d271e7f93c9910

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c4662294de6faf450d7cde6b7009ba7811bf24460f62c7bdc2f76fb4d68fe83c
MD5 b604dab3d6a24b0804491f66e5f55b28
BLAKE2b-256 983cc5acd87811e027413f2d4dafd5c6250d3f8acaf12099cd68b84bd2619e65

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.28-cp311-cp311-win32.whl
  • Upload date:
  • Size: 435.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.28-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 96773d33ff09670543e67ce7d97cdd1f647adb3cde1b5f14b972039208be27e6
MD5 7901a84ed934d35812df8de317f45da4
BLAKE2b-256 e2217bf449a2ceda591c11467c4cf2991a4e04c64da829c5a0a60e851fb6e4f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d79930c6bd96178cad009ba1998f497e47d4bf15984deed4b649e25b81781843
MD5 9fad2b5755668aaf1d5b278a020d906c
BLAKE2b-256 bd86c452b16692ea4cc45d72a1625f48eafce2303daa36387132c8d577bcb751

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.28-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.28-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c3a072a774100eedfd5dcb7361ed98ae1fddb4f40f5a60db82f65c49d22db33f
MD5 b3a720b4aa63ec6dbf5e65c09b13b362
BLAKE2b-256 bf416faa634329723bba9d619592a1809bc5638bc192439b33910ad37c300dcd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 13c1cc79ee03d32c0dc54f619c6d990eb40c09cb82c47fe7336f992f09a7a74d
MD5 0f528c1fec2ffbd055e31399cdb01bd9
BLAKE2b-256 38c592fe7144e96ef944d5ecb57619985beb0c973e2db12a97d84933c9a860b8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48e38856c15514295bb2424864f39188316349b3f04e81cf0e7d8db5d631a760
MD5 e28c577b7a3664922fda30f0bdc22a8b
BLAKE2b-256 b7b881d5ad4d6043e58d3d3dac7575261908d457c1194362433b5e7abb52ff40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 872ce17a0d14e8ca0da6fd4ff1b9dfefd16ea86587a68d3427db20caa4b9f201
MD5 9494f91a5aec2ff6aba4c0da0243c3a1
BLAKE2b-256 8c423f2fa6a26986d6a5ff0f53ec78628c9dbabab794463c348ca52d6df4c764

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.28-cp310-cp310-win32.whl
  • Upload date:
  • Size: 435.7 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.28-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 be66392cf050f9276567a6fc0fe14d90f4902038fe7d3d027e0bccc91ae5b4df
MD5 386a2230b9a52d2a82cdd4ba7b19c6bc
BLAKE2b-256 73a3498f0089fab6913c05b13c9b070d4df8cfc4c6299f1ac9d2d5d3e3fa981e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4b36927b81ab902e3a4d149f808712381aa46956a26a9ccb26a99151993b68b1
MD5 287bda740520320e8d73dbc432157946
BLAKE2b-256 3be5b9c3bc443e2ee946c21dfdc518fb437c2f7dc91025e9f2119f4968f29be9

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.28-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.28-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2ae0647c7d8e1b8ebe5fbc07b9411acb12d56e7d9347c13805d4305a52f7a50c
MD5 e00ea9e3bec215612d728179c380e083
BLAKE2b-256 d8e9c8b71a7470f5fa4b01b83a25495ff4db053b1191977d5085de9198e354ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 bd92f76b0750febde49f5dfd80908770d5af81eec88104b4eddf3ff894bdac02
MD5 47c894a8ef1e093fc8fe8441d5a99042
BLAKE2b-256 9378f755d99c6e3758c1ceb46f2bb22f9ae66cd942bc111c8b2a96fc253f4574

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.28-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce1c119e7f7e60558b4a29da3c5842f42b3a238f3e8575487dd88bd313a2535e
MD5 8a5413d1053ad82835213db8c9427ff9
BLAKE2b-256 d65deba68ef5e476ca941b7b205074dbfa1ac980ae21a300239d46ff74e28785

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