mrxvt / ypricemagic

Fetch accurate prices for tokens solely using on-chain data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use this tool to extract historical on-chain price data from an archive node.

Shoutout to Banteg (@bantg) and nymmrx (@nymmrx) for their awesome work on yearn-exporter that made this library possible.

To install:

pip install ypricemagic

To use:

from y import get_price
get_price(token,block)

Or:

from y import get_prices
get_prices(tokens, block)

You can also use ypricemagic asynchronously

get_price(token, block, sync=False)

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.

Enjoy!

About

Fetch accurate prices for tokens solely using on-chain data.

License:MIT License


Languages

Language:Python 99.9%Language:Makefile 0.1%