MajorM111dex_swap_raw
Updated 2024-02-29
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- WHERE block_timestamp >= '2023-01-01 00:00:00' AND block_timestamp <= '2023-01-31 23:59:59'
-- WHERE BLOCK_NUMBER >= '' AND BLOCK_NUMBER <= ''
-- contract_address IN (
-- LOWER('0x41aB86EEcBd110a82cA602D032a461f453066F1E'),
-- LOWER('0x33d8ba869b17068c36143d176c14e773c37c642c'),
-- LOWER('0xf419fd326e733b191b7f604f8126f3c67792720b')
-- )
WITH filtered_swaps AS (
SELECT
contract_address,
token_in,
token_out,
amount_in,
amount_out,
origin_from_address,
block_timestamp,
MIN(block_timestamp) OVER(PARTITION BY contract_address, token_in, token_out) AS first_minute_start
FROM
avalanche.defi.ez_dex_swaps
--WHERE block_timestamp >= '2022-12-01 00:00:00'
where contract_address IN (LOWER('0x33d8ba869b17068c36143d176c14e773c37c642c'), LOWER('0x41aB86EEcBd110a82cA602D032a461f453066F1E'))
order by first_minute_start ASC
--AND block_timestamp <= '2023-01-31 23:59:59'
),
aggregated_volume AS (
SELECT
contract_address,
token_in,
token_out,
first_minute_start,
SUM(CASE
QueryRunArchived: QueryRun has been archived