0xaimanSales
Updated 2022-06-23
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
›
⌄
with dom as (select asset_id,asset_name from algorand.asset where asset_name like '%.algo' and total_supply=1 and asset_deleted = false and decimals='0') ,
trans as (select tx_group_id, asset_id from algorand.transfers where asset_id in (select asset_id from dom)),
price as (select tx_group_id, sum(tx_message:txn:amt/10e6) as price from algorand.transactions where tx_type='pay' and tx_group_id in (select tx_group_id from trans ) and fee=0 group by 1),
buyer as (select block_timestamp, sender as buyer, tx_group_id from algorand.transactions where tx_group_id in (select tx_group_id from trans) and tx_type='appl'),
sales_record as (select trans.asset_id, price.price, buyer.buyer, buyer.block_timestamp as t from (( dom inner join trans on dom.asset_id=trans.asset_id) inner join price on price.tx_group_id=trans.tx_group_id) inner join buyer on buyer. tx_group_id=trans.tx_group_id)
--( (df inner join tt on df.asset_id=tt.asset_id) inner join pr on tt.tid=pr.tid ) inner join sd on pr.tid=sd.tid)
select date(t) as date , sum(price) as sum_algo_raised , sum(sum_algo_raised) OVER(ORDER BY date asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS cum_algo_raised
from sales_record
group by 1 order by 1
Run a query to Download Data