Monitize AIPirate Price and MCap
Updated 2024-07-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
26
27
28
29
30
31
32
33
34
›
⌄
⌄
with pricet as (
SELECT
'Price' as type,
TO_TIMESTAMP(value[0] :: string) as date,
value[1]::string as amount
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/pirate-token/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:prices)
),
mcapt as (
SELECT
'MCap' as type,
TO_TIMESTAMP(value[0] :: string) as date,
value[1]::string as amount
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/pirate-token/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:market_caps)
)
/*
UNION
SELECT
'Total Volumes' as type,
TO_TIMESTAMP(value[0] :: string) as date,
value[1]::string as price
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/pirate-token/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:total_volumes)*/
select
p.date,
p.amount as price,
round(m.amount,0) as Mcap,
from pricet p join mcapt m on p.date = m.date
order by 1 desc
QueryRunArchived: QueryRun has been archived