# Waves Data Service API
Waves data service aggregates blockchain data into a PostrgreSQL relational database and provides fast and convenient information retrieval using variety of filters.
The Data Service API lets you get the following data:
- List of transactions, including transactions of each type.
- Parameters of tokens (assets) by ID or exchange tickers.
- Market data on cryptocurrency trading.
The Waves team provides data service instances with public API. The interactive documentation of endpoints in Swagger UI is available on the following links:
- Mainnet: https://api.wavesplatform.com/v0/docs/
- Testnet: https://api-testnet.wavesplatform.com/v0/docs/
💡 All endpoints of the Data Service API can be accessed both via POST and GET method. POST request parameters are specified in the request body in JSON format; the keys are the same as the query parameters in the GET request.
# Search Transactions
- The /transactions/{txType} endpoints provide a list of transactions of a given type, applying filters depending on the type. For example, the /transactions/transfer endpoint returns a list of transfer transactions with selection by sender, recipient, and asset ID.
- The /transactions/all endpoint provides a list of transactions regardless of their types, with selection by sender address and timestamp.
Pagination is available for transaction lists. Together with the list of transactions, the endpoints return the isLastPage
and lastCursor
fields. If "isLastPage": false
, then you can get the next page by specifying the lastCursor
value as the after
request parameter.
# Get Market Data
The Data Service API provides market data for any pair of assets. The data source is Exchange transactions. The tickers are sourced from the WX Network exchange, developed by a third-party team from the community.
The /pairs* endpoints provide current market data: last trade price and data for the last 24 hours: minimum, maximum and average price, volume and number of transactions, etc.
⚠️ Current market data, including last price, is not available for a pair of assets if there has not been a deal (Exchange transaction) for it in the last 24 hours.
The /candles endpoint provides data for the OHCLV (open-high-low-close-volume) candlestick chart for a given period.
If there is no data in the response
If the endpoint returns null
or Not found
for the selected pair {amountAsset}/{priceAsset}
, the reasons may be as follows:
The assets are specified in the request in the wrong order. Determine which of the assets is the amount asset (base currency), and which is the price asset (quote currency):
• You can see asset pairs in the WX Network app for Mainnet or Testnet. The first asset in the pair is the amount asset, the second is the price asset.
• You can also use the
GET /matcher/settings
endpoint of the Matcher API for Mainnet or Testnet that returns thepriceAssets
list:• If both assets are in the
priceAssets
list, the price asset is the one that comes first.• If there is only one asset of the pair in the list, this asset is a price asset.
• If both assets are not in the list, their IDs in byte representation should be sorted lexicographically: the first (smallest) one is a price asset.
For more details, see the Matcher API article in the WX Network documentation.
There were no Exchange transactions for the selected pair in the period for which the endpoint provides data (last 24 hours for the
/pairs*
endpoints). You can check this using the /transactions/exchange endpoint by getting, for example, the last 10 Exchange transactions for this pair.
Market data is available for all matchers (senders of Exchange transactions) or for a given matcher. To receive data for a given matcher, specify its address in the request.
💡 Address of the WX Network matcher:
- Mainnet: 3PEjHv3JGjcWNpYEEkif2w8NXV4kbhnoGgu
- Testnet: 3N8aZG6ZDfnh8YxS6aNcteobN8eXTWHaBBd
# Monetary values
By default, the Data Service API returns monetary values (prices, amounts, fees) as floating point numbers (for example, 1.234567). On the blockchain, as well as in the Node REST API, such values are represented as integers, that is, in the normalized form (for example, 123456700). You can find more details about the normalized form in the Token atomic unit, Exchange transaction, and Order articles.
You can obtain monetary values as integers by specifying the following HTTP header in the request:
Accept: application/json;money-format=long
Example:
Floating point numbers in the fee and amount fields
curl -s 'https://api.wavesplatform.com/v0/transactions/transfer?sender=3P2pTpQhGbZrJXATKr75A1uZjeTrb4PHMYf&sort=desc&limit=1' | jq .
{
"__type": "list",
"isLastPage": false,
"lastCursor": "MzE4MDY3NTAwMDIwOjpkZXNj",
"data": [
{
"__type": "transaction",
"data": {
"height": 3180675,
"type": 4,
"id": "EjvguwbqvQ9WBMSy8xwU1r3HtLkuSxZMCcRvVxptumjg",
"timestamp": "2022-06-27T16:20:33.287Z",
"proofs": [
"49YXU4icU3L8nfCdWGHLpTfE1fDTDCXw96pd2fmQE5y9jfDUBU4frk7krkJcGpe8p8kYP2FZssT12QN8BqKjbU18"
],
"version": 2,
"fee": 0.001,
"applicationStatus": "succeeded",
"sender": "3P2pTpQhGbZrJXATKr75A1uZjeTrb4PHMYf",
"senderPublicKey": "8gNkw1MGrCr9QCAm58YiJXw3AN4sLf7yTLCLYrTseYzj",
"assetId": "WAVES",
"amount": 6.0512,
"recipient": "3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo",
"feeAsset": "WAVES",
"attachment": ""
}
}
]
}
Integers in the fee and amount fields
curl -s -H 'Accept: application/json;money-format=long' 'https://api.wavesplatform.com/v0/transactions/transfer?sender=3P2pTpQhGbZrJXATKr75A1uZjeTrb4PHMYf&sort=desc&limit=1' | jq .
{
"__type": "list",
"isLastPage": false,
"lastCursor": "MzE4MTU3NTAwMDA4OjpkZXNj",
"data": [
{
"__type": "transaction",
"data": {
"height": 3181575,
"type": 4,
"id": "2iVppNFRheucBU6QqQTK211GrMysB1UWmvUBPSzhJ91i",
"timestamp": "2022-06-28T07:26:13.814Z",
"proofs": [
"2dKt6fFapGqTu2hsooVrDpi9FWCFAfKE6CW7CPfwrQhHajTruky2qC9HJ1XMVhywS2CHcNw4rtTo8RgV51Fp3D2Y"
],
"version": 2,
"fee": 100000,
"applicationStatus": "succeeded",
"sender": "3P2pTpQhGbZrJXATKr75A1uZjeTrb4PHMYf",
"senderPublicKey": "8gNkw1MGrCr9QCAm58YiJXw3AN4sLf7yTLCLYrTseYzj",
"assetId": "WAVES",
"amount": 604460000,
"recipient": "3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo",
"feeAsset": "WAVES",
"attachment": ""
}
}
]
}
# Limitations
- The maximum number of simultaneous connections per IP address is 15. If the limit is exceeded, HTTP Status 418 is returned.
- The maximum number of the requests per second (r/s) from IP-address is 40. If the requests rate exceeds the limit, the exceeding requests are queued. The size of the queue (burst) is 20. If the number of redundant requests has exceeded the size of the queue, new requests are not queued, HTTP status 429 is returned.
⚠️ Please check the performance of your requests to the Data Service API before you run your application in production and load it. If the combination of filters you are using is slow (the response time is about a second), contact the developer chat in Telegram: we can suggest more effective way to obtain required data or optimize the processing of such requests in the data service.