DIA Nexus Documentation
  • Nexus Overview
  • Intro to Nexus
    • How it works
    • Nexus vs. Lumina
    • Integrated Chains
  • Data products
    • Token Price Feeds
    • RWA Price Feeds
    • Randomness
    • Fair-value Feeds
  • How-to Guides
    • Fetch Price Data
      • Solidity
      • Vyper
      • Demo Oracles
      • Chain-specific Guide
        • Aleph Zero
        • Alephium
        • Edu Chain
        • Hydration
        • Kadena
        • LUKSO
        • Somnia
        • Stacks
        • Superseed
        • XRP Ledger (XRPL)
    • Generate Randomness
      • Solidity
      • WASM
      • Demo Oracles
      • Chain-specific Guide
        • Alephium
    • Migrate to DIA
    • Fund the Oracle
    • Build a Scraper
      • Development Cluster Stack
      • DIA Test‐Space with Docker Compose
      • DIA Test‐Space with Minikube
      • Add a new exchange scraper
      • Add a new foreign scraper
      • Add a new liquidity scraper
      • Additional notes
  • Request a Custom Oracle
  • Reference
    • Architecture
      • Data sourcing
      • Data computation
      • Data delivery
    • APIs
      • Token prices
        • RestAPI
          • Request Samples
        • GraphQL
          • Request Samples
      • RWA prices
    • Pricing Methodologies
      • IR: Interquartile Range Filter
      • MAIR: Moving Average with Interquartile Range Filter
      • VWAP: Volume Weighted Average Price
      • VWAPIR: Volume Weighted Average Price with Interquartile Range Filter
      • LST fair price
    • Data Sources
      • CEXes Data
      • DEXes Data
    • Smart Contracts
      • DIAOracleV2.sol
      • DIARandomOracle.sol
    • Randomness Protocol
  • Resources
    • Audits
    • Community & Support
    • Security Bounty Program
    • Research
      • Return Rates in Crypto Farming
      • Crypto Volatility Index
      • Compounded Rates
      • Polkadot Medianizer
    • T&C
      • Licence Agreement
      • Contributor Covenant Code of Conduct
      • Disclaimer
Powered by GitBook
On this page
  • Digital Assets Market Data
  • Token Price Quotation (by address)
  • Token Price Quotation (by symbol)
  • Quotable Assets
  • DeFi Data
  • DeFi Protocols Collateral Information
  • Decentralized Exchanges Pool Liquidity
  • Slippage calculation (for Uniswap V2 and its forks)
  • Assets Information
  • Blockchains
  • Exchanges
  • Centralized Exchange Pairs by Exchange
  • Centralized Exchange Pairs by Asset
  • Asset Last Trades
  • Chart Points for Graphs
  • Exchange Chart Points
  • Asset Chart Points
  • Guest Quotations
  • Guest Symbols
  • Guest Quotation
Export as PDF
  1. Reference
  2. APIs
  3. Token prices

RestAPI

PreviousToken pricesNextRequest Samples

Last updated 1 month ago

The page includes a list of all available Token data endpoints on DIA network. To review the data sources and methodologies used for pricing, visit the page.

Digital Assets Market Data

Token Price Quotation (by address)

GET https://api.diadata.org/v1/assetQuotation/:blockchain/:asset

Returns the quotation for a fully qualified asset (i.e. distinguished by blockchain and address). Quotations are obtained by filtering trades data with a Moving Average filter and Interquartile Range outlier detection (MAIR).

Example:

Path Parameters

Name
Type
Description

blockchain*

String

Name of the blockchain for requested asset

asset*

String

Address of the requested asset

