price_oracle.oracle

Documentation for eth_defi.price_oracle.oracle Python module.

Price oracle core functionality.

This core mechanism is used by outside event feeders, like eth_defi.uniswap_v2.oracle.

Functions

time_weighted_average_price(events)

Calculate TWAP price over all entries in the buffer.

Classes

BasePriceOracle

Base class for price oracles.

FixedPriceOracle

Always use the same hardcoded exchange rate.

PriceEntry

A single source entry for price calculations.

PriceFunction

A callable for calcualte

PriceOracle

Price oracle core.

PriceSource

Different price entry sources.

TrustedStablecoinOracle

Return a price for a token we trust we can always redeem for 1 USD.

Exceptions

DataPeriodTooShort

We do not have enough events for a longer period of time.

DataTooOld

The price buffer data does not have recent enough entries..

NotEnoughData

The price buffer does not have enough data.

PriceCalculationError

Something wrong with price calculation.