Tron DEX Trades API
In this section we will see how to get Tron DEX trades information using our API.
This Tron API is part of our Early Access Program (EAP), which is intended for evaluation purposes. This program allows you to test the data and its integration into your applications before full-scale implementation. Read more here
Subscribe to Latest Tron Trades
This subscription will return information about the most recent trades executed on Tron's DEX platforms. You can try the query here
subscription {
Tron {
DEXTrades {
Block {
Time
}
Trade {
Dex {
ProtocolName
ProtocolFamily
SmartContract
}
Buy {
Amount
Buyer
Seller
Currency {
Decimals
Fungible
HasURI
Name
ProtocolName
SmartContract
Symbol
}
OrderId
}
Sell {
Buyer
Seller
Currency {
Fungible
Decimals
Name
Native
SmartContract
Symbol
}
}
}
}
}
}
Get Top gainer tokens on Tron Network
This query fetches you the top gainer tokens on Tron network. You can try the query here.
{
Tron {
DEXTradeByTokens(
where: {Transaction: {Result: {Success: true}}}
orderBy: {descendingByField: "usd"}
limit: {count: 100}
) {
Trade {
Currency {
Symbol
Name
SmartContract
}
Side {
Currency {
Symbol
Name
SmartContract
}
}
price_last: PriceInUSD(maximum: Block_Number)
price_1h_ago: PriceInUSD(minimum: Block_Number)
}
dexes: uniq(of: Trade_Dex_OwnerAddress)
amount: sum(of: Trade_Side_Amount)
usd: sum(of: Trade_Side_AmountInUSD)
buyers: uniq(of: Trade_Buyer)
sellers: uniq(of: Trade_Seller)
count(selectWhere: {ge: "100"})
}
}
}
You can check the data here on DEXrabbit.
Get Top bought tokens on Tron Network
This query fetches you the top bought tokens on Tron network. You can try the query here.
{
Tron {
DEXTradeByTokens(
orderBy: {descendingByField: "buy"}
where: {Transaction: {Result: {Success: true}}}
limit: {count: 100}
) {
Trade {
Currency {
Symbol
Name
SmartContract
}
}
buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
Arranged in the descending order of bought - sold
on DEXrabbit.
You can check the data here on DEXrabbit.
Get Top sold tokens on Tron Network
This query fetches you the top sold tokens on Tron network. You can try the query here.
{
Tron {
DEXTradeByTokens(
orderBy: {descendingByField: "sell"}
where: {Transaction: {Result: {Success: true}}}
limit: {count: 100}
) {
Trade {
Currency {
Symbol
Name
SmartContract
}
}
buy: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: buy}}}})
sell: sum(of: Trade_Side_AmountInUSD, if: {Trade: {Side: {Type: {is: sell}}}})
}
}
}
Arranged in the descending order of sold - bought
on DEXrabbit.
You can check the data here on DEXrabbit.
Get OHLC data of a token on Tron Network
This query fetches you the OHLC data of a specific token on Tron network. You can try the query here.
query tradingViewPairs($token: String, $base: String) {
Tron {
DEXTradeByTokens(
orderBy: {ascendingByField: "Block_Time"}
where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}, Currency: {SmartContract: {is: $token}}, PriceAsymmetry: {lt: 0.1}}}
) {
Block {
Time(interval: {count: 5, in: minutes})
}
Trade {
open: PriceInUSD(minimum: Block_Number)
close: PriceInUSD(maximum: Block_Number)
max: PriceInUSD(maximum: Trade_PriceInUSD)
min: PriceInUSD(minimum: Trade_PriceInUSD)
}
volume: sum(of: Trade_Side_Amount)
}
}
}
{
"token": "TJ9mxWPmQSJswqMakEehFWcAntg73odiAq",
"base": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR"
}
You can check the data here on DEXrabbit.
Get Latest Trades of a token on Tron Network
This query fetches you the latest trades of a specific token on Tron network. You can try the query here.
query LatestTrades($token: String, $base: String) {
Tron {
DEXTradeByTokens(
orderBy: {descending: Block_Time}
limit: {count: 50}
where: {Trade: {Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}, Currency: {SmartContract: {is: $token}}, Price: {gt: 0}}, Transaction: {Result: {Success: true}}}
) {
Block {
allTime: Time
}
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
Currency {
Symbol
SmartContract
Name
}
Price
AmountInUSD
Amount
Side {
Type
Currency {
Symbol
SmartContract
Name
}
AmountInUSD
Amount
}
}
}
}
}
{
"token": "TJ9mxWPmQSJswqMakEehFWcAntg73odiAq",
"base": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR"
}
You can check the data here on DEXrabbit.
Get Top Traders of a token on Tron Network
This query fetches you the top traders of a specific token on Tron network. You can try the query here.
query TopTraders($token: String, $base: String) {
Tron {
DEXTradeByTokens(
orderBy: {descendingByField: "volumeUsd"}
limit: {count: 100}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Side: {Amount: {gt: "0"}, Currency: {SmartContract: {is: $base}}}}, Transaction: {Result: {Success: true}}}
) {
Trade {
Dex {
OwnerAddress
ProtocolFamily
ProtocolName
}
}
bought: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: buy}}}})
sold: sum(of: Trade_Amount, if: {Trade: {Side: {Type: {is: sell}}}})
volume: sum(of: Trade_Amount)
volumeUsd: sum(of: Trade_Side_AmountInUSD)
}
}
}
{
"token": "TJ9mxWPmQSJswqMakEehFWcAntg73odiAq",
"base": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR"
}
You can check the data here on DEXrabbit.
Get DEX markets for a specific Token
This query fetches you the DEXs where a specific token is being traded on Tron network. You can try the query here.
query ($token: String, $base: String, $time_10min_ago: DateTime, $time_1h_ago: DateTime, $time_3h_ago: DateTime) {
Tron {
DEXTradeByTokens(
orderBy: {descendingByField: "amount"}
where: {Trade: {Currency: {SmartContract: {is: $token}}, Side: {Amount: {gt: " "}, Currency: {SmartContract: {is: $base}}}}, Transaction: {Result: {Success: true}}, Block: {Time: {after: $time_3h_ago}}}
) {
Trade {
Dex {
ProtocolFamily
ProtocolName
}
price_last: PriceInUSD(maximum: Block_Number)
price_10min_ago: PriceInUSD(
maximum: Block_Number
if: {Block: {Time: {before: $time_10min_ago}}}
)
price_1h_ago: PriceInUSD(
maximum: Block_Number
if: {Block: {Time: {before: $time_1h_ago}}}
)
price_3h_ago: PriceInUSD(minimum: Block_Number)
}
amount: sum(of: Trade_Side_Amount)
pairs: uniq(of: Trade_Side_Currency_SmartContract)
trades: count
}
}
}
{
"token": "TSig7sWzEL2K83mkJMQtbyPpiVSbR6pZnb",
"base": "TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR",
"time_10min_ago": "2024-09-20T08:36:40Z",
"time_1h_ago": "2024-09-20T07:46:40Z",
"time_3h_ago": "2024-09-20T05:46:40Z"
}
You can check the data here on DEXrabbit.
Get All DEXs info on Tron network
This query fetches you all the DEXs information on Tron network such as unique sellers, unique buyers etc. You can try the query here.
query DexMarkets {
Tron {
DEXTradeByTokens {
Trade {
Dex {
ProtocolFamily
}
}
buyers: uniq(of: Trade_Buyer)
sellers: uniq(of: Trade_Sender)
count(if: {Trade: {Side: {Type: {is: buy}}}})
}
}
}
You can check the data here on DEXrabbit.
Get Top Traders on Tron network
This query fetches you TOp Traders information on Tron network. You can try the query here.
query DexMarkets {
Tron {
DEXTradeByTokens(orderBy: {descendingByField: "trades"}, limit: {count: 100}) {
Trade {
Dex {
OwnerAddress
}
}
trades: count(if: {Trade: {Side: {Type: {is: buy}}}})
tokens: uniq(of: Trade_Currency_SmartContract)
}
}
}
You can check the data here on DEXrabbit.
Subscribe to Latest Price of a Token in Real-time
This query provides real-time updates on price of token TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
in terms of USDT TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
, including details about the DEX. Try the query here
subscription MyQuery {
Tron {
DEXTradeByTokens(
where: {Trade: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}, TransactionStatus: {Success: true}}
) {
Block {
Time
}
Trade {
Amount
AmountInUSD
Buyer
Price
PriceInUSD
Seller
Currency {
Symbol
SmartContract
Name
}
Dex {
SmartContract
ProtocolName
ProtocolFamily
}
Side {
Amount
AmountInUSD
Buyer
Seller
Currency {
Name
Symbol
SmartContract
}
}
}
}
}
}