getTokenLiquidity

Returns the latest balance update on Ethereum, where balance update address is 0x0d4a…1852, currency smart contract is 0xc02a…6cc2 or 0xdac1…1ec7 and buy currency smart contract is 0xc02a…6cc2: currency name, smart contract, sum of balance update amount, balance update address, buy currency symbol, buy price in USD, buy price and 3 more fields.

By Jose · saved 7 October 2024 · run 9 times · Bitquery API v2

What it returns

Filters

The query

query getTokenLiquidity($dataset: dataset_arg_enum!, $network: evm_network!, $tokenAddress: String!, $sideTokenAddress: String!, $pairAddress: String!) {
  EVM(dataset: $dataset, network: $network) {
    Current_lquidity: BalanceUpdates(
      where: {BalanceUpdate: {Address: {is: $pairAddress}}, Currency: {SmartContract: {in: [$tokenAddress, $sideTokenAddress]}}}
      orderBy: {descendingByField: "balance"}
    ) {
      Currency {
        Name
        SmartContract
      }
      balance: sum(of: BalanceUpdate_Amount, selectWhere: {gt: "0.00"})
      BalanceUpdate {
        Address
      }
    }
    token_price: DEXTrades(
      limit: {count: 1}
      orderBy: {descending: Block_Time}
      where: {Trade: {Buy: {Currency: {SmartContract: {is: $tokenAddress}}}, Sell: {Currency: {SmartContract: {is: $sideTokenAddress}}}, Dex: {Pair: {SmartContract: {is: $pairAddress}}}}, TransactionStatus: {Success: true}}
    ) {
      Trade {
        Buy {
          Currency {
            Symbol
          }
          PriceInUSD
          Price
        }
        Sell {
          Currency {
            Symbol
          }
          PriceInUSD
          Price
        }
      }
    }
  }
}

Variables

{
  "dataset": "combined",
  "network": "eth",
  "pairAddress": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
  "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "sideTokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}

Similar queries