anomoneRibbon - erc20 combined ETH and WBTC
Updated 2022-02-10
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
›
⌄
⌄
SELECT balance_date ,
max(CASE WHEN contract_address = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' THEN (NON_ADJUSTED_BALANCE/1e8)* (SELECT price
from
ethereum.token_prices_hourly WHERE token_address = LOWER('0x2260fac5e5542a773aa44fbcfedf7c193bc2c599')
and hour = (SELECT max(hour) from ethereum.token_prices_hourly)) END) as BTC_USD ,
max(CASE WHEN contract_address = '0x65a833afdc250d9d38f8cd9bc2b1e3132db13b2f' THEN (NON_ADJUSTED_BALANCE/1e8) * 44921.2 END) as rbtc_USD ,
BTC_USD + rbtc_USD as "WBTC TVL",
max(CASE WHEN contract_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' THEN (NON_ADJUSTED_BALANCE/1e18)* (SELECT price
from
ethereum.token_prices_hourly WHERE token_address = LOWER('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2')
and hour = (SELECT max(hour) from ethereum.token_prices_hourly)) END) as wETH_USD ,
max(CASE WHEN contract_address = '0x25751853eab4d0eb3652b5eb6ecb102a2789644b' THEN (NON_ADJUSTED_BALANCE/1e18) * 3505.17 END) as rETH_USD ,
wETH_USD + rETH_USD as "WETH TVL"
FROM ethereum.erc20_balances
WHERE user_address in (LOWER('0x65a833afdc250d9d38f8cd9bc2b1e3132db13b2f') ,LOWER('0x25751853eab4d0eb3652b5eb6ecb102a2789644b') )-- btc
AND date_trunc('day',balance_date) >= date_trunc('day',getdate()) - interval'150 days'
GROUP BY balance_date
ORDER BY balance_date desc
LIMIT 150
/*
SELECT * FROM ethereum.token_prices_hourly
WHERE token_address = LOWER('0x8b5876f5b0bf64056a89aa7e97511644758c3e8c')
LIMIT 4
SELECT
*
FROM ethereum.erc20_balances
WHERE user_address = LOWER('0x65a833afdc250d9d38f8cd9bc2b1e3132db13b2f') -- btc
AND date_trunc('day',balance_date) >= date_trunc('day',getdate()) - interval'2 days'
Run a query to Download Data