MajorM11104 get toi and block for 1 token
Updated 2024-11-05
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
token_constants AS (
SELECT
'7S2R1dU8w3JdU63Etq2h81yJhV89YF4r78QJdBtWpump' AS token_program,
'So11111111111111111111111111111111111111112' AS purchase_token
),
overall_first_block AS (
SELECT
MIN(block_id) AS first_listing_block
FROM
solana.defi.ez_dex_swaps,
token_constants
WHERE
swap_from_mint = token_constants.purchase_token
AND swap_to_mint = token_constants.token_program
),
investments AS (
SELECT
swapper,
MIN(block_timestamp) AS first_purchase_timestamp,
MIN(block_id) AS first_purchase_block,
SUM(swap_from_amount_usd) AS total_investment
FROM
solana.defi.ez_dex_swaps,
token_constants
WHERE
swap_from_mint = token_constants.purchase_token
AND swap_to_mint = token_constants.token_program
GROUP BY
swapper
),
sales AS (
SELECT
swapper,
MIN(block_timestamp) AS first_sale_timestamp,
MIN(block_id) AS first_sale_block,
QueryRunArchived: QueryRun has been archived