-
Notifications
You must be signed in to change notification settings - Fork 1
/
sql_query_dune.sql
56 lines (53 loc) · 980 Bytes
/
sql_query_dune.sql
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-- Parameters:
-- end_date (default 2023-09-30)
-- nft_contract_address
-- BAYC: 0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d
WITH
collection AS
(
SELECT
*
FROM nft_ethereum.collection_stats
WHERE nft_contract_address = {{nft_contract_address}}
),
trades AS
(
SELECT
*
FROM nft.trades
WHERE nft_contract_address = {{nft_contract_address}}
)
SELECT
project,
version,
t.block_date,
t.block_month,
t.block_time,
t.token_id,
collection,
amount_usd,
token_standard,
trade_type,
number_of_items,
trade_category,
evt_type,
amount_original,
currency_symbol,
tx_hash,
volume_eth,
price_p5_eth,
price_min_eth,
price_max_eth
FROM
trades t
LEFT JOIN
collection c
ON
t.block_date = c.block_date
--WHERE token_id = CAST(7019 AS UINT256)
WHERE
t.block_date <= CAST('{{end_date}}' AS DATE)
ORDER BY
token_id ASC,
block_time ASC
--LIMIT 1000