SniperTotal number of swaps
Updated 2023-05-20
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
›
⌄
with
prices as (
select
RECORDED_HOUR::date as date,
id,
token,
avg(close) as avg_price
from
flow.core.fact_hourly_prices
where
RECORDED_HOUR::date >= CURRENT_DATE - {{Last_days}}
group by 1,2,3
),
swap_from as (
SELECT
block_timestamp::date as date,
POOL_ID,
tx_id as tx_in,
TRADER as user_in,
TOKEN as token_in,
TOKEN_in_AMOUNT as amount_in,
TOKEN_in_AMOUNT * avg_price as volume_in
from
flow.core.ez_swaps a
join flow.core.dim_swap_pool_labels b on a.SWAP_CONTRACT = b.SWAP_CONTRACT
join prices on date = block_timestamp::date
and id = TOKEN_in_CONTRACT
where
BLOCK_TIMESTAMP::date >= current_date - {{Last_days}}
),
swap_to as (
SELECT
block_timestamp::date as date2,
POOL_ID as pool2,
tx_id as tx_out,
TRADER as user_out,
Run a query to Download Data