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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.27-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.27-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.27-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.27-cp313-cp313-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.27-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.27-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.27-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.27-cp312-cp312-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.27-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.27-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.27-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.27-cp311-cp311-macosx_11_0_arm64.whl (524.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.27-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.27-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.27-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.27-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.27.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.27.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.27.tar.gz
Algorithm Hash digest
SHA256 3f98096d2d75a08fe9d7bea78663fe8f70f576d22b6f3ac32f6d24d73b101462
MD5 709b2cc7540af553b92adee74d947f70
BLAKE2b-256 93df4449635d276e175bf3a270be656d23e1b2492d05990a364a40165e3c62ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e689e2d460cd9682fd8ac6bfc6775cf10f8396da7cfb3cd8a7239430f3f58e30
MD5 2c9683d8cd0fe09a2f230b95058054ec
BLAKE2b-256 cf210476be54a4e496435454abe74ae5943b05a8f6cfd7c3b8557a17a1537059

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.27-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.27-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 daf749cfbabb79b150ffc9ab4528a6f5fe7a9754d541d7385a1eecb8610ea579
MD5 ae538d814cb67682bdb653a16a37cd4f
BLAKE2b-256 ec3222cc450d27342182b8d5e45a70e40895022e39fd906db0b7dafda93a200c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fca3e3ac601aeddd1bffddca3734266d91ae6643e77932b3db4c49613346bd13
MD5 bb49016415bc65349b28a05b9d646057
BLAKE2b-256 b7b6fce98e78d870b89cd6a7c4e73af045069f62d3625079f7a4ba2e7230f101

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.27-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.27-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 be07cf1da03187741fbf1ab8c34fb076c6986b08b0910584ac045e62786c5196
MD5 8b344cbe11f5ea0794c3e2af15a39967
BLAKE2b-256 2c60b25b8b43e1217e3e3c1746228debd8cbdda97983b5422a731261e9921ab0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 7b837ebe1750b4772d15041891338c0ece41a4967dd2835bb75e0b9c2cf26635
MD5 b3a4dbc3a1a4d787c1a1313b7676ef0f
BLAKE2b-256 88e8755190999ae573318ae52bebd2449a67af73355f7c7d023702f5a07aad82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a35e5ce99f6e4459844d22908d714974db9e7fc694098626689e21c539fc12e6
MD5 6d596bb6ac38531afe29c5f50c337600
BLAKE2b-256 17ddeed67249c8d27aeae83d0cb3f3d50a242489d6e8e8d2acbbe6d0dbf1f02e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ad9faeec2bb93b7d394bf7b1c434e4ffd1209c8dfc7b6f2235dbe4f5db9685dc
MD5 fc1f0213f2c5ada7cb0b2b15b8b5094f
BLAKE2b-256 ba3a9b303cd5afeebc8d7a1999a2f83d89ae6d1c447dafe3bd504075ad827371

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.27-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.27-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 560e6ad6ca190a79b723cfea233ba0075c28f9be22dc5ba4c12461ab29b7bb9f
MD5 c5017d305d0b674271d51e882dd5f899
BLAKE2b-256 ec49fc1247db42d802d1ae44786a07e52fcc164ad7ea445ec9553ad7e8dfcb34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 59320e9436393996ce24a6b001792746c74c5e1f1a75356f6b5e704eed4e15c3
MD5 f37e41feb24eef98f3b0f089a75fc6a1
BLAKE2b-256 6c82de32fe245cd5dd124918d128d2e3fdc13c7029aa6602d5e86da6ecfcf9c2

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.27-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.27-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1e432013f25344265f9741a113c2fc291dfc4f9cf5f4bf16f34cc703e1058918
MD5 9d1450263ab2b7f2456a9df014dd48cd
BLAKE2b-256 4074fc8bc7be3e0c044f2ee3231dd3e2e1ad51202d7e4100c84fd1d42abfae1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 acfe5e4f1025dc8112edef55b2b8ef6fc869b8a8b3166b547b5d9b008aead924
MD5 eab808b70bc7463dd3fb13f331a9ba4b
BLAKE2b-256 097be8ef409f9ca7750efe4645e1edd2f04e1b3b91f773a0dc6af6e7e1c1e5ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c8f68512e5119fac39595c9df652c05fb37b41963c7e7fa284959ab3915ed49
MD5 a8c2709ffb869ef5299d419588653ecd
BLAKE2b-256 8489802c374f3cae56266acd1aad56d2adfebf60c493c4e0d88df0109e37898d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3c93669e863c713f336908a37bc06fe7b04104c9cf798d18c8fe040a7090edb4
MD5 4160730cfa6e6be46c0c015cda211f89
BLAKE2b-256 b65b0f2f46e65da173a6e674ac96f4f5024212436b1fc2da46de90266b846a3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.27-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.27-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5a656991cedd37e2a9ffe693fa68f7a0bd5210551aff81cbf3b3cc780aac0f11
MD5 1986829af28061081d741477aba7d3cd
BLAKE2b-256 bd1e247951ad50a4888132017c97e65b797c014864a481ffd645cf72e7700ee6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 778d32b3b7c3bb3559430c204a9c68a2d140036dd8496239180f12e9a9869100
MD5 3a2eafd9ddab1d33adce8d64fb4a0f9e
BLAKE2b-256 15a3f8397c25b6d473a86e115e30066c286250eac33121ace3c9ecf4a2488238

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.27-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.27-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 caf43d451abcbec152771e4d45418f1e8f4772b1d0acb7df03a1cb56d04b67de
MD5 cde3e5b1f03740220754fb4a034562e8
BLAKE2b-256 56b79110780c1bbdeac90ff70e959727df83731cc9a3645285b6e46b0f910ceb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 e10ea85446c2e50405f7c47b948e79337daeef9604ef17d691921d137c0c6027
MD5 2cb1a7dcf6ee7d75c5d8f5f297c46bd9
BLAKE2b-256 0963bf48e9e48e0b53a57fd885d5463fedbff7d6f42afc8b8c03df3fd91042f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46de745e7223e806b738ec13c80e30400a6f391261d702548f27cde212457ea3
MD5 b8791217feb83aa071087aa63108a066
BLAKE2b-256 fed247bab5003ee1063a554437f4ffced4cc72e19ca92bf55c0ce47bce817bd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fcc175e5c5f83161195fa6ad8049fc44d838e73558c2642ea4abe23f9864d21b
MD5 82b3aa25f60d080554c3728e61dd910b
BLAKE2b-256 09f6fde6ce46e3941c8f5d9577c1fad1395ecced071c65265fa041cbc4f7dfa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.27-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.27-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 703ddc4ed961bd2573e4f0d30ac613af6192e0bbb62c4b999d9f79c55cd9e126
MD5 779496d45e25928dc807c7bea1785ae4
BLAKE2b-256 13d6c3a231b9a385ce3a8e87a8da11978f1cb2b5029fce91f3b47d226d129a0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4fcb049b41eae57c6d830cc0370d4a0d5f43154ef42de498e35a8cab60a0a1c6
MD5 dfbaf859ba887d26b7eb1868f4ffcdfd
BLAKE2b-256 d29d97b330e6eefa11b519e17e7e8dcf3b691835f441041a4d356900660d0b7e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.27-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.27-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b09456f1db7ac93eeaf13f6a0acae3724b68716a666d5b5400b15679866cb9d
MD5 6fb03ba925696198db2ba0910a77b3c3
BLAKE2b-256 0b357ab082c6aa1dc87eb2aed288c040cfbf659227e028e50235d6ca929b8407

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 03e69e1f1dbc1aa4f1eb4786053693377d28c2732a036728b340e6f1d0d776e8
MD5 9807a94d04fc8c2bc5f6dd8bda6c7dac
BLAKE2b-256 52525f96ea3bfd90c2d6e4b01785af3df419efef23098e9f9d40868e81b1aeca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.27-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dd2e19375cd2fa1c9bbc91abcdf7587be25b2e4012e816fb0583730549c34976
MD5 1608ff94ab0fd41c1799fd03dc3a077b
BLAKE2b-256 9a33a57833e773534f74821db21d6b3363a8f7ebe8dee581f954f5509ac867a4

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