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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.18-cp313-cp313-musllinux_1_2_x86_64.whl (713.2 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (716.2 kB view details)

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

ypricemagic-5.2.18-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (740.6 kB view details)

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

ypricemagic-5.2.18-cp313-cp313-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.18-cp312-cp312-win32.whl (443.1 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.18-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.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (722.3 kB view details)

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

ypricemagic-5.2.18-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.4 kB view details)

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

ypricemagic-5.2.18-cp312-cp312-macosx_11_0_arm64.whl (526.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.18-cp311-cp311-musllinux_1_2_x86_64.whl (705.5 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (700.5 kB view details)

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

ypricemagic-5.2.18-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (706.1 kB view details)

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

ypricemagic-5.2.18-cp311-cp311-macosx_11_0_arm64.whl (524.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.18-cp310-cp310-win_amd64.whl (469.2 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.18-cp310-cp310-win32.whl (441.3 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.18-cp310-cp310-musllinux_1_2_x86_64.whl (711.9 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (706.8 kB view details)

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

ypricemagic-5.2.18-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (713.3 kB view details)

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

ypricemagic-5.2.18-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.18.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.18.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.18.tar.gz
Algorithm Hash digest
SHA256 36c616a458201d44310b4af1ab99558f62878fbbbff34fc8aaab8780ded10207
MD5 6ceac4d4bf77c76bfb6fe0f7eab5346b
BLAKE2b-256 ecb56f00d857d772baf52c4f948653e904d4d7d169244a990e12d22f02badb28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 815ea4fe8544a34b6a14a327a946d0216fa8be606f2ab2a321886fff1324dcde
MD5 c2bb5999df23290ba0131eab36ece719
BLAKE2b-256 f0c6285f2537cff40b04a8c00d523e053f9b44c3a9ce5355f6119330752348b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.18-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.18-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 d3f98ea5739898bd4dd987979543073f16a911092831d54afa974f2f3f577091
MD5 e8db6e3f229592deb166f7964d7624c1
BLAKE2b-256 61ab84cb52f1cdf846e71f6c0403d6d4a2d9d0ea70debe02f64b898f665e5b40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 146bc03ea219c01c29e10fa57a1163b2ad59281655b93bd0b140faf611614b66
MD5 b40131cf629498f77be6dd33efc3cb31
BLAKE2b-256 31c24c5f9fcab8227a7fcbd13abbe67bce75e251024c18c8629af8ae759cc1d3

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.18-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.18-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 428e23daf324d62e68ff839e4e670cf15910a66c4ff4f9d83b4d699bb7ec2dea
MD5 f39920e9d6c01d3ac181ff00558ff25c
BLAKE2b-256 2361aa5b7b323c65d24fecb43e1115f95c96fadf382593b15bbea3c84b3b8b8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 66169819ffc688003d5e41971851f6e08e54278f831a74f3c4e125db1e9fff45
MD5 f3a2755aa325ae682b186023f9816f7c
BLAKE2b-256 9638f662fa80c9dacd7185c20358e04c820615fe62a22264cb2c6d6bd3951b2f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ba3622efb1ad53fac6b009d00261df7c671552450dd550cabf55bb73fde7235
MD5 374b0fe2bd77d3ef302ab3f4c29e26c2
BLAKE2b-256 9db802944c4466082a783402e022758321519b14b98f170e6254fabf106d0bd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9b4dd7a388225e72ae44aa412134a2006da48e0ec72289a4df46f1f48cd45fe2
MD5 b98951359946144f8a8fd09975d0f4b3
BLAKE2b-256 7ccd93f6c0457e90f6bbf8f51f81b6a6f3dcc576cdf51fe0c2f906ddd2942563

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.18-cp312-cp312-win32.whl
  • Upload date:
  • Size: 443.1 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.18-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 fb6282e1eece6f1aa88f4926a429d4c51ec3b7ab05cc172b584d911cfaa2400f
MD5 3f68b59c70cbdbadc35ff4628ac7629a
BLAKE2b-256 25c6bca2cb72b22d9119696bbb12dcb11487ff4b46b772ff0a005bbd17b8a470

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 661f80c579a35c663ed0641dc6a78bb3d296b04854bd0011b71691223bd4cc70
MD5 10ad0021540af3c666a90a1c43ddd7b5
BLAKE2b-256 8550408ef99ce1c92b122a27846c3d844a8146f33276801a236ff13c26ace833

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.18-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.18-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a58e621043d1ad4ba6c831fc6e91e32735d27396f56935a384462356fcc3231c
MD5 2201c190b7ffd5fffb1542d7cea24776
BLAKE2b-256 8ced858352ecd78d07fef37299de7b99055b87d47aa3bb5b0d6f603c37005cc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 0b4bea7fde5ac8dbda6e7e23f9c340191add65fffd9ea83993b76f9ac93ef605
MD5 d299f9a0ba3cf7e004ff4bb27300f16b
BLAKE2b-256 5d5defd319af75a641d607e08c4ba76b12482f4cbccb1d2eb9dc0566fb162da0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fccec356f3353c98428f876774534d72ae5946c150a5bfeff88a4e8927045b8d
MD5 7d50713cecbaad96e88615d63dd58bf1
BLAKE2b-256 7fd181279001831e4642f64572c2e6039d3a6ebfe96780dc2f34ef0b8f4b7ff0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ab1117ab150d7fbf975f463efcfb6a00e6731a37f6ebe419bdfad5582146993e
MD5 00fbd1ae412b43fc2306a67040403fff
BLAKE2b-256 e14a022e006054efb813273e89f5c6327360a48505bc3fce2e4d599ea2b01edb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.18-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.18-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 91449919ecae750e41331d41443d71cfa34351566458b96479a6683c1c5de0d6
MD5 f70f97a9b4a244ae0c5f357e8a788fd2
BLAKE2b-256 c8f2d74d26e649d08b87c06fcdb9780f83deadfbde7b5f60c1b720f04a3caa46

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0e020128fed7fd0476bbe44cb064ba50040e30f3af4b23107c2e4abcca05ee27
MD5 bd2eb8917dbc2ec3220f6a535de74034
BLAKE2b-256 3b4f7cac315b7b585893d546cef395dd12b888573b1077598fa4cb844b8b6810

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.18-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.18-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a4019ac96e7f5decb4673e3f7fd5bb4158c32b11f82da1adcb2f4d55ab896d4b
MD5 104b4738dacd78a6bd115ef5bb6a86a8
BLAKE2b-256 a70530413c8e97752ce367d6c83dc3a741b2b365eb2f0c133b2e983190c5b578

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3a969cfa8a315a1ba8dfa805a41a3c5167377182c83a924a7ee03dbe12456f6a
MD5 0e06d9f17579302ebde52312c6364806
BLAKE2b-256 77234b59a710966aaabe78204ac249ee6b234f5a5f84aa3232b18b6f3ba20bd0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8d1e83ecd38c104275e63ebf468d6ea3dc6cee4d9f19ef764dd2ba1506339361
MD5 49b43c63bcf5e993d0a379bfad96bca4
BLAKE2b-256 fd70fc23c8a83028ebced9696513847b8878646f9c295bb1e1ab703a67c5f9a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ea04f9ba1c4d97b8a39904a4b54725c14489b3b44fd5f9dd9eebf1a0e860498c
MD5 adae1ee723ce8b5ac8b313fc15093965
BLAKE2b-256 0d00cdf5c84bfe4a1f671a358b05bafce286280e3bcb47437da9a8cdc4859094

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.18-cp310-cp310-win32.whl
  • Upload date:
  • Size: 441.3 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.18-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 3dfd677aa19e8e492c09c2f2f48d08c18396649d7d1df4057b1ef3c020a04853
MD5 b55eef15d3a8da6db2412944c631323f
BLAKE2b-256 842f980bc73d8b5f573b7a81c4c4b3b2d83b7335bcb52e90c4dd87a05c042b4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 41c6ba7785c94fbeca3009a6ea33ae751d2486857e475afd8f3566c4a572aa7b
MD5 b78ac675fe05f04488f7d412f5e62f65
BLAKE2b-256 a7afc3aa2559d3e37bf94f8726a277438d97b8a0100d9ad63396371d5dde2d6d

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.18-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.18-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ba076f81a6ab3e35a0a2fe4954b317b85c89183c36dff7201fe05e864a5cfd00
MD5 a74e13c80e4a5f46c273e9049f7671af
BLAKE2b-256 4f07f3a4ba1af6bc38a2e4c6ae7d1fa1fa75268a2cadcdc4ce82571ed80676f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 8d4ff8454eed1c194b6ac97e66769ff3943eb5714fb105f97dfedce12a5addb8
MD5 d87e9a71794c9a7e453dcc24ecee0d98
BLAKE2b-256 b76438404eea9873eb5c79493e69faf37e6e959de1f368288e60f737b3d7d2b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.18-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f6cde6294c7ba11f9e6fe0a8a6cad618f36f5f2ff56d574fe8d5e959eea9dbd
MD5 21a74e1c725b33dc33c01928cb88a8de
BLAKE2b-256 a4735475ae336afe146a77a74e07d9b682866e529adb8aaaf7e5505ebe00847e

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