binhachonDynamic Rate, Mvmt. I - Curve pool
Updated 2022-03-23
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 curve_transaction as (
select
block_timestamp,
amount
from ethereum.udm_events
where to_address = '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7'
and symbol in ('USDT', 'USDC', 'DAI')
union all
select
block_timestamp,
-amount
from ethereum.udm_events
where from_address = '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7'
and symbol in ('USDT', 'USDC', 'DAI')
),
price as (
select
date_trunc('week', hour) as pricetime,
avg(price) as price
from ethereum.token_prices_hourly
where symbol = 'CRV'
group by pricetime
),
pool_stats as (
select
date_trunc('week', block_timestamp) as time,
sum(amount) as net_inflow,
sum(net_inflow) over (order by time) as liquidity
from curve_transaction
group by time
)
select
pool_stats.*,
price
from pool_stats
left join price on (time = pricetime)
Run a query to Download Data