# Get Pools Created Between Time

Here we see how we can apply filter on number fields. We are searching for pools created within an hour. For that we check for <mark style="color:yellow;">poolOpenTime</mark> to between a start and end range using **\_*****gte*** (greater than equal t&#x6F;*) and **\_lte*** (less than equal to). Moreover, we sort them based on <mark style="color:yellow;">lpReserve</mark> field.

{% tabs %}
{% tab title="Code Snippet" %}

```typescript
import { gql, GraphQLClient } from "graphql-request";

const endpoint = `https://programs.shyft.to/v0/graphql/?api_key=YOUR-KEY`;

const graphQLClient = new GraphQLClient(endpoint, {
  method: `POST`,
  jsonSerializer: {
    parse: JSON.parse,
    stringify: JSON.stringify,
  },
});

function queryLpsBetween(start: number, end: number) {

  const query = gql`
    query MyQuery {
  Raydium_LiquidityPoolv4(
    where: {poolOpenTime: {_gte: ${start}}, _and: {poolOpenTime: {_lte: ${end}}}}
    order_by: {lpReserve: desc}
  ) {
    _updatedAt
    amountWaveRatio
    baseDecimal
    baseLotSize
    baseMint
    baseNeedTakePnl
    baseTotalPnl
    baseVault
    depth
    lpMint
    lpReserve
    lpVault
    marketId
    marketProgramId
    maxOrder
    maxPriceMultiplier
    minPriceMultiplier
    minSeparateDenominator
    minSeparateNumerator
    minSize
    nonce
    openOrders
    orderbookToInitTime
    owner
    pnlDenominator
    pnlNumerator
    poolOpenTime
    punishCoinAmount
    punishPcAmount
    quoteDecimal
    quoteLotSize
    quoteMint
    quoteNeedTakePnl
    quoteTotalPnl
    quoteVault
    resetFlag
    state
    status
    swapBase2QuoteFee
    swapBaseInAmount
    swapBaseOutAmount
    swapFeeDenominator
    swapFeeNumerator
    swapQuote2BaseFee
    swapQuoteInAmount
    swapQuoteOutAmount
    systemDecimalValue
    targetOrders
    tradeFeeDenominator
    tradeFeeNumerator
    volMaxCutRatio
    withdrawQueue
  }
}`;

  graphQLClient.request(query).then(console.log);
}

//Querying between an hour
queryLpsBetween(1708702200, 1708705800);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "data": {
    "Raydium_LiquidityPoolv4": [
      {
        "_updatedAt": "2024-02-23T16:31:44.221",
        "amountWaveRatio": 5000000,
        "baseDecimal": 9,
        "baseLotSize": 1000000000000,
        "baseMint": "BhvWrmAxDv4d3RshcBM9jg5HcKG5F6oMTyZp2TnHfPA2",
        "baseNeedTakePnl": 0,
        "baseTotalPnl": 0,
        "baseVault": "4cuwMEomF9U57gkvpwhwNNu9eGyJmZxgau6EdM41NEoN",
        "depth": 3,
        "lpMint": "2nm766H9xiRZXBipSh5XihNujtTauyV6M3iBMsAFYd2w",
        "lpReserve": 237170824512628,
        "lpVault": "11111111111111111111111111111111",
        "marketId": "5PSHUatzhAECAZcrnL6bAhsNBvqiotyvoz8EMeG5Y6H1",
        "marketProgramId": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX",
        "maxOrder": 7,
        "maxPriceMultiplier": 1000000000,
        "minPriceMultiplier": 1,
        "minSeparateDenominator": 10000,
        "minSeparateNumerator": 5,
        "minSize": 1000000000000,
        "nonce": 254,
        "openOrders": "C3PVqfK9MS2syZdNKLPgLjVRGAgyCmXjbkiMh23ST2ik",
        "orderbookToInitTime": 0,
        "owner": "GThUX1Atko4tqhN2NaiTazWSeFWMuiUvfFnyJyUghFMJ",
        "pnlDenominator": 100,
        "pnlNumerator": 12,
        "poolOpenTime": 1708705674,
        "punishCoinAmount": 0,
        "punishPcAmount": 0,
        "quoteDecimal": 9,
        "quoteLotSize": 1,
        "quoteMint": "So11111111111111111111111111111111111111112",
        "quoteNeedTakePnl": 0,
        "quoteTotalPnl": 0,
        "quoteVault": "J5AVUTNJPwZ6jjRZPXNxiov9st4JuXzjeQ7sWg1ehYPe",
        "resetFlag": 0,
        "state": 1,
        "status": 6,
        "swapBase2QuoteFee": 41691883,
        "swapBaseInAmount": 3477515652498138000,
        "swapBaseOutAmount": 5631497824252430000,
        "swapFeeDenominator": 10000,
        "swapFeeNumerator": 25,
        "swapQuote2BaseFee": 8693789131245359,
        "swapQuoteInAmount": 16676752627,
        "swapQuoteOutAmount": 11875480110,
        "systemDecimalValue": 1000000000,
        "targetOrders": "7tsJvz3DhnttoPmKc64BfHQSwJxRmsTCZUU1owcKoNyQ",
        "tradeFeeDenominator": 10000,
        "tradeFeeNumerator": 25,
        "volMaxCutRatio": 500,
        "withdrawQueue": "11111111111111111111111111111111"
      },
      
      <Array of more responses . . . >
    ]
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shyft.to/solana-indexers/case-studies/raydium/get-pools-created-between-time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
