Oracles#

class defichain.ocean.Oracles(ocean)#
list(size: int = 30, next: str | None = None) {}#

Get a list of Oracles

Parameters:
  • size (int) – (optional) for number of records per page

  • next (str) – (optional) offset for the next page

Returns:

(json string) {id: str, weightage: int, ownerAddress: str, priceFeeds: [{token: str, currency: str}], block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.oracles.list()
getPriceFeed(oracleId: str, token: str, currency: str, size: int = 30, next: str | None = None) {}#

Get price feed

Parameters:
  • oracleId (str) – (required) oracleId identifier for an Oracle

  • token (str) – (required) token symbol as part of the price feed pair

  • currency (str) – (required) currency fiat currency part of the price feed pair

  • size (int) – (optional) for number of records per page

  • next (str) – (optional) offset for the next page

Returns:

(json string) {id: str, key: str, sort: str, token: str, currency: str, oracleId: str, txid: str, time: int, amount: str, block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.oracles.getPriceFeed('f95b8a0ef321bcd310a9cc57b90d74fa4423895448678fbf8487807a125a08ef', "GOLD", "USD")
getOracleByAddress(address: str) {}#

Get oracle by address

Parameters:

address (str) – (required) address owner address for an Oracle

Returns:

(json string) {id: str, weightage: int, ownerAddress: str, priceFeeds: [{token: str, currency: str}], block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.oracles.getOracleByAddress("df1q8cz47rwefsxme29sstumepw374gzeu025gqcy4")