Pmisha-bmlMdxUntitled Query
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
›
⌄
with price as(select
date_trunc('day',BLOCK_HOUR) as dt0,
avg(PRICE_USD) as usd
from algorand.prices_swap
where ASSET_ID='0'
group by 1),
t1 as(select
tx_group_id
from algorand.payment_transaction
where RECEIVER='RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE'
)
select
tx_id,
AMOUNT as sale_ALGO,
p.usd as ALGO_price,
sale_ALGO*ALGO_price as sale_usd
from algorand.payment_transaction inner join price p on date_trunc('day',block_timestamp) = p.dt0
where tx_group_id in (select tx_group_id from t1)
and RECEIVER!='RANDGVRRYGVKI3WSDG6OGTZQ7MHDLIN5RYKJBABL46K5RQVHUFV3NY5DUE'
group by 1,2,3 having amount is not null
order by 2 desc limit 1
Run a query to Download Data