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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.22-cp311-cp311-win32.whl (441.0 kB view details)

Uploaded CPython 3.11Windows x86

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.22-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.22-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.22-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.22-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.22.tar.gz.

File metadata

  • Download URL: ypricemagic-5.2.22.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.22.tar.gz
Algorithm Hash digest
SHA256 cbee33b5c293003d541c4d5460cd6ee08a5902d93239af9488ffa3c23793dd1f
MD5 11ed210bbdda5a5b4dedaf8c62dca14e
BLAKE2b-256 0a0151b643fc86444f6bd3b95e5268a9c7d85f6e8680a0e67e350279f5ff0fd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cd1dc5e761df7d39305a5fd32e2b346ae87c7f8f1bbd97b2dac4d5f88d5913f5
MD5 926776ab361c2cf03d12835071eb9598
BLAKE2b-256 6dcfff7748807a8b952b059c6ca704aea1fe7fb0e7bcb83b5b2295f85e2dc904

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.22-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.22-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 eb3ad9ab0cd7480beaf3dbd65f95e6cad123b5b3e460e51077fb607dcf072323
MD5 96c3c94d82f899388d928a025c5b102b
BLAKE2b-256 c16f4e5aabe5c5f4107eafe5df9f6368bdc56870f7f849e14a6dcf21a5e4745f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fc40b5921deb35dbf98eac6322282ffd59143bb6163e40b915e084dba2951955
MD5 d0b73d52ff6b01305c7286190c29f3e3
BLAKE2b-256 66301efdfb13e48c657359a5700e96d8678ae95ba4d413a6069a7c92ccc02b65

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.22-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.22-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa879a1516cd6112975045ec389e17ebf6a1a50664c2b185293e1e6ec9b44413
MD5 af8f196360e603928a014992e6685690
BLAKE2b-256 e99d075a9952be3e32a9748be016523718c6d117cf67d229d9a1ec41f219a8b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 150b9d8b8f3a852c311ad18c91f2bc1b95ac9ea03c0ed4dc65933c77d16d5e5f
MD5 ff6c1137201baa3438cb704101106771
BLAKE2b-256 20d32ad1bbb72af542ef0875bcb1470f0ecdd13af475e5a3b86b6378aff6a716

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 324268a173af38446d6d2af4388ed362ddd5db35a81b8b05b5b30f8c81c9dc84
MD5 367aa8a5c203644077a6a9e2a055f477
BLAKE2b-256 7bf9ad5c178f93600f1195484e520c48a60337471e044b0125ae31fd890b3454

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a4ba31662c8cfe843e844dc72a2a2ace289794698608e4da7b7e767ddfc088c8
MD5 61ab46d53743e530061462393c992d3c
BLAKE2b-256 17945cde4cf6a50d8da9f39a689123acd2175f312cf375c331bbc1db22741635

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.22-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.22-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 4a928fd4a8e85e64df5fb80f2839bb4a9d003b93604758490de6287af919cb64
MD5 e98dce05c96cd53554d322cc39eed3aa
BLAKE2b-256 ae2192b2933f148ae60211e303e2fd666920c335910c1522ce336a03d124e4ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 dcb7e17cf6d72a8c4f2020ae6d4fa32dedf64c669230ee563f7e3067a58b4664
MD5 e3fe2881a2fcc427700607ab59c00bf9
BLAKE2b-256 5af1e6e8a1c286a4492182ecd8527852ddaa46ec356f570a72c1d7da45aa1476

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.22-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.22-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7cceb560bd65b841c2af919188d8d6adb91c846502728ab6ff33fbdad900af9
MD5 dfa4b93881f86cc4948caaa2e0a4aa24
BLAKE2b-256 bfcc6d0a7a28ed254535ed57a49ac014541d09bd1561fabbd6cbc36adee8d587

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 f11bd655810d84fc6f3285068e2c2045eafe2c404cbbf65f124fbcc21b46c3b0
MD5 9a3770a213ede1ee5872fc60fcded02d
BLAKE2b-256 c725643c006b631acbe40eca46ccf233b2064f815370ef2d3428275acc040855

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7be150175be443e776679d817bd3aab4abae8b6e61016088a884e5fffcd31606
MD5 25ca887ef7608fe57b0ceb3568cf4c97
BLAKE2b-256 74c0de7a08578d58121973a5d5b2f6f0e5fc4050977c5bf38f22d0d00b1505c2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 88f40813d68488c1a0c201dbd70bc2ed492ec7e02bf9b695b1bd38cb594b6013
MD5 66dfcebf9d416941e271f7bbf5a54cb0
BLAKE2b-256 836b83f03f183a5436ea137322d75f5b71f3a769693c651fd162fae0ea8a94c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.22-cp311-cp311-win32.whl
  • Upload date:
  • Size: 441.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.22-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 6d984cc75350d8f8eda4efc12a432f734a11a47409a81493bddf67181b89051c
