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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.14-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.14-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.14-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.14-cp313-cp313-macosx_11_0_arm64.whl (539.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.14-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.14-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (732.9 kB view details)

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

ypricemagic-5.2.14-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.14-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.14.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.14.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.14.tar.gz
Algorithm Hash digest
SHA256 073677245c1eedb0d627135e96a6800295b28b3234bc320d8cc39f2909499231
MD5 e78a9aeac791aa8ede72bdcff0ad736f
BLAKE2b-256 76ad447b81bdd82d3a2f31a2e814110fe4c3c109252b095ff72c01593e2db256

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1cd1bae657cecd04d9cb84957f040f59864ca0d97ad86054e11243c23ff28962
MD5 a4cf0bbacbbe4d72433f73499f167cc3
BLAKE2b-256 6f11d599ac6f7cbe29f7ba72a5f9bab65801ed4515252835827c9871c78105ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.14-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.14-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 a8494fcd0a4c54a0b2a121522665ada3caba4965b828ab245d4ff89f11a691ea
MD5 732baa85b00f56bd866384c701d0dc56
BLAKE2b-256 3ed48eaa440f891e177cd55d500061ebeb96a511c7ff566421785406f96a23e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e2c0d0d0363908a6e7f5ba8b63fef8f3fe502b9b14f069623ac67601c8f7405
MD5 7524728ea2047473476c97dd6fdc212a
BLAKE2b-256 91d48ba9dd3babefe729dd113234aff732e8016808f71a8bbd10f7e7cbd0f864

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.14-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.14-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4abc22010076f1736ee71c31d6229bf2e743b18ef343400453d21ef53ad3823e
MD5 7828ef24e3aee3e1d3d867c602c99010
BLAKE2b-256 471ccf57ee37c0a390fae1f375847af2e5dec4947ac88a00fbf9440b07a54e94

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 e73ea4d3d91ca430fb628a18fea28b626c23df63f5ecf7a00732d51f1fbedd30
MD5 984e072698f238590fae73a4d4dd4189
BLAKE2b-256 d91c702c0c3144227a07f5a024c4094a23652ce9ab8299ba5e8bd527e8960b17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bfec1eb68d8aa0e8c89061fb05634b38739a02eff21897395b5be7c865a2c3dc
MD5 17f6f1518cb172883cf0d2d5b59d4656
BLAKE2b-256 01f00e0bead0f9e0c6303c3177a764773382cde2d6d261a507bd856ac8b6837a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 59891f852d18134b13b3aa8524765f2720a827c92b0b3c9e20fd12a86ed72c4c
MD5 99698aea52f969829937242953ad7097
BLAKE2b-256 35929aff869ddc9364758864a97eab0e1ac79e48768f7af7697552a4679ef204

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.14-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.14-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d35f360407afe7593b2b635e37e8d90532343a6bd2adcfaa5bc78d8a88e78f9b
MD5 e350ead8df2e8bfee8440abea2445444
BLAKE2b-256 a3543e3318a69d0a91b32ad62affa4be8f8072531c476d56dd5d6e08d4c64d50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dad203cc46c2c829872f5226e0a4e965c1887b253945f38ca4b8177a585e6f3b
MD5 d83d76ae2992fc45df35ffe596e343bd
BLAKE2b-256 adb1e9197eb12a9eeab479ec4cb575fc6e24752c32f0f5550324911ecf4beb0e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.14-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.14-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ab4e36e765558603ac451873d220b858de4d9cf94cff3ea7b39d65cbbc9071ee
MD5 974115747a7a078b837a53f71c198109
BLAKE2b-256 b77cba79c7d8fee139651898abb8e85a6220bb3e4f4e34876204123893db15ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 e93749dc5bcd74e9b9c6c050268e22d7a84779a575b34605407bf9132dfb4401
MD5 f13fa3b2fe8cf709174847d1b6d0af59
BLAKE2b-256 0e101958703bfae48985b1aeb32f91c2e978a804240fd717d2d6c5a3f4c12b4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7aa5c77b5e84befb47c6f89eb6447d0cd5fb473a5e96848d6f37682136bd6387
MD5 0b71a5e3a3f49195da0c3d60098cd2de
BLAKE2b-256 10aeffdceed1be65afe9dc8ec5a9fe1df3e45558e6917720d270157f2e3229e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 121121a23e74fd57c65628989208fb64bed9408622249bd3b247c1a341d9fff8
MD5 5ddadfbb4dda52862d955e7f8798d19a
BLAKE2b-256 7cbada3e4c8e4b963672328cf750733238d17d7134b4faf5a0fa552725fbf890

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.14-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.14-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 94e6dd4e44f305d21e4b2a3213c9f495fc152feeb4fd44b3afd2158e0aaa119e
MD5 0853dd1c6d47698901526a2ac8acb313
BLAKE2b-256 8ef5783ad9e9f3f033ffc2407f452e70a9085d20a1a799ee3bd06f4c64cd9bfd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ccba213859e565e14aa1e934ee0b87298138a326186f56fea0eeddcf02d45c7e
MD5 27deef4d26b4e2270788475fdaf2c489
BLAKE2b-256 caadc97bc342d4d3fbc81932415015a963faf8718fcfdb6d32d38b44438b38ff

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.14-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.14-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 420e1f5f0a675e9f4812d00122f8a55dbe1547af4fdd026f6f89df9268fee50a
MD5 c47369d2ddb62061b0a6e6cfe2436f76
BLAKE2b-256 bb080287883cdfc8dedc1b58a74b5babf1c344beae29dec35fb135032fbf87b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 0be474ecf68ceda8e5d9d6c241c013df500c56d70d01eed6641cce39a4eafd5a
MD5 eedbda257b380f6e66a7deae6c9a81d8
BLAKE2b-256 34fa4cebccb87b4b3509077ac9b9ed0f87b9adadb1b8cd1e3167a62e6085c8d0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb82ac45d8c2c697e1f2f61cb2e182f07db4697e960649dde7ab9b62b7f2ac1d
MD5 84a33f9cd76478a64da23b52f7985cbb
BLAKE2b-256 4947e06f47ece9edf0a1c3bea6e8f1ac0d95e7927f1d7193a58923cb406585a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5bd304290925dda6a89328eefd2c94b99b3b767265faef6e51ca2cd5a6970acb
MD5 068ec0b4e62b472fe7e8e497475aacd0
BLAKE2b-256 64d74879e037d7faf506df3b4cc6c7c313e39a979be1e4342854c9c9aaceaee7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.14-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.14-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c946c1ebe9adb0b5d234cab34e87bc0b46168c0152936993ad4b7e685f4402d2
MD5 e9d5cdc110d2170235efb892caa64fbd
BLAKE2b-256 9bea11dad42f3ee3f0c208228a859718de71bc9ceb8b95d8da5e61c46ba21cf2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 26b95bcf27d0592f2ca3fd20c7ddb2c5bec1aad81d10afe39cc64d4b3502ffe7
MD5 4871bb3276fe704034e4e2eeb48eab7b
BLAKE2b-256 b14038018e8b8e4849d5b42391775c9c3be9a5d7ff926a5f39179ffc3aecb045

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.14-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.14-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d62a41e10697e7ae87e57e87ace2e904453eeb8159924c0cba6dcb21fe71b363
MD5 a1786e6a3b1d66e71b62b4ada20f4acf
BLAKE2b-256 45ec86fad77bfa0c23f4f186244cf0ff421efd0e1402d06f23327ccd631071be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 8b5480aaa27f67fc9a61930bbe30a8b649e9e5a77eae94dafe342e95080e715d
MD5 d9c68c09d9c1cc76f342b1173279aa03
BLAKE2b-256 656799ac537ccd54d84eb36615885933c84b4e73159ee2c4978ed9e9d52afe55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.14-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee80182066e888c9d8e44f7d3e7f580df65e135a52a4472f12a9f6522b450b05
MD5 03b8c1e52bb94a879cc1bb460c0de790
BLAKE2b-256 12046a7018abd4022daf4ad6112c9c7ad9b4b54d678aa027692998c6ec60f6b6

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