# Getting Last, 24h, 7d dextrade prices in one query?

**URL:** <https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135>\
**Category:** GraphQL API\
**Tags:** closed\
**Created:** [June 9, 2021, 12:32pm UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135 "2021-06-09T12:32:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vitamingum](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@vitamingum](https://community.bitquery.io/u/vitamingum)\
**Post date:** [June 9, 2021, 12:32pm UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135/1 "2021-06-09T12:32:12Z")

</div>

looking to get Last, 24h, 7d, prices for a contract in a single query. I’d love to not request a full week’s worth of trades to get it. I can see how to get Last and 7d in a single query (minimum, maximum) but the 24h one is tripping me up

is it possible?

here is what I have so far:

```auto
{
  ethereum(network: ethereum)
  {
        dexTrades(
          options: { desc: ["trades"], limit: 2, limitBy: { each: "sellCurrency.address", limit: 1 }, 
            offset: 0 },
            date: { since: "2021-06-01" till: "2021-06-08" }
                        sellCurrency: { in: ["0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"] }
                        buyCurrency: { in: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"] })
    {

          trades: count

          exchange {
              fullName
          }

          sellCurrency {
              address
              symbol
          }

          buyCurrency {
              address
              symbol
          }

          ago7d_price: minimum(of: time, get: price)
          close_price: maximum(of: time, get: price)
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [June 9, 2021, 4:11pm UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135/2 "2021-06-09T16:11:41Z")

</div>

Use Time Filter

```auto
{
  ethereum(network: ethereum) {
    dexTrades(
      options: {desc: ["trades"], limit: 2, limitBy: {each: "sellCurrency.address", limit: 1}, offset: 0}
      time: {since: "2021-06-01T00:00:00", till: "2021-06-02T00:00:00"}
      sellCurrency: {in: ["0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"]}
      buyCurrency: {in: ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"]}
    ) {
      trades: count
      exchange {
        fullName
      }
      sellCurrency {
        address
        symbol
      }
      buyCurrency {
        address
        symbol
      }
      ago7d_price: minimum(of: time, get: price)
      close_price: maximum(of: time, get: price)
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![vitamingum](https://avatars.discourse-cdn.com/v4/letter/v/2acd7d/32.png) [@vitamingum](https://community.bitquery.io/u/vitamingum)\
**Post date:** [June 11, 2021, 3:02pm UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135/3 "2021-06-11T15:02:36Z")

</div>

this isn’t quite what i’m going after.

Imagine I need N different prices in a single query, but don’t want to return a huge set of results. For example 30d price, 7d price, 24h price, last price.

minimum and maximum can get me two of the above for a given date range, but how do I get values in between?

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [June 13, 2021, 6:06am UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135/4 "2021-06-13T06:06:46Z")

</div>

As I understand if you asking for a query that returns the price for the last 30d, 7d, 24h, and last trade price in one API call… I don’t think is possible.

Also what you mean by price in between… can you explain to me using an example.

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [July 5, 2022, 5:08am UTC](https://community.bitquery.io/t/getting-last-24h-7d-dextrade-prices-in-one-query/135/5 "2022-07-05T05:08:47Z")

</div>

Please also check this

> [@Volumn and count per hour, minute or days or week](https://community.bitquery.io/t/volumn-and-count-per-hour-minute-or-days-or-week/974):
>
> I am showing how to use time interval to get metrics based on second, mint, hourly, weekly or monthly. { ethereum(network: bsc) { dexTrades( date: {since: "2022-04-06"} exchangeAddress: {is: "0xca143ce32fe78f1f7019d7d551a6402fc5350c73"} baseCurrency: {is: "0xe9e7cea3dedca5984780bafc599bd69add087d56"} quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"} ) { count tradeAmount(in: USD) timeInterval{ hour (count: 4) } …
