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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.16-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.16-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.16-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.16-cp313-cp313-macosx_11_0_arm64.whl (539.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.16-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.16-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.16-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.16-cp312-cp312-macosx_11_0_arm64.whl (540.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.16-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.16-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.16-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.16-cp311-cp311-macosx_11_0_arm64.whl (537.8 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.16-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.16-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.16-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.16-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.16.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.16.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.16.tar.gz
Algorithm Hash digest
SHA256 53663c394dbb010949459f3cd3e254ec97773eb62a6be8498f2c777e9bc7f5f8
MD5 a28ad9a5c78f5984bf5bd3ed9f77b7cc
BLAKE2b-256 b29d194ade531896102376f4e0f2eeb179a8e7d65a4625538e312ebdfbb76c54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 10a31e59769a6bc71b7cc4f85cc6ed297eb8bf1dd0d5027e5a809cd35f787e8b
MD5 0347e14985f559b829ed75edaca46912
BLAKE2b-256 a8d98249c9e46c2057ea8488d2762447054b843ad2b79bf1c5ade8dfc3b2b96a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.16-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.16-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 640fc664e06b69ffe97c021c664e12cea0587e760b9182732433c5e1e3f5508e
MD5 d7ba750cf9287a2f822f4f024169e613
BLAKE2b-256 017cd996039b61e59bd06f49a9c9c99a8d41608520593ea288dd7cd22407030f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4791501416a895e00dd403278a89b3e7d2f19046e582521d16891377a0e232bf
MD5 2ffb2a1d3272882c360b2bd61b1bb17f
BLAKE2b-256 4600a2a4707a3844604a06d424aa2abe092206ca0b4ac607982f435f3d3a55f9

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.16-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.16-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1cc5479aacb1a70d7611d36b8ea791541575ec336fb061ba645e777147feeb3c
MD5 8d8f10215a588cbcdc63258ea6cf77fb
BLAKE2b-256 283bd7f0bea5667a1799a4fa214505eb3bcbf17d2c67c5a3ea8a793c55ad6e66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 dc557a1dc10c9292784de4f1962b15715ef6f01a34c50e2965c44aba90ca08e3
MD5 2434dd1d87a27c84a0d0e87694eb89f5
BLAKE2b-256 60bcdb20ca76f0f9cd0b5a245bdbdbd5f090c2b0880edc845ee20ce02e5530ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 123ec09f3084d6a9fe97b598b700e399d42c1efb40ad5ba7d7f22243baa255fd
MD5 5aad08d2596df69d9d1244928465b07f
BLAKE2b-256 1f0e839e6971827a161560860cdd54d45db586eb27c493464ebe4db86ec34c1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 12a02346591715546afbbeb2b50e17579af66fb0fdd6097e16a1023fec7afe54
MD5 57098630501558b77f1afe248b66b30c
BLAKE2b-256 2a54583eda0cee7aa496767914021a2cb3cf48d24b47da69aa1782915202b7cb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.16-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.16-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 ab59970d7a9584845abb73c45ef144d21a00be2a45eb07a2216802425f62aa42
MD5 81e40dc5772b1149c5413bb02b7235de
BLAKE2b-256 dffdb2f75c70461b03a0c4097c5b6f25d20c21654486f7a316f5744b1519dd05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ec17f7505ba87743fbadbf99ee49635a6bf9c21351a252169eeadea282607b26
MD5 0ea9fadb9b87ba863a3626cb136cd103
BLAKE2b-256 cd043c7b057faae8714038f8fae0e61eba793fc18ededc3046afccf7ac63db52

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.16-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.16-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 598912513bf7773284ef76a17267fbcf3f7547c502e4ccffe11a44d6518327ea
MD5 8b07393a90d2936259308383d52aa5a9
BLAKE2b-256 a71f709bcf6fc750455bcca1d8c4bcaffd551a9c8b4d6a3fb78be7848fd28f8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 c7e3081a5c2a774cdbbf753d367b51f718cd080711c2937dd52984ee469fb170
MD5 6b831379dc376e614b18c1d704ea1785
BLAKE2b-256 f2b441fdf7bb6dc5d27edded4327c20d874e0003f16b13c57b0e349367d8c631

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09fd4ea6452f6ff80cbc9e690da5fe847df9e348f902ab0d16824842371db0cb
MD5 24adb7af93aa1f005d6cb6cf8dd71d7c
BLAKE2b-256 36d3a0212b3108d22fa1cf4f3d88f7c8391aef6b45679be0096cd1d8b8344f3b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 dcb65f1e0d5a723603fa0a2360bd8ef05ef5dba100d805aee1fa19183faf19fd
MD5 190ea183bceb182a5478bb770d68abee
BLAKE2b-256 0508d927d92654a5cfca67720124c51c1dd17c922b682066d2b683dadba2077f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.16-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.16-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 de58aebaad9e3ce46ffd72c30dc62bb22cbe8b7f38339b32a50ce6b5fbab7638
MD5 7c549d4cff61a545143e8caa1d4d4f3b
BLAKE2b-256 c1ccfedfdb9cdf3a7057207b0d54a395470e9730da4c9b4b0ea12278965585d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2b26d255e5248fed1e645648265133e9472e7d09811db477dad60742be2b3198
MD5 c61a5d60b581741fcb9452d66435dfad
BLAKE2b-256 2b5b315d91ec54e4eb12a2a25496cea37bd6c624741c2d9fb7605fe7bef173b6

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.16-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.16-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5e262b043963792892de0ef93d256241acb4736e2a6937c73c20ffaab267ff06
MD5 4c15c71e7115577e7003322d306f5c28
BLAKE2b-256 5840f05d6816c0dfd0a50de3b771750be3fa39c9d4555d9d90170cc099dd87a4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 176700ab7e499e96e23e7a742dec0cd2d770a9af0e02e04392fa63b9d0424e9a
MD5 227260808349f85a6da48421d542fb16
BLAKE2b-256 b9d70e1631eca1d120903e479e1d0366688b1a5a5c202b793b0c0ce56d3bc181

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 867740b3c9b9b28c6a9700778fd4ddd0cb37bd4a4af459dfdbb27cc2fedad320
MD5 335749fd931310538ea59a319ead235f
BLAKE2b-256 3a741b85ec26ec66a652dc0f1533db267f590e368c9e24266788fac893a7662d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 01a393e4ae7c844f46cef14afd1ecb0d164b6b03eaffea58d4e27ab11782e384
MD5 98fda3dd32142a6db2cf514e14759735
BLAKE2b-256 826c7da596ec35581ab49124e9b51844e1c1506f2e8d25ad278428e424b2df28

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.16-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.16-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 79547ab29c1679fadfd49a980669bfca6e8c3d634bc55a966e6f6da8a5315366
MD5 756b5b549f4fe4e412c0b4debcf198bf
BLAKE2b-256 d6239b100628cf9394e7536bf27b2c8b1cf82d224126648216408cc6770ff285

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bc9df0e493a84e8a8fcc2a806a88147632c7381eb11e59bdc0a9552b2d326e0f
MD5 10ee9e8ad8a0fe2971c55026f8027c71
BLAKE2b-256 87525bbbb5d71b6e304adf588f00e6108ed5d23ce340742c02c9f17269efc677

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.16-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.16-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 59aee5553a8501c95aafbd29a6b2d3542845ddbc8acac55839c7f6fb0a6bcc74
MD5 5cec61294d59dbb89ded2e98e299ba95
BLAKE2b-256 d8e01adc854aa9938606a2b60691fc2cccd797327a345ba0638cbe70aa5c5936

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 e891d50502b59371bcce59a673802cf5716cf03d79d5671743e723d5a4cbf003
MD5 b2eaf8e782d35dafb44f5578807e2d20
BLAKE2b-256 89119ee5f2e55080e67e244b5e45bc193c598525e66ae7a23274936f9a34fa86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.16-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7b39661c74567448f09094e53fc579588eb958382619c6dea836f36cba0f3eed
MD5 c63cbd42c98969fccecc18a8ee527f84
BLAKE2b-256 7b71e54fd1a049c250faa829998a2008e5db822d3cb0b699662e10e79e410f76

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