MasiTotal Trading
Updated 2024-11-15
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
›
⌄
⌄
/**select TO_TIMESTAMP(value:time::string) as hour,
'nearnvidia.near' as TOKEN_ADDRESS,
(value:close+value:open)/2 as price
from (
select live.udf_api('https://api.coinmarketcap.com/kline/v3/k-line/candles/60/9488613?reverse-order=false&usd=true&type=1h&to=1816422400000&countBack=321') AS response
),
LATERAL FLATTEN (input => response:data:data)
union all
**/
with tb1 as ( select trunc(hour,'day') as day,
'aurora' as token_address,
avg(price) as avg_price
from near.price.ez_prices_hourly
where symbol = 'ETH'
group by 1,2
UNION
select trunc(hour,'day') as day,
'3.contract.portalbridge.near' as token_address,
1 as avg_price
from near.price.ez_prices_hourly
where symbol = 'ETH'
UNION
Select trunc(TO_TIMESTAMP(value[0]::string),'day') as day,
'usmeme.tg' as token_address,
avg(value[1]) as avg_price
from (
SELECT livequery.live.udf_api(
'https://api.coingecko.com/api/v3/coins/usmeme/market_chart?vs_currency=usd') as resp
)
,LATERAL FLATTEN (input => resp:data:prices)
group by all
UNION
Select trunc(TO_TIMESTAMP(value[0]::string),'day') as day,
'token.jumbo_exchange.near' as token_address,
avg(value[1]) as avg_price
QueryRunArchived: QueryRun has been archived