Skip to main content

Stablecoin Trades API

The Stablecoin API by Bitquery provides you the comprehensive set of APIs which can provide you realtime transfers, realtime trades, realtime price, holder distribution of stablecoins across chains with a single API call.

We are going to particularly deep-dive into how to get Stablecoin Trades data in this section.

Ethereum

Stablecoin trades for Ethereum

Below stream will give you realtime USDT DEX trades on Ethereum. Test the stream here.

subscription {
EVM {
DEXTrades(
where: {any: [{Trade: {Buy: {Currency: {SmartContract: {is: "0xdAC17F958D2ee523a2206206994597C13D831ec7"}}}}}, {Trade: {Sell: {Currency: {SmartContract: {is: "0xdAC17F958D2ee523a2206206994597C13D831ec7"}}}}}]}
) {
Block {
Time
}
Transaction {
Hash
Index
}
Trade {
Index
Dex {
SmartContract
ProtocolFamily
ProtocolName
}
Buy {
Amount
Buyer
Seller
Currency {
Decimals
Fungible
Symbol
SmartContract
Name
}
Price
PriceInUSD
}
Sell {
Buyer
Seller
Currency {
Decimals
Fungible
Symbol
SmartContract
Name
}
Price
PriceInUSD
}
}
}
}
}

Stablecoin Depeg tracking Stream for EVM

Below stream tracks USDT on Ethereum when PriceInUSD is outside 0.95–1.05 (depeg-style band). Test the query here.

subscription {
EVM {
DEXTradeByTokens(
where: {Trade: {Currency: {SmartContract: {is: "0xdAC17F958D2ee523a2206206994597C13D831ec7"}}, PriceInUSD: {lt:0.95 gt: 1.05}}}
) {
Transaction {
Hash
}
Trade {
AmountInUSD
Amount
Buyer
Seller
Currency {
SmartContract
Name
}
Dex {
SmartContract
ProtocolName
}
Price
PriceInUSD
Side {
Buyer
Seller
AmountInUSD
Amount
Currency {
Name
SmartContract
}
}
}
}
}
}

Solana

Stablecoin trades

Below stream will give you realtime trades of USDT on Solana. Test the stream here.

subscription {
Solana {
DEXTrades (where:{any:[{Trade:{Buy:{Currency:{MintAddress:{is:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"}}}}},{Trade:{Sell:{Currency:{MintAddress:{is:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"}}}}}]}){
Block{
Time
Slot
}
Transaction{
Signature
Index
Result{
Success
}
}
Trade {
Index
Dex {
ProgramAddress
ProtocolFamily
ProtocolName
}
Buy {
Amount
Account {
Address
}
Currency {
MetadataAddress
Key
MintAddress
IsMutable
EditionNonce
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Price
PriceInUSD
Order {
LimitPrice
LimitAmount
OrderId
}

}
Market {
MarketAddress
}
Sell {
Account {
Address
}
Currency {
IsMutable
Decimals
CollectionAddress
Fungible
Symbol
Native
Name
}
Price
PriceInUSD
}
}
}
}
}

Real Time Stablecoin portfolio

Below stream will provide you the realtime portfolio updates for a particular address for a specific Stablecoin. In this query example, we are tracking portfolio updates for the address 3i51cKbLbaKAqvRJdCUaq9hsnvf9kqCfMujNgFj7nRKt and for stablecoin USDC. Test the query here.

subscription MyQuery {
Solana {
DEXTradeByTokens(
where: {Transaction: {Result: {Success: true}}, Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}}, any: [{Trade: {Account: {Address: {is: "3i51cKbLbaKAqvRJdCUaq9hsnvf9kqCfMujNgFj7nRKt"}}}}, {Trade: {Account: {Owner: {is: "3i51cKbLbaKAqvRJdCUaq9hsnvf9kqCfMujNgFj7nRKt"}}}}, {Transaction:{Signer:{is: "3i51cKbLbaKAqvRJdCUaq9hsnvf9kqCfMujNgFj7nRKt"}}}]}
) {
Block {
Time
}
Trade {
Account {
Address
Token {
Owner
}
}
Amount
AmountInUSD
Currency {
Name
MintAddress
Symbol
}
Dex {
ProtocolName
ProtocolFamily
ProgramAddress
}
Price
PriceInUSD
Side {
Account {
Address
Token {
Owner
}
}
}
}
Transaction {
Signature
Signer
}
}
}
}

Stablecoin Depeg tracking Stream

Below stream will be able to track specific Stablecoin depeg. In this query example, we are tracking depeg for the stablecoin EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v which has a symbol USDC. Test the query here.

subscription {
Solana {
DEXTradeByTokens(
where: {Trade: {Currency: {MintAddress: {is: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}}, PriceInUSD: {lt:0.95 gt: 1.05}}}
) {
Transaction {
Signature
}
Trade {
AmountInUSD
Amount
Currency {
MintAddress
Name
}
Dex {
ProgramAddress
ProtocolName
}
Price
PriceInUSD
Side {
Account {
Address
}
AmountInUSD
Amount
Currency {
Name
MintAddress
}
}
}
}
}
}

Tron

Stablecoin trades for Tron

Below stream will give you realtime USDT DEX trades on Tron. Test the stream here.

subscription {
Tron {
DEXTrades(
where: {any: [{Trade: {Buy: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}}}, {Trade: {Sell: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}}}}]}
) {
Block {
Time
}
Transaction {
Hash
Index
}
Trade {
Index
Dex {
SmartContract
ProtocolFamily
ProtocolName
}
Buy {
Amount
Buyer
Seller
Currency {
Decimals
Fungible
Symbol
SmartContract
Name
}
Price
PriceInUSD
}
Sell {
Buyer
Seller
Currency {
Decimals
Fungible
Symbol
SmartContract
Name
}
Price
PriceInUSD
}
}
}
}
}

Stablecoin Depeg tracking Stream for Tron

Below stream tracks USDT on Tron when PriceInUSD is outside 0.95–1.05 (depeg-style band). Test the query here.

subscription {
Tron {
DEXTradeByTokens(
where: {Trade: {Currency: {SmartContract: {is: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"}}, PriceInUSD: {lt:0.95 gt: 1.05}}}
) {
Transaction {
Hash
}
Trade {
AmountInUSD
Amount
Buyer
Seller
Currency {
SmartContract
Name
}
Dex {
SmartContract
ProtocolName
}
Price
PriceInUSD
Side {
Buyer
Seller
AmountInUSD
Amount
Currency {
Name
SmartContract
}
}
}
}
}
}