{
    "Symbol": "BTC",
    "Name": "Bitcoin",
    "Address": "0x0000000000000000000000000000000000000000",
    "Blockchain": "Bitcoin",
    "Price": 25703.376586196053,
    "PriceYesterday": 25815.29054321003,
    "VolumeYesterdayUSD": 1317774231.5192668,
    "Time": "2023-09-11T10:07:59.944Z",
    "Source": "diadata.org",
    "Signature": "0x8e0ffd0f2aac9306a6605e82f87856859b0666f1e600c9247b2935bfe52ded71061aa0c04e83dde4b6272a3057b5b93d9395ed5d8e1f033d1b25b04e73e1680101"
}

Token Price Quotation (by symbol)

GET https://api.diadata.org/v1/quotation/:symbol

Get most recent information on the currency corresponding to symbol. Quotations are obtained by filtering trades data with a Moving Average filter and Interquartile Range outlier detection (MAIR).

Note: this endpoint is intended for testing purposes only; if multiple assets with the same symbol exists, data for the highest volume generating asset will be returned

Path Parameters

Name
Type
Description

Symbol*

String

Which symbol to get a quotation for, e.g., BTC.

{
    "Symbol": "BTC",
    "Name": "Bitcoin",
    "Address": "0x0000000000000000000000000000000000000000",
    "Blockchain": "Bitcoin",
    "Price": 25692.061459484863,
    "PriceYesterday": 25825.253617593764,
    "VolumeYesterdayUSD": 1323023983.1804218,
    "Time": "2023-09-11T10:15:59.299Z",
    "Source": "diadata.org"
}

Quotable Assets

GET https://api.diadata.org/v1/quotedAssets

Returns a list of assets available for quotations.

Use the query parameter blockchain in order to obtain exclusively assets on the selected blockchain.

Query Parameters

Name
Type
Description

blockchain

String

Name of the blockchain for the requested assets.

[{"Asset":{"Symbol":"WETH","Name":"Wrapped Ether","Address":"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619","Decimals":18,"Blockchain":"Polygon"},"Volume":35305550.57803},{"Asset":{"Symbol":"WMATIC","Name":"Wrapped Matic","Address":"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270","Decimals":18,"Blockchain":"Polygon"},"Volume":24233330.345671}]

DeFi Data

DeFi Protocols Collateral Information

GET https://api.diadata.org/v1/synthasset/:blockchain/:protocol

The endpoint provides information on the health factor of DeFi protocols.

It takes into consideration outstanding loans, contracts' balance and compares it to synthetic token issuance. This helps to make sure that all assets are fully collateralized.

Exemplary query:

Currently only Aave V2 and Aave V3 are supported on Ethereum and Avalanche blockchains.

It is possible to receive collateral information for a single token by using token filter as in example below:

To receive all asset updates data during the selected period use starttime and endtime filter parameters with timestamps as inputs. Here is an example:

Path Parameters

Name
Type
Description

blockchain*

String

Ethereum or Avalanche

protocol*

String

Aave

address

String

Token contract address. You can use either underlying token address or synthetic token to receive the data

starttime

Integer

Unix timestamp setting the start of the return array

endtime

Integer

Unix timestamp setting the end of the return array

{
    // Response
}

Decentralized Exchanges Pool Liquidity

GET https://api.diadata.org/v1/poolLiquidity/:blockchain/:pool_address

Path Parameters

Name
Type
Description

blockchain*

String

Name of the blockchain of the requested pool.

address*

String

Address of the requested pool.

