mlhUntitled Query
Updated 2022-09-28Copy 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 eth_price as (--credit to misaghlb
select date(hour) as date, avg(price) as eth_price
from ethereum.core.fact_hourly_token_prices
where symbol = 'WETH'
group by date
),
opensea as (
select date_trunc('day', block_timestamp) as date,
tx_hash,
buyer_address as buyer,
seller_address as seller,
NFT_Address,
price_usd,
'Opensea' as platform
from ethereum.core.ez_nft_sales
where platform_name = 'opensea'
and block_timestamp >= '2022-07-01'
and event_type = 'sale'
),
quix_raw as (
select date_trunc('day', block_timestamp) as date,
tx_hash,
origin_from_address as buyer,
event_inputs:from as seller,
contract_address as nft_address
from optimism.core.fact_event_logs
where origin_to_address in ('0x3f9da045b0f77d707ea4061110339c4ea8ecfa70', '0x20975da6eb930d592b9d78f451a9156db5e4c77b', '0x065e8a87b8f11aed6facf9447abe5e8c5d7502b6', '0x998ef16ea4111094eb5ee72fc2c6f4e6e8647666')
and event_name = 'Transfer'
and event_inputs:to = origin_from_address
and event_removed = 'false'
and block_timestamp >= '2022-07-01'
),
quix_all as (
select a.*,
b.eth_value*c.eth_price as price_usd,
'quix' as platform
Run a query to Download Data