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

This version

5.2.9

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.9.tar.gz (279.6 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.9-cp313-cp313-win_amd64.whl (470.4 kB view details)

Uploaded CPython 3.13Windows x86-64

ypricemagic-5.2.9-cp313-cp313-win32.whl (442.7 kB view details)

Uploaded CPython 3.13Windows x86

ypricemagic-5.2.9-cp313-cp313-musllinux_1_2_x86_64.whl (712.8 kB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

ypricemagic-5.2.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (715.8 kB view details)

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

ypricemagic-5.2.9-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (740.2 kB view details)

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

ypricemagic-5.2.9-cp313-cp313-macosx_11_0_arm64.whl (526.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

ypricemagic-5.2.9-cp312-cp312-win_amd64.whl (470.0 kB view details)

Uploaded CPython 3.12Windows x86-64

ypricemagic-5.2.9-cp312-cp312-win32.whl (442.7 kB view details)

Uploaded CPython 3.12Windows x86

ypricemagic-5.2.9-cp312-cp312-musllinux_1_2_x86_64.whl (717.7 kB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

ypricemagic-5.2.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (721.9 kB view details)

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

ypricemagic-5.2.9-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (742.0 kB view details)

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

ypricemagic-5.2.9-cp312-cp312-macosx_11_0_arm64.whl (526.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ypricemagic-5.2.9-cp311-cp311-win_amd64.whl (468.7 kB view details)

Uploaded CPython 3.11Windows x86-64

ypricemagic-5.2.9-cp311-cp311-win32.whl (440.7 kB view details)

Uploaded CPython 3.11Windows x86

ypricemagic-5.2.9-cp311-cp311-musllinux_1_2_x86_64.whl (705.1 kB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

ypricemagic-5.2.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (700.1 kB view details)

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

ypricemagic-5.2.9-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (705.7 kB view details)

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

ypricemagic-5.2.9-cp311-cp311-macosx_11_0_arm64.whl (524.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ypricemagic-5.2.9-cp310-cp310-win_amd64.whl (468.8 kB view details)

Uploaded CPython 3.10Windows x86-64

ypricemagic-5.2.9-cp310-cp310-win32.whl (440.9 kB view details)

Uploaded CPython 3.10Windows x86

ypricemagic-5.2.9-cp310-cp310-musllinux_1_2_x86_64.whl (711.5 kB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

ypricemagic-5.2.9-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (706.4 kB view details)

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

ypricemagic-5.2.9-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl (712.9 kB view details)

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

ypricemagic-5.2.9-cp310-cp310-macosx_11_0_arm64.whl (526.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: ypricemagic-5.2.9.tar.gz
  • Upload date:
  • Size: 279.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ypricemagic-5.2.9.tar.gz
Algorithm Hash digest
SHA256 22432b9c6b869c00b8f22f2e714429a8d4b160b130c964effcb2e56cc23b9521
MD5 4bc09d99add7c7656f44bf95a198628b
BLAKE2b-256 51debc8bf844daeda43e6abee80d3b353b96bef34d6f28d94c0abf4986658701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e2a39f2eac82c925a28fed37721c6b13113eb88f62501fd371929d5fa9e3d721
MD5 43361ea908a0f24fec94a7e467fca185
BLAKE2b-256 ffd2180c6f080e8d2c767045ceed0ce0fd057f271ad7682fd8308b2dec1185ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.9-cp313-cp313-win32.whl
  • Upload date:
  • Size: 442.7 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ypricemagic-5.2.9-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 7d3692597329385daa64e091ba4d2eadc2d4588dfd2aa28c24f4976b7cf29c02
MD5 964775f72bf851b3637d34c31d283a72
BLAKE2b-256 516cc329bd35867743f58de381aa1cd3c4a0669dde7f5f398581aab5af24d259

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d41c4fee252fd429379091907e1f4bd47f728b614148892ba28cb4eb4ff72b21
MD5 c5194d7f65c2cbc0edb8a01bafc4affa
BLAKE2b-256 e9336ca9a3d651fc7eab7d979412f98fd73315748db32345cc785b447872e09b

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.9-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.9-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1d78ce76b32fae3e992a634e9203fbcf52374f5a14fa902ffa5c604b2c724d33
MD5 c0f8c027238c81c9ed4c1ac57e75ac45
BLAKE2b-256 43ec576d42a1a357c13387da88a058fb1e195b24d4b8ae84ebe3ebab2f710518

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 b6d71e6c3cc5f6180a57cd1f17c9fb0d8ce37fa7ed671a60c2f01c82a10f1ed3
MD5 7403a72e9058aa5492d038511e394943
BLAKE2b-256 b99e41eacfb5858326181e94bb13db1ee6bb5fc6234c67f22943a9c02ca82821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eb0e6498e38a1624728f87d7e49d1dc959b349b038140b56c1d28d5d2c8973af
MD5 c03c4c259d5cc9bf8010e5c165b3b989
BLAKE2b-256 3a552843141e237afb6ae70ef7a89a50dc61103dccb062dfb0aa27f5c5fa50a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5067ba21d98bb94628b8b5408a4bc56643b6c8505237786b68a6cafa20495c59
MD5 05fb76255a486bb8d3e6882a6bfbe5db
BLAKE2b-256 b937a50e0c437e6cf412c36780996d58b2c2ec5a5ee9b9d75bc64b5f0c835caa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.9-cp312-cp312-win32.whl
  • Upload date:
  • Size: 442.7 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ypricemagic-5.2.9-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 25c71a999ca04ec8e836ca28cc5b381a6c43f5092ee9d8fa28e1711afb7cd05d
MD5 b4ef1c5032fdc8683c0c2db07c4eace1
BLAKE2b-256 c371ec192f3e5978b32e0a6b8acc1c8b12963332a4985317122426c67291eab2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 8d47fd9dc98bfbfdc1113e6162055644ba6f80b7a813d16404e527aa4201e093
MD5 3a72a53d2c106b1672bfc87cca6d4c4e
BLAKE2b-256 192203d92caf8ede1e409ce34d8f22f8dd58372ae78867233dc94afe362c24f3

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.9-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.9-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 08fde407502bd33337f5c46badcddffdcbec7dde02ed5807475d45966dd0929c
MD5 6b656d365f850389d0c8072042794c37
BLAKE2b-256 6fe0fd496030d526b12aac98a70a52644b8c373d93f2f706bf8663ac0d5c79e2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 379e57331ec523bee640a23503d4bac40873454e91d1e203cab7be9e14ecfbb6
MD5 d4c153b1af6fc5c8e58752c5f081a15b
BLAKE2b-256 c859027532c90b764b69b140b95135b3be62c7439bed3cd48402aa193be87069

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f9ad2c6d4a78ea9c49960b55a8a95a65e929518550951578461f20867439578d
MD5 1fec8e6f6c37e0eeeb06cac0fa952149
BLAKE2b-256 d57ce209ecb0a88a8b63a1954cdc7afd9f5e69918dbe6db0dbf47769a493d172

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5fec401e2f8a8c1c1c6e43153f0197b1095aa8f56c8d32e625f80c66224f00f2
MD5 f928f4e7e2cba841ecc50e3618a8a644
BLAKE2b-256 59c1a91f33963506be717eb0077dc83acca95b4c3f9fa01e1bfe38be91b5d798

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.9-cp311-cp311-win32.whl
  • Upload date:
  • Size: 440.7 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ypricemagic-5.2.9-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 fd5754a51c411193206b4708d428dd218fa4a154cbbf669f201bc3a01b373879
MD5 8c91387600a2d34c156e89cb3ad22bb9
BLAKE2b-256 2f0317969567b464bae9c3b481dacb6780c0886522654876005d26910b394043

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c59a86a400eb241b18a03f00c599994a537200322d2732c8573109b6dd252ac8
MD5 81543da0aa7862ebf45161c93816f003
BLAKE2b-256 1a94243e319eddc0ae99d5705c4cadc058335deb98580c022800d66ad320c046

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.9-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.9-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d81c9f5a2248edb2a0768a498fe7fb637b133ee902493a68308578080b322eaa
MD5 9d697dd86b71fc51842c4d969bbc0f85
BLAKE2b-256 2ff2a80e59b1af6c7b553e5ce27c301ceaeca87719ffba82aca5e7a6ab73bf44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 c29c78fd25cb9ea7fddb8f25737d8d8ff19f4e8bf1ec621af229e0d146205256
MD5 1da2bad411c878abd0995941f4f3a252
BLAKE2b-256 fae03d3f3bd61a7c255b6b6a766b0d594827ed58b82eb97909a3028c4400ac55

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 82f45730e256e8128fb101a2c97d1f3e10cc74e3ff50b0aee311078a386a0b56
MD5 538dc44b79fed22cfa184243065d7c0f
BLAKE2b-256 6a3289a83e955011f5a3ea715f033f634e2d55aedaa8b5ea3299fb7dbba7f5c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3e36914aebe5b4d7143a657aae17cbf84a14c8935f9d88bb40099371f9fcb2d9
MD5 046f3bc59fb9e0af65120f26c1b034e4
BLAKE2b-256 2ec4616506fdeb461fc3e71a5a6df096f2dfb625f5a6785e3ccac51da0d5baf1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ypricemagic-5.2.9-cp310-cp310-win32.whl
  • Upload date:
  • Size: 440.9 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ypricemagic-5.2.9-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 b48d205ab2b549054142a7880a9e9c8e5d11d2c09fe144d2be169ce485fd6fef
MD5 d850e1c37d07a24d882151208dd1e525
BLAKE2b-256 9ceb190be4e7fe15b5f962bbef1050bb6de0d611a63b136afee2deb4077f8ea7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 621e70d04adf8238b2db042ac436373ad2eee4876cc5fc9f294682b5d41efc70
MD5 61037135fed0292ac8b05ea556772549
BLAKE2b-256 9fce1d81a1f332d9ecd00f8f1903093df5536d261298c2fbd9a67b7bacca981e

See more details on using hashes here.

File details

Details for the file ypricemagic-5.2.9-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.9-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc2e8c9d7e73c25447b7eb275b30ecee6adb1df9a52ee25bf50422a33c28158f
MD5 80a87ce27f4552fe70ca248409565ac6
BLAKE2b-256 99dd385afa34510db534da4f28cac55878545bbc2919ddbaece4aeaeb16542d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl
Algorithm Hash digest
SHA256 413ffa6fb97254f249292e16ea64c6eae595347a2e294367488237d286e2a7a0
MD5 01bc00d491bc5b872b05ced37c1f77a5
BLAKE2b-256 f39bb7541d45a9d0c12157103a06b0fd5b157d8b19c426d92cdc2cc97d316c01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ypricemagic-5.2.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1c8d873b80c990300e104553e840f82c51d317d21c4ef577630b307512049595
MD5 6f80768b78e7a3d4530e9afa40901660
BLAKE2b-256 95b5c3b618a98153764db028f43ac58eac9463ad508df79b44d50b2e9e5b290b

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