Pairs API

Pairs data

POST https://api.flatqube.io/v1/pairs

{
 ...
"counter": "BRIDGE",
        "poolAddress": "0:83b88abbcd562c8d8dc4cab30ec1ded86a4ded99000ca02425715e5cec754f06",
        "fee": "0.3000"
      },
      "tvl": "8955040.156573434959",
      "tvlChange": "3.26",
      "leftLocked": "22564291945792668",
      "leftPrice": "0.2323725625631798673951181204",
...
}

This function is used to get all Pairs data by It can be used for representing data specific to each currency in detail.

Request parameters

Body required. Data used for Postman tests:

{
  "currencyAddress": "0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1",
  "currencyAddresses": [
    "0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1"
  ],
  "limit": 0,
  "offset": 0,
  "ordering": "tvlascending",
  "tvlAmountGe": "8955040.156573434959",
  "tvlAmountLe": "8955043.156573434959",
  "whiteListUri": "https://raw.githubusercontent.com/broxus/ton-assets/master/manifest.json"
}

Response fields explanation

Example

app.post('/pairs', (req, res) => {
    axios({
        method: 'post',
        url: `${liveApiUrl}/pairs`,
        data: {
            currencyAddress: req.body.currencyAddress,
            currency_addresses: req.body.currency_addresses,
            limit: req.body.limit,
            offset: req.body.offset,
            ordering: req.body.ordering,
            tvlAmountGe: req.body.tvlAmountGe,
            tvlAmountLe: req.body.tvlAmountLe,
            whiteListUri: req.body.whiteListUri
          }
        })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })

Dex pair data info

POST https://api.flatqube.io/v1/pairs/address/{address}

{
  "meta": {
    "base": "WEVER",
    "baseAddress": "0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d",
    "counterAddress": "0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1",
    "counter": "BRIDGE",
    "poolAddress": "0:83b88abbcd562c8d8dc4cab30ec1ded86a4ded99000ca02425715e5cec754f06",
    "fee": "0.3000"
  },
  "tvl": "11991318.532110678860",
  "tvlChange": "1.58",
  "leftLocked": "25793313867480582",
  "leftPrice": "0.2324501340486766469128429809",
  "rightLocked": "644828780315691",
  "rightPrice": "9.298063996337",
  "volume24h": "71793.071260381244",
  "volumeChange24h": "-40.15",
  "volume7d": "1568911.947379165588",
  "fee24h": "215.553088264148",
  "fee7d": "4697.356377562167",
  "feeAllTime": "18787.266129440217"
}

This function is used to get pair data info by liquidity pool address.

It can be used for presenting a pair with all the details about it in the desired pool.

Request parameters

Address parameter required - represents the pool address of a specific pair. Value used for testing is pool WEVER/BRIDGE address: 0:83b88abbcd562c8d8dc4cab30ec1ded86a4ded99000ca02425715e5cec754f06

Response field explanation

Example

 app.post('/pairs/address/:address', (req, res) => {
    axios({
        method: 'post',
        url: `${liveApiUrl}/pairs/address/${req.params.address}`
    })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })

Dex cross pairs data

POST https://api.flatqube.io/v1/pairs/cross_pairs

{
  "meta": {
    "base": "WEVER",
    "baseAddress": "0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d",
    "counterAddress": "0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1",
    "counter": "BRIDGE",
    "poolAddress": "0:83b88abbcd562c8d8dc4cab30ec1ded86a4ded99000ca02425715e5cec754f06",
    "fee": "0.3000"
  },
  "tvl": "11992480.952892429456",
  "tvlChange": "1.22",
  "leftLocked": "25795814233390122",
  "leftPrice": "0.2324501340486766469128429809",
  "rightLocked": "644766509092723",
  "rightPrice": "9.299863426349",
  "volume24h": "68293.598448021590",
  "volumeChange24h": "-44.98",
  "volume7d": "1549070.057378500757",
  "fee24h": "205.053510628491",
  "fee7d": "4637.831319664494",
  "feeAllTime": "18789.418763913485"
}

This function is needs to get all cross pairs data.

It can be used anywhere where certain details about one currency and how it affects the other one in the pair and vice versa is needed.

Request parameters

Body required. Data used for Postman tests:

Response fields explanation:

Example

app.post('/pairs/cross_pairs', (req, res) => {
    axios({
        method: 'post',
        url: `${liveApiUrl}/pairs/cross_pairs`,
        data: {
            fromCurrencyAddress: req.body.fromCurrencyAddress,
            toCurrencyAddresses: req.body.toCurrencyAddresses
        }
    })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })

Pair data

POST https://api.flatqube.io/v1/pairs/left/{left}/right/{right}

{
  "meta": {
    "base": "WEVER",
    "baseAddress": "0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d",
    "counterAddress": "0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1",
    "counter": "BRIDGE",
    "poolAddress": "0:83b88abbcd562c8d8dc4cab30ec1ded86a4ded99000ca02425715e5cec754f06",
    "fee": "0.3000"
  },
  "tvl": "11992480.952892429456",
  "tvlChange": "1.22",
  "leftLocked": "25795814233390122",
  "leftPrice": "0.2322691452075765631601791831",
  "rightLocked": "644766509092723",
  "rightPrice": "9.292622425991",
  "volume24h": "68293.598448021590",
  "volumeChange24h": "-44.98",
  "volume7d": "1549070.057378500757",
  "fee24h": "205.053510628491",
  "fee7d": "4637.831319664494",
  "feeAllTime": "18789.418763913485"
}

This function is used to get pair data info by token root addresses. It can be used anywhere where details about the pairs are used and should be retrieved using their root addresses.

Request parameters

Left and right parameter required - represents address of a specific currency. Value used for testing are WEVER and BRIDGE addresses (respectively) : left = 0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d ``right = 0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1

Response field explanation:

Example

app.post('/pairs/left/:left/right/:right', (req, res) => {
 
    axios({
        method: 'post',
        url: `${liveApiUrl}/pairs/left/${req.params.left}/right/${req.params.right}`
    })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })

Ohlcv Pair data

POST https://api.flatqube.io/v1/pairs/left/{left}/right/{right}/ohlcv

 {
    "open": "0.024984390565",
    "high": "0.025131270323",
    "low": "0.024980850704",
    "close": "0.025131270323",
    "volume": "249.621417263132",
    "openTimestamp": 1647274428000,
    "closeTimestamp": 1647275606000,
    "timestamp": 1647273600000
  },
  ...
  }

This function needs to get ohlcv pair data info by token root addresses. It can be used ie. for graphic representation of price change of the right pair compared to the value of the left pair over a certain period of time (ie. 1 WEVER = 0.02245627 BRIDGE).

Request parameters

Left parameter required - represents the address of a specific currency. Value used for testing is WEVER address: 0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d

Right parameter required - represents the address of a specific currency. Value used for testing is BRIDGE address: 0:f2679d80b682974e065e03bf42bbee285ce7c587eb153b41d761ebfd954c45e1

Data used for Postman tests:

{
  "from": 1646741858511,
  "timeframe": "H1",
  "to": 1647346658513
}

Response field explanation

Example

 app.post('/pairs/left/:left/right/:right/ohlcv', (req, res) => {
    axios({
        method: 'post',
        url: `${liveApiUrl}/pairs/left/${req.params.left}/right/${req.params.right}/ohlcv`,
        data: {
            from: req.body.from,
            timeframe: req.body.timeframe,
            to: req.body.to
        }
    })
    .then(function(response){
        res.send(response.data)
    })
    .catch(function(error){
        console.error(error)
        res.send('Error')
    })
  })

Last updated