geekmodule-ashdRL SB crafting profitability copy
Updated 2024-10-17
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 Aephia / SB crafting profitability @ https://flipsidecrypto.xyz/Aephia/q/9W0IlMlgt-wd/sb-crafting-profitability
WITH atlas_price AS (
SELECT
hour::DATE AS DATE,
AVG(price) AS atlas_price
FROM
SOLANA.price.ez_prices_hourly
WHERE token_address = 'ATLASXmbPQxBUYbxPsV97usA3fPQYEqzQBUHgiFCUsXx'
AND hour::DATE >= current_date -14 AND hour::DATE < current_date
GROUP BY ALL
),
gecko_call_data as (
select live.udf_api('https://api.coingecko.com/api/v3/nfts/star-atlas-crew')
as response
)
,gecko_flattened_data as (
select * from
gecko_call_data, lateral flatten(input => parse_json(response:data))
)
,crew AS (
SELECT
case when key = 'floor_price' then value:usd end as fp_crew
FROM gecko_flattened_data
)
,sage_volumes AS (
select
QueryRunArchived: QueryRun has been archived