misaghlbALGOxNFT Marketplace - auction sales
Updated 2022-05-11
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
›
⌄
-- Tips Use NFT Explorer Monthly Sales As a Reference Point : https://www.nftexplorer.app/stats
-- Auction Sale: https://algoexplorer.io/tx/group/Wr9GCaMUKq0Rd8tV72PM42rRUtZKLhM%2FpthbhL%2BAyFg%3D note for Auction sale look for (try_base64_decode_string(tx_message:txn:apaa[0]::string) = ‘close_auction’
-- Buy Now Sale: https://algoexplorer.io/tx/group/TIjA0X5Cw7DXD2aNCYAfvrKpyP1AjP%2BjFHwM1LiTGKQ%3D
-- Shuffle Sale: https://algoexplorer.io/tx/group/E9kTaCcLS9mzMyJjqb24lQv7M0NIkiIuCZN6%2F7n%2FK%2Bw%3D Fee Address: XNFT36FUCFRR6CK675FW4BEBCCCOJ4HOSMGCN6J2W6ZMB34KM2ENTNQCP4
with price_tbl as (
SELECT date(block_hour) as price_hour,
avg(price_usd) as price
from algorand.prices_swap
where asset_id = 0 -- ALGO
GROUP by price_hour
)
SELECT
date(ca.block_timestamp) as date,
count(DISTINCT ca.tx_group_id) as sales,
sum(zeroifnull(p.tx_message:ca/1e6)) as fee_earned,
sum(amount) as tota_sale,
(tota_sale + fee_earned) as total_sale_with_fee,
total_sale_with_fee * pr.price as total_usd_sale,
sum(fee_earned) over (order by date asc) as fee_accumulated
from algorand.application_call_transaction ca
join algorand.payment_transaction p on p.tx_group_id = ca.tx_group_id
join price_tbl pr on pr.price_hour = date(ca.block_timestamp)
-- where ca.tx_group_id = 'Wr9GCaMUKq0Rd8tV72PM42rRUtZKLhM/pthbhL+AyFg=' -- sample auction sale trx
where try_base64_decode_string(ca.tx_message:txn:apaa[0]::string) = 'close_auction'
and date(ca.block_timestamp) >= '2022-01-01'
group by date(ca.block_timestamp), pr.price
Run a query to Download Data