Flipside TeamKlaySwap APY 2
Updated 2024-08-29
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
›
⌄
-- forked from KlaySwap APY @ https://flipsidecrypto.xyz/studio/queries/ff0e7bce-b38d-46a5-96bc-a16c8f4e0b4e
with price_tab as (
select *
from(
SELECT
TO_TIMESTAMP(log.value[0] :: string) as pdate,
log.value[1]:: string as prices,
'WKLAY' :: string as token_symbol,
'0x19aac5f612f524b754ca7e7c41cbfa2e981a4432' :: string as token_contract,
rank() over(order by TO_TIMESTAMP(log.value[0] :: string) desc) as rank
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/klay-token/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:prices) log
UNION all
SELECT
TO_TIMESTAMP(log.value[0] :: string) as pdate,
log.value[1]:: string as prices,
'oWBTC' :: string as token_symbol,
'0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c' :: string as token_contract,
rank() over(order by TO_TIMESTAMP(log.value[0] :: string) desc) as rank
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/orbit-bridge-klaytn-wrapped-btc/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:prices) log
UNION all
SELECT
TO_TIMESTAMP(log.value[0] :: string) as pdate,
log.value[1]:: string as prices,
'0ETH' :: string as token_symbol,
'0x34d21b1e550d73cee41151c77f3c73359527a396' :: string as token_contract,
rank() over(order by TO_TIMESTAMP(log.value[0] :: string) desc) as rank
FROM (SELECT livequery.live.udf_api('https://api.coingecko.com/api/v3/coins/orbit-bridge-klaytn-ethereum/market_chart?vs_currency=usd&days=365&interval=daily&precision=3') as resp)
,LATERAL FLATTEN (input => resp:data:prices) log
QueryRunArchived: QueryRun has been archived