ChainLinkLatestRoundData
Documentation for eth_defi.chainlink.round_data.ChainLinkLatestRoundData Python class.
- 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")
Attributes summary
How many decimals the aggregator has been configured for.
Chainlink provided description of this feed
Human-readable price in this response.
Python datetime when the feed price was updated.
See ChainlinkAggregatorV2V3Interface.sol
Current round id
Price, non-decimal converted
When processing started
When price was updated last time
Which round gave the answer
Methods summary
__init__(aggregator, round_id, answer, ...)- aggregator: web3.contract.contract.Contract
See ChainlinkAggregatorV2V3Interface.sol
- round_id: int
Current round id
- answer: int
Price, non-decimal converted
- started_at: int
When processing started
- updated_at: int
When price was updated last time
- answered_in_round: int
Which round gave the answer
- property decimals: int
How many decimals the aggregator has been configured for.
- 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.
- property description: str
Chainlink provided description of this feed