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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.12-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.12-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.12-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.12-cp313-cp313-macosx_11_0_arm64.whl (539.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.12-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.12-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (732.8 kB view details)

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

ypricemagic-5.2.12-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.12-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.12.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.12.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.12.tar.gz
Algorithm Hash digest
SHA256 bca0f969a669f9063e4c9dc960841e3ce6927db724d3e913e9140ebe78554ec4
MD5 937b58a67160ed2c1b7a42fa22bf1de4
BLAKE2b-256 0d8c8aead34804d4af180d2b0828525d922b4c537fe44f57c50f6f6db17eb0f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ce87cbbd0c5b25eb1801864c1b42d56ca9e5dee5d7a6df4b078a6d0e3790cfde
MD5 6c5db83f62db1d4cb456f9fc5a1738ee
BLAKE2b-256 b0b1c72499eee087c0499abcd7ab2057c9f2b33756c98a94e8adbba600085d82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.12-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.12-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 f56fd50fe9881a62827b0210ad576674ff2faa05afe226d7cf39bcee499387a7
MD5 c1b61fb409e19d87f43bb2a2a16f4f7c
BLAKE2b-256 198db58e037d871be7c2c74d54391f0c2c7d347cb9d7da444cabfe377745bc12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d37d6af2853c3942b3cde490656bb1c0804a0ca05a826707b7c977a43404f5a7
MD5 3215b544c6d6d9c6f157c8dbe93b36b0
BLAKE2b-256 8963f7676111ba1e63cda912f01b4be2a710410daecb58af23e57371326e5d56

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.12-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.12-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7aa94c189694336ada2cea607f214ddd1342517375f36bc7b27e5d13e4349b48
MD5 8b07c6f5c26ede1c71ea6143725518b2
BLAKE2b-256 cea01f5a56f1ecca9d48cea6c62c3a9071345ec8f3dea7f2b781165040f274d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 a72507eb409b92d903fbfd92224daa07e2a6326f5cfc07390939c7d9221e3ef2
MD5 4e1e8c17fef188eb65c48666b5837111
BLAKE2b-256 2f5d30741829eaac182c81ca14f19396a77572e33e83750a838a9cbb818f51df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ecc901872ce6320f32e9f07f749480d78b4bccba649ccfe8a340ed4034e7513b
MD5 89bcda6b5631d9a8c8d8c7adfbd2b098
BLAKE2b-256 745b2decdc2dc1e034608a4e2b46af084e1b2c6981a2b4782c6f24edad818572

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fffaa5edd4950a8b869af8beda17b5950e6f90925d62a44ad852ea36a224208f
MD5 80b1390d9b14b95dc28945df9426fe19
BLAKE2b-256 d584493109db00c6c5fd099c18ae630965f599cc91eb23c90f81b377880955f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.12-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.12-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 7ef7e65f55d932024fa47557d7457eb9af6f696e213f82b2a04a3a40a2aeeea3
MD5 2d9c776010b50b287326e905f9ae0edc
BLAKE2b-256 fa70d3848024eaca4efc7730c952866be7a4b08597d19e8801f0c4c1fe3b004f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 82398fe751736f4db27d43d6958cf2de7db84015fbc13bfbd556728cabb013a4
MD5 62f82b27097948add1cabe9150b877d5
BLAKE2b-256 3a1edd49e36ab6c15cd6db41f0336caeb79b69627709770cfa1942d810be74c4

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.12-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.12-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 69c59845d0e52b4e968fbd5167b804f79bb018568bd8474d431bbb7423a6ec38
MD5 a0750025be35557d8b75ba67da246e6e
BLAKE2b-256 6b424dd8ce3e58d9f9b36753e59ac6c5870b7c6dceade59b9ebdb8de4b7ea519

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 9f0f03ad2d8b2f460be9c53e71e99c491cdb0e91b509e13b750a0510c6aced07
MD5 63fb0bf2ada0401ea9b7a3898cf99868
BLAKE2b-256 c3fea2dd83cbfdff8881501afbf08083326e5c7b7525b24ea1d431fb462f1ffb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 aedee75e92da607b32c0ed1a06a1015bd41544a4d0f50655a09fc04ee2f00f8e
MD5 870e69f52997845efed6f3800b44f249
BLAKE2b-256 f54348378dddf7bc10872c457e9814abeffdf12104f2231cf6303d3733c4bca6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bf041647937f522b453fe34180e92f0bfe4b0e1393738396c9150a177a227355
MD5 323ccb5501ab48cfe3724e50c85fe18b
BLAKE2b-256 d839a3a7b091093d7288d7ac0dd851b95de44ec048dd1d9f8466349113e77294

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.12-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.12-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 fcacd029ff244320704ada023eed762b18a97112400cd8eb874546ccd23d7ae5
MD5 8c3408773ad58051209e2b4d87071ac8
BLAKE2b-256 b8654ab6cf8e06f4afd7d10578f390d0af53b2e2f86cb2f914c1057377682d3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 056d9ef960e05eab8f0d8ec16efacfaa877038a52a789d63c9b14fbdced01e51
MD5 987ea754f7ca6e3c8498cb601bb858ba
BLAKE2b-256 967ad00b5920243d5ca955d8607a24642d512fa42701e23ec19e89d3d3260e08

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.12-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.12-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b433fc79336c5d594f0d2c53f0834b5746945c7346c772b2951e50fbef94b71
MD5 e0a89dd2c9974555b92038303f5806fe
BLAKE2b-256 ba4ea4585c3ed7d8498df2a8d8e0829829635014c5511207059563ef737317bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 edba97f6ad74ea298e4d3ad70d09d88a9a0c586cfd610d7368b8648b4ac467df
MD5 214c1e6700171642c2f98fd1faf1591a
BLAKE2b-256 6581342e36e435c336ff703d545a56d32382fc2b1f46b059e98dd762b8c8e3f7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec2613f55baddfdf62b3bbb5ac1786f6dfe8010925718ac2a566740a2362d7e5
MD5 144fdb0246ec267a5e63c0351ac9626e
BLAKE2b-256 927fc35df81d6744d10c852e835a9a838997a46ae1daf8f6df8ae4fc58fa08c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a4bc26c029c735acbb6764047d0c9c60bdd59c26fb95af8154f64251b04fae54
MD5 5be74da7fd51e48bfd02dceed84bdc8e
BLAKE2b-256 6512a72c2a8ec296f56399b6c7ea84f7f82a21fb358c6f59f7027e07b126062c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.12-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.12-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 6d5d51fc60f417ab77d771fdf481d7b1a3844ec49574c2f9c8c2f234d7d344dd
MD5 ec9b80865c5db5ed4226c6fe066792a9
BLAKE2b-256 7bcebb31910ac997b78a6bc32ff8b46d7c4f683307de8e442de05617b1423a18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9ebdbf51cb776520123d6dcf77892e2268f926799df26d453b589fd5c22f3afc
MD5 be512cccebf3033840561826623bb0f6
BLAKE2b-256 18f0ddfe164da979a588ca8b71ee1837cd53b936943f8fb48d8018210e52e048

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.12-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.12-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8dafd6ad867458bc74369dd0ff1bea22fc97ea640dbea10c3f10cca2bcece405
MD5 5cbbc0e6921477b69d9cdcdbf2a28b4f
BLAKE2b-256 fa6cdd5c2535e10e6ae812c505f10f6016ae29af64d98543cdab0159d6348dfa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 d4455a556d6bdf40aa28708a69172bb52cf8b0e4a54bc231172834a789bd5f8b
MD5 2f77228b63e75a5419a6738b8b5ce9e9
BLAKE2b-256 cd4beb6f488de59cf3a0b43c6563debb68fbe2593c04f1b90aedfdda562af243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.12-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 025a4f57060af09e0692283d72eacb17b48577469dcc8843ca27874612233c87
MD5 21998d552e3bb42ea5b76033af438fc7
BLAKE2b-256 cd7323bac22033ade8a9481e4583fc9aa11eb2640579f72daf32b784b16ed4d7

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