maybeyonasthor_swap_single_from_native
Updated 2022-06-12
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
single_swaps_txs as (
select tx_id from (
select
tx_id,
count(tx_id) as swaps
from thorchain.swaps
group by 1
)
where swaps = 1
),
swap_from as (
select
block_timestamp,
tx_id,
from_asset,
from_amount,
from_amount_usd,
to_amount,
to_amount_usd
from thorchain.swaps
where to_asset = 'THOR.RUNE'
and tx_id in ( select tx_id from single_swaps_txs)
)
select
date(block_timestamp) as date,
split(from_asset,'.')[0]::string as chain,
split(from_asset,'-')[0]::string as asset,
count(tx_id) as swaps,
sum(from_amount) as from_amount,
sum(from_amount_usd) as from_amount_usd,
sum(to_amount) as to_amount,
sum(to_amount_usd) as to_amount_usd
from swap_from
where block_timestamp >= '2022-05-01'
Run a query to Download Data