Pool Pairs Ocean REST API

List Pool Pairs

Get a list of Pool Pairs

Code Samples

Shell
curl https://ocean.defichain.com/v0/mainnet/poolpairs
curl https://ocean.defichain.com/v0/mainnet/poolpairs?size=5
JavaScript (@defichain/whale-api-client)
await api.poolpairs.list()
Response
{
  "data": [
    {
      "id": "4",
      "symbol": "ETH-DFI",
      "displaySymbol": "dETH-DFI",
      "name": "Ether-Default Defi token",
      "status": true,
      "tokenA": {
        "symbol": "ETH",
        "displaySymbol": "dETH",
        "id": "1",
        "reserve": "12159.80542157",
        "blockCommission": "0"
      },
      "tokenB": {
        "symbol": "DFI",
        "displaySymbol": "DFI",
        "id": "0",
        "reserve": "9243059.41443104",
        "blockCommission": "0"
      },
      "priceRatio": {
        "ab": "0.00131556",
        "ba": "760.1321809"
      },
      "commission": "0.002",
      "totalLiquidity": {
        "token": "334994.03471476",
        "usd": "63734877.7995231105508613574932987776"
      },
      "tradeEnabled": true,
      "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
      "rewardPct": "0.14549",
      "creation": {
        "tx": "9827894c083b77938d13884f0404539daa054a818e0c5019afa1eeff0437a51b",
        "height": 466822
      },
      "apr": {
        "reward": 0.5805722764182902,
        "commission": 0.019798033629675645,
        "total": 0.6003703100479659
      },
      "volume": {
        "h24": 1728527.7452852414,
        "d30": 47781391.722987436
      }
    },
    {
      "id": "5",
      "symbol": "BTC-DFI",
      "displaySymbol": "dBTC-DFI",
      "name": "Bitcoin-Default Defi token",
      "status": true,
      "tokenA": {
        "symbol": "BTC",
        "displaySymbol": "dBTC",
        "id": "2",
        "reserve": "3755.6649905",
        "blockCommission": "0",
        "fee": {
          "pct": "0.001",
          "inPct": "0.001",
          "outPct": "0.001",
        }
      },
      "tokenB": {
        "symbol": "DFI",
        "displaySymbol": "DFI",
        "id": "0",
        "reserve": "41916986.84361",
        "blockCommission": "0"
      },
      "priceRatio": {
        "ab": "0.00008959",
        "ba": "11161.00263192"
      },
      "commission": "0.002",
      "totalLiquidity": {
        "token": "396653.46457843",
        "usd": "289035687.6891449731052296850022684"
      },
      "tradeEnabled": true,
      "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
      "rewardPct": "0.74878692",
      "creation": {
        "tx": "f3c99e199d0157b2b6254cf3a51bb1171569ad5c4beb797e957d245aec194d38",
        "height": 466826
      },
      "apr": {
        "reward": 0.6588811567787998,
        "commission": 0.010911764008121796,
        "total": 0.6697929207869217
      },
      "volume": {
        "h24": 4320396.183546773,
        "d30": 126879352.6488824
      }
    },
    {
      "id": "6",
      "symbol": "USDT-DFI",
      "displaySymbol": "dUSDT-DFI",
      "name": "Tether USD-Default Defi token",
      "status": true,
      "tokenA": {
        "symbol": "USDT",
        "displaySymbol": "dUSDT",
        "id": "3",
        "reserve": "6224259.19516267",
        "blockCommission": "0"
      },
      "tokenB": {
        "symbol": "DFI",
        "displaySymbol": "DFI",
        "id": "0",
        "reserve": "1806717.03300473",
        "blockCommission": "0"
      },
      "priceRatio": {
        "ab": "3.44506587",
        "ba": "0.29027021"
      },
      "commission": "0.002",
      "totalLiquidity": {
        "token": "3336009.65823173",
        "usd": "12448518.39032534"
      },
      "tradeEnabled": true,
      "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
      "rewardPct": "0.03233133",
      "creation": {
        "tx": "37939243c7dbacb2675cfc4e0632e9bf829dcc5cece2928f235fba4b03c09a6a",
        "height": 466826
      },
      "apr": {
        "reward": 0.6605507837727896,
        "commission": 0.2709183798345587,
        "total": 0.9314691636073483
      },
      "volume": {
        "h24": 4619907.443352945,
        "d30": 122745063.46824223
      }
    },
    {
      "id": "8",
      "symbol": "DOGE-DFI",
      "displaySymbol": "dDOGE-DFI",
      "name": "Dogecoin-Default Defi token",
      "status": true,
      "tokenA": {
        "symbol": "DOGE",
        "displaySymbol": "dDOGE",
        "id": "7",
        "reserve": "4610815.28650627",
        "blockCommission": "0"
      },
      "tokenB": {
        "symbol": "DFI",
        "displaySymbol": "DFI",
        "id": "0",
        "reserve": "164699.80497866",
        "blockCommission": "0"
      },
      "priceRatio": {
        "ab": "27.99526864",
        "ba": "0.03572032"
      },
      "commission": "0.002",
      "totalLiquidity": {
        "token": "857164.31440619",
        "usd": "1135676.1298679088280347411776130904"
      },
      "tradeEnabled": true,
      "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
      "rewardPct": "0.000969",
      "creation": {
        "tx": "9e0c956f9c626c07ba3dd742748ff9872b5688a976d66d35aa09418f18620b64",
        "height": 607452
      },
      "apr": {
        "reward": 0.2170049230082904,
        "commission": 0.03673795229365656,
        "total": 0.253742875301947
      },
      "volume": {
        "h24": 57153.99380839965,
        "d30": 1811324.2691068945
      }
    },
    {
      "id": "10",
      "symbol": "LTC-DFI",
      "displaySymbol": "dLTC-DFI",
      "name": "Litecoin-Default Defi token",
      "status": true,
      "tokenA": {
        "symbol": "LTC",
        "displaySymbol": "dLTC",
        "id": "9",
        "reserve": "31911.14739015",
        "blockCommission": "0"
      },
      "tokenB": {
        "symbol": "DFI",
        "displaySymbol": "DFI",
        "id": "0",
        "reserve": "961366.74883423",
        "blockCommission": "0"
      },
      "priceRatio": {
        "ab": "0.03319352",
        "ba": "30.12636108"
      },
      "commission": "0.002",
      "totalLiquidity": {
        "token": "171488.37243298",
        "usd": "6629038.0176298080540178905641555012"
      },
      "tradeEnabled": true,
      "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
      "rewardPct": "0.019399",
      "creation": {
        "tx": "75a25a52c54d12f84d4a553be354fa2c5651689d8f9f4860aad8b68c804af3f1",
        "height": 614026
      },
      "apr": {
        "reward": 0.7442676463136286,
        "commission": 0.03902402698949747,
        "total": 0.7832916733031261
      },
      "volume": {
        "h24": 354372.2719375212,
        "d30": 5694468.743365625
      }
    }
  ],
  "page": {
    "next": "10"
  }
}
TypeScript Definitions
export interface PoolPairData {
  id: string
  symbol: string
  displaySymbol: string
  name: string
  status: boolean
  tokenA: {
    id: string
    symbol: string
    displaySymbol: string
    reserve: string // BigNumber
    blockCommission: string // BigNumber
  }
  tokenB: {
    id: string
    symbol: string
    displaySymbol: string
    reserve: string // BigNumber
    blockCommission: string // BigNumber
  }
  priceRatio: {
    ab: string // BigNumber
    ba: string // BigNumber
  }
  commission: string // BigNumber
  totalLiquidity: {
    token: string // BigNumber
    usd?: string // BigNumber
  }
  tradeEnabled: boolean
  ownerAddress: string
  rewardPct: string // BigNumber
  customRewards?: string[]
  creation: {
    tx: string
    height: number
  }
  apr?: {
    total: number // fractional number
    reward: number // fractional number
    commission: number // fractional number
  }
  volume?: {
    d30: number // 30d volume in usd
    h24: number // 24h volume in usd
  }
}

