-
Notifications
You must be signed in to change notification settings - Fork 122
DEX Api Document
Harsh R edited this page Feb 3, 2021
·
5 revisions
Endpoint: https://api.defichain.io/v1/listswaps
Query params:
- network: mainnet(default)/testnet
Sample output:
{
"ETH_DFI": {
"base_id": "1",
"base_name": "Ether",
"base_symbol": "ETH",
"quote_id": "0",
"quote_name": "Default Defi token",
"quote_symbol": "DFI",
"last_price": "1014.38963182",
"base_volume": "*",
"quote_volume": "*"
},
"BTC_DFI": {
"base_id": "2",
"base_name": "Bitcoin",
"base_symbol": "BTC",
"quote_id": "0",
"quote_name": "Default Defi token",
"quote_symbol": "DFI",
"last_price": "34734.50763876",
"base_volume": "*",
"quote_volume": "*"
},
"USDT_DFI": {
"base_id": "3",
"base_name": "Tether USD",
"base_symbol": "USDT",
"quote_id": "0",
"quote_name": "Default Defi token",
"quote_symbol": "DFI",
"last_price": "1.60368329",
"base_volume": "*",
"quote_volume": "*"
}
}
Endpoint: https://api.defichain.io/v1/getsubgraphswaps
Query params:
- network: mainnet/testnet, mainnet by default
- start: n (numeric) Exclude from a response the first n items of a resource collection
- limit: n (numeric) Maximum number of data to return, 100 by default
Sample output:
{
"data": {
"swaps": [
{
"id": "3b4473133be190e129de366fdac031cc4d32543643aa594cfc643703c488300f",
"fromAmount": 10462.77219,
"toAmount": 3788.11070677,
"timestamp": "2021-02-03T08:18:51.000Z",
"pair": {
"fromToken": {
"decimals": 8,
"symbol": "USDT",
"tradeVolume": 212506.5465035932
},
"toToken": {
"decimals": 8,
"symbol": "DFI",
"tradeVolume": 4117602.75777615
}
}
},
{
"id": "9e53a62270a48bfffd53e4202160d08b0b841fdbbca36772a69ffe713a837fe8",
"fromAmount": 10,
"toAmount": 527.58066236,
"timestamp": "2021-02-03T08:18:51.000Z",
"pair": {
"fromToken": {
"decimals": 8,
"symbol": "LTC",
"tradeVolume": 411696.7246296674
},
"toToken": {
"decimals": 8,
"symbol": "DFI",
"tradeVolume": 4117602.75777615
}
}
},
{
"id": "9dcaaa9a5fda522b7a9efce4768e4d94521ac15dae0c38d60365959a0b28eddf",
"fromAmount": 0.0531611,
"toAmount": 0.01916723,
"timestamp": "2021-02-03T08:18:51.000Z",
"pair": {
"fromToken": {
"decimals": 8,
"symbol": "USDT",
"tradeVolume": 212506.5465035932
},
"toToken": {
"decimals": 8,
"symbol": "DFI",
"tradeVolume": 4117602.75777615
}
}
},
{
"id": "e52f216f4607a6e05747e17d4607f92b3f6f42d273ec5ba8a63676fc4fd43d85",
"fromAmount": 0.19158386,
"toAmount": 103.29803766,
"timestamp": "2021-02-03T08:13:50.000Z",
"pair": {
"fromToken": {
"decimals": 8,
"symbol": "ETH",
"tradeVolume": 1040451.1393524016
},
"toToken": {
"decimals": 8,
"symbol": "DFI",
"tradeVolume": 4117602.75777615
}
}
},
{
"id": "87cbe3256b5fdefeb58846a4e4b84e0fc9fe89b5df881392665e0594f4f4b81c",
"fromAmount": 1e-8,
"toAmount": 1e-8,
"timestamp": "2021-02-03T08:11:45.000Z",
"pair": {
"fromToken": {
"decimals": 8,
"symbol": "USDT",
"tradeVolume": 212506.5465035932
},
"toToken": {
"decimals": 8,
"symbol": "DFI",
"tradeVolume": 4117602.75777615
}
}
}
],
"total": 49285
}
}
Endpoint: https://api.defichain.io/v1/listyieldfarming
Query params:
- network: mainnet/testnet, mainnet by default
- start: n (numeric) Optional first key to iterate from, in lexicographical order. Typically, it's set to last ID from previous request.
- including_start: bool (Boolean) If true, then iterate including starting position. False by default
- limit: n (numeric) Maximum number of pools to return, 100 by default
Sample output:
{
"pools": [
{
"apr": 357.40539908693245,
"name": "Ether-Default Defi token",
"pair": "ETH-DFI",
"logo": "https://defichain.com/downloads/symbol-defi-blockchain.svg",
"poolRewards": [
"DFI"
],
"totalStaked": 1660911.530270244,
"pairLink": "https://dex.defichain.com/mainnet/pool/4"
},
{
"apr": 401.1516191325137,
"name": "Bitcoin-Default Defi token",
"pair": "BTC-DFI",
"logo": "https://defichain.com/downloads/symbol-defi-blockchain.svg",
"poolRewards": [
"DFI"
],
"totalStaked": 12578185.205055784,
"pairLink": "https://dex.defichain.com/mainnet/pool/5"
},
{
"apr": 365.635294364571,
"name": "Tether USD-Default Defi token",
"pair": "USDT-DFI",
"logo": "https://defichain.com/downloads/symbol-defi-blockchain.svg",
"poolRewards": [
"DFI"
],
"totalStaked": 811763.4668665677,
"pairLink": "https://dex.defichain.com/mainnet/pool/6"
}
],
"provider": "Defichain",
"provider_logo": "https://defichain.com/downloads/symbol-defi-blockchain.svg",
"provider_URL": "https://defichain.com",
"links": [
{
"title": "Twitter",
"link": "https://twitter.com/defichain"
},
{
"title": "YouTube",
"link": "https://www.youtube.com/DeFiChain"
},
{
"title": "Reddit",
"link": "https://reddit.com/r/defiblockchain"
},
{
"title": "Telegram",
"link": "https://t.me/defiblockchain"
},
{
"title": "LinkedIn",
"link": "https://www.linkedin.com/company/defichain"
},
{
"title": "Facebook",
"link": "https://www.facebook.com/defichain.foundation"
},
{
"title": "GitHub",
"link": "https://github.com/DeFiCh/ain"
}
]
}