update_live_price_feed

Documentation for eth_defi.uniswap_v2.oracle.update_live_price_feed function.

update_live_price_feed(oracle, web3, pair_contract_address, reverse_token_order=False, lookback_block_count=5)[source]

Fetch live price of Uniswap v2 pool by listening to Sync event.

We use HTTP polling method, as HTTP polling is supported by free nodes.

Warning

We do not have bullet-proof logic to deal with minor chain reorgs. Some transactions can hop blocks and be rejected in later blocks, and we do not deal with this. This is a simple example implementation and may not suitable for production usage.

Returns

Debug stats

Parameters
Return type

collections.Counter