Get Pool Pair

Get Pool Pair.

Code Samples

Shell
https://ocean.defichain.com/v0/mainnet/poolpairs/5
JavaScript (@defichain/whale-api-client)
await api.poolpairs.getPoolPair('5')
Response
{
  "data": {
    "id": "5",
    "symbol": "BTC-DFI",
    "displaySymbol": "dBTC-DFI",
    "name": "Bitcoin-Default Defi token",
    "status": true,
    "tokenA": {
      "symbol": "BTC",
      "displaySymbol": "dBTC",
      "id": "2",
      "reserve": "3755.63424527",
      "blockCommission": "0"
    },
    "tokenB": {
      "symbol": "DFI",
      "displaySymbol": "DFI",
      "id": "0",
      "reserve": "41915557.02870717",
      "blockCommission": "0"
    },
    "priceRatio": {
      "ab": "0.0000896",
      "ba": "11160.7132887"
    },
    "commission": "0.002",
    "totalLiquidity": {
      "token": "396645.07644573",
      "usd": "288628848.1153640414293528247191279938"
    },
    "tradeEnabled": true,
    "ownerAddress": "8UAhRuUFCyFUHEPD7qvtj8Zy2HxF5HH5nb",
    "rewardPct": "0.74878692",
    "creation": {
      "tx": "f3c99e199d0157b2b6254cf3a51bb1171569ad5c4beb797e957d245aec194d38",
      "height": 466826
    },
    "apr": {
      "reward": 0.6589036323979718,
      "commission": 0.010927144790213571,
      "total": 0.6698307771881853
    },
    "volume": {
      "h24": 4320396.183546773,
      "d30": 126879352.6488824
    }
  }
}
TypeScript Definitions
export interface PoolPairData {
  id: string
  symbol: string
  displaySymbol: string
  name: string
  status: boolean
  tokenA: {
    id: string
    symbol: string
    displaySymbol: string
    reserve: string // BigNumber
    blockCommission: string // BigNumber
  }
  tokenB: {
    id: string
    symbol: string
    displaySymbol: string
    reserve: string // BigNumber
    blockCommission: string // BigNumber
  }
  priceRatio: {
    ab: string // BigNumber
    ba: string // BigNumber
  }
  commission: string // BigNumber
  totalLiquidity: {
    token: string // BigNumber
    usd?: string // BigNumber
  }
  tradeEnabled: boolean
  ownerAddress: string
  rewardPct: string // BigNumber
  customRewards?: string[]
  creation: {
    tx: string
    height: number
  }
  apr?: {
    total: number // fractional number
    reward: number // fractional number
    commission: number // fractional number
  }
  volume?: {
    d30: number // 30d volume in usd
    h24: number // 24h volume in usd
  }
}

