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

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.29-cp313-cp313-win32.whl (437.3 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.29-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.29-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.29-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.29-cp313-cp313-macosx_11_0_arm64.whl (529.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.29-cp312-cp312-win_amd64.whl (464.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.29-cp312-cp312-win32.whl (437.4 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.29-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.29-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.29-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.29-cp312-cp312-macosx_11_0_arm64.whl (530.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.29-cp311-cp311-win_amd64.whl (462.3 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.29-cp311-cp311-win32.whl (435.1 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.29-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.29-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.29-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.29-cp311-cp311-macosx_11_0_arm64.whl (527.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.29-cp310-cp310-win_amd64.whl (462.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.29-cp310-cp310-win32.whl (435.7 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.29-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.29-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.29-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.29-cp310-cp310-macosx_11_0_arm64.whl (530.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.29.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.29.tar.gz
Algorithm Hash digest
SHA256 3ff0b8ade0f6e030c714a56c98a3b86e7f87602ba10fbfc2383906a740092e56
MD5 40ab877e3ad970744410a0ea448856af
BLAKE2b-256 db6089e42959f1ce73176621a1567c3e10139e6f48f6c301a285480297aa9b54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 87e36f32d09e3afd695b233e507d9876ab28ce8f09a806bcfd157ae9d9b706c2
MD5 75b3f19560a5bff3c85c89dd372a46aa
BLAKE2b-256 5f6fd4304ec86fb3f7fa3777f2c205313f8f2177e7d2ff658801cbc212e00384

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.29-cp313-cp313-win32.whl
  • Upload date:
  • Size: 437.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.29-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 9fb3ea76c4ca7c43f2fd689e5a746eb36d84e2de26dc696f09551d2c878cff28
MD5 6c4e7fec22ede871abe325e9d2027710
BLAKE2b-256 c04e074d691f6275baa64b6501fcf49ce487fda990fdd6cd4e4f98734fd90cf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 db3cabde63f449b53a4e09153dfad72f675d091520c45aa332d916f84f9b0702
MD5 cdfee2ce16d38ee806c2dbc283e6a48b
BLAKE2b-256 b6d60aba17e774c143a3d2b0e6b35bc4390f650d455e978bd2f5c02a55f14fce

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.29-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.29-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 66f0c4b4eb40ebee49135d95a9e313a13bcb36e91178d7a54f2179b46738707c
MD5 ffa700f235a20fc405f8683388a1de1d
BLAKE2b-256 37d4f30f914f9ad787a4a6160ab8542a2ecc3e38eb391606a49ef7d0ad970131

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 de5e20ad85b90315619bdf624ee2e2a6be53c311128604e52713e84a97614e0f
MD5 a02795fca43d26c3fa417f8eec624f3c
BLAKE2b-256 b6270c004f3056de7eafe50043ed45c1e5ab241f86ebe779d343126e3fb3c993

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3068ac6defc9099de7e71f7b59df26a76b4d46e1e0d7a8f0ea0c7390fbfcde88
MD5 4b3d734e534e05c9d8badf464330af7c
BLAKE2b-256 25b8082fcf5b704bd07e9c9c52ad8845bee7e2d85c48d5b27adbf61c28a73f7f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8fd274e4a927b82cc31099a8a7ded71398e59e876ad3fd49bd96b953d3ce3243
MD5 94206e136eb03648e8cb09e0beb7be92
BLAKE2b-256 9fb32f9bbd3fbaa87f1e1df48adabafae41bb4fb2ae32a806fd5ebda40f89342

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.29-cp312-cp312-win32.whl
  • Upload date:
  • Size: 437.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.29-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 1ea8df694be0c987e44bf28ead136571fe9fea0bbbc9b16353a41b2399e6e3cc
MD5 a2fe6bdf4da110f74cba29b5a16a610b
BLAKE2b-256 d3c21ee66e8ed6f48418e70c3a85cd45d754e3a3483769da7bac48a6895c0467

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 53af8aa465569e1939c6ba444ec6c781011aca0fb0850ac0dda0802f8a4b4b37
MD5 2995caf3c983b13ed5e6abb4e0313f72
BLAKE2b-256 ebc8c009104b426297e3a9e7401ab2a888273b1e31088fff42ddb9aa55fea679

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.29-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.29-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 600798c58ecfad3cdbabfcea820b712cfb599531fd052e076ec398282a74e83f
MD5 f2dcb79475bb7bfb40be1f4e6ff08968
BLAKE2b-256 70c9a98f6c94c4005954b11eafbbbb789e84b07ea98bfd359cd9b3510a6936c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3ef5ee5319227cd9196efa83a4dd1a14709d4764f572cffbad000d447c28a0e2
MD5 811bd3bcd24ab60f53494d61d4b14d52
BLAKE2b-256 20e0883764d896633f79b32665c5cc7a05652ef8294c1b7b043c4cd60945ebfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 61e8340793cf353a2607d23a71f16cf49f59ffcf4d48fa81b7a21881df736202
MD5 9e2f3e8108aa37822e2ebc60eb81f848
BLAKE2b-256 b330eb70675d313b712e9fa7bd2efb6ff4c5ec20881338442e14eafbc69a92ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 27882f11d7cea8512bbb70d387fc349c513789af61f7986c2ed7cbaf1d605660
MD5 b6db1eb09930f0c4ea4bd4aa8225faa2
BLAKE2b-256 b2c43c0e1ad7480aa82bdf392dda9a65daae0c8930022162fb7f206a9412ff1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.29-cp311-cp311-win32.whl
  • Upload date:
  • Size: 435.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.29-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 30cf6980cf2eace7c60b017394b90787eb2d93a1c7db2f8e6307be6c92a3789a
MD5 e615b0d3c5bb58363015ab66294d71a7
BLAKE2b-256 4e25d0c517f57d32c349df181fba08b5035a8298247fd972fa93c3294d453e5d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 931227d542fc5ba1350f472ac0dad23aeefa5d2b288071a093eae8bf47da5a57
MD5 2edcee54d4578835e01faa865c6e6911
BLAKE2b-256 6fb6709064dcb8c7a5fa3978e57133ab0de1324dc0d6a3e9fcec8a6d91616ad0

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.29-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.29-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4315b3cd9ca2bbca809d28ddabcd176298b581f8d961ef47b648408bd9522572
MD5 e7acb3381c590e84e43f0118bb8f8521
BLAKE2b-256 fd249d0ec18f57e0d90b5d6f79db7997c806b8012a69abd817b2fcf43617601d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 4249b3e6332e57530c33772cb8591a499e7c3fe5cdb16c060fd9d0e6f3b333dd
MD5 a7f68dc08006c7f81390d64936325219
BLAKE2b-256 4b4c9def162358e3797521620f44d8556b9c70d2a449afcd53e700a75cc7d589

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9f167c39debd4cdfe6c6ad0946526dc2df5ea694d8935006504882ba5a282d3a
MD5 2856fa96016d5c895113c6032c6675c9
BLAKE2b-256 a4e4e6e8fd6c8e45f84e3e81f629b8cb91a7a9c03811dd7a49b78a0fcb5e13e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 710c3f8d69bfaf1910de2333061b0dd128f59f2cb469ad3d63f66b2786530254
MD5 2402c905d7a9b3ae61233d79db3e4ce0
BLAKE2b-256 5a3ed8891436172d4f3217343823dc0742c1b5d4ed3fa4381c8ab1590945096e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.29-cp310-cp310-win32.whl
  • Upload date:
  • Size: 435.7 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.29-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 e8c885b5813fedabbfb10ce794c53fc2d56fe8d123840b2f35902c210d79efe5
MD5 785c0a33021df29f30367425e54d3f20
BLAKE2b-256 6b284b8151c209d400b138f23093af073cf87cc300796b761aced1dfb5aa3e1b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 062c26ac71f8c94d60ab0789bd2d04fdba0a3d21a04f53efe236ecc19f6e47be
MD5 733ed4ede5d0e291bd87e0aa27f33ec4
BLAKE2b-256 aee1d7b050964a84fda2489fed2bb4af940e51c6ab100b893033cd053eb2c550

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.29-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.29-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e342e32a8fbc17d2647b49687222439cba234dd4d0c64af410d2b369b8910fb6
MD5 8d634ca6e342d949d687a8a8cd118a16
BLAKE2b-256 bb50ca01ac10cbe36eb23b20494976b344cd31009c11d5f9044d27fbd61b8d10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 0ec3309cc9721b728a6a8437bc10ab2651ea9f6a18c5871ebd5a01ef1bcfa313
MD5 1da5dc67c410c90289a9b05ece08444e
BLAKE2b-256 46a0dc86c65bb6518b6343ffc56e44bbad01f986a4c20fd98a41a8cbecec3e66

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.29-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff31d3db360126d6f3ea2b9a2c131b2ed28db4ac9aa749c4834d7a0fe826d58f
MD5 82895fe302174f85a3daa6bce94fe542
BLAKE2b-256 5c33b8a95016e105f4d482ccdde1a17f28e6f8426da43457d61b0bc6e5755792

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