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

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.26-cp313-cp313-win32.whl (444.3 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.26-cp313-cp313-musllinux_1_2_x86_64.whl (742.8 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.26-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (747.6 kB view details)

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

ypricemagic-5.2.26-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (772.5 kB view details)

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

ypricemagic-5.2.26-cp313-cp313-macosx_11_0_arm64.whl (543.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.26-cp312-cp312-win_amd64.whl (473.6 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.26-cp312-cp312-win32.whl (444.4 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.26-cp312-cp312-musllinux_1_2_x86_64.whl (750.3 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.26-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (756.0 kB view details)

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

ypricemagic-5.2.26-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (777.1 kB view details)

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

ypricemagic-5.2.26-cp312-cp312-macosx_11_0_arm64.whl (543.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.26-cp311-cp311-win_amd64.whl (470.7 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.26-cp311-cp311-win32.whl (441.7 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.26-cp311-cp311-musllinux_1_2_x86_64.whl (724.0 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.26-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (730.0 kB view details)

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

ypricemagic-5.2.26-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (736.5 kB view details)

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

ypricemagic-5.2.26-cp311-cp311-macosx_11_0_arm64.whl (541.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.26-cp310-cp310-win_amd64.whl (470.8 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.26-cp310-cp310-win32.whl (442.4 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.26-cp310-cp310-musllinux_1_2_x86_64.whl (731.2 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.26-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (735.3 kB view details)

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

ypricemagic-5.2.26-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (745.8 kB view details)

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

ypricemagic-5.2.26-cp310-cp310-macosx_11_0_arm64.whl (543.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.26.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.26.tar.gz
Algorithm Hash digest
SHA256 57bbcbca1ef1b8c970584435fee5256f92916d1cbf0fc42578908dae6c74e5e2
MD5 1565ae34ecf72f0ae7674bfc506657da
BLAKE2b-256 bec2b9e86c2463ffc339756e1e8ae6581de103c46d287f9d70f358fc1f1404df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8a8a669ea83dfdf25dbc73146eab212277f8f559139934e98b758c08a93492db
MD5 91aed3b119e504746a053ec86d72f946
BLAKE2b-256 1c399b3b80e94987dc79fa402b4444b9c79093b35c25a7cb72bf7b8b5f5d37e5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.26-cp313-cp313-win32.whl
  • Upload date:
  • Size: 444.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.26-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 224ec31a6f8cbece43955ec8e776053e41aefc2a8b144051c97b43ea1119eaca
MD5 96d787517ce0d35e7936ce0d69da445b
BLAKE2b-256 b7b921fb5e571fdb9cc846f8cc5c770da1ce555ac35217a99ddedfb035566106

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f16ac4623adeb9be86b7c9049a1e60c65e362e6bf47afcfd44867b796dc1a24f
MD5 e59f4622cd84840644ee0695fda3e82d
BLAKE2b-256 679bda9be17f2166411fe948ca22c25dcbe268ae4aaf747c1691fac09198d336

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.26-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.26-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a92ac15d88bd46d79d5f5833e8ddf771d51b7002c9833fe0433cb133f6f38540
MD5 cfb2476d7d6ad0e25438888d6c0bffe9
BLAKE2b-256 a9eb429e321b4741c5314c1c680bc911fe48aa1a65de64ba677aaf5358a780f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 fb6611a07acba88ffa7662ad59ef217cce8b62b9e2d072be1b6e99b5b0238fd4
MD5 7bf247028944aa38aba351aee5aaf53c
BLAKE2b-256 db010f1744b80a21feb2b927528dbbaa713526422e4c100f29887cd667ddc915

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 41bd8e7a894a35c6eaabb6cd5e440620cab03961ab2ac2fc3e2783f7dab03c2e
MD5 ff9e6032f2827d5f6c30954fc8536d0b
BLAKE2b-256 f2d24ea6918f11614d2c62d9290f893c33f3ff670d04bd1a6e6f70a784fb69e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e642d5e0a89082a0162c7415f0344d6073c4f3b4a8d659f96e7d20ff03b69f9d
MD5 2c173c225e8bc9bd537e1765a75a400c
BLAKE2b-256 79e9ba292d04ade5912cfb4e687ab2b26546eae67e9792cb2bcfb6317aaf3b4f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.26-cp312-cp312-win32.whl
  • Upload date:
  • Size: 444.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.26-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 eaebd9f44e9d5d098460e32ddf4d9b7094c55b4ee9f6ca9f3cb0c3911fdd3dc9
MD5 1852e6cba8d69eb324a1dcf4d1ae7eb9
BLAKE2b-256 bbd93f457e720c7fae495901ef1239c40e0019acad3d525c3abce5220b515af7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d7aaf416698386da036f1beb0d0fa635b1a224ac9693e6df3dba0ef782154949
MD5 e6de53ee72cbf1bc9083ce3fbd10e387
BLAKE2b-256 a391cf60dd8561ec844ee7b88ee45de1a73cc9378edf3740b055c49ca80a79a4

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.26-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.26-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b7c994bc9ef285892b0a2b894eca8a95cc3b575a8411bfe3d2356ec9542fa74
MD5 6b80a2807f5c24ab9a7b5a9276c87272
BLAKE2b-256 4f9083218afe1b1ffb95a0d9a6e3786a10583e0eac999465d8f91a2b047cdc54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 f06a86a614f3eb23fa3773dd060a608f9151b7755811c9f7543ba254d9c981ff
MD5 c2778edcfa046d06902b66af11a10aef
BLAKE2b-256 132ddf419bd64b60dcca7f981943a7d1543a4292d486f824941015938051cd2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c7014f16567020989862826b1dae655c612fbfa29ad8d36baf6ce148e8e0471f
MD5 b2031c8f916a871e03809ee75fa7046d
BLAKE2b-256 3e95ea1a32f880dcc84e12fd54b9b2e56ee8f363a7109ea39aa78f2e20f0a6de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 97a18005eebce1bde34c3a10960410c090c37ae4a6b78563e407963db7f2a0e1
MD5 dc98ffac6ebcc872c94e82ed7969a205
BLAKE2b-256 27b68d7ea0e716c01e96727c02f80773f63b7a22064ce342a1f98eb61592fd49

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.26-cp311-cp311-win32.whl
  • Upload date:
  • Size: 441.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.26-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f6bd131da2413e23aab109bef064d3dc881736c44fc8107047fe7abc360441b5
MD5 683831536a70fe7fff2a225ab80b7be6
BLAKE2b-256 c1867bae01e04b7049d5d09cb6421dec522b38cba74d712948be4a961de957ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e18b0e2d40e2629c300be33130ebd2f574f83f88c20c111fc6b8b46c2d916e1
MD5 8148d27d9d25cd9e56becd32b06d69aa
BLAKE2b-256 339740993a829d60c1eb03e5b48c739e71e8ffc945775f99fb2ad1acc461641d

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.26-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.26-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b6df9313ac28686ff60e4b41f4e520758d3b5dbc499db29c0337e7840f6d29b5
MD5 47a0f3a56bc681ecc668ee337593e421
BLAKE2b-256 8cca30b44ea25ddc2f680d8193dd35673f2fa2b009275366f9770140be8fe417

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 6b8d797de76ef0e16e7e08ade1767be7761e42d831727d4e801f5d529383d083
MD5 a6d3a3e3845b776774f39ec1d0926e21
BLAKE2b-256 a7d78cfb61eb0420828c30e88056c822f20103d3232526143703fbdb3e5b770d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7c5b5a7441d3e18f9fc463d5cd6fd3a8cac5e925cc9d0c632f9a1c359fad7c7f
MD5 00d9e0a83041ec833df909ddc6776912
BLAKE2b-256 8f64ada0c412d8f3749b756c06b0dd851aee2b8648830c79a62c8d5920f6166d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4c1bda479a8ed6b5facc79e322ad406b66e7d3ed7f034e97837de39a25bc56bf
MD5 acfa7003b1ba121c70e529dab73a5d0c
BLAKE2b-256 2c563d0a9843c3ed83c76f4c8f8b0203a5ddbfe7779b548e129deabba8d04dee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.26-cp310-cp310-win32.whl
  • Upload date:
  • Size: 442.4 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.26-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c992ae7e7f76d5586a81403d0b053e0cd57c51eb39b8e49aa72d8f88f00fc5bb
MD5 de0d791f7f6f86e3d52982fa30651e28
BLAKE2b-256 00c3425b8f07c61ed28f3b9bff909d9d345e561469b487cec06d97becd021df9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f0f7d08fe973f5576e1449eaedc7fd33ad71f4000e921866b36db9b074049cdf
MD5 94ad1e570aba9faaaa52dcad21d8607b
BLAKE2b-256 e16f5d3a7f813201792a11df450603f7f9d012d82f43b78ece7e8d287c33d64e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.26-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.26-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6d457a1045e5381dd2e124968c3ed6b5fb3967fa505e03c68d371564702dc65b
MD5 cecefbfe1d233cc957d7d08b60749bff
BLAKE2b-256 4630f42aa54b3e5da6a17431b30ce033a2940798903d8fd37792eb7667ba4e2b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 c482588c20c603b56692e660e284d6f7031d75bd71cb65a198df085f3edd4d02
MD5 84b79f4754912377835289c117f23961
BLAKE2b-256 c5787aeabdf86df4fed3e9a9a09bcb5f06988a22457431761087636547abf97a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.26-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 299493d450bbc5de2d11524f5c5c158409a611e55a05f11e053e3c0cc585537e
MD5 3de1b860d6131afa850aca8fec565876
BLAKE2b-256 978f705acdf222067f39a359a74c5997e37f6765d95f07339d40a47e10791b6e

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