AurelianLabsLVR Framework for LP-er
Updated 2024-09-02
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
›
⌄
-- Target One Pool first, (WETH - USDC/USDT?)
-- 1. Daily Volume
-- 2. Liquidity Information
-- For single trade, we can take LVR = a(p - q)
-- And also LVR = σ²/8
-- So, we need to get few stuffs
-- a, Quantity of asset traded (in terms of what?) -> Get from blockchain, SQL
-- p, Market/CEX Price -> Get from ??? API? Minutes, Hours, or Daily?
-- q, AMM Price -> Get from blockchain, SQL
-- σ, Volatility -> Further derivation is needed
-- Volatility
-- Importantly, here we are getting HISTORICAL/Realized volatility, not Implied Volatility (future).
-- 1. Take daily closing price of the asset.
-- 2. Calculate Percentage change from one day to the next.
-- 3. Daily Return (%) = (Todays Closing Price - Yesterday Closing price) / Yesterday Closing Price * 100%
-- 4. Calculate average daily return
-- 5. Calculate standard deviation of daily return -> This is the volatility.
WITH initial_LP_deposit as (
SELECT
amount0_adjusted / amount1_adjusted as real_price,
*
FROM ethereum.uniswapv3.ez_lp_actions
--WHERE ez_lp_actions_id = 'dcc0a955a918568cb55bd608e0e89b97'
WHERE tx_hash ='0x0e878ef9068fe28e3b4ede4ecce7552d7a6b85f82e4ce9eabad1134aa18c2ae1'
),
hourly_ethereum_price as (
SELECT
hour,
open,
high,
low,
QueryRunArchived: QueryRun has been archived