Soheil_MKUntitled Query
Updated 2022-10-22
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
›
⌄
with OP_uniswap as (
SELECT
logs.BLOCK_TIMESTAMP::date as date,
(transfer.raw_amount * price.price) / pow(10, price.decimals) as USD_amounts,
'OP' as network
FROM optimism.core.fact_event_logs logs
JOIN optimism.core.fact_token_transfers transfer
ON logs.tx_hash = transfer.tx_hash
JOIN optimism.core.fact_hourly_token_prices price
ON transfer.contract_address = price.token_address
AND date_trunc('hour', transfer.block_timestamp) = price.hour
WHERE logs.origin_to_address IN ('0xe592427a0aece92de3edee1f18e0157c05861564','0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45')
and logs.tx_status ='SUCCESS'
and logs.event_name = 'Swap'
and logs.BLOCK_TIMESTAMP >='2022-06-01'
),
ETH_uniswap as (
select
abs(AMOUNT1_USD) as USD_amounts,
'ETH' as network
from ethereum.uniswapv3.ez_swaps
where BLOCK_TIMESTAMP >='2022-06-01'
)
SELECT
date,
avg(USD_amounts) as "Average USD volume of swaps"
from OP_uniswap
group by 1
Run a query to Download Data