Arbitrum Liquidity API
In this section we will see how to get Arbitrum DEX pool liquidity information using Bitquery API. The liquidity API helps you monitor real-time liquidity changes, track pool reserves, and analyze liquidity depth for token pairs on Arbitrum DEX pools.
Understanding Liquidity and Pool Reserves
Liquidity in DEX pools refers to the amount of tokens available for trading. Pool reserves (the balance of each token in the pool) determine the pool's ability to handle trades without significant price impact. Monitoring liquidity changes helps you:
- Track when liquidity is added or removed from pools
- Monitor pool health and depth
- Identify liquidity events that may affect trading
- Analyze liquidity patterns across different pools
The DEXPoolEvents API provides real-time information about:
- Current liquidity reserves for both tokens in the pool
- Spot prices for both swap directions
- Pool and token pair information
- Transaction details for liquidity-changing events
For a comprehensive explanation of how DEX pools work, liquidity calculations, and when pool events are emitted, refer to the DEXPools Cube documentation.
Realtime Liquidity Stream
This subscription query returns real-time liquidity data for all DEX pools on Arbitrum. You can monitor liquidity changes, pool reserves, and spot prices as trades and liquidity modifications occur across all pools.
You can find the query here
subscription MyQuery {
EVM(network: arbitrum) {
DEXPoolEvents {
Block {
Time
Number
}
PoolEvent {
AtoBPrice
BtoAPrice
Dex {
SmartContract
ProtocolName
}
Liquidity {
AmountCurrencyA
AmountCurrencyB
}
Pool {
CurrencyA {
Name
SmartContract
Symbol
}
CurrencyB {
Name
SmartContract
Symbol
}
PoolId
SmartContract
}
}
Transaction {
Gas
Hash
}
}
}
}
Latest Liquidity Changes of a Specific Pool
This query retrieves the latest liquidity events for a specific DEX pool on Arbitrum. Use this to check current pool reserves, spot prices, and recent liquidity changes for a particular token pair.
You can find the query here
query MyQuery {
EVM(network: arbitrum) {
DEXPoolEvents(
limit: { count: 10 }
orderBy: { descending: Block_Time }
where: {
PoolEvent: {
Pool: {
SmartContract: { is: "0xff74c74359016e5e0deb882d6537c8271e3d1026" }
}
}
}
) {
Block {
Time
Number
}
PoolEvent {
AtoBPrice
BtoAPrice
Dex {
SmartContract
ProtocolName
}
Liquidity {
AmountCurrencyA
AmountCurrencyB
}
Pool {
CurrencyA {
Name
SmartContract
Symbol
}
CurrencyB {
Name
SmartContract
Symbol
}
PoolId
SmartContract
}
}
Transaction {
Gas
Hash
}
}
}
}
Note: Replace
"0xff74c74359016e5e0deb882d6537c8271e3d1026"with your target pool address. This query can be converted to a subscription to monitor in real-time. Simply replacequerywithsubscriptionto receive live updates whenever the pool's liquidity changes.