ArioTraderJoe - Distribution of Trades by Fee
Updated 2023-10-11
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
›
⌄
-- forked from Avalanche dex Fee Volume @ https://flipsidecrypto.xyz/edit/queries/bb4a8db4-246d-489b-bd14-45e6a2e4f9fb
with
price_{{Blokchain}} as (
select
date_trunc({{Granularity}}, HOUR) as date,
avg(PRICE) as avg_Price
from
{{Blokchain}}.price.ez_hourly_token_prices
where
1=1
and TOKEN_ADDRESS is not NULL
and symbol in (case when '{{Blokchain}}' = 'Avalanche' then 'WAVAX'
when '{{Blokchain}}' = 'Bsc' then 'WBNB' else 'WETH' end)
group by
1
),
platforms as (
select
tx_hash
from {{Blokchain}}.defi.ez_dex_swaps
where 1=1
and platform in ('trader-joe-v1', 'trader-joe-v2')
and block_timestamp::date between '{{Start_date}}' and '{{End_date}}'
),
tab1 as (
SELECT
block_timestamp,
tx_hash,
TX_FEE * avg_Price as TX_FEE_USD
from
{{Blokchain}}.core.fact_transactions a
join price_{{Blokchain}} b on date_trunc(day, block_timestamp) = b.date
where
BLOCK_TIMESTAMP::date between '{{Start_date}}' and '{{End_date}}'
and tx_hash in (select tx_hash from platforms)
Run a query to Download Data