# Transaction and Pool Analysis

### /gethistoricaltimeseries&#x20;

## Retrieves the transactionHash, timestamp and the price of the token pair with regard to the first token.User can provide the startBlock and endBlock and fetch the data according to the same.

<mark style="color:blue;">`GET`</mark> `https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries`

#### Query Parameters

| Name                                          | Type   | Description                                                                                                                                           |
| --------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>       | String | <p>Refer to <a href="/pages/8x8qwIu19Aq8uFsjOXvI">DEX ID</a> page for details.<br>Supported Dexs: Uniswap v2, Sushiswap, Pancakeswap, Uniswap v3.</p> |
| endBlock                                      | String | Last block of the range.                                                                                                                              |
| startBlock                                    | String | Starting block of the range.                                                                                                                          |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose time series is to be fetched.                                                                                                      |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "string",
        "priceData": [
            {
                "hash": "string",
                "timestamp": "integer",
                "price": "number"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicaltrade.api.expand.network/dex/gethistoricaltimeseries?poolAddress=0x517f9dd285e75b599234f7221227339478d0fcc8&dexId=1000
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "DAI/MKR",
        "priceData": [
            {
                "hash": "0x0700027e70d6d216810815c38a0959fe0635867ea2480ab1f6e20d3c98731ff0",
                "timestamp": 1703748059,
                "price": "0.0006244081987727642"
            },
            {
                "hash": "0x1c3b182bb64097b756b03aaa3717663af8064ecf3e05f02f7b6e339785558f1f",
                "timestamp": 1703747891,
                "price": "0.0006261003865058129"
            },
            {
                "hash": "0xec8964514a2cb94d565c84794cf7125333f2a18e376764fc24c5fd32df09a93e",
                "timestamp": 1703747855,
                "price": "0.0006274642197158615"
            },
            {
                "hash": "0x4ece3e41b95e78c882ce79ec2fa80bd7eef0503a6d7b759bc3336cc9fc40867b",
                "timestamp": 1703747843,
                "price": "0.00062797052848499"
            },
            {
                "hash": "0xf4e8eb0cc1661d952dc0e2d5d5ee2b16dd66b5f8a275fd3d148dd9ce53ed7964",
                "timestamp": 1703746955,
                "price": "0.0006318073557952554"
            },
            {
                "hash": "0xcae75ad1f4b23672972cc793b8dfa97e5c257f368ed3b6d72afb1bcb92444ea5",
                "timestamp": 1703746403,
                "price": "0.0006311921656383271"
            },
            {
                "hash": "0xbf1eef520c783cd699c1b040b8c1274c90ff4cc76b24994fb95123e3a9b360d5",
                "timestamp": 1703746355,
                "price": "0.0006303980131723315"
            },
            {
                "hash": "0xddf411be6d49bcddcc306cae01f4a3d7bbee240a295ba18e1a762e3a3290f302",
                "timestamp": 1703746319,
                "price": "0.000629607991380723"
            },
            {
                "hash": "0x31e8736e4e7eb1f862bfc4a66414859bb49102390bb97736facf4613035a81e5",
                "timestamp": 1703745695,
                "price": "0.0006261412353574351"
            },
            {
                "hash": "0x6dea226fba19c1da6e96feb49511e1fef3a27cbded505e3d597bb9e5f5121e9e",
                "timestamp": 1703745083,
                "price": "0.0006301614630221084"
            },
            {
                "hash": "0xc1ae0d5cb6774c9b76c3f005eb136b9fb5951c0d32f1027806d755ff45760b0d",
                "timestamp": 1703744891,
                "price": "0.000629113433416803"
            },
            {
                "hash": "0x20937932802b6eb955192a589c7e0143127554fa60f05a429dc25f5cc6342f5e",
                "timestamp": 1703743655,
                "price": "0.0006273380063042033"
            },
            {
                "hash": "0xaf2d9bfae18358fb785d4a7ae8b35099c63777c557e92db96c98bc0b41531071",
                "timestamp": 1703743631,
                "price": "0.0006255421068541817"
            },
            {
                "hash": "0x161d09fdd5e30165040ebd65832b35337fd608d47e119a139f608b2045410409",
                "timestamp": 1703742575,
                "price": "0.0006215430273569083"
            },
            {
                "hash": "0xc264388fba6edb499d5846a456217a4ddf0668d156356c8695ab34c6be55ce23",
                "timestamp": 1703742515,
                "price": "0.0006222533452384632"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### /gethistoricaltransactions

## Retrieves the transaction details of the Add Liquidity Events that have happened for the poolAddress.User can provide the startBlock and endBlock and fetch the data according to the same.

<mark style="color:blue;">`GET`</mark> `https://historicaltrade.api.expand.network/dex/gethistoricaltransactions`

#### Query Parameters

| Name                                          | Type   | Description                                                                                                                                           |
| --------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>       | String | <p>Refer to <a href="/pages/8x8qwIu19Aq8uFsjOXvI">DEX ID</a> page for details.<br>Supported Dexs: Uniswap v2, Sushiswap, Pancakeswap, Uniswap v3.</p> |
| endBlock                                      | String | Last block of the range.                                                                                                                              |
| startBlock                                    | String | Starting block of the range.                                                                                                                          |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose transactions is to be fetched.                                                                                                     |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "string",
        "transactions": [
            {
                "transactionHash": "string",
                "transactionDetails": {
                    "blockHash": "string",
                    "blockNumber": "string",
                    "from": "string",
                    "gas": "string",
                    "gasPrice": "string",
                    "maxFeePerGas": "string",
                    "maxPriorityFeePerGas": "string",
                    "hash":"string",
                    "input": "string",
                    "nonce": "string",
                    "to": "string",
                    "transactionIndex": "string",
                    "value": "string",
                    "type": "string",
                    "accessList": [],
                    "chainId": "string",
                    "v": "string",
                    "r": "string",
                    "s": "string",
                    "yParity": "string"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicaltrade.api.expand.network/dex/gethistoricaltransactions?poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&dexId=1000
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "USDC/WETH",
        "transactions": [
            {
                "transactionHash": "0xe02a5ced07a09949bb143486c5d57947d0b904d7ffa620637e2b11a4810ff645",
                "transactionDetails": {
                    "blockHash": "0xa870d68aa85ea355176dd1f49912cb0df145a967a8a6789a2e9a9ca659aabfc5",
                    "blockNumber": "18879055",
                    "from": "0xcc4ea98876f3ee733712ac64137c34e637fc2dae",
                    "gas": "203074",
                    "gasPrice": "30150130093",
                    "maxFeePerGas": "41820000000",
                    "maxPriorityFeePerGas": "110000000",
                    "hash": "0xe02a5ced07a09949bb143486c5d57947d0b904d7ffa620637e2b11a4810ff645",
                    "input": "0xf305d719000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000000000000000000000000000000000e210966f48000000000000000000000000000000000000000000000000000000e0ef3985c30000000000000000000000000000000000000000000000164f0244c4ce3dffe6000000000000000000000000cc4ea98876f3ee733712ac64137c34e637fc2dae00000000000000000000000000000000000000000000000000000000658c7c4b",
                    "nonce": "212",
                    "to": "0x7a250d5630b4cf539739df2c5dacb4c659f2488d",
                    "transactionIndex": "88",
                    "value": "413589505640828440000",
                    "type": "2",
                    "accessList": [],
                    "chainId": "1",
                    "v": "0x0",
                    "r": "0xc01569d522e3ed0c193fbc1e6cf689d61ab1affdcdba0eab79fa09afe441415f",
                    "s": "0x4fe253f33af8c7efa878194c1d074b4b4ff662016eb47a7dd0d1948f30b45e73",
                    "yParity": "0x0"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

### /getpoolchartdata

## Retrieves the open, close, high and low price for the range of the blockNumbers along with the transaction details if any happened within the specified blockRange which includes blockNumber ,price and the amount of the first and second token for the 30 interval range for the given interval.

<mark style="color:blue;">`GET`</mark> `https://historicaltrade.api.expand.network/dex/getpoolchartdata`

#### Query Parameters

| Name                                          | Type   | Description                                                                                                                              |
| --------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>       | String | <p>Refer to <a href="/pages/8x8qwIu19Aq8uFsjOXvI">DEX ID</a> page for details.<br>Supported Dexs: Uniswap v2, Sushiswap, Uniswap v3.</p> |
| interval                                      | String | 15 mins(by default), 30 mins, 60 mins, and 90 mins.                                                                                      |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose transactions is to be fetched.                                                                                        |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "string",
        "chartData": {
            "blockRange": [
                {
                    "open_price": "string",
                    "close_price": "string",
                    "low_price": "string",
                    "high_price": "string",
                    "transactions": []
                }
            ]
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicaltrade.api.expand.network/dex/getpoolchartdata?dexId=1000&poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&interval=60
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "USDC/WETH",
        "chartData": {
            "18882523 to 18882800": [
                {
                    "open_price": "419005433942909",
                    "close_price": "419447697581705",
                    "low_price": "418943818861548",
                    "high_price": "422263827518504",
                    "transactions": [
                        {
                            "blockNumber": "18882529",
                            "price": "418986597113367",
                            "amount": {
                                "token0": "2400000000",
                                "token1": "1005567833072081114"
                            }
                        },
                        {
                            "blockNumber": "18882531",
                            "price": "421498241454276",
                            "amount": {
                                "token0": "679221347",
                                "token1": "286290603318704585"
                            }
                        },
                        {
                            "blockNumber": "18882538",
                            "price": "418975454284176",
                            "amount": {
                                "token0": "376508407",
                                "token1": "157747780864636534"
                            }
                        },
                        {
                            "blockNumber": "18882543",
                            "price": "418968454985399",
                            "amount": {
                                "token0": "513835000",
                                "token1": "215280656067422305"
                            }
                        },
                        {
                            "blockNumber": "18882543",
                            "price": "418963677671102",
                            "amount": {
                                "token0": "93100000",
                                "token1": "39005518391179607"
                            }
                        },
                        {
                            "blockNumber": "18882548",
                            "price": "418960589212921",
                            "amount": {
                                "token0": "300000000",
                                "token1": "125688176763876449"
                            }
                        },
                        {
                            "blockNumber": "18882560",
                            "price": "418954948262823",
                            "amount": {
                                "token0": "417601922",
                                "token1": "174956391625965577"
                            }
                        },
                        {
                            "blockNumber": "18882561",
                            "price": "418947749154645",
                            "amount": {
                                "token0": "498134300",
                                "token1": "208692243761724622"
                            }
                        },
                        {
                            "blockNumber": "18882565",
                            "price": "421805099375960",
                            "amount": {
                                "token0": "42147657986",
                                "token1": "17778097065248708608"
                            }
                        }
                    ]
                }
            ]
        }
    }
}
```

{% endtab %}
{% endtabs %}

### /getpooltradedata

## Retrieves the blockNumber,transactionHash, the values and the data for the given poolAddress and an event Type.User can provide the startBlock and endBlock along with the eventType and fetch the data according to the same.

<mark style="color:blue;">`GET`</mark> `https://historicaltrade.api.expand.network/dex/getpooltradedata`

#### Query Parameters

| Name                                          | Type   | Description                                                                                                                              |
| --------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| dexId<mark style="color:red;">\*</mark>       | String | <p>Refer to <a href="/pages/8x8qwIu19Aq8uFsjOXvI">DEX ID</a> page for details.<br>Supported Dexs: Uniswap v2, Sushiswap, Uniswap v3.</p> |
| endBlock                                      | String | Last block of the range.                                                                                                                 |
| startBlock                                    | String | Starting block of the range.                                                                                                             |
| poolAddress<mark style="color:red;">\*</mark> | String | Pool address whose data is to be fetched.                                                                                                |
| eventType                                     | String | Transfer, Swap, Burn or Mint(by default).                                                                                                |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "string",
        "transactions": [
            {
                "blockNumber": "string",
                "transactionHash": "string",
                "values": {
                    "0": "string",
                    "1": "string",
                    "2": "string",
                    "3": "string",
                    "sender": "string",
                    "amount0": "string",
                    "amount1": "string",
                    "to": "string"
                },
                "eventType": "string",
                "data": {
                    "data": "string",
                    "topics": "array"
                }
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Sample Request" %}

```url
https://historicaltrade.api.expand.network/dex/getpooltradedata?poolAddress=0xb4e16d0168e52d35cacd2c6185b44281ec28c9dc&dexId=1000&eventType=Burn
```

{% endtab %}

{% tab title="Sample Response" %}

```json
{
    "status": 200,
    "msg": "success",
    "data": {
        "pair": "USDC/WETH",
        "transactions": [
            {
                "blockNumber": "18880403",
                "transactionHash": "0x47d3993957a8497a7549276c96b3c18987586075f5882124cfd477fd989cd3fd",
                "values": {
                    "0": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "1": "1596637993",
                    "2": "671389840781055738",
                    "3": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "sender": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "amount0": "1596637993",
                    "amount1": "671389840781055738",
                    "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
                },
                "eventType": "Burn",
                "data": {
                    "data": "0x000000000000000000000000000000000000000000000000000000005f2ac32900000000000000000000000000000000000000000000000009514180c58f96fa",
                    "topics": [
                        "0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496",
                        "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d",
                        "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d"
                    ]
                }
            },
            {
                "blockNumber": "18879029",
                "transactionHash": "0x22c9fcffc57264eb4270f2ecf0d4f23b39a3871adcee89414285f3a1e1f152e2",
                "values": {
                    "0": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "1": "970041191908",
                    "2": "413293955455183879313",
                    "3": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "sender": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D",
                    "amount0": "970041191908",
                    "amount1": "413293955455183879313",
                    "to": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
                },
                "eventType": "Burn",
                "data": {
                    "data": "0x000000000000000000000000000000000000000000000000000000e1daf5ede4000000000000000000000000000000000000000000000016679b16c2e259fc91",
                    "topics": [
                        "0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496",
                        "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d",
                        "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d"
                    ]
                }
            }
        ]
    }
}
```

{% 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.expand.network/use-cases/transaction-and-pool-analysis.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.
