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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.13-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.13-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.13-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.13-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.13.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.13.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.13.tar.gz
Algorithm Hash digest
SHA256 d9a19c339bbc86c1f9b6f5f19e31e8acf4ebc74927db83daef4fb110b2403c10
MD5 16440acb31e579c3ca8ad97d2562e4d9
BLAKE2b-256 69642bfb11529f955969ac50868520b4849bd5a16bddb9d578d8fc29cdc7a263

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cca3eaa0866071147263cb7afb62befbecc3802571df0481dfc531e82b7663b5
MD5 e938137f0cb8f55ce0444afc9a5a696a
BLAKE2b-256 1978e284f1417be007fdb8927cc14a4ab47fc974f1c2442b230a2f2c5e874720

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.13-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.13-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 8fe28379af3e0a251cd01484f686639e846dd3aac98e7fe1a1bd5665ae5eceef
MD5 c40e085078337e01749e2d56216d7afe
BLAKE2b-256 1ec02b9fca5fec7bd675aaf3cc1a4b85a508fd88503d76748c379d7af1aaf7e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 beec05bbeaf160d91ef382b8eaa44271a4c17bb049719dc45e2da2e5b06bde18
MD5 1467d7e8be9e848b975657890b219f5d
BLAKE2b-256 a03f33145b1cb41b7340244d85a0e61cdff76eb2c03cf0ebff591e6054fac3be

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.13-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.13-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f89ff5f43b0edf195dd5192457676de12996e3f96ac1970a47f0506ea93d1353
MD5 21d115754429dfa3c2ca518b7ba02286
BLAKE2b-256 8c86298cb16796cff4fb3617e58e965d6f9f05daa80eaff0fa2fc87d09c33cd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 87b96a7ac1005df9f6e3686696cd6bb9da6fe71fa5883acf7354566f6a901710
MD5 70a5c9a01498e5a7e770ed6f6c203b6b
BLAKE2b-256 046ff72c4fb42ac7f1913f2af5e0ef81b5503d9a6eaeed9bb3c88320ba6e9d83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bcc245d9260c59ba6cd7a83ae7636be9ddf6265e5c554c95727a0951ecd707d8
MD5 b6852a0f6f9c1a2a20d61293006e080f
BLAKE2b-256 399846df3c99258f3f09595439300aef80654a743dda5c270fffd259de339bb0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 78ff70737e92ae5fb9e3a750cc7d45bcc96184a70988fa8bdeed0436687f08a3
MD5 56904158df1b86dfe5e199416fe1e30d
BLAKE2b-256 7fefb4707266208f8290341a6d7b3f4dc4c960bc23e81c60d6937af9c7e8dfb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.13-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.13-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 966527f4ea8b8d281668ec138cc06ee78887184881bdd442bde70001675a7b2a
MD5 cc7b686d76521e241e71359772b5502c
BLAKE2b-256 4b4d7adf1b6107dca6c48bbfa1bf11c6bfa840dfe3273ca2b951fde85e4b2692

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 246c951204b90abf878e4369800521f7ffb47740275642d1d3693877b13c0b62
MD5 a0f114fc060c59cce975f7eee1928ff2
BLAKE2b-256 23e42d41c3c035b097aaa9b1b44a915782a6e9b5dc9330ce6ad39d5e1aa8b51e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.13-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.13-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4267610a9993bd4cae3a9dc803a27d20fc4e2af021a73e2fb182f413c0d57dbe
MD5 3b2e54dd0c4965a0b92c389501ce85d5
BLAKE2b-256 b3718427391b67c5421df8a4841c9e2304e7bce7f408969978290aaad1923123

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 9186dc1dbd2f5141b2a86494bbceb7f00b5ec966adc0f83c0590f197a6bf8079
MD5 bba64087a1c7d2b551665feaf3e45b7e
BLAKE2b-256 c8e91f7b2eb1a073e4ed931aa3a7ccb1016043a0b2b86520b863fa2a8e148bca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82b8984c7d307c7680812a4f514d4adf3ad19f1991145a85d1449c7b7f21b4a8
MD5 0afc223d66771df12b43e4bb65a84643
BLAKE2b-256 578af54d6b80ba48d479283315929c89108e025d02ac9962be1fd255ffc2d8f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7d30d38c33750aa35819ec704a63e2ac94488d24d74efce24edd270f00d353cc
MD5 70439d686fc510f7ef7b81d139e67814
BLAKE2b-256 97315224865e9c5c4fa7f29773bf488434c7759360ab4010b13dd6515fff786c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.13-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.13-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 424ffc73084db21dea2b984c09b2182e783271e9ad409a16ec9f7f22cace3bf7
MD5 3dab7dcb28ec91173bc08ea559fba7f8
BLAKE2b-256 c9232a1d6932114cfb2b273fdbf690d04dac77c4121c581a8af81fb26e0dfbe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9dd1e9c3f863d7a099779e6e987dbeb4526251e565328b0673c26729b03fb822
MD5 c044cc4b37123d92c05acc54ce6dbaa0
BLAKE2b-256 84b0f48e602b138bb7e88d95169c8cc5c9639466f4bd4de0fb24a0da0d1a9385

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.13-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.13-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 99a91ca62cba7b40550e5bc070c9189653cbda8b94f75a7094a9ebd578ecca49
MD5 207705f68930c221e55fb956e210deff
BLAKE2b-256 bdcd11981199574f4d355713d78f97e681beb1bad035a06807a01b35ea36beb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 569ee07ffacd3c95c0300d81f7f4a8e2b56198e6a693155934774cebb91650e8
MD5 964dacb6e0e61f45b029c79f9f502631
BLAKE2b-256 7f43acf8e06bc42b315124ede2614ff68c68e910303460d26ac814e4687e0fac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 652dde68461d382e3c057d8fb025ba2e20e9ba2d0191996924507c3a743ba7f2
MD5 75336b2874c7f3b8ce40880eda130023
BLAKE2b-256 6af54b9257241c809f15d0d79a2ba07af722c313fdf6cc317510122e90f1cf93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 16a4ff7b75d939e3f8b83f38de3726db6ef805dde9d894a6a7c025e4e2f78a7b
MD5 9bd5140811d56787694fda0aa9163fbb
BLAKE2b-256 36357de2ca907eb159e62adbc59cdddf1c844257c0ad5389292941d8b2757fd7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.13-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.13-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 0bdfa619743f0a647b5db1ba9706834d2ef296f1f73128af781a7feb3ed8b23f
MD5 250564584e32015b2f92ee34c6514a15
BLAKE2b-256 871886a579dbff72765557d56a2dfb856c952f7782c18123b46ee9b41b11ceee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a9353048785ec340f96c5f0680cb636b305d142e17da3b6dd23a167bfe1ffd80
MD5 ee215b586f73a4cebd27e5d7f47d9816
BLAKE2b-256 681b5680b62af250d67272f18f4ae87cf6a850f6765cbfe2c461f75fa58cf58e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.13-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.13-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ff5a64421f708c92487d4dc0d3e73d708f0e0393a8fb8c99abb5f70b55806247
MD5 c62bc1d5206a8d42f28a999254a5abf1
BLAKE2b-256 ddfddb363bd3a8f76130a7a7228c576f946162d05b1f19ea3c726a3d29e394c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 cf86604e9ef1733dc40142f34dcb5a59658beb188bdddddcab59c49179cc53c6
MD5 ed69caab3857c191feb456b9d650760c
BLAKE2b-256 dcb8d7589fe07a8ebb5c37648e357b2b43ce1b2eef16e8f3d9fe03bde3f391b6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4f54e1f7bcd33090639fb562b0dee1aaf68e1f9b545a2c93dddb224c7bbc57ab
MD5 b8a8632ce355f50a94e829017242ad3d
BLAKE2b-256 f2e91eeb951b7bf82eb00dfc9e74f588ecf0d9bb9b2a22ebeb1bb27ec1813338

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