PriceEntry
Documentation for eth_defi.price_oracle.oracle.PriceEntry Python class.
- class PriceEntry
Bases:
objectA single source entry for price calculations.
PriceOraclemaintains a buffer of these to calculate a smoothed out price, like py:func:time_weighted_average_price.Price entry can be sourced from:
Manually entered price
Price from Uniswap v2 sync events
Price from some other event
Attributes summary
block_hashblock_numberfirst_seen_at_block_numberpool_contract_addresstx_hashvolumeMethods summary
__init__(timestamp, price, source[, volume, ...])update_chain_reorg(new_entry)Update entry data in the case of chain reorganisation.
- __init__(timestamp, price, source, volume=None, pool_contract_address=None, block_number=None, tx_hash=None, block_hash=None, first_seen_at_block_number=None)
- Parameters
timestamp (datetime.datetime) –
price (decimal.Decimal) –
source (eth_defi.price_oracle.oracle.PriceSource) –
volume (Optional[decimal.Decimal]) –
- Return type
None
- update_chain_reorg(new_entry)
Update entry data in the case of chain reorganisation.
TODO: We are not yet dealing with the situation if the transaction gets reorganisated and rejected.
- Parameters
new_entry (eth_defi.price_oracle.oracle.PriceEntry) –