binhachonTo Go Bankless or Not To Go Bankless
Updated 2022-03-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
›
⌄
with July21_price as (
select
symbol as symbol_21,
avg(price) as price_21
from ethereum.token_prices_hourly
where token_address in (lower('0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6'), lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'), lower('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), lower('0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b'))
and hour::date = '2021-07-21'
group by symbol
union all
select
symbol as symbol_21,
price_usd as price_21
from terra.oracle_prices
where symbol = 'mSPY'
and block_timestamp::date = '2021-07-21'
)
select
hour::date as time,
symbol,
avg(price) / avg(price_21) * 100 as price_percent
from ethereum.token_prices_hourly
left join July21_price on (symbol = symbol_21)
where token_address in (lower('0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6'), lower('0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'), lower('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'), lower('0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b'))
and time > '2021-07-20'
group by symbol, time
union all
select
block_timestamp::date as time,
symbol,
avg(price_usd) / avg(price_21) * 100 as price_percent
from terra.oracle_prices
left join July21_price on (symbol = symbol_21)
where symbol = 'mSPY'
and time > '2021-07-20'
group by symbol, time
Run a query to Download Data