goanji6455Untitled Query
Updated 2022-05-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
›
⌄
with
sell as (
SELECT BLOCK_TIMESTAMP::date as date,
SWAP_PROGRAM,
sum(SWAP_FROM_AMOUNT) as sold_amount,
count(DISTINCT SWAPPER) as sold_SWAPPERS
from flipside_prod_db.algorand.swaps
where BLOCK_TIMESTAMP::date >= '2022-04-01'
and SWAP_FROM_ASSET_ID in (386195940)
GROUP by 1,2
)
, buy as (
SELECT BLOCK_TIMESTAMP::date as date,
SWAP_PROGRAM,
sum(SWAP_to_AMOUNT) as bought_amount,
count(DISTINCT SWAPPER) as bought_SWAPPERS
from flipside_prod_db.algorand.swaps
where BLOCK_TIMESTAMP::date >= '2022-04-01'
and SWAP_to_ASSET_ID in (386195940)
GROUP by 1,2
)
SELECT sell.date, sell.SWAP_PROGRAM, sold_amount, sold_SWAPPERS, bought_amount, bought_SWAPPERS,
sold_amount-bought_amount as net_sold
from sell
join buy on (sell.SWAP_PROGRAM = buy.SWAP_PROGRAM and sell.date = buy.date)
Run a query to Download Data