ATH token (2nd highest buy/ MEV out)

This query will return the top two buy prices. From there, you can select the 2nd highest one programmatically. This approach should help you get a more accurate representation of the ATH that excludes MEV bot manipulation. Reasoning: MEV bots, especially in sandwich attacks, manipulate the price by placing a buy order just before a legitimate user’s trade and a sell order right after, inflating the price temporarily. Here's how the idea works: - Highest Sell Price: This would typically be the point at which the MEV bot sells after sandwiching the victim’s transaction, effectively realizing its profit. - Highest Buy Price: This is likely to include the victim’s trade that was sandwiched, which would reflect an inflated value because the MEV bot's first buy artificially drove up the price. Why the 2nd Highest Buy Price is Better: The 2nd highest buy price could represent the last "natural" trade before the sandwich attack, or at least the closest non-manipulated price. This would give a more reliable indication of the token's highest price without the artificial inflation from the MEV bot’s buy order. By focusing on the 2nd highest buy price: - You’re more likely to avoid the artificially high value caused by the MEV bot. - This price is likely closer to the fair market value, making it a more accurate indicator of the true all-time high (ATH).

By Basic · saved 18 October 2024 · run 33 times · Bitquery API v2

What it returns

Filters

The query

{
  EVM(dataset: combined, network: eth) {
    DEXTrades(
      limit: {count: 2}
      orderBy: {descending: Trade_Buy_Price}
      where: {Trade: {Dex: {SmartContract: {is: "0x7EB6D3466600b4857eb60a19e0d2115e65aa815e"}}, Buy: {Currency: {SmartContract: {is: "0x240Cd7b53d364a208eD41f8cEd4965D11F571B7a"}}}, Sell: {Currency: {SmartContract: {is: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"}}}}}
    ) {
      Transaction {
        Hash
      }
      Trade {
        Buy {
          Price
          PriceInUSD
          Currency {
            Name
            Symbol
            SmartContract
          }
        }
      }
    }
  }
}

Similar queries