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.20.tar.gz (280.7 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.20-cp313-cp313-win_amd64.whl (470.7 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.20-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.20-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.20-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.20-cp313-cp313-macosx_11_0_arm64.whl (526.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.20-cp312-cp312-win32.whl (443.0 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.20-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.20-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.20-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.20-cp312-cp312-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.20-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.20-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.20-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.20-cp311-cp311-macosx_11_0_arm64.whl (524.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.20-cp310-cp310-win_amd64.whl (469.1 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.20-cp310-cp310-win32.whl (441.2 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.20-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.20-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.20-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.20-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.20.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.20.tar.gz
  • Upload date:
  • Size: 280.7 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.20.tar.gz
Algorithm Hash digest
SHA256 20ad077f0412c0f1e54a99b6380a0326829860822da79055e5b375986fdcfa25
MD5 bcc0dd64d82f77fcfae2c042217420f7
BLAKE2b-256 b083a37b1ee020ba532ac0fc55d82bedd570b50108dbaba92e0348de95d53a14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 048e8fb5df84deb98ad3c05b7f29963c881480aed19c683313af1e658c0d5024
MD5 99fbd7c66898047c0290c62dcc74ffef
BLAKE2b-256 7eae49dd497f93befad786edfe59a5322837b567e2f095077caff77d3dc6d216

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.20-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.20-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 497b0156d61d4028280fd8e1f21ba467ad33713e3032c9950ed0c04956942940
MD5 a7e0687a077c4a70714d483d9048dbd4
BLAKE2b-256 801718ee68af39a08770283f7400a69b96c519a8b1914b196e3ce20a7edb18d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8526f084adcf832521d5aa11171b2bbc9d88295e083dab3d13535fbb089c5ad3
MD5 382f9bd01ad4dbae365b757c319e86e8
BLAKE2b-256 0782d06b7b25b79351c110307fbcfdbe2851c061fab174aff557ddae05d24595

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.20-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.20-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8bcbcf1d5a19b09ce3ab587e9bcf95b8e48cd5d82d9608629c8dabec8e7adf09
MD5 f9418d17953542aeab4302024ce72fcf
BLAKE2b-256 c135da193e7f33bc87efd4b7166b762a610a3814b1271f31ab702bead18e4d53

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 0bb7a779f31ee38285d07d9f7e488698babd8bbf8c235ac59a7a04c0bdabb6f1
MD5 80bb6c72627a9a70efc0b8db989cb4e3
BLAKE2b-256 726c0cbc62828e5d4414307ac5339af0c78ada11add92b9d7b4e35a924e23f6a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 766f6302d8749358fff52796773002a51e42dd0b2ab9e28b2829588b094bce28
MD5 38b92236195ba7044b4bbc23ab92e0dc
BLAKE2b-256 950f23c6e5bd5d1fbe061ee209dee71d51be52cedfc4018dda0fef711a6d805c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cf849787ea752d3f0023c236143488e61e66c2f53e8a72cf2c993842915dc6ed
MD5 3471aa1dbd1e5c04511ba2120430c44c
BLAKE2b-256 dd45cf3b3a3a49813c5ab12ae8604e6072721818bd7c45256ab9ee5b6875c4c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.20-cp312-cp312-win32.whl
  • Upload date:
  • Size: 443.0 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.20-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 935ab8b01d7fe787c6bca6b83bf7a1c3f3e81c99c8e67d5dda4aad9776ce73a6
MD5 5c3b7398c1944980cf83d76e48d98de5
BLAKE2b-256 14de2cecfe881a34cfa26f73ffb7bed6a3d793843ed1019e07bd080cd9df2756

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dbc696fcb562ecabb5d430ee20060e4bd7f3bd55c530fbe7dc8e92b95abf2d79
MD5 0feef6a5d0506de57c34d8e1bfcdabd8
BLAKE2b-256 7ab5436dd015b9f91775382f745bbcd6f4eb27174cf365827757cf3ce2232623

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.20-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.20-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a89502e2ab96f6177cb17b3ae93c9c273a373ba32fe66c45a514ad5d15acee72
MD5 5cbe7b2aa1a7bc3686aaf4421d41c355
BLAKE2b-256 505280fd9b51cd3042f0c83738661d9bffc4ec4d6747e702fa811ca718312bb5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 920e56ca43bcd6ca2418a285f439a75a4f45068644c196a73e0485322fd06678
MD5 152bdef613cdcd178ef801af60438da7
BLAKE2b-256 08134504491f3385154a638222914e1c71112f3a7eab6f960e2dd3a6fc464195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bc9d70022cebdd267b0717989606e3f50d0e270649961145d046ef025e5c62b0
MD5 e87149487f26cded66e98c4fcebfec4f
BLAKE2b-256 41165095e2225c560bb9c4618154af6b5bb6c680fccd04f2d893eb14a13e6044

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5b5fdd48e2ca2d0febbe83e8fb3e6a313a37809863d21aaf4f96b0e5a3611635
MD5 b885933fc314a8f4ebf7298a8344c5d9
BLAKE2b-256 928185194886cffb68f15e1ac19d6c3ca8d6dea6a2a084d21891cfbe8289977f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.20-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.20-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 d301066e7cb3759bb2cf02f0d5214344b36c724e53c7fba70db866bfcf326de4
MD5 be15bf99096abe5c69d435ebd5d222c6
BLAKE2b-256 ac32045c6ae2454c88aec3509d6e695100c3c6230d356bfed8e60ce5eac8e585

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b9ab4c270f93d5444be50e8b311b7b810b74e3c3b638bec2c4892506c0fc027a
MD5 668d5e412116687656f080ce9f1b1fce
BLAKE2b-256 79b40b589b1b8746af8df096bb025d5c9dec7deff60c8ef40743521ce761f6f9

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.20-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.20-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d703b75322beb2d4cf1fb2a2933c9b91e4e162f4a5b82849ef93e47211dbc6a0
MD5 1a213d01c0e3ca7930de14ce5d265b2b
BLAKE2b-256 1dd0ff5eb87a7ea222180a7bcc35e8cf9ad0df1dc512d23e55f284ece0c9aea8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 da319d6f9a9dd1f7472addf1934722cd2195380245050ea54053c007f5099ab9
MD5 b1c163368e48466a63abe5b9b664290d
BLAKE2b-256 1dc319551f64a3cd2373c6055cf1d6b55c53900800acae28e8ca5f25e3d5699d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 98992f49652e561f8adb9e2c14d8c69f5e65d3c8b24d87e68ad98951c602cd98
MD5 366f2c133e41d00546e11b5603d91d53
BLAKE2b-256 6c12dd37518797fbcd53a83d9dd6695e1f6f89a420721d06a26b02dac12bd33d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1cba3db0c575db7142859f826fe79a41cf962cdb3384e71ecb2c9c55261ae254
MD5 e732f9df91df8bbc082ae046b3b7629e
BLAKE2b-256 80f72387fd5dd15333adf31bad6c70e39e5610764bcab4b2432d7ea068b6c7df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.20-cp310-cp310-win32.whl
  • Upload date:
  • Size: 441.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.20-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 bab3fe46c8b25db7010a611f7fccf3c0f8965b2e2d98f5ab368154e84c73ca7b
MD5 65730fe5b07230af12949651a2f169dd
BLAKE2b-256 afef32fe6b76881a89ca579c1d809143b8f06a2b17fd41184f0f08227aba9624

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 323b4b71904bffc3233c11e84c9d951f45b14020477cba0b516006ce4b64086c
MD5 1aaf25c6bafd10f6280ec4ce3edbcdd5
BLAKE2b-256 5c558b026058d09594de9e86b33ce75279e2d7821b4d5506c963af07ab4e65ff

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.20-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.20-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e9603d5cc71f3c73c938e2bbb4bd64914f54184ad55b8d728a6029caf16ff0e8
MD5 696abcdbe77b1988bff842cdfa83a637
BLAKE2b-256 1015902a7094a579665e6cfd5b5b3bc8ae0b76e11736c6ae2e3d9ed0f96d1ae8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 f3df93c350d6ffb3f5b6151798607a9c49bd7549aa2577be7b274d9a58bc8f72
MD5 9d6b239fcbb0a49ff81eb250487cdd79
BLAKE2b-256 7fef0ae9201a5c195bc7a21f120ad5d96e05460e01555e242fe0116e0e62011c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.20-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07a8469d41fc19c38874233723cc6733d451d1010d0f7895267a477629c3bf70
MD5 9064629ae57fbe0617854b47ea3c1deb
BLAKE2b-256 2c9168ddb3c9beadd2d76c59ab608e6a28fa45d8366b947c7e513d35d8d78f0c

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