Oracles

Fetch the Price Oracle Address for a given currency

The getRateStorage method can be used to fetch the addresses of price oracles used by the Notional protocol:

# Fetch the DAI/ETH price oracle address.
DaiEthOracleAddress = notional.getRateStorage(2)["ethRate"]["rateOracle"]

# Fetch the USDC/ETH price oracle address.
UsdcEthOracleAddress = notional.getRateStorage(3)["ethRate"]["rateOracle"]

ETH Price Oracle Exchange Rates

The getCurrencyAndRates method can be used to fetch the current ETH price oracles used to value accounts in the Notional system:

# Fetch the DAI/ETH price oracle exchange rate.
notional.getCurrencyAndRates(2)["ethRate"]["rate"]/notional.getCurrencyAndRates(2)["ethRate"]["rateDecimals"]

# Fetch the USDC/ETH price oracle exchange rate.
notional.getCurrencyAndRates(3)["ethRate"]["rate"]/notional.getCurrencyAndRates(3)["ethRate"]["rateDecimals"]

Last updated