profit&loss

Returns the latest DEX trades on Ethereum, where buy currency smart contract is 0xd412…4e39, transaction from is 0x0b1d…9bc7 and sell currency smart contract is 0xd412…4e39: block time, sender fee, buy amount, buy currency symbol, buy smart contract, buy price, sell amount and 5 more fields.

By junglerider · saved 22 February 2024 · run 1 time · Bitquery API v2

What it returns

Filters

The query

query MyQuery($token: String!, $account: String!, $network: evm_network!, $since: DateTime!, $till: DateTime!) {
  EVM(dataset: combined, network: $network) {
    sellside: DEXTrades(
      where: {Trade: {Buy: {Currency: {SmartContract: {is: $token}}}}, Block: {Time: {since: $since, till: $till}}, Transaction: {From: {is: $account}}}
      orderBy: {descending: Block_Time}
    ) {
      Block {
        Time
      }
      Fee {
        SenderFee
      }
      Trade {
        Buy {
          Amount
          Currency {
            Symbol
            SmartContract
          }
          Price
        }
        Sell {
          Amount
          Currency {
            Symbol
            SmartContract
          }
          Price
        }
      }
      Transaction {
        Hash
        From
      }
    }
    buyside: DEXTrades(
      where: {Trade: {Sell: {Currency: {SmartContract: {is: $token}}}}, Block: {Time: {since: $since, till: $till}}, Transaction: {From: {is: $account}}}
      orderBy: {descending: Block_Time}
    ) {
      Block {
        Time
      }
      Fee {
        SenderFee
      }
      Trade {
        Buy {
          Amount
          Currency {
            Symbol
            SmartContract
          }
          Price
        }
        Sell {
          Amount
          Currency {
            Symbol
            SmartContract
          }
          Price
        }
      }
      Transaction {
        Hash
        From
      }
    }
  }
}

Variables

{
  "token": "0xd4126f195a8de772eeffa61a4ab6dd43462f4e39",
  "account": "0x0b1dd81b07b2b446973a8f6f2294653eb82d9bc7",
  "network": "eth",
  "since": "2024-01-01T00:00:00Z",
  "till": "2024-02-23T00:00:00Z"
}

Similar queries