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

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.23-cp313-cp313-win32.whl (437.3 kB view details)

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.23-cp312-cp312-win_amd64.whl (464.9 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.23-cp312-cp312-win32.whl (437.4 kB view details)

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.23-cp311-cp311-win_amd64.whl (462.3 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.23-cp311-cp311-win32.whl (435.0 kB view details)

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.23-cp310-cp310-win_amd64.whl (462.5 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.23-cp310-cp310-win32.whl (435.7 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.23-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.23-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.23-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.23-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.23.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.23.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.23.tar.gz
Algorithm Hash digest
SHA256 73ed0ba9316fe3a5711f5483fde673d0fd902e8582f518392e0ee2af5617c816
MD5 a659f5acad51a88d739d819d85fd084b
BLAKE2b-256 6a42a414e63d126d5826bf1882ff050209787875e05305794e18e70296596faa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 131657e90f7e9749cd5c0f1ce787d7d8413f902233f14aa6f405719e2ab8140e
MD5 fe60ff5703d42afee784cfd75263d7a2
BLAKE2b-256 a38efe177afbc3225583b8247e644584a2daf2b5dcd6eefcbea87931103bb180

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.23-cp313-cp313-win32.whl
  • Upload date:
  • Size: 437.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.23-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 27fda307d357818a49820efef121b91d328044ae402be20cb92cd9836351c36d
MD5 4912e290a47ed6aa0868b35405523a78
BLAKE2b-256 313673875559a71232b3e98b834bafe31c1e7616519087a8bbec395394cb2a87

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 96de36e93574ea6e4a607007c6e43d493a0067dc1c852c1ff2bed4ad4a4345b5
MD5 fff26f4581dedcc9cc735ddf594fd115
BLAKE2b-256 42f23c9026b47f8ec7e6c93cb94844639b7963aebfa10b8a1ab5c22dadcca7af

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.23-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.23-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7338cb610c7489846dea6380a57d381d8a70c41c91bf0f3f55351412324de91
MD5 27e0ad43765907cadc00df6ec4d8311d
BLAKE2b-256 d0d276362083a7877f23952794a37996883ad5b7ba5e97ba8b2b2055384c0018

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 d1c24710904bc75ecce83f94cc28afda79043cfdfbad586cbbbf26a5861d0c7f
MD5 1c6961ef468bcaaa4821d645815686d2
BLAKE2b-256 c6c6848f1a5c981a138aeae447a22a29c1c76fbfcc57a9965d17ddc7b7864b10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e0e784ea1f71d74fc98844aeea49cf976461074fabde164a890be74dff92338
MD5 e8e708dd20abe02ce1ca7e2039f1688b
BLAKE2b-256 335d50dfd32bba4589f0d750d4e849e1d47b0e67ced54939afb3090d72b4993f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2f854af9394e923a8a9c2f48e40804256c13a90112264c87ad5cff1fc0e48bb7
MD5 a706db6aadd6fee2c195ee302d8bb1eb
BLAKE2b-256 45845df4d0fe5cf005554b0de43148e9a11f2cd5dfb12240658e9fd9f7f758c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.23-cp312-cp312-win32.whl
  • Upload date:
  • Size: 437.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.23-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 9b9534c90fd15274c4c9f522ef05df04e11130e89d8eaa3ea9a565de5b8186a9
MD5 117bee046e989854eba81057e4d78740
BLAKE2b-256 a7dbc914bae908269302208e3ff37aa33dbcb66bd7a27f1436e6d2017c78cb8d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 db332d4742b177db3a7ec8c625e1c3fe328f58fbdda7d2362ebd6362649a7e0c
MD5 ca244bc9550e35c620de9c1f8d59ad6c
BLAKE2b-256 5d7a7c9cee13b39fe863cbfffccd1e0b9a91fd00aed0d81585f0d7416679c582

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.23-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.23-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8d63ec710f6ba285c3140a7fa93761e427fd4efa90ea72242af1b1e347d75bb2
MD5 864366965414b72be2b791c149cde515
BLAKE2b-256 eb4884cdcd9f8e6ae9a8b21432f0d765500f6ee2c0c96ae871626dace5e82c9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 71a1c962ecfa55b9927e465ee163f031b7321b6d53cbf7987bc64901fb6fa2e7
MD5 d20ec177ebe8040bd3794e32cdb904f4
BLAKE2b-256 88ab4a56635d49e4a1888fb1b2cb8fb24bc97e6afbdd98c67660a01999f5a319

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 87e9b3e74ccd2dbdb17403a0bad31e1a6f5a21ae21e90002fe468179b0f2039f
MD5 997bb7dd6079839962b3d0e2f367f7a4
BLAKE2b-256 3a922b5b8233991cbb30a7c08c9e7b67f8b5b257829d47377f58d759f367bfba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f52a11b344bf457187b76a1579a0d9d92782367009e2fdef787baa18a17b22f0
MD5 4484167cd15ab14fc05640ada039d429
BLAKE2b-256 f1fc72246286b988281de0524a95b4e65e4b28f746b17d4413bfd75f85c42ced

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.23-cp311-cp311-win32.whl
  • Upload date:
  • Size: 435.0 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.23-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 e2d0a4816a1e27c4f64b3b0db09eec741d35a2e9580778983f027b62d6c24e85
MD5 c3cb43bbe1a09846d7cb318f385230b7
BLAKE2b-256 161ab25c1f81f6b8d370bca4c1acc90786801b460c130d6a07fe0c8f25f09a8a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d9126c3c0832854d9533727f9af887d2da1f7b357bdb7e7c757f4328d587a32e
MD5 9a52ced4650d3b5c2e3b517779960e5c
BLAKE2b-256 482264b1fc1aad5d3445594cc743bd5569f0c4643df2f92a13b8b3355f0aa990

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.23-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.23-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2e2e9fb68e9a9b144b414063c746ee60765d21eb3c9985f253ad21becd36d3c0
MD5 6e48e0511cdf24c63ae7dd1e21d5f1f8
BLAKE2b-256 d79c24477aca42d2f2f9ffd30108f3e1a83bf2bfdfd8399d34507b6b58bd2e09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 ef876b0963a6b426fa9d5c4b3d636b07ed9e6a6e3349c8b0de5ab9b9e5c2c9ed
MD5 1ae956d769e0eb5fc511a9e0af36b57f
BLAKE2b-256 3f7a6df76a74957f830a651acab841adc4c4d2c79bc55aa3e587a111aef72cb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0977eeb51440c1fcff3b526417a37de83b11744f3b5145f64639492bb67c00e6
MD5 ca2d59ce13ef8759c534f40c03fff8ad
BLAKE2b-256 b36fc5b0f70747e04b9310e0b0556bafa0000c487082180c17ed072c89126be7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f996372aa74a4e0f8d65e3e7649cc7ed0706a309d300dba5747ff655686bb312
MD5 68426021641509d3f9eb458a3998bff2
BLAKE2b-256 de3062b0b71df4f61e99e606b971770df7033ebbae728bdabb0af83a0ead64e4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.23-cp310-cp310-win32.whl
  • Upload date:
  • Size: 435.7 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.23-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 4862557c3b803e8fcb1dad632872575a3c9f6ecb8565ea3a4dddad8cd5ef5475
MD5 74503b4306b2736702a08fa3a329b377
BLAKE2b-256 0d62b140c8a66a0ded089c1dd168e57108eb9fd259bbbde30aa6375cf31c19e4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 5bf0f8b2cb26a484538c8a56f1da4b3fb61b35f1d0c4e176860a1d6aa08068e8
MD5 99be7540cfc3110970e64ef5393426c9
BLAKE2b-256 f0f5c73438f6f80dc7ef051cba6ac8d28a5a5c17b15c4f4ec080a5a3009c8ba2

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.23-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.23-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 538ab18ae79295d6bb5ae8e51cc537214a4d07467631396155ab6e6d23df83b6
MD5 4692d463bbce0ce243e20274933e4229
BLAKE2b-256 fc31f15012eaf4a98c4fb8329188731bb07800af06c809ea5c812913e8b050b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 a8e4b3f2557e961cfbf1e5a1e4f3aa833ab93382edc3d0da853189115d01355e
MD5 79b1f48d0c538b0ecf3bc83fbee6b35c
BLAKE2b-256 c79b642615996009ffbf9da458ea3dc6c952727cb720ee8a4d042ceeadb2eb81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.23-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c7f6a67a08aec73f32abaac05e2ec02f8a96fb62d4be9d394047742b4230043
MD5 9a7f0559539be290f1888010cbd836d4
BLAKE2b-256 c1df3495456a8dc015cc5940f8068164d0d0176a86390ffba8061bccc6e3e08d

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