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.24.tar.gz (280.8 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.24-cp313-cp313-win_amd64.whl (473.7 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.24-cp313-cp313-win32.whl (444.3 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.24-cp313-cp313-musllinux_1_2_x86_64.whl (742.8 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.24-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (747.6 kB view details)

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

ypricemagic-5.2.24-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (772.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.24-cp313-cp313-macosx_11_0_arm64.whl (540.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.24-cp312-cp312-win_amd64.whl (473.6 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.24-cp312-cp312-win32.whl (444.4 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.24-cp312-cp312-musllinux_1_2_x86_64.whl (750.3 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.24-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (756.0 kB view details)

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

ypricemagic-5.2.24-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (777.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.24-cp312-cp312-macosx_11_0_arm64.whl (541.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.24-cp311-cp311-win_amd64.whl (470.7 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.24-cp311-cp311-win32.whl (441.7 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.24-cp311-cp311-musllinux_1_2_x86_64.whl (724.0 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.24-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (730.0 kB view details)

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

ypricemagic-5.2.24-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (736.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.24-cp311-cp311-macosx_11_0_arm64.whl (538.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.24-cp310-cp310-win_amd64.whl (470.8 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.24-cp310-cp310-win32.whl (442.4 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.24-cp310-cp310-musllinux_1_2_x86_64.whl (731.2 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.24-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (735.3 kB view details)

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

ypricemagic-5.2.24-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (745.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ i686manylinux: glibc 2.5+ i686

ypricemagic-5.2.24-cp310-cp310-macosx_11_0_arm64.whl (542.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.24.tar.gz
  • Upload date:
  • Size: 280.8 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.24.tar.gz
Algorithm Hash digest
SHA256 33b61a2a5a5e80c993fe6bf885c43c5be03cef0e4a04b9546a3d16a507b83d65
MD5 66bdc7b60ba13cb4c825dd3ce5c4e228
BLAKE2b-256 2011fd5ec7f7a7325d15d2a80d1b1dd1ab83a001c87cb684abb5d5da80738845

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 967dd31f035add31cdcecd1b099c08e5465f20a3c01a1653784bb9e78382bea2
MD5 bd3058950d8bb84932e31cc40404cf41
BLAKE2b-256 9c377c894aa5da5b99fbe6c7fbea2fc3372e53df14e4444ab7e3f85045ef87eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.24-cp313-cp313-win32.whl
  • Upload date:
  • Size: 444.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.24-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 b1b5c8407db10f9da82b11c369bd2ebcffe8817ce29efa4515770a8d1420cd7e
MD5 b5e9d5697d49961e79157f398d099a16
BLAKE2b-256 a8c76a91525cadcf0313e799f1d9bc2ca8d3ee4af5f78dcce60691d3d61faf3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ca851db93cacaf50f91b8aad673c7a04c2354dec8c44368b9707997ff0bc4234
MD5 06cb84782a6c50490ce46430a1b39f25
BLAKE2b-256 8c86c61dbad7b50c2ddc9c09e448eabfb4e16a9e170047e9c06b79f2c81d95b9

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.24-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.24-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 833f4e56d6962201e9d1e71d067d1551ab0bcc0cf68e14d23cf3b638bec284a3
MD5 01ef7916e0eb05f2eeeafb3fdb51f4e5
BLAKE2b-256 180c680c68a0f5f2da4b4a952814c496e413a35977d5e834e01c93657d6e7cdc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 ceef257c0246100df9e1d5adfe4f9bf68286f5c7d6161a5f77811fd54c89c9ed
MD5 7833c90dbcd1be13a66c4442870a4bac
BLAKE2b-256 bdebd890666b5c37f1e9f744f1b3baa201779658b86ac445094909ec30dabe50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b77848a356bfdd3179221666b49565d11c64528ccba31950aef67e745c182cc
MD5 301e93582c1d1c2cbe6710395a126b1e
BLAKE2b-256 8dcc35b874a121f1761056f2c48f36f3c4a95a4f2888037f1b91f4348d7b0959

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 235d5c38c0188d4438229c794ef63b198f8427c54b5c7419fc62d4905d5a8501
MD5 da409bef4bb411e57600f41bcd41c40d
BLAKE2b-256 27067f8c53965c7449ebd1beda21c94ed3f8cc0bc6a97c19515c5def5c5d6177

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.24-cp312-cp312-win32.whl
  • Upload date:
  • Size: 444.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.24-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 fbe6797dcd07f5e4919ed9fd788a55e067175723af63a5867d34f697cd7ed884
MD5 438ce5e1af47dc303e0e3f102043f8c4
BLAKE2b-256 05552dd99d136733937c269870b9ba11b83c0cd539e39cb234f376f0bcdf5449

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ce2881438e0dfb9d37531c55c4041035dee98228b297f841c2b9b1c989714f25
MD5 b50c8d674ef13d5eb85154e75cb13548
BLAKE2b-256 8a93e3c90c300b0dfa7b4760c0fb2a49e89956776fa96c94b570fbe76dd0a7f5

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.24-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.24-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c5cec95bc7d076f1733ef1d20e8d01da06f32cf18fc99da24f8062509bcaf6c5
MD5 176731cdbbc3bf75f7b4a3aee59a0240
BLAKE2b-256 49229bb277f4eebe489fb8cec5bbb5ffb8f79f42efbccd20a3730e9df1010941

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3678e48a3801d67cca7ec9a88bc5b87538ef1f88998d5b202ca1506524b190d2
MD5 debe54bd046a21cff97b7657c2502d12
BLAKE2b-256 0fe13e1133495e35d2426a2701b5a0886dd9a1b93174de4f0cec4e9e0af7b953

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cc2915eab46419d917b336996b21c4d24e179b337e5ca2f91ff512dbfac1f801
MD5 60d2976b22353531ff01cd3efd47e27c
BLAKE2b-256 852272a694984eee1d317ed98631a23b0647b9752d06589c72e90e6764783240

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3705d8a09ac4638c04b0f04e26506533d024dde217f2aed9ba0c29aefa39dd81
MD5 1954205889ef41c9bd213ccdea9b8077
BLAKE2b-256 f1ddcef1f0a071a0241e62e306fb0f2398059a4a12f1a705b908ec4e0d540c83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.24-cp311-cp311-win32.whl
  • Upload date:
  • Size: 441.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.24-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 5dac5fedd2f71db86863e1f76e233bd59099fe0113fea35df1abe738aac2657b
MD5 e28bd9b077cccf9b03866e84e5df067a
BLAKE2b-256 5b4de2f846e8747ec429d8f9188bb414b2a740b74fe54999f63b51104a7dcf7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 cb06cd20c27046ea4b4e5365692a8cba78125bff93c65005b78e4f292a0672b2
MD5 169c61c0c4c64ffb37245bb8c4138265
BLAKE2b-256 349aa57e6ecefed7c33501334dd7d2448fc8e85314859065991e34182e33cd2b

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.24-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.24-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f99e1331c4bfd6ba9dbec1d7d5cadd7e441af1dcffd6802a0fd47632bf1e689
MD5 578e64a52a3e21584cc1245c9b827dcc
BLAKE2b-256 302a1ec54e462691d9343b1f17c68419d589bba750859abb80d2696ea5b47f32

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 3b946790d9883e7b816d65dad1239b0394f5c367c5bff88cee7f023d24c8c2c1
MD5 8ad19b5d8b73b39584ae5f566fc95d71
BLAKE2b-256 a2eb6e508e0ed562d18c3b97a1a3fdb678b1f2c6c6967e09100b01846aee4b6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47d3257e330d3a36e7af20e6ca93cdec3f00ba175ef0ed5e23a1535b99fb10a4
MD5 32595d281776b05e18a70f862b64980a
BLAKE2b-256 d6b8fbba6b3fabcf3b1af0dff4aa961a426d97c6740ea2caaccf5f7d16c2ff62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 bc42d55b9e8f8be410177dc40f691cb377aaba530566292817402e9399e72e8c
MD5 b82bd89e6548abd5de0aeb41e5848e66
BLAKE2b-256 1ba79f61b9a9695ef563ed6f685b555b86a384c9163bef3a62a68825fb179046

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.24-cp310-cp310-win32.whl
  • Upload date:
  • Size: 442.4 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.24-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 daffc2d81f4012ff0f13b383dbaa8fe2b0f38290c16c53ed82593ae28bd78ca0
MD5 2d99454d5befce6eb08893af2eaef42a
BLAKE2b-256 b2056f2e4a7f90721e67d3130dea466a96ebe04cd02dbf0c0acb6636dae83a62

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b65b59d662f9312661edf75470724134a88caf29b91a1908937599eecb584b0c
MD5 a5f1efa26bfdbf18ba8295b8c91e3f7f
BLAKE2b-256 b36cb23fb64e25ceed6033672940ef2b3c1ba18689268596445226d991745eed

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.24-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.24-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8501ccb55916fdf03171ae4dc24f16bb1353facf89804b8bbd9555a91d9763de
MD5 12f0843bdb8fb75c26a4e13eecbe3902
BLAKE2b-256 6890b1518313dd362dba3b9b942d2693450f2f4a6d1f215b1cc91b6c3a68f635

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 9d926b0c4debf48fcb2e1df2f6c1a9be0b07020264365b92ca05c3477ed31be7
MD5 8fa89af498e965a22245a55eff26ebef
BLAKE2b-256 6c047b4ed4394d38966b6807c129a8a9250e0874d786833801d9decfbdfe4402

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.24-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 06801fbbaecb9e9a273607698c6adaa1770c888df112f04fa8b2c73637580bd1
MD5 6b34c061bcc6843467aca24d9d37716d
BLAKE2b-256 15a36a0896fa7a880684d1de7991aa20b6fd807267fdb1be829a24e2405ddad5

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