Pre-Sages Lab (Team 2)LVR (ETH-USDT POOL)
Updated 2025-03-09
999
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 liquidity AS (
-- select
-- *
-- from $query('b7f48f5a-ed4b-4cfa-87bb-8067d04c3fcf')
-- Where symbol = 'WETH'
-- ),
WITH liquidity AS (
SELECT
value:DT::date as DT
, value:TOTAL_TVL::float AS total_tvl
, value:SYMBOL::string AS symbol
FROM (SELECT
livequery.live.udf_api('https://flipsidecrypto.xyz/api/v1/queries/b7f48f5a-ed4b-4cfa-87bb-8067d04c3fcf/data/latest') as response
), lateral FLATTEN (input => response:data)
Where symbol = 'WETH'
),
swapping AS (
-- Extract relevant swap data from Uniswap V3 swaps table
SELECT
DATE_TRUNC('day', block_timestamp) AS block_timestamp,
tx_hash AS swap_tx,
price_0_1 AS eth_per_usdt,
amount0_adjusted AS amount_eth_adjusted,
amount1_adjusted AS amount_usdt_adjusted,
token0_price AS eth_price,
token1_price AS usdt_price,
amount0_usd AS amount_eth_in_usd,
amount1_usd AS amount_usdt_in_usd,
token0_address AS eth,
token1_address AS usdt,
--0.03% Fee tier
CASE
QueryRunArchived: QueryRun has been archived