hessSweat Vs. GMT
Updated 2023-08-14
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
›
⌄
with price as ( select date(block_timestamp) as date, token_in , (sum(AMOUNT_OUT)/sum(AMOUNT_IN)) as price
from near.core.ez_dex_swaps
where TOKEN_OUT in ('wNEAR')
and date >= '2023-01-01'
and AMOUNT_OUT > 0 and AMOUNT_IN > 0
and token_in ilike '%sweat%'
group by 1,2 )
,
near_price as ( select timestamp::date as date,'Near' as symbol, avg(price_usd) as near_price
from near.core.fact_prices
where token = 'LiNEAR'
and timestamp >= '2023-01-01'
group by 1,2)
,
sweat_price as ( select a.date, price*near_price as sweat_price
from near_price a left outer join price b on a.date = b.date)
,
gmt as ( select recorded_hour::date as date, avg(close) as gmt_price
from solana.core.fact_token_prices_hourly
where symbol ilike '%gmt%'
and date >= '2023-01-01'
group by 1)
select a.date, gmt_price , sweat_price
from gmt a left outer join sweat_price b on a.date = b.date
Run a query to Download Data