kasadeghcorrelation_coefficient
Updated 2022-11-22
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
›
⌄
with SOL_Price as
(
select block_timestamp::date as day,
median (swap_to_amount/swap_from_amount) as USDPrice
from solana.fact_swaps
where swap_from_mint = 'So11111111111111111111111111111111111111112' --SOL
and swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
and swap_to_amount > 0
and swap_from_amount > 0
and succeeded = 'TRUE'
group by 1
)
select CORR(total_volume,price) as "between price and total USDC volume",
CORR(avg_volume,price) as "between price and avg USDC volume",
CORR(tx_count,price) as "between price and total USDC transaction",
CORR(senders_cnt,price) as "between price and total USDC senders"
from
(
SELECT
'solana' as chain,
block_timestamp::date as day,
avg(USDPrice) as price,
sum(amount) as total_volume,
count(distinct TX_ID) as tx_count,
avg(amount) as avg_volume,
count(DISTINCT TX_FROM) as senders_cnt,
count(DISTINCT TX_TO) as receivers_cnt
FROM solana.core.fact_transfers as t1 join SOL_Price as t2 on t1.block_timestamp::date=t2.day
where MINT ='EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
AND block_timestamp::date >='{{start_time}}' and block_timestamp::date <='{{end_date}}'
GROUP BY 1,2
)
Run a query to Download Data