shadabwif dist copy
Updated 2024-03-13
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 Moe / wif dist @ https://flipsidecrypto.xyz/Moe/q/MsIo8Jhk5pu3/wif-dist
with prc as (
select
RECORDED_HOUR::date days ,
avg(close) as price
from solana.price.ez_token_prices_hourly
where
token_address ilike 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
group by 1
),
middle as (
select
tx_id,
swapper,
(swap_to_amount)*price as USD_Volume
from solana.defi.fact_swaps sw
inner join prc pr on sw.block_timestamp::date = pr.days
where
SWAP_TO_MINT = 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'
and
swap_to_amount is not null
and
swap_to_amount > 0
and block_timestamp::date >= CURRENT_DATE - 90
)
select
case
when USD_Volume < 10 then ' less than 10 USD'
when USD_Volume between 10
and 99.99 then ' 10 - 100 USD'
when USD_Volume between 100
and 499.99 then ' 100 - 500 USD'
QueryRunArchived: QueryRun has been archived