MD5 56b74fe180228b48f45f7e4e7a0e14f1
BLAKE2b-256 e7bc21642cd863804ad4bf2a12aca1b4ade33859bfe22304104fa3efb5c0fc03

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 33908db7f19c06e44a22990c380b32d82f3ab7dff510bc39228b922f0f4835d9
MD5 3971d9d37fed0658fe688a17dab54676
BLAKE2b-256 4f5f063dce5704e46c6cce37d553f5f3d1c43206f0f101a1e2b7c95f53bc4b9f

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.22-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.22-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 48535abe05428c40a7de2ecc427a6a7f9b160013c3c51ef9f3f194e2dab41349
MD5 82cf13937169472153ec8f6058f9b769
BLAKE2b-256 d4f25e5dca11abbb90cff23608b5cd23ab1af198b7e539fcfb9bc4fcf2b45f3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 8298305dfd466d8521dc8a5ff56850fcef4aad726c96db057962d145950970a6
MD5 6c04ad665279d48c390a61b9da2a4984
BLAKE2b-256 7624e4192fb4b7cc72f9cabafb4403ddb5180af49505f1971ebfa27c9f174318

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5485c99fdc67afe067e65811cbfaf7d7b5692a78ccbaf55c4e0ce5612a1b87a
MD5 1703650c1d67205bd4b6f35778a5e4df
BLAKE2b-256 4fa70116575c6125c8def5177e3a63114b24a2b820029e7d4a95df9c84576384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8435913e1c88549bffe124c15b95a36a0377175c4674338681a38cfa6bef02bd
MD5 97453377a15e5ca86248a3dabe2bbb02
BLAKE2b-256 c1e24f0bf5721a0cde69a666286267873a1fb26a0b92277602426916000076b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.22-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.22-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 847c5a6847e3f1f10c308d5b61cf2015947654f6ee85658fe6beb5e9ef41fb91
MD5 d0c033ac51eaf56a54513804aef9d961
BLAKE2b-256 55e3fb0a6b8fabe0b04917666662b98a293e6a044f9ca624cfa48e25bb7961af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4c93c815ee3082ae96c3e5718ac9afece4ce913872402c3f6d4272a616018187
MD5 a3b5728f0fabc42fd75afedaa59900ba
BLAKE2b-256 ec7c085ff3a7542576f8717c589f67ff68002e07404678a3ef5934aa6eff8fda

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.22-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.22-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b8fdf511f82efcef39c122d63eb069fc8d05b8f7ea981b0364a148f6091b00a8
MD5 790efda5ab86ef4e6545c93dcdede259
BLAKE2b-256 e705f3fbb24abb870235e2b7714f588eaf228b58623172eec1d188c63a8e8bec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 cbe426200669ca31fa880370ca72e55d4cd4b52caaf05231dbef2927e0f080d1
MD5 ea767427b4b980b7ef5db79ec79c8657
BLAKE2b-256 46f3f2549dbbc99ce822bf1a17d9c6367a31bf7399f4363efc692a0db0f880bc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.22-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57f330bbede87226b21b65019302fd69c95d688cff96397a8a06678b9033703f
MD5 fb50c5061ac22f7049c75ae12662d71d
BLAKE2b-256 92712221100826a04876f572cfb6d3e25ec6424f8844cb4be28f8d8e6a12a6e4

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