subscription_check

Streams DEX trades on Ethereum as they happen, where sell currency smart contract is 0xdAC1…1ec7, buy currency smart contract is 0xC02a…6Cc2 and buy currency smart contract is 0xdAC1…1ec7: block time, sell buyer, sell amount, sell currency symbol, buy price, buy amount, buy currency symbol and sell price.

By Omkar Acharekar · saved 17 April 2023 · Bitquery API v2

What it returns

Filters

The subscription

subscription subscribeTrading(
  $network: evm_network!
  $baseCurrency: String!
  $quoteCurrency: String!
) {
  EVM(network: $network) {
    buy: DEXTrades(
      where: {
        Trade: {
          Sell: { Currency: { SmartContract: { is: $baseCurrency } } }
          Buy: { Currency: { SmartContract: { is: $quoteCurrency } } }
        }
      }
    ) {
      Block {
        Time
      }
      Trade {
        Sell {
          Buyer
          Amount
          Currency {
            Symbol
          }
        }
        Buy {
          Price
          Amount
          Currency {
            Symbol
          }
        }
      }
    }
    sell: DEXTrades(
      where: {
        Trade: {
          Buy: { Currency: { SmartContract: { is: $baseCurrency } } }
          Sell: { Currency: { SmartContract: { is: $quoteCurrency } } }
        }
      }
    ) {
      Block {
        Time
      }
      Trade {
        Sell {
          Price
          Buyer
          Amount
          Currency {
            Symbol
          }
        }
        Buy {
          Amount
          Currency {
            Symbol
          }
        }
      }
    }
  }
}

Variables

{
  "network": "eth",
  "baseCurrency":"0xdAC17F958D2ee523a2206206994597C13D831ec7",
  "quoteCurrency":"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}

Similar queries