anomoneETH and USDC - case when query
Updated 2022-03-01
99
1
2
3
4
5
6
7
8
9
10
11
12
13
›
⌄
SELECT BALANCE_DATE,
SUM(CASE WHEN contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' THEN BALANCE ELSE 0 END) AS "USDC_Amount",
SUM(CASE WHEN contract_address = 'ETH' THEN BALANCE ELSE 0 END) AS "ETH_Amount",
SUM(CASE WHEN contract_address = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' THEN AMOUNT_USD ELSE 0 END) AS "USDC_Balance_USD",
SUM(CASE WHEN contract_address = 'ETH' THEN AMOUNT_USD ELSE 0 END) AS "ETH_Balance_USD"
FROM ethereum.erc20_balances
WHERE user_address = '0x660f6d6c9bcd08b86b50e8e53b537f2b40f243bd'
AND date_trunc('day' , balance_date ) >= TO_DATE('2021-02-13')
AND contract_address in (--'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', --WETH
'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' , --USDC
'ETH') -- Native ETH
GROUP BY BALANCE_DATE
Run a query to Download Data