0xsloaneSolana Volume by Program
Updated 2023-10-13
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 source_token AS (
SELECT DATE_TRUNC('hour', fs.block_timestamp) AS date_hour
, fs.program_id
, fs.swap_from_mint AS mint
, SUM(COALESCE(fs.swap_from_amount,0)) AS sum_amount
FROM solana.core.fact_swaps fs
WHERE TRUE
AND fs.block_timestamp::DATETIME BETWEEN '{{start_date}} 00:00:00.000' AND '{{end_date}} 23:59:59.000'
AND fs.succeeded
GROUP BY 1, 2, 3
),
destination_token AS (
SELECT DATE_TRUNC('hour', fs.block_timestamp) AS date_hour
, fs.program_id
, fs.swap_to_mint AS mint
, SUM(COALESCE(fs.swap_to_amount,0)) AS sum_amount
FROM solana.core.fact_swaps fs
WHERE TRUE
AND fs.block_timestamp::DATETIME BETWEEN '{{start_date}} 00:00:00.000' AND '{{end_date}} 23:59:59.000'
AND fs.succeeded
GROUP BY 1, 2, 3
),
source_and_destination_unioned AS (
SELECT date_hour
, program_id
, mint
, sum_amount
FROM source_token
UNION ALL
SELECT date_hour
, program_id
, mint
, sum_amount
FROM destination_token
),
convert_to_usd AS (
Run a query to Download Data