SocioAnalyticabridge (ETH) to other
Updated 2024-02-29
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 bridge as (
select
tx_hash,
block_timestamp
from ethereum.defi.ez_bridge_activity
where block_timestamp::date >= dateadd('day', -{{past_days}}, current_date)
)
,
fee_eth as (
select
count(DISTINCT tx_hash) as n_bridge,
sum(tx_fee) as total_fee_eth,
avg(tx_fee) as avg_fee_eth,
median(tx_fee) as median_fee_eth
from ethereum.core.fact_transactions a
join bridge b using(tx_hash, block_timestamp)
where a.block_timestamp::date >= dateadd('day', -{{past_days}}, current_date)
)
,
eth_price as (
SELECT 'Ethereum' as network,
TO_TIMESTAMP(value[0]::string) as date,
value[1] as last_price
FROM (
SELECT livequery.live.udf_api(
'https://api.coingecko.com/api/v3/coins/ethereum/market_chart?vs_currency=usd&days=30') as response
),LATERAL FLATTEN (input => response:data:prices)
qualify row_number () over (order by date DESC) = 1
)
select
network
,date
,last_price
,n_bridge
QueryRunArchived: QueryRun has been archived