fmrmf
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Tick Choice Rule Outlines a strategy for maximizing expected yield on active liquidity for Uniswap-style concentrated liquidity LPs. ## TL;DR - This note gives guidance on what concentrated liquidity tick width to choose for +EV LPing with no external hedging, ideal for vaults. - Strategy consists of providing liquidity over a fixed time period, and rebalancing around the current pool tick once this time period elapses. - Rebalance swaps at the end of each period are executed through the pool itself, assuming virtual pool liquidity outside of the LP's contribution is approximately constant over the period. - Yields an optimization problem where the LP must balance gains from a larger share of pro-rata swap fees with potential losses due to a higher probability of inactive liquidity and larger rebalancing costs. i.e. Maximize with respect to half tick width $\Delta$ the value of the LP position after the next rebalance swap: $$ \mathbb{E}_0[V_{\tau}(\Delta)] $$ - Provided script [`optimize.py`](https://github.com/smolquants/kodiak-simulations-2023-07/blob/main/scripts/optimize.py) uses `scipy` to determine the solution numerically, given the complexity of full expressions. - Ignoring drift, +EV solutions appear to exist when the Uniswap V2 limit of infinite tick width is also +EV. To first order assuming GBM, this occurs when the fee volume per unit of pool virtual liquidity $\theta$ outside of the LP's own physical contribution $l$ satisfies $$ \theta > \frac{\sigma^2}{8}(l + 1) $$ - Suggested vault strategy is then relatively simple. Choose full tick width when fee volume $\theta$ is less than the bound $(\sigma^2 / 8) (l + 1)$ to minimize IL. However, when $\theta$ exceeds the bound, concentrate liquidity around the critical half tick width $\Delta_c$ (calculated by `optimize.py`) that solves $$ 0 = \partial_{\Delta} \mathbb{E}_0[V_{\tau}]|_{\Delta = \Delta_c} $$ - Using the Ethereum mainnet Uniswap V3 USDC/ETH 5 bps pool as an example, a tick width of about ~ +/- 15% around the current price [appears optimal](https://www.desmos.com/calculator/2yqi1ymgz4) under GBM assuming a 7 day rebalance period, LP providing $10M of physical liquidity to the pool with existing virtual liquidity of about $1.6B, and 24h fees of approximately $500K. Expected yield would be close to 37 bps over the 7 days. ## Intro Given a pair of tokens $(X, Y)$ an LP is comfortable providing liquidity for on [Uniswap V3](https://uniswap.org/whitepaper-v3.pdf) (or V4 in the future), what should the LP choose as their tick range to maximize expected yield? This is an inherently probabilistic question relying on the nature of the stochastic price process $p_t$ for the pool. The tradeoff the LP must consider is that a tighter tick range leads to a larger share of the currently active liquidity and thus a larger share of pro-rata swap fees. However, the downside to a tighter tick range is the higher probability of their liquidity quickly becoming inactive in addition to larger rebalancing costs (i.e. realized IL + swap fees, slippage) as price significantly deviates. I'll start general by not assuming any particular model for the stochastic price process. Then I'll focus on results for standard but unrealistic [GBM](https://en.wikipedia.org/wiki/Geometric_Brownian_motion). The LP employs a strategy of deploying liquidity in a set tick range over fixed periods of time $[t_i, t_i + \tau]$, rebalancing around the current price once another period has elapsed. The problem reduces to the LP setting an optimal half tick width $\Delta$ given a chosen rebalance period $\tau$, liquidity to deploy $l$, as well as existing pool conditions (i.e. liquidity, volume, and price history). From a vault perspective, this is easier to implement with keepers vs what I've seen from [existing work](https://crocswap.medium.com/benchmarking-the-performance-of-automated-liquidity-vault-strategies-81a6facf617b) on this topic where LPs rebalance only when price moves out of a range. The latter strategy seems prone to LPs chasing price. Gas costs are less variable in the former as one roughly knows when the rebalance transactions will happen regardless of where the price has gone. It's also easier to analyze analytically. ## Setup Assume the LP provides liquidity in a set tick range over a fixed period of time $\tau$, and rebalances to a new "optimal" tick range every time this period has elapsed. To optimize over the next period $0 \leq t < \tau$, take the LP to enter a range position at the beginning of the period between prices $[p_a, p_b]$. The LP aims to maximize their excess fee revenues relative to principal losses caused by rebalancing costs. The value of the LP's position will be the principal plus cumulative fee revenues gained over the period less swap fees and slippage incurred on the portion of principal that needs to be rebalanced at the end of the period due to swaps on the pool. For each time period $t_i \leq t < t_i + \tau$, the same optimization procedure also takes place with the LP rebalancing to a new price range $[p_{a_i}, p_{b_i}]$. I'll assume the time-dependence of the stochastic process doesn't change. I'll examine portfolio values assuming $Y$ as the quote currency. I break down the value of the portfolio at the end of the period into two components: - $\psi_{\tau}$: value of accumulated fee revenues over the period $[0, \tau]$ - $\rho_{\tau}$: value of the principal tokens used for LPing *after* performing the rebalancing swap at $\tau$ From this portfolio value expression, $$ V_{\tau} = \psi_{\tau} + \rho_{\tau} $$ I calculate the yield of the LP's portfolio value over the period. I then maximize the expected value of the yield to determine an appropriate choice of tick width. I take the LP to be providing active liquidity in an on-chain vault that does not hedge on other venues. Information the vault has access to is constained to the individual pool the LP is providing liquidity on. ## Fee Revenues The pool sees $Y$ token volume in of $v^{Y}_{t}$ with fees at fee tier $f$ taken on that volume of $$ v^{Y}_{t} f dt $$ Cumulative fees between rebalances taken by the pool are $$ \int_{0}^{\tau} dt \; v^Y_t f $$ But the LP only sees a fraction of these fees based on whether the current price is in range $p_a \leq p_t \leq p_b$ at the time the swaps occur. If not in range, the LP receives no fees. If in range, the liquidity is active and the LP receives a pro-rata share based on the existing virtual liquidity at the current tick range. Assume before the LP provides liquidity, the virtual liquidity on the pool is $L$. Virtual liquidity on the pool is taken to remain constant throughout the rebalance period, outside of the LP's actions. The LP's share of virtual liquidity after they add $\delta L$ to the pool will be $$ \frac{\delta L}{L + \delta L} $$ Further, assume token volumes in are roughly constant throughout the rebalance period, with $$ v_0 = v^{Y}_{0} \approx p_0 v^{X}_{0} $$ Taking the external active liquidity and volumes to each be roughly constant between rebalances avoids estimating liquidity and volume distributions. The LP receives fees on volume at time $t$ of $$ d\psi^{Y}_{t} = v_0 f dt \cdot \frac{\delta L}{L + \delta L} \cdot \mathbb{1}_{p_a \leq p_t \leq p_b} $$ where $\mathbb{1}_A$ is the indicator function. Assume the LP provides liquidity symmetrically around the current tick range when rebalancing, such that $$ \frac{p_b}{p_{0}} = \frac{p_{0}}{p_a} = e^{\Delta} $$ for a full tick range width of $2 \Delta$ in natural log terms. One finds their contribution to Uniswap-style virtual liquidity will be $$ \delta L = \frac{\sqrt{\delta x_0 \cdot \delta y_0}}{1-e^{-\Delta/2}} $$ for $(\delta x_0, \delta y_0)$ initial token amounts sent to the pool. $Y$ cumulative fees received by the LP at the end of the rebalance period are then $$ \psi^{Y}_{\tau} = \delta y_0 \frac{\theta}{1-e^{-\Delta/2} + l} \int_{0}^{\tau} dt \; \mathbb{1}_{p_a \leq p_t \leq p_b} $$ where I've introduced shorthand \begin{eqnarray} \theta &=& \frac{v_0 f}{L \sqrt{p_0}} \\ l &=& \frac{\delta y_0}{L \sqrt{p_0}} \end{eqnarray} for fee volume per unit of external virtual liquidity (excluding the LP) and the amount of physical tokens the LP contributes to the pool per unit of external virtual liquidity, respectively. Note that the "payoff" of the future LP fee revenues looks like a portfolio of [double digital options](https://en.wikipedia.org/wiki/Double_digital_option) with expiries at each successive time $t$ between rebalances. This is useful context when thinking through replication strategies for any derivative protocols aiming to tokenize these fee streams and sell them off to interested buyers. I assume the LP holds the accumulated fees until the end of the rebalance period, at which point they reinvest the fees into principal for the next period. Accumulated $X$ token fees are then valued at the price at the end of the rebalance period. Total value of the fees accumulated in quote terms at the end of the period will be \begin{eqnarray} \psi_{\tau} = \psi^{Y}_{\tau} + p_{\tau} \psi^{X}_{\tau} \\ \approx \psi^{Y}_{\tau} \cdot \bigg[1 + \frac{p_{\tau}}{p_0} \bigg] \end{eqnarray} given prior assumptions on volume. ## Principal Losses As a Uniswap V3 liquidity provider, token balances attributed to the LP change as price moves. At any time $t$ before the rebalance swap happens, the LP has principal token balances in the pool of \begin{eqnarray} \delta x_t &=& \delta L \bigg[\frac{1}{\sqrt{p_a}} - \frac{1}{\sqrt{p_b}}\bigg] \mathbb{1}_{p_t < p_a} + \delta L \bigg[\frac{1}{\sqrt{p_t}} - \frac{1}{\sqrt{p_b}}\bigg] \mathbb{1}_{p_a \leq p_t \leq p_b} \\ \delta y_t &=& \delta L \bigg[ \sqrt{p_b} - \sqrt{p_a} \bigg] \mathbb{1}_{p_t > p_b} + \delta L \bigg[ \sqrt{p_t} - \sqrt{p_a} \bigg] \mathbb{1}_{p_a \leq p_t \leq p_b} \end{eqnarray} At rebalance time $\tau$, the LP removes all of their liquidity and swaps a portion of the returned principal through the same pool. The LP then adds the rebalanced liquidity to the pool. I assume arbitraguers immediately return the price back to its pre-swap value of $p_{\tau}$, after the LP rebalances but prior to the LP adding liquidity again to simplify things. Post rebalance swap, the LP holds token balances of \begin{eqnarray} \delta x_{\tau'} &=& \delta x_{\tau} + \epsilon^X_{\tau} \cdot \mathbb{1}_{p_{\tau} > 0} - \epsilon^X_{\tau} (1+f) \cdot \mathbb{1}_{p_{\tau} > 0} \\ \delta y_{\tau'} &=& \delta y_{\tau} - \epsilon^Y_{\tau} (1+f) \cdot \mathbb{1}_{p_{\tau} > 0} + \epsilon^Y_{\tau} \cdot \mathbb{1}_{p_{\tau} < 0} \end{eqnarray} Principal balances after the swap must satisfy $$ p_{\tau} \delta x_{\tau'} = \delta y_{\tau'} $$ for the LP to rebalance around the current price at the end of the period. The LP removes their full liquidity contribution then swaps through the remaining external virtual liquidity $L$. The pool pre- and post-swap obeys the Uniswap invariant \begin{eqnarray} L^2 &=& \tilde{x}_{\tau} \tilde{y}_{\tau} \\ &=& (\tilde{x}_{\tau} \mp \epsilon^X_{\tau})(\tilde{y}_{\tau} \pm \epsilon^Y_{\tau}) \end{eqnarray} where \begin{eqnarray} \tilde{x}_{\tau} &=& \frac{L}{\sqrt{p_{\tau}}} \\ \tilde{y}_{\tau} &=& L \sqrt{p_{\tau}} \end{eqnarray} are virtual token balances ignoring possible changes in external liquidity distribution between ticks (roughly ok for smaller LP sizes). $\pm, \mp$ signs are dictated by whether $p_{\tau} > p_0$ or $p_{\tau} < p_0$. Expanding terms to second order in $f, (\epsilon / \tilde{x}), (\delta x / x)$, I find $$ \frac{\delta y_{\tau'}}{\tilde{y}_{\tau}} \approx \frac{1}{2} \bigg[ \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} + \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} \bigg] - \frac{1}{2} \bigg| \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} - \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} \bigg| \bigg[ \frac{f}{2} + \frac{1}{4} \bigg| \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} - \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} \bigg| \bigg] $$ and \begin{eqnarray} \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} + \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} = l \bigg[ e^{\Delta/2} + 1 \bigg]\bigg[\mathbb{1}_{p_{\tau} < p_a} \sqrt{\frac{p_{\tau}}{p_0}} + \mathbb{1}_{p_{\tau} > p_b} \sqrt{\frac{p_0}{p_{\tau}}} \bigg] \nonumber \\ + \mathbb{1}_{p_a \leq p_{\tau} \leq p_b} \frac{l}{1-e^{-\Delta / 2}} \bigg[ 2 - e^{-\Delta/2} \bigg( \sqrt{\frac{p_0}{p_{\tau}}} + \sqrt{\frac{p_{\tau}}{p_0}} \bigg) \bigg] \end{eqnarray} \begin{eqnarray} \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} - \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} = l \bigg[ e^{\Delta/2} + 1 \bigg]\bigg[\mathbb{1}_{p_{\tau} > p_b} \sqrt{\frac{p_0}{p_{\tau}}} - \mathbb{1}_{p_{\tau} < p_a} \sqrt{\frac{p_{\tau}}{p_0}} \bigg] \nonumber \\ + \mathbb{1}_{p_a \leq p_{\tau} \leq p_b} \frac{l}{e^{\Delta / 2}-1} \bigg[ \sqrt{\frac{p_{\tau}}{p_0}} - \sqrt{\frac{p_0}{p_{\tau}}} \bigg] \end{eqnarray} This leads to a principal value at the end of the period post-swap of $$ \rho_{\tau} \approx \tilde{y}_{\tau} \bigg\{ \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} + \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} - \bigg| \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} - \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} \bigg| \bigg[ \frac{f}{2} + \frac{1}{4} \bigg| \frac{\delta y_{\tau}}{\tilde{y}_{\tau}} - \frac{\delta x_{\tau}}{\tilde{x}_{\tau}} \bigg| \bigg] \bigg\} $$ Each term represents - $\delta y_{\tau} + p_{\tau} \delta x_{\tau}$: principal before rebalancing - $-(f/2) \cdot |\delta y_{\tau} - p_{\tau} \delta x_{\tau}|$: swap fees paid on rebalance - $-|\delta y_{\tau} - p_{\tau} \delta x_{\tau}|^2 / (4\tilde{y}_{\tau})$: slippage paid on rebalance ## EV for LPs The LP optimizes their expected gains at the end of the period from information known at the beginning of the period $\mathcal{F}_0$, i.e. $$ \mathbb{E}_0[V_{\tau}] $$ Assume the price process abides by GBM \begin{eqnarray} dp_{t} &=& \mu p_t dt + \sigma p_t dW_t \\ p_t &=& p_0 e^{\mu't + \sigma W_t} \\ \mu' &=& \mu - \sigma^2 / 2 \end{eqnarray} where $W_t$ is a [Wiener process](https://en.wikipedia.org/wiki/Wiener_process). I'll make use of the identity that the expectation of the indicator function is the probability of the associated event occurring, as e.g. \begin{eqnarray} \mathbb{E}_0[\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}] &=& \mathbb{P}_0[-\Delta \leq \ln (p_{\tau} / p_0) \leq \Delta] \\ &=& \Phi \bigg(\frac{\Delta - \mu' \tau}{\sigma \sqrt{\tau}} \bigg) - \Phi \bigg(\frac{-\Delta - \mu' \tau}{\sigma \sqrt{\tau}} \bigg) \end{eqnarray} $\Phi(z)$ is the standard [normal CDF](https://en.wikipedia.org/wiki/Normal_distribution). To simplify expressions, let \begin{eqnarray} d^{+}_{t} &=& \frac{\Delta - \mu' t}{\sigma \sqrt{t}} \\ d^{-}_{t} &=& \frac{-\Delta - \mu' t}{\sigma \sqrt{t}} \end{eqnarray} I find for the fee revenue term (see Appendix A) \begin{eqnarray} \mathbb{E}_0[\psi_{\tau}] = \delta y_0 \frac{\theta}{1-e^{-\Delta/2} + l} \int_{0}^{\tau} dt \; \bigg\{ \Phi (d^{+}_{t}) - \Phi (d^{-}_{t}) \nonumber \\ + e^{\mu \tau} \bigg[ \Phi (d^{+}_{t} - \sigma \sqrt{t}) - \Phi (d^{-}_{t} - \sigma \sqrt{t}) \bigg] \bigg\} \end{eqnarray} and below for the principal value terms (see Appendix B). Principal before rebalance swap: \begin{eqnarray} \mathbb{E}_{0} [\delta y_{\tau} + p_{\tau} \delta x_{\tau}] \nonumber \\ = \delta y_0 \bigg\{ \bigg[e^{\Delta/2} + 1 \bigg] \bigg[ e^{\mu \tau} \Phi(d^{-}_{\tau} - \sigma \sqrt{\tau}) + 1 - \Phi(d^{+}_{\tau}) \bigg] \nonumber \\ + \frac{1}{1 - e^{-\Delta/2}} \bigg[ 2 e^{\frac{1}{2}(\mu - \frac{1}{4}\sigma^2)\tau} \bigg( \Phi(d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi(d^{-}_{\tau} - \sigma \sqrt{\tau}/2) \bigg) \nonumber \\ - e^{-\Delta/2} \bigg( \Phi (d^{+}_{\tau}) - \Phi (d^{-}_{\tau}) + e^{\mu \tau} [ \Phi(d^{+}_{\tau} - \sigma \sqrt{\tau}) - \Phi(d^{-}_{\tau} - \sigma \sqrt{\tau}) ] \bigg) \bigg] \bigg\} \end{eqnarray} Swap fees paid on rebalance: \begin{eqnarray} \mathbb{E}_{0} [-(f/2) \cdot |\delta y_{\tau} - p_{\tau} \delta x_{\tau}|] \nonumber \\ = - \delta y_0 \cdot (f/2) \bigg\{ \bigg[e^{\Delta/2} + 1 \bigg] \bigg[ e^{\mu \tau} \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) + 1 - \Phi (d^{+}_{\tau}) \bigg] \nonumber \\ + \frac{1}{e^{\Delta/2} - 1} \bigg[ e^{\mu \tau} \bigg( \Phi(d^{+}_{\tau} - \sigma \sqrt{\tau}) + \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) \nonumber \\ - 2 \Phi (-\mu'\tau/(\sigma \sqrt{\tau}) - \sigma \sqrt{\tau}) \bigg) \nonumber \\ + 2 \Phi (-\mu'\tau/(\sigma \sqrt{\tau})) - \Phi (d^{+}_{\tau}) - \Phi (d^{-}_{\tau}) \bigg] \bigg\} \end{eqnarray} Slippage paid on rebalance: \begin{eqnarray} \mathbb{E}_{0} [-|\delta y_{\tau} - p_{\tau} \delta x_{\tau}|^2 / (4\tilde{y}_{\tau})] \nonumber \\ = - \delta y_0 \cdot (l/4) e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2)\tau} \bigg\{ \bigg[ e^{\Delta / 2} + 1 \bigg]^2 \bigg[ e^{-\mu \tau} \bigg( 1 - \Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2) \bigg) \nonumber \\ + e^{\mu \tau} \Phi (d^{-}_{\tau} - 3\sigma \sqrt{\tau}/2) \bigg] \nonumber \\ \frac{1}{[e^{\Delta/2} - 1]^2} \bigg[ e^{\mu \tau} \bigg( \Phi (d^{+}_{\tau} - 3\sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - 3\sigma\sqrt{\tau}/2) \bigg) \nonumber \\ + e^{-\mu \tau} \bigg( \Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} + \sigma \sqrt{\tau}/2) \bigg) \nonumber \\ - 2 e^{-\frac{1}{2}\sigma^2 \tau} \bigg( \Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau} / 2) \bigg) \bigg] \bigg\} \end{eqnarray} Hard to have clarity about these expressions from just looking at them. Desmos plots make life easier: <iframe src="https://www.desmos.com/calculator/2yqi1ymgz4?embed" width="500" height="500" style="border: 1px solid #ccc" frameborder=0></iframe> Solid black line is the expected LP value $\mathbb{E}_{0}[V_{\tau}]$ at the end of the period as a function of half tick width $\Delta$, given strategist set parameters for liquidity provided $l$ and rebalance period length $\tau$ as well as assumed pool fee volume $\theta$. Solid blue line is the associated expected yield relative to initial principal $y_{\tau} = \mathbb{E}_{0}[V_{\tau}] / V_{0} - 1$. This is also given as a function of half tick width $\Delta$, but scaled by a multiplier of 100 to express in percentage points. Optimization for half tick width choice reduces to finding the critical point $\Delta_c$ $$ 0 = \partial_{\Delta} \mathbb{E}_0[V_{\tau}]|_{\Delta = \Delta_c} $$ at which the yield peaks. Script [`optimize.py`](https://github.com/smolquants/kodiak-simulations-2023-07/blob/main/scripts/optimize.py) in the Kodiak simulations repo uses the `scipy.optimize` package to find this value. When ignoring drift $\mu = 0$, expected yield appears to peak with the same sign as expected yield when $\Delta \to \infty$. In the Uniswap V2 limit with zero drift, expected yield is positive when fee volume exceeds $$ \frac{l+1}{\tau} \bigg[ 1 - e^{-\frac{1}{8}\sigma^2\tau} \bigg] $$ or to first order $$ \theta > \frac{\sigma^2}{8}(l + 1) $$ I used the Ethereum mainnet [Uniswap V3 USDC/ETH 5 bps pool](https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640) history to [fit](https://github.com/smolquants/kodiak-simulations-2023-07/blob/main/notebook/analysis.ipynb) and set parameters in the Desmos plot above, ignoring drift param results. For a 7 day rebalance period providing about $10M of physical liquidity to a pool with virtual liquidity of about $1.6B and assuming 24h fees of about $500K, a tick width of approximately `0.14 * 2 / log(1.0001) = 2800` (i.e. ~ +/- 15% around current price) appears optimal under GBM with an expected yield at the end of the period after rebalancing of 37 bps. ## References - [Uniswap v3 Core (Adams et. al 2021)](https://uniswap.org/whitepaper-v3.pdf) - [A Guide for Choosing Optimal Uniswap V3 LP Positions, Part 2 (Lambert 2021)](https://lambert-guillaume.medium.com/a-guide-for-choosing-optimal-uniswap-v3-lp-positions-part-2-4a94b0a12886) - [Benchmarking the Performance of Automated Liquidity Vault Strategies (0xfbifemboy 2022)](https://crocswap.medium.com/benchmarking-the-performance-of-automated-liquidity-vault-strategies-81a6facf617b) - [Liquidity Provider Strategies for Uniswap: Liquidity Rebalancing (Atis E 2023)](https://atise.medium.com/liquidity-provider-strategies-for-uniswap-liquidity-rebalancing-f4430eec63a0) ## Appendix ### A. Derivation of $\mathbb{E}_0[\psi_{\tau}]$ Need to take the expectation of $$ \mathbb{E}_0[\psi_{\tau}] = \delta y_0 \frac{\theta}{1-e^{-\Delta/2} + l} \int_{0}^{\tau} dt \; \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_t \leq p_b} \cdot (1 - p_{\tau}/p_0)] $$ From earlier assumptions of GBM $$ p_{\tau} / p_0 = e^{\mu' \tau + \sigma W_{\tau}} $$ and symmetric LP tick range \begin{eqnarray} \mathbb{1}_{p_a \leq p_t \leq p_b} &=& \mathbb{1}_{-\Delta \leq \ln (p_t/p_0) \leq \Delta} \nonumber \\ &=& \mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} \end{eqnarray} Which means \begin{eqnarray} \mathbb{E}_0[\psi_{\tau}] = \delta y_0 \frac{\theta}{1-e^{-\Delta/2} + l} \nonumber \\ \int_{0}^{\tau} dt \; \bigg\{ \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}}] - e^{\mu' \tau} \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma W_{\tau}}] \bigg\} \end{eqnarray} But given the Gaussian increments of the Wiener process, \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}}] = \mathbb{P}_{0}\bigg[\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}\bigg] \nonumber \\ = \Phi \bigg(\frac{\Delta - \mu' t}{\sigma \sqrt{t}} \bigg) - \Phi \bigg(\frac{-\Delta - \mu' t}{\sigma \sqrt{t}} \bigg) \nonumber \\ = \Phi (d^{+}_t) - \Phi (d^{-}_t) \end{eqnarray} Need to be a bit more careful with the second term to separate out independent r.v.s. Using Wiener process properties of stationary and independent increments \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma W_{\tau}}] &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma (W_{\tau} - W_{t} + W_{t})}] \nonumber \\ &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma W_t} e^{\sigma W_{\tau-t}}] \nonumber \\ &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma W_t}] \cdot \mathbb{E}_0[e^{\sigma W_{\tau-t}}] \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 (\tau - t)} \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' t}{\sigma} \leq W_t \leq \frac{\Delta - \mu' t}{\sigma}} e^{\sigma W_t}] \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 (\tau - t)} \int_{d^{-}_t}^{d^{+}_t} \; \frac{dz}{\sqrt{2 \pi}} e^{-\frac{1}{2}z^2 + \sigma \sqrt{t}z} \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 (\tau - t)} \int_{d^{-}_t}^{d^{+}_t} \; \frac{dz}{\sqrt{2 \pi}} e^{-\frac{1}{2}(z^2 - 2 \sigma \sqrt{t}z + \sigma^2 t - \sigma^2 t)} \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 \tau} \int_{d^{-}_t}^{d^{+}_t} \; \frac{dz}{\sqrt{2 \pi}} e^{-\frac{1}{2}(z-\sigma \sqrt{t})^2} \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 \tau} \int_{d^{-}_t - \sigma \sqrt{t}}^{d^{+}_t - \sigma \sqrt{t}} \; \frac{dz'}{\sqrt{2 \pi}} e^{-\frac{1}{2}{z'}^2} \nonumber \\ &=& e^{\frac{1}{2}\sigma^2 \tau} \bigg[ \Phi (d^{+}_t - \sigma \sqrt{t}) - \Phi (d^{-}_t - \sigma \sqrt{t}) \bigg] \end{eqnarray} Leads to \begin{eqnarray} \mathbb{E}_0[\psi_{\tau}] = \delta y_0 \frac{\theta}{1-e^{-\Delta/2} + l} \nonumber \\ \int_{0}^{\tau} dt \; \bigg\{ \Phi (d^{+}_t) - \Phi (d^{-}_t) - e^{\mu \tau} \bigg[ \Phi (d^{+}_t - \sigma \sqrt{t}) - \Phi (d^{-}_t - \sigma \sqrt{t}) \bigg] \bigg\} \end{eqnarray} ### B. Derivation of $\mathbb{E}_0[\rho_{\tau}]$ To second order in $f, (\epsilon / \tilde{x}), (\delta x / x)$, have $$ \mathbb{E}_0 [\rho_{\tau}] \approx \mathbb{E}_0[\delta y_{\tau} + p_{\tau} \delta x_{\tau}] - \mathbb{E}_0 [(f/2) \cdot |\delta y_{\tau} - p_{\tau} \delta x_{\tau}|] - \mathbb{E}_0 [|\delta y_{\tau} - p_{\tau} \delta x_{\tau}|^2 / (4\tilde{y}_{\tau})] $$ I'll divide into separate sections for each term. #### Principal before rebalancing From the end of principal losses section, \begin{eqnarray} \mathbb{E}_0[\delta y_{\tau} + p_{\tau} \delta x_{\tau}] = \delta y_0 \mathbb{E}_0 \bigg[ \bigg[ e^{\Delta/2} + 1 \bigg]\bigg[\mathbb{1}_{p_{\tau} < p_a} \frac{p_{\tau}}{p_0} + \mathbb{1}_{p_{\tau} > p_b} \bigg] \nonumber \\ + \frac{\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}}{1-e^{-\Delta / 2}} \bigg[ 2 \sqrt{\frac{p_{\tau}}{p_0}} - e^{-\Delta/2} \bigg( 1 + \frac{p_{\tau}}{p_0} \bigg) \bigg] \bigg] \nonumber \\ = \delta y_0 \bigg\{ \bigg[ e^{\Delta/2} + 1 \bigg]\bigg[ \mathbb{E}_0[\mathbb{1}_{p_{\tau} < p_a} (p_{\tau}/p_0)] + \mathbb{E}_0 [\mathbb{1}_{p_{\tau} > p_b}] \bigg] \nonumber \\ + \frac{1}{1-e^{-\Delta / 2}} \bigg[ 2 \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}\sqrt{p_{\tau}/p_0}] - e^{-\Delta/2} \mathbb{E}_0[\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}(1 + p_{\tau}/p_0)] \bigg] \bigg\} \end{eqnarray} as $\tilde{y}_{\tau} l = \delta y_0 \sqrt{p_{\tau}/p_0}$. Taking each expectation separately, \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{p_{\tau} > p_b}] &=& \mathbb{P}_0 [p_{\tau} > p_b] \nonumber \\ &=& \mathbb{P}_0 [\ln(p_{\tau}/p_0) > \Delta] \nonumber \\ &=& \mathbb{P}_0 [W_{\tau} > (\Delta - \mu' \tau) / \sigma] \nonumber \\ &=& 1 - \mathbb{P}_0 [W_{\tau} \leq (\Delta - \mu' \tau) / \sigma] \nonumber \\ &=& 1 - \Phi(d^{+}_{\tau}) \end{eqnarray} \begin{eqnarray} \mathbb{E}_0[\mathbb{1}_{p_{\tau} < p_a} (p_{\tau}/p_0)] &=& \mathbb{E}_0 \bigg[ \mathbb{1}_{W_{\tau} < (-\Delta-\mu'\tau)/\sigma} e^{\mu' \tau + \sigma W_{\tau}} \bigg] \nonumber \\ &=& e^{\mu' \tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \sigma \sqrt{t} z} \nonumber \\ &=& e^{\mu' \tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z^2 - 2 \sigma \sqrt{t} z + \sigma^2 \tau - \sigma^2 \tau)} \nonumber \\ &=& e^{\mu \tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z - \sigma \sqrt{\tau})^2} \nonumber \\ &=& e^{\mu \tau} \int_{-\infty}^{d^{-}_{\tau} - \sigma \sqrt{\tau}} \; \frac{dz'}{\sqrt{2\pi}} e^{-\frac{1}{2}{z'}^2} \nonumber \\ &=& e^{\mu \tau} \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) \end{eqnarray} \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}\sqrt{p_{\tau}/p_0}] &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta-\mu'\tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} e^{\frac{1}{2}(\mu' \tau + \sigma W_{\tau})}] \nonumber \\ &=& e^{\frac{1}{2}\mu' \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \frac{1}{2}\sigma \sqrt{\tau}z} \nonumber \\ &=& e^{\frac{1}{2}\mu' \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z^2 - \sigma \sqrt{\tau}z + \frac{1}{4}\sigma^2 \tau - \frac{1}{4} \sigma^2 \tau)} \nonumber \\ &=& e^{\frac{1}{2}(\mu - \frac{1}{2}\sigma^2) \tau + \frac{1}{8}\sigma^2 \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z-\frac{1}{2}\sigma\sqrt{\tau})^2} \nonumber \\ &=& e^{\frac{1}{2}(\mu - \frac{1}{4}\sigma^2) \tau} \int_{d^{-}_{\tau} - \frac{1}{2} \sigma \sqrt{\tau}}^{d^{+}_{\tau} - \frac{1}{2} \sigma \sqrt{\tau}} \; \frac{dz'}{\sqrt{2\pi}} e^{-\frac{1}{2}{z'}^2} \nonumber \\ &=& e^{\frac{1}{2}(\mu - \frac{1}{4}\sigma^2) \tau} [ \Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}/2) ] \end{eqnarray} \begin{eqnarray} \mathbb{E}_0[\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}(1 + p_{\tau}/p_0)] &=& \mathbb{E}_0[\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}}(1 + e^{\mu' \tau + \sigma W_{\tau}})] \nonumber \\ &=& \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu' \tau}\mathbb{E}_0[\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}}e^{\sigma W_{\tau}}] \nonumber \\ &=& \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu' \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \sigma \sqrt{\tau}z} \nonumber \\ &=& \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu' \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z^2 + \sigma \sqrt{\tau}z + \sigma^2 \tau - \sigma^2 \tau)} \nonumber \\ &=& \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z-\sigma \sqrt{\tau})^2} \nonumber \\ &=& \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu \tau} [ \Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) ] \end{eqnarray} Leads to \begin{eqnarray} \mathbb{E}_0[\delta y_{\tau} + p_{\tau} \delta x_{\tau}] = \delta y_0 \bigg\{ \bigg[ e^{\Delta/2} + 1 \bigg]\bigg[ e^{\mu \tau} \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) + 1 - \Phi(d^{+}_{\tau}) \bigg] \nonumber \\ + \frac{1}{1-e^{-\Delta / 2}} \bigg[ 2 e^{\frac{1}{2}(\mu - \frac{1}{4}\sigma^2) \tau} [ \Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}/2) ] \nonumber \\ - e^{-\Delta/2} \bigg( \Phi(d^{+}_{\tau}) - \Phi(d^{-}_{\tau}) + e^{\mu \tau} [ \Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) ] \bigg) \bigg] \bigg\} \end{eqnarray} #### Swap fees paid on rebalance Also have at the end of principal losses section, \begin{eqnarray} \mathbb{E}_0 [-(f/2) \cdot |\delta y_{\tau} - p_{\tau} \delta x_{\tau}|] \nonumber \\ = - \delta y_0 \cdot (f/2) \mathbb{E}_0 \bigg[\bigg|\bigg[ e^{\Delta/2} + 1 \bigg]\bigg[\mathbb{1}_{p_{\tau} > p_b} - \mathbb{1}_{p_{\tau} < p_a} \frac{p_{\tau}}{p_0} \bigg] \nonumber \\ + \mathbb{1}_{p_a \leq p_{\tau} \leq p_b} \frac{1}{e^{\Delta / 2}-1} \bigg[ \frac{p_{\tau}}{p_0} - 1\bigg] \bigg| \bigg] \nonumber \\ = - \delta y_0 \cdot (f/2) \bigg\{ \bigg[ e^{\Delta / 2} + 1 \bigg] \bigg[ \mathbb{E}_0[\mathbb{1}_{p_{\tau} > p_b}] + \mathbb{E}_0[\mathbb{1}_{p_{\tau} < p_a}(p_{\tau} / p_0)] \bigg] \nonumber \\ + \frac{1}{e^{\Delta / 2}-1} \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} \cdot |p_{\tau}/p_0 - 1|] \bigg\} \end{eqnarray} First two expectations can be found in the prior section. Last expectation separates into two terms $$ \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} \cdot |p_{\tau}/p_0 - 1|] = \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_0} \cdot (1 - p_{\tau}/p_0)] + \mathbb{E}_0 [\mathbb{1}_{p_0 \leq p_{\tau} \leq p_b} \cdot (p_{\tau}/p_0 - 1)] $$ which individually evaluate to \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{p_a \leq p_{\tau} \leq p_0} \cdot (1 - p_{\tau}/p_0)] &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq -\frac{\mu' \tau}{\sigma}} \cdot (1 - e^{\mu' \tau + \sigma W_{\tau}})] \nonumber \\ &=& \mathbb{E}_0 [\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq -\frac{\mu' \tau}{\sigma}}] - e^{\mu' \tau} \mathbb{E}_0[\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq - \frac{\mu' \tau}{\sigma}} e^{\sigma W_{\tau}}] \nonumber \\ &=& \Phi (-\mu' \sqrt{\tau}/\sigma) - \Phi (d^{-}_{\tau}) - e^{\mu' \tau} \int_{d^{-}_{\tau}}^{-\mu' \sqrt{\tau}/\sigma} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \sigma \sqrt{\tau}z} \nonumber \\ &=& \Phi (-\mu' \sqrt{\tau}/\sigma) - \Phi (d^{-}_{\tau}) - e^{\mu \tau} \int_{d^{-}_{\tau}}^{-\mu' \sqrt{\tau}/\sigma} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z - \sigma \sqrt{\tau})^2} \nonumber \\ &=& \Phi (-\mu' \sqrt{\tau}/\sigma) - \Phi (d^{-}_{\tau}) - e^{\mu \tau} [\Phi (-\mu' \sqrt{\tau}/\sigma - \sigma \sqrt{\tau}) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau})] \end{eqnarray} \begin{eqnarray} \mathbb{E}_0 [\mathbb{1}_{p_0 \leq p_{\tau} \leq p_b} \cdot (p_{\tau}/p_0 - 1)] &=& \mathbb{E}_0 [\mathbb{1}_{-\frac{\mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} \cdot (e^{\mu' \tau + \sigma W_{\tau}} - 1)] \nonumber \\ &=& e^{\mu' \tau} \mathbb{E}_0 [\mathbb{1}_{-\frac{\mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} e^{\sigma W_{\tau}}] - [\Phi(d^{+}_{\tau}) - \Phi (-\mu' \sqrt{\tau}/\sigma) ] \nonumber \\ &=& e^{\mu' \tau} \int^{d^{+}_{\tau}}_{-\mu'\sqrt{\tau}/\sigma} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \sigma \sqrt{\tau} z} - [\Phi(d^{+}_{\tau}) - \Phi (-\mu' \sqrt{\tau}/\sigma) ] \nonumber \\ &=& e^{\mu \tau} [\Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}) - \Phi (-\mu'\sqrt{\tau}/\sigma - \sigma \sqrt{\tau})] - [\Phi(d^{+}_{\tau}) - \Phi (-\mu' \sqrt{\tau}/\sigma) ] \end{eqnarray} Leads to \begin{eqnarray} \mathbb{E}_0 [-(f/2) \cdot |\delta y_{\tau} - p_{\tau} \delta x_{\tau}|] \nonumber \\ = - \delta y_0 \cdot (f/2) \bigg\{ \bigg[ e^{\Delta / 2} + 1 \bigg] \bigg[ 1 - \Phi (d^{+}_{\tau}) + e^{\mu\tau} \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) \bigg] \nonumber \\ + \frac{1}{e^{\Delta / 2}-1} \bigg[ 2 \Phi (-\mu' \sqrt{\tau}/\sigma) - \Phi (d^{+}_{\tau}) - \Phi (d^{-}_{\tau}) \nonumber \\ + e^{\mu \tau} \bigg(\Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}) + \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}) - 2\Phi (-\mu' \sqrt{\tau}/\sigma - \sigma \sqrt{\tau}) \bigg) \bigg] \bigg\} \end{eqnarray} #### Slippage paid on rebalance Finally, \begin{eqnarray} \mathbb{E}_{0} [-|\delta y_{\tau} - p_{\tau} \delta x_{\tau}|^2 / (4\tilde{y}_{\tau})] \nonumber \\ = - \delta y_0 \cdot (l/4) \mathbb{E}_{0} \bigg[ \sqrt{\frac{p_{\tau}}{p_0}} \bigg\{ \bigg[ e^{\Delta/2} + 1 \bigg]^2 \bigg[\mathbb{1}_{p_{\tau} > p_b} \frac{p_0}{p_{\tau}} + \mathbb{1}_{p_{\tau} < p_a} \frac{p_{\tau}}{p_0} \bigg] \nonumber \\ + \frac{\mathbb{1}_{p_a \leq p_{\tau} \leq p_b}}{[e^{\Delta / 2}-1]^2} \bigg[ \sqrt{\frac{p_{\tau}}{p_0}} - \sqrt{\frac{p_0}{p_{\tau}}} \bigg]^2 \bigg\} \bigg] \nonumber \\ = - \delta y_0 \cdot (l/4) \bigg\{ \bigg[ e^{\Delta/2} + 1 \bigg]^2 \bigg[\mathbb{E}_{0} [\mathbb{1}_{p_{\tau} > p_b} (p_0/p_{\tau})^{1/2}] + \mathbb{E}_{0} [ \mathbb{1}_{p_{\tau} < p_a} (p_{\tau}/p_0)^{3/2}] \bigg] \nonumber \\ + \frac{1}{[e^{\Delta / 2}-1]^2} \bigg[ \mathbb{E}_{0} [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_{\tau}/p_0)^{3/2}] + \mathbb{E}_{0} [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_0/p_{\tau})^{1/2}] \nonumber \\ - 2 \mathbb{E}_{0} [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_{\tau}/p_0)^{1/2}] \bigg] \bigg\} \end{eqnarray} Taking expectations separately, \begin{eqnarray} \mathbb{E}_{0} [\mathbb{1}_{p_{\tau} > p_b} (p_0/p_{\tau})^{1/2}] &=& \mathbb{E}_{0} [\mathbb{1}_{W_{\tau} > \frac{\Delta - \mu' \tau}{\sigma}} e^{-\frac{1}{2}\mu'\tau - \frac{1}{2}\sigma W_{\tau}}] \nonumber \\ &=& e^{-\frac{1}{2}\mu'\tau} \int_{d^{+}_{\tau}}^{\infty} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 - \frac{1}{2} \sigma \sqrt{\tau}z} \nonumber \\ &=& e^{-\frac{1}{2}\mu'\tau} \int_{d^{+}_{\tau}}^{\infty} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2} (z^2 + \sigma \sqrt{\tau}z + \frac{1}{4} \sigma^2 \tau - \frac{1}{4} \sigma^2 \tau)} \nonumber \\ &=& e^{-\frac{1}{2}(\mu - \frac{1}{2}\sigma^2)\tau + \frac{1}{8}\sigma^2 \tau} \int_{d^{+}_{\tau}}^{\infty} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2} (z+\frac{1}{2}\sigma \sqrt{\tau})^2} \nonumber \\ &=& e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2) \tau} e^{-\mu\tau} [1 - \Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2)] \end{eqnarray} \begin{eqnarray} \mathbb{E}_{0} [ \mathbb{1}_{p_{\tau} < p_a} (p_{\tau}/p_0)^{3/2}] &=& e^{\frac{3}{2}\mu'\tau} \mathbb{E}_{0} [ \mathbb{1}_{W_{\tau} < \frac{-\Delta - \mu' \tau}{\sigma}} e^{\frac{3}{2}\sigma W_{\tau}} ] \nonumber \\ &=& e^{\frac{3}{2}\mu'\tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \frac{3}{2}\sigma \sqrt{\tau}z} \nonumber \\ &=& e^{\frac{3}{2}\mu'\tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z^2 - 3\sigma \sqrt{\tau}z + \frac{9}{4} \sigma^2 \tau - \frac{9}{4} \sigma^2 \tau)} \nonumber \\ &=& e^{\frac{3}{2}(\mu - \frac{1}{2}\sigma^2)\tau + \frac{9}{8} \sigma^2 \tau} \int_{-\infty}^{d^{-}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z-3\sigma\sqrt{\tau}/2)^2} \nonumber \\ &=& e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2)\tau} e^{\mu \tau} \Phi (d^{-}_{\tau} - 3\sigma \sqrt{\tau}/2) \end{eqnarray} \begin{eqnarray} \mathbb{E}_{0} [ \mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_{\tau}/p_0)^{3/2}] &=& e^{\frac{3}{2}\mu'\tau} \mathbb{E}_{0} [\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} e^{\frac{3}{2}\sigma W_{\tau}} ] \nonumber \\ &=& e^{\frac{3}{2}\mu'\tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \frac{3}{2}\sigma \sqrt{\tau}z} \nonumber \\ &=& e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2)\tau} e^{\mu \tau} [\Phi (d^{+}_{\tau} - 3\sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - 3\sigma \sqrt{\tau}/2)] \end{eqnarray} \begin{eqnarray} \mathbb{E}_{0} [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_0/p_{\tau})^{1/2}] &=& \mathbb{E}_{0} [\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} e^{-\frac{1}{2}\mu'\tau - \frac{1}{2}\sigma W_{\tau}}] \nonumber \\ &=& e^{-\frac{1}{2}\mu'\tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 - \frac{1}{2} \sigma \sqrt{\tau}z} \nonumber \\ &=& e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2) \tau} e^{-\mu\tau} [\Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} + \sigma \sqrt{\tau}/2)] \end{eqnarray} \begin{eqnarray} \mathbb{E}_{0} [\mathbb{1}_{p_a \leq p_{\tau} \leq p_b} (p_{\tau}/p_0)^{1/2}] &=& \mathbb{E}_{0} [\mathbb{1}_{\frac{-\Delta - \mu' \tau}{\sigma} \leq W_{\tau} \leq \frac{\Delta - \mu' \tau}{\sigma}} e^{\frac{1}{2}\mu'\tau + \frac{1}{2}\sigma W_{\tau}}] \nonumber \\ &=& e^{\frac{1}{2}\mu'\tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}z^2 + \frac{1}{2} \sigma \sqrt{\tau}z} \nonumber \\ &=& e^{\frac{1}{2}\mu'\tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z^2 - \sigma \sqrt{\tau}z + \frac{1}{4}\sigma^2 \tau - \frac{1}{4}\sigma^2 \tau )} \nonumber \\ &=& e^{\frac{1}{2}(\mu - \frac{1}{2}\sigma^2)\tau + \frac{1}{8}\sigma^2 \tau} \int_{d^{-}_{\tau}}^{d^{+}_{\tau}} \; \frac{dz}{\sqrt{2\pi}} e^{-\frac{1}{2}(z - \sigma \sqrt{\tau}/2 )^2} \nonumber \\ &=& e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2)\tau} e^{- \frac{1}{2}\sigma^2 \tau} [\Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}/2)] \end{eqnarray} Leads to \begin{eqnarray} \mathbb{E}_{0} [-|\delta y_{\tau} - p_{\tau} \delta x_{\tau}|^2 / (4\tilde{y}_{\tau})] \nonumber \\ = - \delta y_0 \cdot (l/4) e^{\frac{1}{2}(\mu + \frac{3}{4}\sigma^2) \tau} \nonumber \\ \bigg\{ \bigg[ e^{\Delta/2} + 1 \bigg]^2 \bigg[e^{-\mu\tau} [1 - \Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2)] + e^{\mu \tau} \Phi (d^{-}_{\tau} - 3\sigma \sqrt{\tau}/2) \bigg] \nonumber \\ + \frac{1}{[e^{\Delta / 2}-1]^2} \bigg[ e^{\mu \tau} [\Phi (d^{+}_{\tau} - 3\sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - 3\sigma \sqrt{\tau}/2)] \nonumber \\ + e^{-\mu\tau} [\Phi (d^{+}_{\tau} + \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} + \sigma \sqrt{\tau}/2)] \nonumber \\ - 2 e^{- \frac{1}{2}\sigma^2 \tau} [\Phi (d^{+}_{\tau} - \sigma \sqrt{\tau}/2) - \Phi (d^{-}_{\tau} - \sigma \sqrt{\tau}/2)] \bigg] \bigg\} \end{eqnarray}

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully