Moe8 Race
Updated 2022-10-23Copy Reference Fork
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
›
⌄
with base as (select
distinct BUYER
from flow.core.fact_nft_sales
where 1=1
and NFT_COLLECTION ilike 'A.329feb3ab062d289.RaceDay_NFT'
and TX_SUCCEEDED = 'TRUE'
),
flow_prices as (
select date_trunc('day', timestamp)::Date as day,
avg(price_usd) as flow_price
from flow.core.fact_prices
group by 1),
final as (select
s.*,
case
when currency = 'A.1654653399040a61.FlowToken' then price*flow_price else price end as price_usd
from flow.core.fact_nft_sales s,flow_prices p
where tx_succeeded = 'TRUE'
and s.BLOCK_TIMESTAMP::date = p.day
),
buying as (select
BLOCK_TIMESTAMP as buy_date,buyer,
NFT_COLLECTION as buy_collection,NFT_ID b_NFT_ID,price_usd as buy_usd
from final
where 1=1
and buyer in (select buyer from base)
and TX_SUCCEEDED = 'TRUE'
),
selling as (select
Run a query to Download Data