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.21.tar.gz (280.7 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.21-cp313-cp313-win_amd64.whl (470.7 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.21-cp313-cp313-win32.whl (443.0 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.21-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.21-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.21-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.21-cp313-cp313-macosx_11_0_arm64.whl (526.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.21-cp312-cp312-win_amd64.whl (470.4 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.21-cp312-cp312-win32.whl (443.0 kB view details)

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.21-cp311-cp311-win_amd64.whl (469.0 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.21-cp311-cp311-win32.whl (441.1 kB view details)

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.21-cp310-cp310-win_amd64.whl (469.1 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.21-cp310-cp310-win32.whl (441.2 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.21-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.21-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.21-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.21-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.21.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.21.tar.gz
  • Upload date:
  • Size: 280.7 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.21.tar.gz
Algorithm Hash digest
SHA256 4f929268c35a1180149ec4b97e3972372ff9c1927723900559cb30c168227a37
MD5 bb1148b64a8ae872673c1e56758e1f58
BLAKE2b-256 6610f99ecd39593c3cedd82b21122438d5e173431797bb71bbebd228ca65d34c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b6523c10425ca40bdc4e38cd91e59d207bce0faee95b73df75fd5d75ecd6dcb0
MD5 2ed037220defaf538b85742d3e5fbb1d
BLAKE2b-256 cc5a5d03b08ad92160e4f086c88d06eace5c033af317fe45c4f3ef2754efc19b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.21-cp313-cp313-win32.whl
  • Upload date:
  • Size: 443.0 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.21-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 ea0a5354af12e129b9f8143c6a8a59c139cafb6a5c65bb304ce3289dbee60855
MD5 32f66190ea99f76b96e8191ed80c5c79
BLAKE2b-256 65132fc223ad4eb957caba12b276eeec1777d6ef1a7dcba6f48d58ccfdc3c1f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 6eb5ac4b4e9b36dcdb3c4836b431d5211a87f69f395bd28fbb93fe7f46529bf8
MD5 cf141a072eb89c26952a76320d29d5bd
BLAKE2b-256 7f4440488c659d959efd1cd293bea779e5dadbacbb20513b34db7339e5c2013b

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.21-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.21-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 74eadba08635429c64cb820f5107282a06f0708862b95fc140acffed6f27eebf
MD5 b63df0437b6ada53f919fa804c439f4e
BLAKE2b-256 8e47b73c6ca539cc4657841c6ac84bc664f9db86ae54a83d8d7a7a8b8a623852

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 af93b65d7c628746cd69eb1a7c9494743296777f2c93d1b6ed882f24f294131c
MD5 49d2fbc73352ebd6e4add92ed23b2cb5
BLAKE2b-256 ee4e9227e3d8725a6d42d32fa95f57e76f0027fe4921fb63a1bdd15e90a43e10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0732960c4b5f5ce20a44babb15bd2a8a7443beb96481d35bc02b0dd6750cef0c
MD5 8526b1e8098c2440582593da533917ba
BLAKE2b-256 2ac74f47403c14c15f0aa9a08b08676ae0a5bfa7cdc8aeb9865241b9aa48c683

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 637299a149cb8083b895cf629d21981b70ca16bcb33e909a91b079ea0e627560
MD5 db18006bbdc0edb1f1a6020fcaccb112
BLAKE2b-256 00a851b284231756a51eebff6e4c1d6ed83bf530f67aad8c9839643c448d9e33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.21-cp312-cp312-win32.whl
  • Upload date:
  • Size: 443.0 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.21-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 1f348f4a8b2a5f7a821b52dd335e02a1db5a92b5ee0d8ac81aca9a8c345ab354
MD5 781e9465f1a07f8c43337f2534517c03
BLAKE2b-256 a57494c3be80d75a21491a24249e8bcca350a26dbe5f3dae79630f0c575ca3d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 27bff43bca344ec64e5055d2f841d2c1b24360793d662de279d546495a006265
MD5 5ff0ce12a3002657347a06d6ed243bd3
BLAKE2b-256 6707f7f8db01926cbbbae2c6eeb46699542929fab795f673007b0f3a5f5c044d

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.21-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.21-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ced1fc9831c381e4d93dfe764832761c1f1d682e37109b5f486f046d2ecbb6b3
MD5 f399f3742542525bbd60afe07b50847d
BLAKE2b-256 1f6592c8e7870fa88f14ac5b5b8589ce2b0ab03f71d8809e980cdaf34f64e46f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 7897d56a545a29907b797b98dd55fdd9bb3e949c21c23a304afedbd8bfca60b7
MD5 11a4c785b4f6f4dfefe0b6a206dd08ee
BLAKE2b-256 52f9ab45f0966be46e13625f0bf004b17ec57fc31ec544f7c950c9402504ca50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 751cdfa42e4e5e5ecae63806c1af762ea307b6fce9a36ed33a88228765eb66d9
MD5 16406d26d7e314e1e471220d68baf4be
BLAKE2b-256 f0d0ef8f5592050d1b321e1acb1d54f9a51a67ae79d408c081fbe23793c701c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 166c8be16161a9761dad69ae1f927aa790876d528e22affe06b9b108818925aa
MD5 44e1f9b1fd3e3a496427dda071b10335
BLAKE2b-256 64e0c8577d73dccee8845c6c1e010bff2e5ebea5a873eb443ee8e5a094939c5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.21-cp311-cp311-win32.whl
  • Upload date:
  • Size: 441.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.21-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 db41eb649345520b2125e2fd2d8ccfd5bbc4aa62315b7b96812762dc364cb1fc
MD5 33bb8dc558e8b9a4c04659e1cde2fffb
BLAKE2b-256 eb660d0a2158a36f2381d4df5060b713c9362600302342c6acc2620ef3e251e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b5cda7aae5c74f9fbf8a0042182a5ae32f6e41a197d07befaffc47b00d2f8551
MD5 696ca131c7c4bb6e43e485323ed2cc9e
BLAKE2b-256 c85fc7e3dac8fb2b1f41fce4e03ea86be384018cc3863ed9788973b6794606c6

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.21-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.21-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5726a013b477fe73e7ab21bcdd800d734bd37714173ce6a736d1f9eaac6e8712
MD5 20974be3c65b8042034ce77a0d75de04
BLAKE2b-256 a40b6baa0b285eb144915f6bbadc93adc4ac8db560c345e66bd5d9788a4d07d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 9b8565f916287fc0685d126f05eecae778e5f439ba937edd4b3e510746582736
MD5 4dac82203ca355446f26aa3e256899e6
BLAKE2b-256 695d6347068bbf339dc267b0e1919151b139fe44669a752d654544d6956b7c5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce0fff99eeb078c6a9c65e6405889c9f92ae9707267157fdeab81fd19d34b419
MD5 bdaa5660511536a267dbbd8246879eb4
BLAKE2b-256 a99a0069ec3a446d829baafae3e82e67e2771a620680b372d5c2637830e6b6de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c1faf0af3a5499a361c86b6d95fe4cb0b5ad796f2ae775cc81184a501aee7f40
MD5 f91f4771739a3a8e7a2ab37b1bf8d7f8
BLAKE2b-256 590752e80d10a343624c15818765111f1e0c9fcbefc4eb02ccc6020a5c43b251

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.21-cp310-cp310-win32.whl
  • Upload date:
  • Size: 441.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.21-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 04ea4a7dc5ed4754880cff7cb10ead75b68c73f484bf1321343779246fbc4247
MD5 3c3e9c3f78022648573316ce663bba6c
BLAKE2b-256 b1926372a8a81c84b4991b237eeb4ce91603cc96d6e93f795dd7a57648a90676

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 92486a0ac1377c8cbaa731060124cb0d0413363771637c601d2396d8cecbfcc1
MD5 1d24019417a07cd166abb6c6140835c9
BLAKE2b-256 d57ca5c7b404179f17a433d3d80ab0b71bbf3e3aa6a9b67fdfdf53ad72411bc3

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.21-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.21-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd1bdf55a1b84de5c839737dc04c8bdc15396bae801e4825d4f15379ae524ffe
MD5 51431108f7d253399c586fdaf2c918ea
BLAKE2b-256 a1fb95d7483b33b2387978e04b2127b1c36a354f16175fc72410f6da50255cf5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3fc19252a2247f9f003ebb7dbd1d086f457280b77f448aab5950a03e64a0ad41
MD5 48e0d8aa6ca18cb7e992b4041ba8ab74
BLAKE2b-256 1102ac4896ab7ffa91fb1dc6f09825befb1d042d9a5f0d6a91040585fd9be044

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.21-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc110327008f5c77a648ae94d684dd6dd9dfc05e2a59cf2a5c04a16d715755ef
MD5 6f9a3845a64f9b38b9fa3d85628c8a3c
BLAKE2b-256 dcdac7b0c6429930a8c9adf138a6012332d082a8e7d2d50f53898ab0bd502f6d

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