nitsUntitled Query
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
›
⌄
with deposit_details_eth as (select tx_id, max(amount_usd) as amt, max(block_timestamp)as b from ethereum.udm_events where tx_id in
(select tx_id from ethereum.udm_events
where contract_address = lower('0x25751853Eab4D0eB3652B5eB6ecB102A2789644B') --0x65a833afDc250D9d38f8CD9bC2B1E3132dB13B2F
and event_name = 'Deposit')
and amount_usd is not NULL
-- where tx_id = '0x322a5b945fcba30d259470d5d3a2c12e26b7a6fa6bdcda2ea30448770f9550fb'
GROUP by 1),
deposit_details_btc as (select tx_id, max(amount_usd) as amt, max(block_timestamp)as b from ethereum.udm_events where tx_id in
(select tx_id from ethereum.udm_events
where contract_address = lower('0x65a833afDc250D9d38f8CD9bC2B1E3132dB13B2F') --
and event_name = 'Deposit')
and amount_usd is not NULL
-- where tx_id = '0x322a5b945fcba30d259470d5d3a2c12e26b7a6fa6bdcda2ea30448770f9550fb'
GROUP by 1),
btc_tvl as (select date(b) as day, sum(amt) as amt_transfer_today_btc,sum(amt_transfer_today_btc) over (order by day) as tvl_btc from
(SELECT * FROM
(select tx_id, max(amount_usd)*(-1) as amt, max(block_timestamp)as b from ethereum.udm_events where tx_id in
(select tx_id from ethereum.udm_events
where contract_address = lower('0x65a833afDc250D9d38f8CD9bC2B1E3132dB13B2F') --0x65a833afDc250D9d38f8CD9bC2B1E3132dB13B2F
and event_name ilike 'withdraw')
and amount_usd is not NULL
-- where tx_id = '0x322a5b945fcba30d259470d5d3a2c12e26b7a6fa6bdcda2ea30448770f9550fb'
GROUP by 1)
UNION ALL
SELECT * from deposit_details_btc)
GROUP by 1),
eth_tvl as
(select date(b) as day_, sum(amt) as amt_transfer_today_eth,sum(amt_transfer_today_eth) over (order by day_) as tvl_eth from
(SELECT * FROM
(select tx_id, max(amount_usd)*(-1) as amt, max(block_timestamp)as b from ethereum.udm_events where tx_id in
(select tx_id from ethereum.udm_events
where contract_address = lower('0x25751853Eab4D0eB3652B5eB6ecB102A2789644B') --0x65a833afDc250D9d38f8CD9bC2B1E3132dB13B2F
and event_name ilike 'withdraw')
and amount_usd is not NULL
-- where tx_id = '0x322a5b945fcba30d259470d5d3a2c12e26b7a6fa6bdcda2ea30448770f9550fb'
GROUP by 1)
Run a query to Download Data