Query editor
WITH tx_raw AS (SELECT JSON_PARSE(HTTP_GET('https://reserves.prosperavest.com/api/lisk/usdt-transactions')) AS data),tx_array AS (SELECT CAST(JSON_EXTRACT(tx_raw.data, '$.transactions') AS array(json)) AS transactionsFROM tx_raw),tx_unnested AS (SELECT txFROM tx_arrayCROSS JOIN UNNEST(transactions) AS t(tx)),transactions AS (SELECTfrom_iso8601_timestamp(JSON_EXTRACT_SCALAR(tx, '$.timestamp')) AS ts,CASEWHEN JSON_EXTRACT_SCALAR(tx, '$.direction') = 'out' THEN -CAST(JSON_EXTRACT_SCALAR(tx, '$.amount') AS double)ELSE CAST(JSON_EXTRACT_SCALAR(tx, '$.amount') AS double)END AS net_amount,JSON_EXTRACT_SCALAR(tx, '$.direction') AS directionFROM tx_unnested),current_balance AS (SELECTcurrent_timestamp AS ts,CAST(regexp_replace(JSON_EXTRACT_SCALAR(JSON_PARSE(HTTP_GET('https://reserves.prosperavest.com/usdt')), '$.usdtBalance'),',','') AS double) AS net_amount,'current_balance' AS direction)SELECT ts, net_amount, directionFROM transactionsUNION ALLSELECT ts, net_amount, directionFROM current_balanceORDER BY ts;