adambalaOpening Positions (Mean Finance)
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
›
⌄
select date,transactions,cum_transactions,address,token,
case when token in ('WMATIC',' Dai ','MANA','Ether','CRV','jEUR',' miMATIC ') then (volume/pow(10,18))
when token in ('USDT') then (volume/pow(10,6))when token in ('USD') then (volume/pow(10,6)) else (volume/pow(10,8))
end as volumes
from (select
case when CONTRACT_ADDRESS = '0xa3fa99a148fa48d14ed51d610c367c61876997f1' then ' miMATIC '--18
when CONTRACT_ADDRESS = '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270' then 'WMATIC' --18
when CONTRACT_ADDRESS = '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063' then ' Dai '--18
when CONTRACT_ADDRESS = '0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4' then 'MANA' --18
when CONTRACT_ADDRESS = '0xc2132d05d31c914a87c6611c10748aeb04b58e8f' then 'USDT' --6
when CONTRACT_ADDRESS = '0x2791bca1f2de4661ed88a30c99a7a9449aa84174' then 'USD'--6
when CONTRACT_ADDRESS = '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619' then 'Ether'--18
when CONTRACT_ADDRESS = '0x172370d5cd63279efa6d502dab29171933a610af' then 'CRV'--18
when CONTRACT_ADDRESS = '0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c' then 'jEUR'--18
when CONTRACT_ADDRESS = '0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6' then 'WBTC'--8
end as token,
date(BLOCK_TIMESTAMP) as date ,
count(distinct tx_hash) as transactions,
sum (transactions) over (order by date ) as cum_transactions,
count (distinct origin_from_address) as address ,
sum(EVENT_INPUTS :value) as volume
from polygon.core.fact_event_logs
where origin_to_address ='0x059d306a25c4ce8d7437d25743a8b94520536bd5'
and origin_function_signature ='0x6b29e1bd' and block_timestamp >= CURRENT_DATE - 30 and EVENT_NAME = 'Transfer' and token is not null
group by 1,2 )
--group by 1,2,3,4
Run a query to Download Data