curl --request GET \
--url https://api.amberdata.com/defi/dex/trades \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/dex/trades"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.amberdata.com/defi/dex/trades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.amberdata.com/defi/dex/trades",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.amberdata.com/defi/dex/trades"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.amberdata.com/defi/dex/trades")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/dex/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"data": [
{
"assetBoughtAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetBoughtAmount": "16.1794651319315006",
"assetBoughtAmountRaw": "16179465131931500625",
"assetBoughtDecimals": 18,
"assetBoughtPrice": "0.000000000054573194",
"assetBoughtSymbol": "weth",
"assetPair": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2-0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
"assetSoldAddress": "0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
"assetSoldAmount": "296472755569.2866327389741926",
"assetSoldAmountRaw": "296472755569286632738974192626",
"assetSoldDecimals": 18,
"assetSoldPrice": "18324014616.785653102374439753",
"assetSoldSymbol": "elon",
"blockNumber": 21440571,
"blockchain": "ethereum-mainnet",
"callerAddress": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
"event": "Swap (index_topic_1 address sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, index_topic_2 address to)",
"liquidityPoolAddress": "0x7b73644935b8e68019ac6356c40661e1bc315860",
"logIndex": 4,
"project": "uniswap",
"protocolName": "uniswap_v2",
"receiverAddress": "0xa568bd1f7038bdea2fca05881168eef8fd4ffa33",
"timestamp": "2024-12-20T01:52:47.000Z",
"tradeFeeBought": "0.048538395395794502",
"tradeFeeSold": "889418266.707859898216922578",
"tradeId": "0x6a1bfd5881c74188933ee27ee95af994457fd4a96c9b65f7b1505c06306390c5_4",
"transactionFee": "1982124877779670",
"transactionFromAddress": "0xa568bd1f7038bdea2fca05881168eef8fd4ffa33",
"transactionGasPrice": "20035630019",
"transactionGasUsed": "98930",
"transactionHash": "0x6a1bfd5881c74188933ee27ee95af994457fd4a96c9b65f7b1505c06306390c5",
"transactionToAddress": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d"
}
]
}
}DEX Trades Historical
Retrieves the historical (time series) DEX trades.
curl --request GET \
--url https://api.amberdata.com/defi/dex/trades \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/dex/trades"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.amberdata.com/defi/dex/trades', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.amberdata.com/defi/dex/trades",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.amberdata.com/defi/dex/trades"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.amberdata.com/defi/dex/trades")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/dex/trades")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"data": [
{
"assetBoughtAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"assetBoughtAmount": "16.1794651319315006",
"assetBoughtAmountRaw": "16179465131931500625",
"assetBoughtDecimals": 18,
"assetBoughtPrice": "0.000000000054573194",
"assetBoughtSymbol": "weth",
"assetPair": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2-0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
"assetSoldAddress": "0x761d38e5ddf6ccf6cf7c55759d5210750b5d60f3",
"assetSoldAmount": "296472755569.2866327389741926",
"assetSoldAmountRaw": "296472755569286632738974192626",
"assetSoldDecimals": 18,
"assetSoldPrice": "18324014616.785653102374439753",
"assetSoldSymbol": "elon",
"blockNumber": 21440571,
"blockchain": "ethereum-mainnet",
"callerAddress": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
"event": "Swap (index_topic_1 address sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, index_topic_2 address to)",
"liquidityPoolAddress": "0x7b73644935b8e68019ac6356c40661e1bc315860",
"logIndex": 4,
"project": "uniswap",
"protocolName": "uniswap_v2",
"receiverAddress": "0xa568bd1f7038bdea2fca05881168eef8fd4ffa33",
"timestamp": "2024-12-20T01:52:47.000Z",
"tradeFeeBought": "0.048538395395794502",
"tradeFeeSold": "889418266.707859898216922578",
"tradeId": "0x6a1bfd5881c74188933ee27ee95af994457fd4a96c9b65f7b1505c06306390c5_4",
"transactionFee": "1982124877779670",
"transactionFromAddress": "0xa568bd1f7038bdea2fca05881168eef8fd4ffa33",
"transactionGasPrice": "20035630019",
"transactionGasUsed": "98930",
"transactionHash": "0x6a1bfd5881c74188933ee27ee95af994457fd4a96c9b65f7b1505c06306390c5",
"transactionToAddress": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d"
}
]
}
}Authorizations
Query Parameters
Filter by trades after this date.
Examples: 2025-02-05
Filter by trades before this date.
If endDate is not specified but startDate is, the endpoint will return trades spanning from startDate to the now i.e. the time the request was made.
Filter for trades on just this network/blockchain.
ethereum-mainnet, polygon-mainnet, arbitrum-mainnet, bnb-mainnet, optimism-mainnet, avalanche-mainnet Filter for trades from this protocol. Use the DEX Information endpoint to see available protocols.
Filter by the smart contract address of the liquidity pool
Filter by the smart contract address of the asset that was bought in the trade
Filter by the smart contract address of the asset that was sold in the trade
Filter by a specific address that was either the initiator or recipient of the trade
Was this page helpful?