saeedmznOpening Positions - over time
Updated 2022-06-27Copy Reference Fork
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 tokens as (
select ADDRESS,
ADDRESS_NAME ,
case when ADDRESS = '0xa3fa99a148fa48d14ed51d610c367c61876997f1' then 18
when ADDRESS = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' then 18
when ADDRESS = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063' then 18
when ADDRESS = '0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4' then 18
when ADDRESS = '0xc2132d05d31c914a87c6611c10748aeb04b58e8f' then 6
when ADDRESS = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' then 6
when ADDRESS = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' then 18
when ADDRESS = '0x172370d5cd63279efa6d502dab29171933a610af' then 18
when ADDRESS = '0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c' then 18
when ADDRESS = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' then 8
when ADDRESS = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then 8
when ADDRESS = '0x68f180fcce6836688e9084f035309e29bf0a2095' then 8
when ADDRESS = '0xd4bccebe77b7c1da89818f8889e3ea09046e7e38' then 8
when ADDRESS = '0x5af59f281b3cfd0c12770e4633e6c16dd08ea543' then 8
else 18
end as decimal_
from polygon.core.dim_labels
group by 1,2 ,3
)
select
BLOCK_TIMESTAMP::date as date ,
-- address_name,
count(distinct tx_hash) as num_open_positions,
sum (num_open_positions) over (order by date ) as cum_open_posistions,
count (distinct origin_from_address) as num_wallets ,
sum(EVENT_INPUTS :value/pow(10,decimal_)) as volume
-- sum (volume) over (partition by address_name order by date ) as cum_volume
from polygon.core.fact_event_logs
join tokens
on CONTRACT_ADDRESS = ADDRESS
where origin_to_address in ('0x059d306a25c4ce8d7437d25743a8b94520536bd5' , lower('0xa3DB2c0D23720e8CDA0f4d80A53B94d20d02b061'))
and origin_function_signature ='0x6b29e1bd'
and block_timestamp >= CURRENT_DATE - 30
Run a query to Download Data