StangFAST02 : Strategy : part 1
Updated 2023-03-10
999
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 prices AS
(
SELECT
date( fp.hour ) AS date
, avg( fp.price ) AS avg_sushi_price
FROM
ethereum.core.fact_hourly_token_prices fp
WHERE
date BETWEEN '2022-06-01' AND '2023-02-28'
AND fp.symbol = 'SUSHI'
GROUP BY
date
)
, arbitrum_chain AS
(
SELECT
'arbitrum' AS chain
, date_trunc( 'month' , ez.block_timestamp ) AS date
, count( DISTINCT ez.tx_hash ) AS tx_count
, count( DISTINCT ez.origin_from_address ) AS unique_user
, -sum( CASE when ez.action = 'Repay' then ez.amount_usd END ) AS total_repay
, sum( CASE when ez.action = 'Borrow' then ez.amount_usd END ) AS total_borrow
, total_repay + total_borrow as net_liquidity
, sum( net_liquidity ) over ( ORDER BY date ASC ) AS net_cumu
FROM
arbitrum.sushi.ez_borrowing ez
WHERE
ez.block_timestamp::date >= '2022-06-01'
AND ez.block_timestamp::date < '2023-02-28'
Run a query to Download Data