maybeyonasthor_swap_bot_type
Updated 2022-05-17
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
swap_data as (
select
from_address as user,
tx_id,
block_timestamp,
pool_name
from thorchain.swaps
union all
select
native_to_address as user,
tx_id,
block_timestamp,
pool_name
from thorchain.swaps
),
swap_range as (
select
user,
count(distinct pool_name) as pools,
min(block_timestamp) as first_swap,
max(block_timestamp) as last_swap,
datediff(day,first_swap,last_swap) as lifetime,
count(distinct tx_id) as swaps,
case when lifetime = 0 then swaps else swaps/lifetime end as swaps_per_day
from swap_data
group by 1
),
data as (
select *,
case
when swaps_per_day > 10 and pools > 1 then 'multi-pool bot'
when swaps_per_day > 10 then 'single-pool bot'
else 'normal user'
Run a query to Download Data