scottincryptoBAL Dex Prices
Updated 2023-05-09
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
›
⌄
-- Balancer 8020 pool 0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014
-- Uniswap V3 pool 0xdc2c21f1b54ddaf39e944689a8f90cb844135cc9
with balancer8020 as (
select
block_number
, block_timestamp
, 'Bal V2 8020' as feed
, event_inputs:amountIn/1e18 as bal_amount
, event_inputs:amountOut/1e18 as weth_amount
, div0(bal_amount, weth_amount) as bal_eth_price
from ethereum.core.fact_event_logs
where contract_address = '0xba12222222228d8ba445958a75a0704d566bf2c8' -- Balancer V2 Vault
and block_timestamp >= current_date - interval'30 days'
and event_name = 'Swap'
and topics[1] = '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014' -- BAL:WETH 80:20 pool
and event_inputs:tokenIn = '0xba100000625a3754423978a60c9317c58a424e3d' -- BAL in
union all
select
block_number
, block_timestamp
, 'Bal V2 8020' as feed
, event_inputs:amountOut/1e18 as bal_amount
, event_inputs:amountIn/1e18 as weth_amount
, div0(bal_amount, weth_amount) as bal_eth_price
from ethereum.core.fact_event_logs
where contract_address = '0xba12222222228d8ba445958a75a0704d566bf2c8' -- Balancer V2 Vault
and block_timestamp >= current_date - interval'30 days'
and event_name = 'Swap'
and topics[1] = '0x5c6ee304399dbdb9c8ef030ab642b10820db8f56000200000000000000000014' -- BAL:WETH 80:20 pool
and event_inputs:tokenOut = '0xba100000625a3754423978a60c9317c58a424e3d' -- BAL out
)
, univ3 as (
select
block_number
, block_timestamp
Run a query to Download Data