From 2fe973654752bd25ed86d0f5b4ee88611f21f2d6 Mon Sep 17 00:00:00 2001 From: canonbrother Date: Mon, 28 Feb 2022 10:54:47 +0800 Subject: [PATCH] chore(doc): add list and get poolpair API doc (#1103) * add list get poolpair api doc * too lengthy and add size filter info * Apply suggestions from code review Co-authored-by: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> --- docs/ocean/REFERENCES/poolpairs.mdx | 443 ++++++++++++++++++++++++++++ 1 file changed, 443 insertions(+) create mode 100644 docs/ocean/REFERENCES/poolpairs.mdx diff --git a/docs/ocean/REFERENCES/poolpairs.mdx b/docs/ocean/REFERENCES/poolpairs.mdx new file mode 100644 index 0000000000..61254527a5 --- /dev/null +++ b/docs/ocean/REFERENCES/poolpairs.mdx @@ -0,0 +1,443 @@ +--- +id: poolpairs +title: Pool Pairs Ocean REST API +sidebar_label: Pool Pairs +slug: /poolpairs +--- + +## List Pool Pairs + +Get a list of Pool Pairs + +#### Code Samples + +##### Shell + +```shell +curl https://ocean.defichain.com/v0/mainnet/poolpairs +curl https://ocean.defichain.com/v0/mainnet/poolpairs?size=5 +``` + +##### JavaScript ([@defichain/whale-api-client](https://www.npmjs.com/package/@defichain/whale-api-client)) + +```javascript +await api.poolpairs.list() +``` + +##### Response + +```json +{ + "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" + }, + "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 + +```typescript +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 + +```shell +https://ocean.defichain.com/v0/mainnet/poolpairs/5 +``` + +##### JavaScript ([@defichain/whale-api-client](https://www.npmjs.com/package/@defichain/whale-api-client)) + +```javascript +await api.poolpairs.getPoolPair('5') +``` + +##### Response + +```json +{ + "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 + +```typescript +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 + } +} +``` +