StangFAST02 : Strategy : part 4
Updated 2023-03-07
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 current_date
AND fp.symbol = 'SUSHI'
GROUP BY
date
)
, arbitrum_chain AS
(
SELECT
'arbitrum' AS chain
-- , e.action AS action
, 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
, CASE
when ez.action = 'Repay' then 'Repay'
when ez.action = 'Borrow' then 'Borrow'
when ez.action = 'Remove collateral' then 'Remove collateral'
when ez.action = 'add collateral' then 'add collateral'
END
AS type
, sum
(
CASE
Run a query to Download Data