getValidTimePeriod (deprecated)
Get the default valid time period of price freshness in seconds.
Description
This method returns the default valid time period of price freshness in seconds. This quantity is the maximum age of price updates returned by functions like getPrice and getEmaPrice; these functions revert if the current on-chain price is older than this period.
NOTE: We recommend using getPriceNoOlderThan()
or getEmaPriceNoOlderThan()
instead of getPrice and
getEmaPrice.
The valid time period is configured to be a same default for each blockchain.
Arguments
This API takes no arguments
import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";// address contractAddress = IPyth pyth = IPyth(contractAddress);uint validTimePeriod = pyth.getValidTimePeriod();