zpokoBridges and Dexes Volume
Updated 2023-07-19
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
›
⌄
WITH bridge_volume AS (
SELECT
date AS dt,
SUM(deposit_usd) AS bridge_deposit,
SUM(withdraw_usd) AS bridge_withdraw
FROM
external.defillama.fact_bridge_volume
GROUP BY dt
),
dex_volume AS (
SELECT
date AS dt,
SUM(volume) AS dex_vol
FROM
external.defillama.fact_dex_volume
GROUP BY dt
),
price AS (
SELECT
date_trunc('day', hour) AS dt,
AVG(price) AS price
FROM
optimism.core.fact_hourly_token_prices
WHERE
symbol = 'WBTC'
GROUP BY dt
)
SELECT
bridge_volume.dt,
bridge_volume.bridge_deposit,
bridge_volume.bridge_withdraw,
dex_volume.dex_vol,
price.price,
bridge_volume.bridge_deposit / dex_volume.dex_vol AS b_d_ratio
FROM
bridge_volume
Run a query to Download Data