Prices#

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

Get a list of PriceTicker

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

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

Returns:

(json string) {id: str, sort: str, price: PriceFeed}

Example:

>>> ocean.prices.list()
get(token: str, currency: str) {}#

Get a PriceTicker

Parameters:
  • token (str) – (required) token symbol for the PriceTicker

  • currency (str) – (required) currency fiat currency for the PriceTicker

Returns:

(json string) {id: str, sort: str, price: PriceFeed}

Example:

>>> ocean.prices.get("DFI", "USD")
getFeedActive(token: str, currency: str, size: int = 30, next: str | None = None) [{}]#

Get active price feed

Parameters:
  • token (str) – (required) token symbol for the PriceTicker

  • currency (str) – (required) currency fiat currency for the PriceTicker

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

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

Returns:

(json string) {id: str, key: str, sort: str, active: {amount: str, weightage: int, oracles: {active: int, total: int}}, next: {amount: str, weightage: int, oracles: {active: int, total: int}}, isLive: bool, block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.prices.getFeedActive("DFI", "USD")
getFeed(token: str, currency: str, size: int = 30, next: str | None = None) [{}]#

Get a list of price feed

Parameters:
  • token (str) – (required) token symbol for the PriceTicker

  • currency (str) – (required) currency fiat for the PriceTicker

  • 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, active: {amount: str, weightage: int, oracles: {active: int, total: int}}, next?: {amount: str, weightage: int, oracles: {active: int, total: int}}, isLive: bool, block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.prices.getFeed("DFI", "USD")
getFeedWithInterval(token: str, currency: str, interval: int, size: int = 30, next: str | None = None) [{}]#

Get a list of price feed wit interval

Parameters:
  • token (str) – (required) token symbol for the PriceTicker

  • currency (str) – (required) currency fiat for the PriceTicker

  • interval (int) – (required) Time interval for graphing: 15 * 60, 60 * 60, 24 * 60 * 60

  • 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, aggregated: {amount: str, weightage: int, count: int, oracles: {active: int, total: int}, time: {interval: int, start: int, end: int}}, block: hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.prices.getFeedWithInterval("DFI", "USD", 900)
getOracles(token: str, currency: str, size: int = 30, next: str | None = None) [{}]#
Parameters:
  • token (str) – (required) token symbol for the PriceOracle

  • currency (str) – (required) currency fiat currency for the PriceOracle

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

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

Returns:

(json string) {id: str, key: str, token: str, currency: str, oracleId: str, weightage: int, feed: OraclePriceFeed, block: {hash: str, height: int, time: int, medianTime: int}}

Example:

>>> ocean.prices.getOracles("DFI", "USD")