chainlink.round_data
Documentation for eth_defi.chainlink.round_data Python module.
High-level Python wrapper for Chainlink latest round data.
Functions
|
Fecth data from Chainlink aggregator. |
Classes
Human-readable presentation for Chainlink price booking. |
- class ChainLinkLatestRoundData
Bases:
objectHuman-readable presentation for Chainlink price booking.
Wraps IChainlinkAggregator.latestRoundData() response.
Example:
aggregator = chainlink_aggregator # Point to any Chainlink aggregator contract round_data = fetch_chainlink_round_data(web3, aggregator.address) ago = native_datetime_utc_now() - round_data.update_time print(f" {feed.primitive_token.symbol}, current price is {round_data.price:,.4f} USDC, Chainlink feed is {round_data.description}, updated {ago} ago")
- aggregator: web3.contract.contract.Contract
See ChainlinkAggregatorV2V3Interface.sol
- property update_time: datetime.datetime
Python datetime when the feed price was updated.
Naive timestamp
Always UTC
- property price: decimal.Decimal
Human-readable price in this response.
- fetch_chainlink_round_data(web3, aggregator_address)
Fecth data from Chainlink aggregator.
- Parameters
web3 (web3.main.Web3) –
aggregator_address (eth_typing.evm.HexAddress) –
- Return type