Created
September 30, 2020 06:04
-
-
Save Vergan-star/6dc7e6273fbe430e73c53bdee0514de1 to your computer and use it in GitHub Desktop.
btc_volume
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH deposits as | |
( | |
SELECT | |
block_time, | |
sum(e.value/1e18 * p.price) as vol | |
FROM erc20."ERC20_evt_Transfer" e | |
LEFT JOIN ethereum."transactions" tx ON evt_tx_hash = tx.hash | |
INNER JOIN prices."layer1_usd_btc" p ON p.minute = date_trunc('minute', block_time) | |
WHERE e."contract_address" = '\x8dAEBADE922dF735c38C80C7eBD708Af50815fAa' -- tBTC contract address | |
AND e."from" = '\x0000000000000000000000000000000000000000' | |
GROUP BY 1 | |
ORDER BY 1 desc | |
) | |
SELECT | |
sum(vol) as "Cumulative BTC Deposit Volume" | |
FROM deposits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment