The dexTrades field allows us to fetch dex trades from Tron network.
Here is an example that demonstrates how to retrieve DEX trades:
{
tron {
dexTrades(
date: {after: "2023-07-26"}
options: {limit: 10, desc: "block.timestamp.iso8601"}
) {
baseAmount
baseCurrency {
address
name
}
block {
hash
height
timestamp {
iso8601
}
}
buyAmount
buyCurrency {
address
name
}
energyFee
energyUsageTotal
fee
internalTransactionsCount
logsCount
quoteAmount
quoteCurrency {
address
name
}
quotePrice
sellAmount
sellCurrency {
address
name
}
side
tradeAmount(in: USD)
transaction {
hash
}
}
}
}
Fileting DEX Trades
DEX trades can be filtered using the following arguments:
any:baseCurrency: filter by base currency of tradebuyAmount: filter by buy amount of tradebuyCurrency: filter by buy currency of tradedate: filter by date of tradeexchangeAddress: filter by exchange addressexchangeName: filter by name of exchangeheight: filter by block heightmaker: filter by maker of the trademakerOrTaker: filter by address of maker or takeroptions: filter returned data by ordering, limiting, and constraining itprice: filter by trade pricepriceAsymmetry: filter by price asymmetry of tradeprotocol: filter by protocol name of smart contractquoteCurrency: filter by quote currency of smart contractsellAmount: filter by sell amount of tradesellCurrency: filter by sell currency of tradesmartContractAddress: filter by address of smart contract being calledtaker: filter by address of takertime: filter by time of the tradetradeAmountUsd: filter by trade amount in USDtradeIndex: filter by trade index in transactiontxHash: filter by transaction hash
The following fields are available for the dexTrades:
any:baseAmount: returns base amount of tradebaseCurrency: returns base currency of tradeblock: returns block where trade is includedbuyAmount: returns buy amount of tradebuyCurrency: returns buy currency of tradecount: returns trade count and other metrics of tradecountBigInt: returns count and other metrics asBigIntdate: returns date of the tradeenergyFee: returns energy fee for tradeenergyUsageTotal: returns total energy usage for the tradeexchange: returns exchange where trade happenedexpression: performs arithematic operation on fields in the query and returns value of the operationfee: returns fee for the tradeinternalTransactionCount: returns internal transaction count of tradeinternalTransactionCountBigInt: returns internal transaction count asBigIntlogsCount: returns logs countlogsCountBigInt: returns logs count asBigIntmaker: returns address info of trade maker sidemaximum: returns maximum for selected measurable field of Tron DEX tradesminimum: returns minimum for selected measurable field of Tron DEX tradesnetFee: returns net fee for the tradenetUsage: returns net usage for the tradeprice: returns price of the tradeprotocol: returns protocol name of the smart contractquoteAmount: returns quote amount of tradequotePrice: returns quote price of the tradesellAmount: returns sell amount of the tradesellCurrency: returns sell currency of the tradeside: returns side of the tradesmartContract: returns details of smart contract being calledtaker: returns taker side of tradetimeInterval: returns time intervaltradeAmount: returns trade amounttradeIndex: returns index of trade in the transactiontransaction: returns details of transaction