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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.19-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.19-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.19-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.19-cp313-cp313-macosx_11_0_arm64.whl (526.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.19-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.19-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.19-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.19-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.19.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.19.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.19.tar.gz
Algorithm Hash digest
SHA256 d0662e68a01a26823f52ce4927c4268aeb43e8973b3c014cbd0ffa228777fb11
MD5 07224ca153d9c7937ff5c9fe960f75e1
BLAKE2b-256 0e5306f5d1c8ce0b068268c34c92965046cee8c88f43fb9b309b813a2bdee4f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 24de20cd9573da6b92b2400f01718def7ab967dc0ebf3f29c3986a0792bd6e63
MD5 6d91542e7c9991b90f666a394b6a69ca
BLAKE2b-256 96599f8beb9316c3fc68140b06caf4be72607d66428687709abdf0222dab4098

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.19-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.19-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 52642c23a90cc20b824a943848f019c3e2416151f95b80baedd0265c6e1e0e94
MD5 2fdead029618213a1c6f438d7f1874e6
BLAKE2b-256 04258b6539271d6da4a93c56fdecc1e776ddb9c022191925592b776e95056914

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4290608f949436e98e979d24ed9fe6d32802de11a9e4f1a99ff9c704da30910d
MD5 f66cf40a5e964614d61d4b210324eb75
BLAKE2b-256 177eb7452d0de49ec526199c8c6df8e2410e558b10dd7b227cef7193ad7a1a8f

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.19-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.19-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4d95c7fb6078110c31e833259407f1111c1f08d7dce21f12557ff03dd0b5cb2
MD5 d5f0d4d961c734cd00d3527d43fef88a
BLAKE2b-256 eb0fe57ac469518ae159022c8e0a17235a2f554450d38835eee3907522585ec9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 d69228b1ae841e7bcf47d38658ecd6410e13fccafd2145a2a52a2bc6f7651467
MD5 cc5be114cb915064bb7185f2d55a969d
BLAKE2b-256 e586da52ad475d801b3b0ad735e2a06b335eb1fdffbc8b9fd33d183a4b6a8325

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75f62ee600196563a4926bcb4e742847edd5289dab34b7f2ed9613644ccec38c
MD5 cbd9f0923936f4863e4ea7a7c94d77c1
BLAKE2b-256 1fa467d63ddb001ffcb3600be00206e7a500266906a1ffa514472657f4f7fbaa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 43fcd01f8402aceca8e178ca07f894c4e8caff101d16db139b6d362d4d90424a
MD5 0c25c452561472d039b84ee4823d76c4
BLAKE2b-256 67c96f46739af8653bdddc87e116dc5865b526111a02f75b15ac5ecc60de5d03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.19-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.19-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 24b4c65bcac258d255a689bce5200d209981fcc4c28f44bec23200553fbaf49c
MD5 a410142671a0cd517bd38d15b40bf261
BLAKE2b-256 84aa3ed6c01ca3fe9638f217e9b3c41734e3d6a66c798caa32483dd3123ad8ac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 bb657904c1cee29f0f431ae213fdbad6ace4575b749150efe3a44999329d2168
MD5 82976bf0ec6d5de9fb4dbfda8be202f6
BLAKE2b-256 53a405ef6ca1b9e0e110d3d15df6a610cfe885eb9c8eba3c0de46324a97c2cd2

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.19-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.19-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edd4a81ae135dd6d3bfce0c09e6cd810516c87cac0f8657b64418a662882d9fc
MD5 b4308f0b3a466637289b2feedcab0a37
BLAKE2b-256 7b34dd5b079273fff543a026087b1b0b0a28e8b0493312a9765c3c2e74747cd2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 7f9994d13358199abd03d39a101b34f7530848aea8e3e19ae3a13d54dbfdc2f6
MD5 c8c6f23bfbe99b29f747b869cf0b2987
BLAKE2b-256 3ec48c394d07001d0827f11b774e076aa8ea4c088c570c7a032030ffdff14ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fe5fff4851a71ff1fdeac8eab505160ea2fa682abab2c56ce8f97df458864dcb
MD5 f10481d57f77fbe27fad543ba5692329
BLAKE2b-256 9856553e8c659cca885200c99c2b221053bfd8f8b328f692c4f0f1654c3c2810

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ff75fae0f3b082ad1c0f9ee173d62be234d9efce7bb468b67df3a8fc89bea030
MD5 d2126a43ea6f4ef88e97deb3c577508e
BLAKE2b-256 116638fe539c0ed3f900ce0ed0d2870cbdd4005ec72d027f6b44e4bd36cfab7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.19-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.19-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 8e355735d67f05e81212cb9fbc706aabc2e3855108bc221461c9b85399b1d78d
MD5 5f8040bde9d6b271e2472e6098cd55a9
BLAKE2b-256 17529fd8fcb7bbb58bbd824dc0f8c2a1172173c043142b51193bf634872c3a9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 734b0db78390e1aa3fe145fba6720b09f70a15565a0d675c59b967ff4fdc332e
MD5 0a7aad1323b209de5321923657e4005a
BLAKE2b-256 bd5d561930c793031763340e478b979a063036b1862eefa2daf10c7da7de939a

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.19-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.19-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23dbf76b508d783a126329d4b6acd4938da39bb90cbd541bacce554f97633f41
MD5 68557271fabbe899377e9c21ee93723b
BLAKE2b-256 9e91fa2772478d0a88d17e8c0a96bafb89d1166252015a5c91b8e57f1e7aa80e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 f2697a00cf80239a2c04966621e5b824680dff9ad1216afa1ef8d95b6332529b
MD5 9325a5c170541427f74df71415fe6c5a
BLAKE2b-256 1ff79834e5a011eebf5a7454b7f948e613d9121f5c20c7a54967bf62bb7123c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9e99f7aeb65ccc0c2add23c5c0b68e17a2cf50466f82acf7a7e3d1f69dfcd38f
MD5 e349318d15a1a761d612a84c7c79c691
BLAKE2b-256 b7eecb1158120ff64fe1ebadf18c21a0eae3ed1ba705d3c5d41b50eff6c6b05e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1b8a8a6ebbfd95a8abd6adf1c316f51998a0667e557442876fc5de05d8e2bde5
MD5 edf8fd6189da7ed152dc738824aab6d1
BLAKE2b-256 01e15a79d4651041c9be88c05db2ae68bb531b064fe5413b7585133126c6c4db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.19-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.19-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 66cd2ed33ddb757d7222ef98c7c382af2846b3e9d6392464241a6ba818abf21f
MD5 b64b010e55e2a10b483d9e97a166ddc7
BLAKE2b-256 4067ba944f4c3558592eb39e28069bc1f4af4df6e8de7351c831aa04ac5f7882

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fcd849ac9fe427c16ad1c94ffadeced567dd8b14901d18c57a4d814b01615526
MD5 ad38ca28a99a59868880dd65c993c3f6
BLAKE2b-256 df8803a2dee68c44c5b0630153997f1dc588b9f03fb3a3335bf723024fac28d7

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.19-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.19-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 25fb84da68f44295598de7e62d4843625bbf5587e484eca47dab3a662881a372
MD5 cedeb24f99cbf185c9b26f918c9950ce
BLAKE2b-256 b36fe7a9296e052a3afc543c3386ff5d1eaa4417673c4159883c1a53be0b97ab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 853850d660ee011a661b1e32dc2935e67ac99b2a0c68d7bc61b9b57fe1e5037b
MD5 e157febf82fe720c7bd2d8762b0a6bd1
BLAKE2b-256 aae10fc388cebba03ff0d4ef61e82e2e78fe11b47f8ce30e03074f1d410ff021

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.19-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d71b5a91e2dfd4e7d2cd48ca30e04f192cb346a53f422b0dc2bd39d0dc432ee
MD5 6c1c5d700cb4984eaa32cc6d9aa28721
BLAKE2b-256 10b534c9d9cd63726eb6e4a51c9e0df295da0d46ae24ed843643701798bbf1e9

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