price_oracle.oracle

Documentation for eth_defi.price_oracle.oracle 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

PriceEntry

A single source entry for price calculations.

PriceFunction

A callable for calcualte

PriceOracle

Price oracle core.

PriceSource

Different price entry sources.

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.