maybeyonastoken_2nd_attempt
Updated 2021-12-21
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
toke_price as (
select
date(block_timestamp) as date,
avg(amount_usd/(amount_in+amount_out)) as toke_price
from ethereum.dex_swaps
where platform='sushiswap'
and pool_address = lower('0xd4e7a6e2D03e4e48DfC27dd3f46DF1c176647E38')
and token_address != '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
group by 1
),
toke_pool as (
select
balance_date as date,
2*balance as eth_locked,
2*amount_usd as liq_locked
from ethereum.erc20_balances
where user_address = '0xd4e7a6e2d03e4e48dfc27dd3f46df1c176647e38'
),
toke_swaps as (
select
date(block_timestamp) as date,
sum(amount_usd) as usd_volume,
sum(amount_in+amount_out) as eth_vol
from ethereum.dex_swaps
where platform='sushiswap'
and pool_address = lower('0xd4e7a6e2D03e4e48DfC27dd3f46DF1c176647E38')
and token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
group by 1
),
lp_return as (
select
l.date,
liq_locked,
usd_volume,
0.25*365*usd_volume/(100*liq_locked) as fee_apr,
Run a query to Download Data