davidwallUntitled Query
Updated 2023-01-14Copy Reference Fork
999
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
›
⌄
--credit : https://app.flipsidecrypto.com/velocity/queries/f93304b5-9d3d-4f7e-afff-37a1d72779be
with pricet as (
select timestamp::date as day,
token_contract as Token1,
avg (price_usd) as USDPrice
from flow.core.fact_prices
where timestamp::date >= '2022-12-17'
group by 1,2
union ALL
select block_timestamp::date as day,
swap_from_mint as token1,
median (swap_to_amount/swap_from_amount) as USD_Price
from solana.fact_swaps
where swap_to_mint in ('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v','Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB') --USDC,USDT
and swap_to_amount > 0
and swap_from_amount > 0
and succeeded = 'TRUE'
and block_timestamp::date >= '2022-12-17'
group by 1,2
union ALL
select timestamp::date as day,
token_contract as Token1,
avg (price_usd) as USDPrice
from near.core.fact_prices
where timestamp::date >= '2022-12-17'
and symbol = 'wNEAR'
group by 1,2),
maintable as (
select 'Ethereum' as chain,
block_timestamp::date as date,
case when date >= '2022-12-24' and date < '2023-01-04' then 'Holidays'
Run a query to Download Data