winnie-fsDay by Day THORCHAIN Who is Buying Custom Other Month copy
Updated 2023-12-04
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
›
⌄
-- forked from RUNE Who is Buying Custom Other Month @ https://flipsidecrypto.xyz/edit/queries/736a5250-bc98-4760-9e58-706df15e931e
-- forked from RUNE Who is Buying Custom @ https://flipsidecrypto.xyz/edit/queries/6c53d3f0-f8ce-4c8d-9e98-df6d5b5e605a
-- forked from KUJIRA Who is Buying Custom @ https://flipsidecrypto.xyz/edit/queries/0741a838-1e6e-4047-bf69-aa337bdaaec8
-- forked from KUJIRA Who is Buying @ https://flipsidecrypto.xyz/edit/queries/64d47120-94e6-429c-83a9-d8323a713142
-- forked from KUJI Weekly WHALEs @ https://flipsidecrypto.xyz/edit/queries/f2b08602-84e0-4d45-a6e7-01bcae8d5def
With Prices As (
SELECT
date_trunc('day',BLOCK_TIMESTAMP) as Date,
avg(rune_usd) as Rune_Price,
CASE when rune_usd>0 then 'Thorchain'
End as Chain
FROM thorchain.price.fact_prices
Group by 1,3
ORder by Date DESC
),
swaps AS(
SELECT
date_trunc('day',BLOCK_TIMESTAMP) as Date,
sum(TO_AMOUNT_USD) AS Swapped_Value_USD,
CASE
When Blockchain='ETH' Then 'Ethereum'
When Blockchain='BTC' Then 'Bitcoin'
When Blockchain='AVAX' Then 'Avalanche'
When Blockchain='THOR' Then 'Thorchain'
When Blockchain='DOGE' Then 'Doge'
Else Blockchain
End As Chain
from thorchain.defi.fact_swaps
WHERE BLOCK_TIMESTAMP BETWEEN {{start_date}} AND {{end_date}}
GROUP BY 1,3
)
QueryRunArchived: QueryRun has been archived