Flipside TeamSwap - Daily - $WIF copy
Updated 2024-06-07
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
›
⌄
-- forked from Swap - Daily - $WIF @ https://flipsidecrypto.xyz/edit/queries/0ad8c7aa-803a-4630-bed7-04c41de1b546
-- forked from Swap - Monthly - $WIF @ https://flipsidecrypto.xyz/edit/queries/ba3a66d4-a012-4a51-a153-1514e304d85d
with Price as (select date_trunc('day',RECORDED_HOUR) as ddate
, avg(CLOSE) as Price
from solana.price.fact_token_prices_hourly
where SYMBOL = 'WIF'
and ddate >= '2024-01-01'
group by 1)
, swaps as (
select date_trunc('day', BLOCK_TIMESTAMP) as date
, sum(SWAP_FROM_AMOUNT)*-1 as volume
, count(TX_ID)*-1 as transactions
, count(distinct SWAPPER)*-1 as swappers
, 'swap from' as action
from solana.defi.fact_swaps
where SWAP_FROM_MINT = 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
and SUCCEEDED = 'TRUE'
and date >= '2024-01-01'
group by 1
UNION
select date_trunc('day',BLOCK_TIMESTAMP) as date
, sum(SWAP_TO_AMOUNT) as volume
, count(TX_ID) as transactions
, count(distinct SWAPPER) as swappers
, 'swap to' as action
from solana.defi.fact_swaps
where SWAP_TO_MINT = 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
and SUCCEEDED = 'TRUE'
and date >= '2024-01-01'
group by 1)
select s.date
, s.volume*p.price as volume
QueryRunArchived: QueryRun has been archived