Query editor
WITH api_data AS (SELECTJSON_PARSE(HTTP_GET('https://api.coingecko.com/api/v3/coins/tomochain/market_chart?vs_currency=usd&days=365&interval=daily')) AS coin_data)SELECTTRY_CAST(FROM_UNIXTIME(TRY_CAST(JSON_EXTRACT_SCALAR(array_element, '$[0]') AS DECIMAL(18, 0)) / 1000) AS TIMESTAMP) AS timestamp,TRY_CAST(JSON_EXTRACT_SCALAR(array_element, '$[1]') AS DECIMAL(18, 6)) AS price_usd,TRY_CAST(JSON_EXTRACT_SCALAR(market_cap_element, '$[1]') AS DECIMAL(18, 6)) AS market_cap_usd,TRY_CAST(JSON_EXTRACT_SCALAR(volume_element, '$[1]') AS DECIMAL(18, 6)) AS total_volume_usdFROM api_data, UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.prices') AS ARRAY(JSON))) WITH ORDINALITY AS t1(array_element, offset), UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.market_caps') AS ARRAY(JSON))) WITH ORDINALITY AS t2(market_cap_element, offset), UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.total_volumes') AS ARRAY(JSON))) WITH ORDINALITY AS t3(volume_element, offset)WHEREt1.offset = t2.offset AND t2.offset = t3.offset/*WITH api_data AS (SELECTJSON_PARSE(HTTP_GET('https://api.coingecko.com/api/v3/coins/tomochain/market_chart?vs_currency=usd&days=30&interval=daily')) AS coin_data)SELECTJSON_EXTRACT(coin_data, '$.prices') AS prices,JSON_EXTRACT(coin_data, '$.market_caps') AS market_caps,JSON_EXTRACT(coin_data, '$.total_volumes') AS total_volumesFROM api_data*//*WITH api_data AS (SELECTJSON_PARSE(HTTP_GET('https://api.coingecko.com/api/v3/coins/tomochain/market_chart?vs_currency=usd&days=30&interval=daily')) AS coin_data)SELECTTRY_CAST(JSON_EXTRACT_SCALAR(array_element, '$[0]') AS TIMESTAMP) AS timestamp,TRY_CAST(JSON_EXTRACT_SCALAR(array_element, '$[1]') AS DECIMAL(18, 6)) AS price_usd,TRY_CAST(JSON_EXTRACT_SCALAR(market_cap_element, '$[1]') AS DECIMAL(18, 6)) AS market_cap_usd,TRY_CAST(JSON_EXTRACT_SCALAR(volume_element, '$[1]') AS DECIMAL(18, 6)) AS total_volume_usdFROM api_data, UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.prices') AS ARRAY(JSON))) WITH ORDINALITY AS t1(array_element, offset), UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.market_caps') AS ARRAY(JSON))) WITH ORDINALITY AS t2(market_cap_element, offset), UNNEST(TRY_CAST(JSON_EXTRACT(coin_data, '$.total_volumes') AS ARRAY(JSON))) WITH ORDINALITY AS t3(volume_element, offset)WHEREt1.offset = t2.offset AND t2.offset = t3.offset*/