FlippppppaSwap from and to RLB copy
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 Masi / Swap from and to RLB @ https://flipsidecrypto.xyz/Masi/q/_6RZcDLkebGw/swap-from-and-to-rlb
with tb1 as ( select trunc(recorded_hour,'day') as day,
symbol,
avg(close) as token_price
from solana.core.fact_token_prices_hourly
where symbol in ('RLB')
and recorded_hour::date >= '{{Start_date}}'
group by 1,2)
,
tb2 as ( select DISTINCT tx_from as user
from solana.core.fact_transfers
where tx_to = 'RBHdGVfDfMjfU6iUfCb1LczMJcQLx7hGnxbzRsoDNvx'
UNION
select DISTINCT tx_to as user
from solana.core.fact_transfers
where tx_from = 'RBHdGVfDfMjfU6iUfCb1LczMJcQLx7hGnxbzRsoDNvx'
)
,
tb3 as ( select trunc(block_timestamp,'day') as day,
'Swap From RLB' as pair,
swapper,
tx_id,
swap_from_amount*token_price as from_volume,
SWAP_FROM_MINT,
SWAP_To_MINT
from tb1 a left outer join solana.core.fact_swaps b on a.day = b.block_timestamp::date
where SUCCEEDED = 'true'
and block_timestamp::date >= '{{Start_date}}'
and swap_from_mint = 'RLBxxFkseAZ4RgJH3Sqn8jXxhmGoz9jWxDNJMh8pL7a'
and swapper in (select user from tb2))
,
tb4 as ( select trunc(block_timestamp,'day') as day,
'Swap to RLB' as pair,
swapper,
tx_id,
Run a query to Download Data