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

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.17-cp313-cp313-win32.whl (451.5 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.17-cp313-cp313-musllinux_1_2_x86_64.whl (748.9 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.17-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (753.6 kB view details)

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

ypricemagic-5.2.17-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (778.7 kB view details)

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

ypricemagic-5.2.17-cp313-cp313-macosx_11_0_arm64.whl (543.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.17-cp312-cp312-win_amd64.whl (480.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.17-cp312-cp312-win32.whl (451.8 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.17-cp312-cp312-musllinux_1_2_x86_64.whl (756.5 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.17-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (761.9 kB view details)

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

ypricemagic-5.2.17-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (783.3 kB view details)

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

ypricemagic-5.2.17-cp312-cp312-macosx_11_0_arm64.whl (544.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.17-cp311-cp311-win_amd64.whl (479.5 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.17-cp311-cp311-win32.whl (449.2 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.17-cp311-cp311-musllinux_1_2_x86_64.whl (729.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.17-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (735.7 kB view details)

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

ypricemagic-5.2.17-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.1 kB view details)

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

ypricemagic-5.2.17-cp311-cp311-macosx_11_0_arm64.whl (541.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.17-cp310-cp310-win_amd64.whl (479.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.17-cp310-cp310-win32.whl (449.8 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.17-cp310-cp310-musllinux_1_2_x86_64.whl (736.6 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.17-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (740.9 kB view details)

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

ypricemagic-5.2.17-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (751.6 kB view details)

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

ypricemagic-5.2.17-cp310-cp310-macosx_11_0_arm64.whl (544.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.17.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.17.tar.gz
Algorithm Hash digest
SHA256 2479031416772b58ae7f146ef4d6d31357e079550695c5ac58f786961cf6f7aa
MD5 9c9fa2369622bdd413b95047644149ce
BLAKE2b-256 12f797a390b3f654c717fd8732303d8beafbb026b4e655d1204d3250b1a7ae50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 133458d59d5ab5f024090351a87eb6cd0381ea1c8381961ce93d7174203d02c7
MD5 87b69c8b30504c3e90e0733c417fa474
BLAKE2b-256 0baea68da348ec7e16e5a07b6130664202e95e1912b047409d04831cbb617cee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.17-cp313-cp313-win32.whl
  • Upload date:
  • Size: 451.5 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.17-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 4cc80a260eae4bf6c6e4cf89226dd33e7527628f05baf4a639ab7cf8772dfa8b
MD5 97a8c19911fc11d7bd7995c9b0ffd67a
BLAKE2b-256 1e0f46b7e94768131b5739f75b3787338ff6443ba593380b90b11f0c647c27af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6382b1ac37db1e028c5fbb27e4290261437ddb564ba41a85c1cc913df82ad720
MD5 1046ae23a91f9a0b4a3f02884e25bcc0
BLAKE2b-256 2c7e2ad076e2fa048d149d33a816eb81df1eea5498d6024986a8179bd5a1af10

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.17-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.17-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 845b6177dd72848abfe4863cebafc357e09b853f0cd73f78a551db457c3fcf3c
MD5 dbc78942130036c1248163d1f36644ba
BLAKE2b-256 282bdbde457ac86965355bad46ba6df15a489ac462b112ca2b27f84c54b579e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 59aae90cdddd27aef2db43bf87cf35a43a27a0f12206dc444fb8375b8d05e1f7
MD5 7d140769c6aa48085b19d8de9bea631d
BLAKE2b-256 d6297a7d7ab704cf7c11395af3fe1ca6e0395caf0138bbc6366809244c7e281f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f82ec7b5248e8874c931918ed1ca82fc8b511aa34d203de4ce337a2a7be34af0
MD5 3afd249379e6588794d4f871ccd6bf6a
BLAKE2b-256 347a3777b07a6b9846a96b59dfc0ca367a050977f9670eace48d4e660bcd91e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 14c79c840692e2874a5994e5ef5a05326f58a1b1c190851654c7b250edf3f19e
MD5 76f2c140367413e140902feb5db2e709
BLAKE2b-256 67a58dea671d1b459ff230c9ae42c299c643baa6515743c9702979352638d53f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.17-cp312-cp312-win32.whl
  • Upload date:
  • Size: 451.8 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.17-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 488739bd4c62d99dfa819c596404e273433292bd5636f6b8158cfa3dca738342
MD5 c54cefdd992c7d42059cf6ad43c59090
BLAKE2b-256 3d4f3f68e4ebe17ea15082aba1abae097cab6609a8c59df1d5d51b08f8bc9b6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6643667d9a87f09b32a3a14334991213d109f0c41b1539aba644099773eac5fe
MD5 286cfb525707ae2c5e24afe78c1a0f94
BLAKE2b-256 f980897a1e437d7f7e41f73432a44184bee65a00a06c752e0056fcdfb2cd7d7a

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.17-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.17-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 344d91adbfc8f76db7f5b5d5f92df3dbfb47211fedfb327021d6e8c0004187b1
MD5 4613a79571862f440ae7de39cf634868
BLAKE2b-256 61c0be364090bd00aecdc5b02dc597561a3cc575ede52442b9177855dc657442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 5ef8f4b7a173eb0d858a860caaeedb2431aba1947b853b31ecc2b24a16749c89
MD5 181fbfc611f1087150081faa1b800ac7
BLAKE2b-256 5478c74a4158c1cf8946ea1388d0f0ed56506f53465189b210abf4857f7fc9d9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0af1d58e6f2cca83a7cc9bf6fe93db065ee505803565c91ebf693e0500de5c1
MD5 29d283fd3b7ab847b270c47871a46308
BLAKE2b-256 f4808f5b044f8c03fcb98b1dbc2d3a55846ee2463c849be77eedfae5417854c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c966e7a6965f42eb6f67f7d619880295c1e4f649b6d113dfc05313e7467e2e89
MD5 b92877c68d35de50d30e08be8f7e90e7
BLAKE2b-256 5b5d2f2affebe352ca52446eebb41ee54fcf57012d0558e9e8b1f7582c0b3755

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.17-cp311-cp311-win32.whl
  • Upload date:
  • Size: 449.2 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.17-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0a15a9f513ce121174d477151bd9ed7414b982f63b9518ae4422ed6ff9d4b156
MD5 40d123ab9b625199a16f33e390884a49
BLAKE2b-256 576268827befd88daac9fb352359d5231365305bdec2da4672a66da7b211de28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 da7787780003f30119d542dc1cc1870a88d6f957f206167d54656d306c1c6b77
MD5 c3ec586737f78b345f085014400dbc21
BLAKE2b-256 61d0b04f3c2d2f483284c807efbc185ae0284ab061859536ab0e6279a7f592aa

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.17-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.17-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 166c5af3e12d33fda9880bc97ee6fde035910d4df60a288a22755ae783c1427e
MD5 1675e81203dbc7583e7080dc550189ed
BLAKE2b-256 aae4c045a5b121daaacd58f04bb032a8ae0dadf88eaf01f44e38ea29f33fc740

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 1956916ebccac3948c44a7d6f81ed6fd23aee1c36175521d92788e1e2603d2e8
MD5 b045d8e6c4a1a318ec7a06f1444ffd64
BLAKE2b-256 b39209d36a72d8aed8405b3a2d9b25354ca982ad8175dfa4498ea70e58a516bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d2b3d65d46132d363c66e613caa3264126b2558601475fab1930b933422560dc
MD5 5b25d2845b163da1d4fb02659dc770d6
BLAKE2b-256 aae4f1542a175a8697d5830cb4dc6569eaee14cc85122dcf77d6b19340a0327b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 df49352ceff540390a2bf8e7fbc2bf82979ab7d0a84c132086d8a9b7e585bf6a
MD5 8123de3cd83cfe436742789fb68172ca
BLAKE2b-256 e1638dbebeb9a5449bb28d8e3eb49e953683c85ae2a9f95f4012ff36a2c539c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.17-cp310-cp310-win32.whl
  • Upload date:
  • Size: 449.8 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.17-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c39f5e94cf099dfbdbb8085ea8ad6a6e7e80e0586bea66172d1acc7e0cb10d44
MD5 93c3531dbb2c1f918ed99c5c19914d07
BLAKE2b-256 8f6fd450ad0da5c95fbbd839053939a111dbdc0e0f2e0b78aec26700a60db2d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d95c03256d955fa9849bbfde061d997799e2e4945b86511550a3cc7b9f355af0
MD5 5e771fac39237dd59b41f5255ca156d3
BLAKE2b-256 d274ff7dd731eb027c14b5111ee89179aeb2212298f61dcb11f809699d7c1ef3

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.17-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.17-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 64aee133d00a744150c29eff6e3b7cedeefd9e22913d9e376afee2269e3b7d80
MD5 69e6796c9cb43edd2608a1ee8a3d80c1
BLAKE2b-256 17dca58470bf50d044899cf4f845dabacf9d847c55f254fd726b3fd72bbe9cd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 bd2219051ee120889a65c3b8f0fe47527dcf9733e7dd706d4f745b1517a4be91
MD5 d97daf72928029054bb7452b18529459
BLAKE2b-256 bcf6af59d6cd7114c51082004024b8e194b7c245ef5f8369665129f2655065cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.17-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dba3dd12bc26c79938345df1d5611cdca7ae05dcd7daaa97d3fe3a96e627e821
MD5 66b6b161e0d6c91dc58dca9d4d2690b2
BLAKE2b-256 50ca1dbdf719150710142095e13eea63964e56a06c635e5972d720e49a65bcf5

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