List Pool Swaps (Verbose)

List all PoolSwap with from and to information for each PoolPair. This endpoint will include all swaps that are routed through a given PoolPair. Composite PoolSwap & PoolSwap.

Code Samples

Shell
https://ocean.defichain.com/v0/mainnet/poolpairs/5/swaps/verbose
JavaScript (@defichain/whale-api-client)
await api.poolpairs.listPoolSwapsVerbose('5')
Response
{
  "data": [
    {
      "id": "5-3e05541fb8cf8865928914dc10248726cee60def92f61da28953f7278084aee5",
      "txid": "3e05541fb8cf8865928914dc10248726cee60def92f61da28953f7278084aee5",
      "txno": 46,
      "poolPairId": "5",
      "sort": "0019bb100000002e",
      "fromAmount": "0.00001744",
      "fromTokenId": 2,
      "block": {
        "hash": "569dd605b99a36c56b999325d687781a5f49e99a3abbe72c2db961b793bd7f01",
        "height": 1686288,
        "time": 1646655844,
        "medianTime": 1646655687
      },
      "from": {
        "address": "dSPPfAPY8BA3TQdqfZRnzJ7212HPWunDms",
        "symbol": "BTC",
        "amount": "0.00001744"
      },
      "to": {
        "address": "dXCuxKuMc9u4PSbDs7XCNqgE2Upjz3zWNa",
        "amount": "0.19209075",
        "symbol": "DFI"
      }
    },
    {
      "id": "5-fa72ecb67c27bf4e311844c2faf47f009c3c72f7457a2fcdba2a0789392f827c",
      "txid": "fa72ecb67c27bf4e311844c2faf47f009c3c72f7457a2fcdba2a0789392f827c",
      "txno": 30,
      "poolPairId": "5",
      "sort": "0019bb100000001e",
      "fromAmount": "1.15000000",
      "fromTokenId": 0,
      "block": {
        "hash": "569dd605b99a36c56b999325d687781a5f49e99a3abbe72c2db961b793bd7f01",
        "height": 1686288,
        "time": 1646655844,
        "medianTime": 1646655687
      },
      "from": {
        "address": "dKp2Z17NxQcKPfdsPCaRDmK6WaZTqJ9JmC",
        "symbol": "DFI",
        "amount": "1.15000000"
      },
      "to": {
        "address": "dKp2Z17NxQcKPfdsPCaRDmK6WaZTqJ9JmC",
        "amount": "0.00010402",
        "symbol": "BTC"
      }
    }
  ],
  "page": {
    "next": "0019bb100000001e"
  }
}
TypeScript Definitions
export type CompositePoolSwapData = PoolSwapData

export interface PoolSwapData {
  id: string
  sort: string
  txid: string
  txno: number

  poolPairId: string
  fromAmount: string
  fromTokenId: number

  from?: PoolSwapFromToData
  to?: PoolSwapFromToData

  block: {
    hash: string
    height: number
    time: number
    medianTime: number
  }
}

export interface PoolSwapFromToData {
  address: string
  amount: string
  symbol: string
}