{Exchange: "Uniswap", Blockchain: "Ethereum", Address: "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc", Time: "0001-01-01T00:00:00Z", TotalLiquidityUSD: 97124191.13292821,
Liquidity:
{ 0: {Asset: {Symbol: "WETH", Name: "Wrapped Ether", Address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", Decimals: 18, Blockchain: "Ethereum"}, Volume: 34642.164578066426 }}
{1: {Asset: {Symbol: "USDC", Name: "USD Coin", Address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", Decimals: 6, Blockchain: "Ethereum"}, Volume: 50362947.314436}}
}

Slippage calculation (for Uniswap V2 and its forks)

GET https://api.diadata.org/v1/poolSlippage/:blockchain/:pool_address/:token1_address/:pool_type/:desired_slippage

To predict the amount of tokens required to reach a specified slippage, you can use Pool Slippage endpoint. It works for any pool that exists on Uniswap V2 or any fork DEX on supported list of exchanges.

The logic is as follows:

Provide the address of the pool, select a token in which you wish to have slippage calculated (e.g. if selected ETH from ETH-USDC, it will show how much is ETH is required to move the price by selected amount) and determine the goal for price movement.

Path Parameters

Name
Type
Description

:blockchain*

String

Name of the blockchain of the requested pool (e.g. Ethereum, Moonbeam, etc.)

:pool_address*

String

Address of the requested pool

:token1_address*

String

Address of either of the tokens in the pool

:pool_type*

String

Type of the pool (e.g. UniswapV2)

:desired_slippage*

Integer

Per mille (e.g. 100 will result in 10% slippage)

{
    // Response
}

Assets Information

Blockchains

GET https://api.diadata.org/v1/blockchains

Get a list of all available blockchains.

{
    // Response
}

Exchanges

GET https://api.diadata.org/v1/exchanges

Get a list of all available crypto exchanges.

["KuCoin","Uniswap","Balancer","Maker","Gnosis","Curvefi","Binance","BitBay","Bitfinex","Bittrex","CoinBase","GateIO","HitBTC","Huobi","Kraken","LBank","OKEx","Quoine","Simex","ZB","Bancor","Loopring","SushiSwap","Dforce","0x","Kyber","Bitmax","PanCakeSwap","CREX24","STEX"]

Centralized Exchange Pairs by Exchange

GET https://api.diadata.org/v1/pairsCex/:exchange

Get all pairs on a given exchange for which DIA is collecting trades data at the moment.

Use the query parameter verified in order to get either verified or unverified pairs.

Path Parameters

Name
Type
Description

exchange*

String

Name of the crypto exchange.

Query Parameters

Name
Type
Description

verified

Bool

If set to true, only verified pairs are returned. If set to false, only unverified pairs are returned.

Centralized Exchange Pairs by Asset

GET https://api.diadata.org/v1/pairsAssetCex/:blockchain/:address

Get all pairs on a centralized exchange for which DIA is collecting trades data at the moment. Include pairs across all exchanges involving the requested asset as either base- or quote token.

Use the query parameter verified in order to get either verified or unverified pairs.

Path Parameters

Name
Type
Description

blockchain*

String

Name of the blockchain for the requested asset.

address*

String

Address of the requested asset.

Query Parameters

Name
Type
Description

verified

Bool

If set to true, only verified pairs are returned. If set to false, only unverified pairs are returned.

Asset Last Trades

GET https://api.diadata.org/v1/lastTradesAsset/:blockchain/:address

Get last trade timestamp for an asset.

Path Parameters

Name
Type
Description

blockchain*

String

A valid blockchain from GET /v1/blockchains, e.g., Bitcoin.

address*

String

A valid asset address from GET /v1/token/:symbol, e.g., 0x000000000000000000000000000000000000000 for BTC.

{
    // Response
}

Chart Points for Graphs

Exchange Chart Points

GET https://api.diadata.org/v1/chartPoints/:filter/:exchange/:symbol

Get chart points for an exchange.

Path Parameters

Name
Type
Description

filter*

string

Which filter should be applied (Available options: MA120, VOL120, MEDIR120 and MAIR120).

exchange*

string

A valid exchange from GET /v1/exchanges, e.g., Binance

symbol*

string

A valid symbol from GET /v1/coins, e.g., BTC.

Query Parameters

Name
Type
Description

scale

string

Which scale the graph points distance should have. Available options: 5m 30m 1h 4h 1d 1w.

{"DataPoints":[{"Series":[{"name":"filters","columns":["time","exchange","filter","symbol","value"],"values":[["2020-05-19T08:02:09Z","GateIO","MEDIR120","EOS",2.6218717017500084]]}],"Messages":null}]}

Asset Chart Points

GET https://api.diadata.org/v1/assetChartPoints/:filter/:blockchain/:address

Get asset details for all exchanges.

Remark: Careful! Successful responses can be rather large.

Path Parameters

Name
Type
Description

starttime

integer

Unix timestamp setting the start of the return array

endtime

integer

Unix timestamp setting the end of the return array

filter*

string

Which filter should be applied (Available options: MA120, MEDIR120, VOL120 and MAIR120).

blockchain*

string

A valid blockchain from GET /v1/blockchains, e.g., Bitcoin.

address*

String

A valid asset address from GET /v1/token/:symbol, e.g., 0x000000000000000000000000000000000000000 for BTC.

Query Parameters

Name
Type
Description

scale

string

Which scale the graph points distance should have. Available options: 5m 30m 1h 4h 1d 1w

{"DataPoints":[{"Series":[{"name":"filters","columns":["time","exchange","filter","symbol","value"],"values":[["2020-05-19T08:17:59Z",null,"MEDIR120","EOS",2.6236194301032314]]}],"Messages":null}]}

Guest Quotations

Guest Symbols

GET https://api.diadata.org/v1/foreignSymbols/:source

Get the list of available symbols along with their ITIN for guest quotations.

Path Parameters

Name
Type
Description

source*

string

source of the quotation

Guest Quotation

GET https://api.diadata.org/v1/foreignQuotation/:source/:symbol

Get the latest quotation for a token from a guest source.

Path Parameters

Name
Type
Description

source*

string

source of the quotation

symbol*

string

Which symbol to get a quotation for, e.g. BTC

Query Parameters

Name
Type
Description

time

number

Unix timestamp.

Example:

Example:

Example:

Get the latest state of a DEX pool's liquidity. Example:

Here is an exemplary API call:

Example:

Example:

Example:

Example:

Example:

Example: Note: Successful responses can be rather large.

Example:

Example:

Example: Use the query parameter time in order to get the latest quotation before the specified timestamp

Example:

Data Sources
https://api.diadata.org/v1/assetQuotation/Bitcoin/0x0000000000000000000000000000000000000000
https://api.diadata.org/v1/quotation/BTC
https://api.diadata.org/v1/quotedAssets
https://api.diadata.org/v1/quotedAssets?blockchain=Polygon
https://api.diadata.org/v1/synthasset/Ethereum/Aave-V2
https://api.diadata.org/v1/synthasset/Avalanche/Aave-V3?address=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7
https://api.diadata.org/v1/synthasset/Avalanche/Aave-V3?address=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7&starttime=1664502770&endtime=1664531570
https://api.diadata.org/v1/poolLiquidity/Ethereum/0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc
https://api.diadata.org/v1/poolSlippage/Ethereum/0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc/0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48/UniswapV2/100
https://api.diadata.org/v1/pairsCex/Kraken
https://api.diadata.org/v1/pairsCex/Kraken?verified=true
https://api.diadata.org/v1/pairsAssetCex/Shiden/0x0000000000000000000000000000000000000000
https://api.diadata.org/v1/pairsAssetCex/Shiden/0x0000000000000000000000000000000000000000?verified=true
https://api.diadata.org/v1/lastTradesAsset/Bitcoin/0x0000000000000000000000000000000000000000
https://api.diadata.org/v1/chartPoints/MEDIR120/Binance/BTC
https://api.diadata.org/v1/assetChartPoints/MA120/Bitcoin/0x0000000000000000000000000000000000000000
https://api.diadata.org/v1/foreignSymbols/Coingecko
https://api.diadata.org/v1/foreignQuotation/CoinMarketCap/BTC
https://api.diadata.org/v1/foreignQuotation/Coingecko/BTC?time=1647349656