Ali3NThorchain Swap Pairs Trading Stats In Specific Chain
Updated 2024-10-07
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
›
⌄
-- Credit: https://flipsidecrypto.xyz/Rayyyk/q/BH8Jf0qCGZTF/top-5-largest-swap-last-week
with maintable as (
select split(from_asset, '-')[0] as from_assets,
case when from_assets ilike '%/%' then split(from_assets, '/')[1]
else split(from_assets, '.')[1] end as from_asset_names,
split(to_asset, '-')[0] as to_assets,
case when to_assets ilike '%/%' then split(to_assets, '/')[1]
else split(to_assets, '.')[1] end as to_asset_names,
*
from thorchain.defi.fact_swaps
where block_timestamp >= '{{Start_Date}}' and block_timestamp <= '{{End_Date}}'
and blockchain ilike '{{Blockchain}}')
select concat (from_asset_names,' => ',to_asset_names) as Swap_Pair,
count (Distinct tx_Id) as Swaps,
count (distinct from_address) as Swappers,
sum (from_amount_usd) as Volume,
avg (from_amount_usd) as Average_Volume,
round (swaps / swappers) as Swaps_Per_Trader,
volume / swappers as Swap_Volume_Per_Trader
from maintable
group by 1
order by 2 desc
QueryRunArchived: QueryRun has been archived