adriaparcerisasOP price vs swapper activity
Updated 2023-04-13
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
t1 as (
SELECT trunc(hour,'{{granularity}}') AS date,
avg(price) as op_price
from optimism.core.fact_hourly_token_prices where symbol = 'OP'
GROUP BY 1
),
t2 as (
SELECT trunc(hour,'{{granularity}}') AS date,
avg(price) as eth_price
from optimism.core.fact_hourly_token_prices where symbol = 'ETH'
GROUP BY 1
) ,
t3 as (
select trunc(block_timestamp,'{{granularity}}') as date,
count(distinct origin_from_address) as swappers_from,
count(distinct tx_hash) as swaps_from,
sum(EVENT_INPUTS:amountIn/1e18) as volume_from
from optimism.core.fact_event_logs
WHERE event_name = 'Swap' and EVENT_INPUTS:tokenIn='0x4200000000000000000000000000000000000042' and tx_status = 'SUCCESS'
GROUP BY 1
),
t4 as (
select trunc(block_timestamp,'{{granularity}}') as date,
count(distinct origin_from_address) as swappers_to,
count(distinct tx_hash) as swaps_to,
sum(EVENT_INPUTS:amountOut/1e18) as volume_to
from optimism.core.fact_event_logs
WHERE event_name = 'Swap' and EVENT_INPUTS:tokenOut='0x4200000000000000000000000000000000000042' and tx_status = 'SUCCESS'
GROUP BY 1
)
SELECT
t1.date,
op_price,
eth_price,
swappers_from as swappers_selling_op,swappers_to as swappers_buying_op,
Run a query to Download Data