Updated 2023-05-23
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
›
⌄
-- forked from 04 @ https://flipsidecrypto.xyz/edit/queries/b9e6a432-8d24-4b6e-b02f-944d3db855dc
-- forked from 02 @ https://flipsidecrypto.xyz/edit/queries/618dca8c-8959-4b93-b4a4-54f370e4b158
-- forked from 01 @ https://flipsidecrypto.xyz/edit/queries/a284fb20-0315-49a2-95ce-d402efd50321
-- --- ARB = 'ibc/10E5E5B06D78FFBB61FD9F89209DEE5FD4446ED0550CBB8E3747DA79E10D9DC6'
with
price_token AS
(
SELECT
date_trunc( 'day' , a.recorded_hour ) AS date
, avg( a.price ) AS price_usd
, a.symbol AS token_name
, a.currency AS token_address
FROM
osmosis.core.ez_prices a
GROUP BY
1 , 3 , 4
)
SELECT
sum( ( a.from_amount / power( 10 , a.from_decimal ) ) * b.price_usd ) AS swap_from_ARB
, b.token_name AS token_names
FROM
osmosis.core.fact_swaps a
INNER JOIN
price_token b
ON
date_trunc( 'day' , a.block_timestamp ) = b.date
AND a.from_currency = b.token_address
Run a query to Download Data