SectorPnL QA - Holder List (Buy/Sell Dates)
Updated 2022-10-09
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
›
⌄
--Issues: Wallets and vaults trade to themselves in same date creating issues. See 106
-- select *
-- from (
with buy as (
select
ROW_NUMBER() OVER (PARTITION BY nft_to_address, tokenid ORDER BY block_timestamp DESC) AS rank,
block_timestamp as date,
nft_to_address as wallet,
tokenid
from ethereum.core.ez_nft_transfers
where nft_address = lower('0x08d7c0242953446436f34b4c78fe9da38c73668d')
),
sell as (
select
ROW_NUMBER() OVER (PARTITION BY nft_from_address, tokenid ORDER BY block_timestamp DESC) AS rank,
block_timestamp as date,
NFT_FROM_ADDRESS as wallet,
tokenid
from ethereum.core.ez_nft_transfers
where nft_address = lower('0x08d7c0242953446436f34b4c78fe9da38c73668d')
)
--select distinct wallet from (
select
Wallet,
tokenid,
buy_date,
case when sell_date is null then current_date
else sell_date end as sell_or_current_date,
buy_rank,
sell_rank
from (
select
a.rank as buy_rank,
Run a query to Download Data