-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sam bacha
authored
Feb 2, 2021
1 parent
03d6577
commit 1224774
Showing
1 changed file
with
121 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
SELECT day, sum(volume) AS volume FROM ( | ||
select date_trunc('day', block_time) AS day, sum(tokens_bought) / 1e18 as volume from curvefi."susd_v2_evt_TokenExchange" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_bought) / 1e18 as volume from curvefi."susd_v2_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."susd_v2_evt_TokenExchange" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."susd_v2_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."compound_v2_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."compound_v2_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."compound_v3_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."compound_v3_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."usdt_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."usdt_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."y_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."y_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."busd_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE bought_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."busd_evt_TokenExchangeUnderlying" as cst | ||
LEFT JOIN ethereum."transactions" tx ON cst.evt_tx_hash = tx.hash | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
|
||
UNION | ||
|
||
select date_trunc('day', evt_block_time) AS day, sum(tokens_sold) / 1e18 as volume from curvefi."dai_usdc_usdt_evt_TokenExchange" as cst | ||
WHERE sold_id = 1 | ||
|
||
GROUP BY 1 | ||
) a | ||
|
||
GROUP BY 1 | ||
ORDER BY 1 |