LogoLogo
  • 👋Welcome to Cetra Finance!
  • 🏅Why Cetra?
  • 🖥️Official Links
  • ⚡Team
  • Cetra's Products
    • 🏗️Liquidity as a service
      • Problems of Yield Farming
    • 🏯Hedging module
      • The lenging module principles
    • 🧞‍♂️Market making strategy
      • Overview
      • The key concepts
      • Chamber's superpower
      • Rebalancing
      • 🌅Upcoming strategies
        • ⚖️Strategy №2
        • ✨Strategy №3
          • The basic mechanics
          • Math deep dive
          • Comparison with existing algorithms
    • 🎱Omipools Product
  • Tokenomics
    • ⚙️Utility token
  • Mass Adoption with Cetra
    • 🍾Account Abstraction
  • The delta-neutral paradigm
    • Why delta-neutrality?
    • Long and short concepts intro
  • More Information
    • ❔FAQ
    • 🌡️Risks
    • 🛡️Security
    • 💽Deployment addresses
    • 📄Whitepaper
  • Twitter
  • Github
  • Medium
Powered by GitBook
On this page
  • Position constructing
  • 1'st subPosition (borrowing notional)
  • 2'nd subPosition (borrowing asset)
  • Delta-neutrality condition
  • Generalized equation for delta of position​
  • Rebalancing
  1. Cetra's Products
  2. Market making strategy
  3. Upcoming strategies
  4. Strategy №3

Math deep dive

Position constructing

EV−equity value;DV−debt value;PV−sum value of assets in liquidity pool ,associated with position;C−collateral value;l−leverage;S−current asset price;S0−asset price at position opening;rB−borrowing rate;rY−yield farming rate;T−time from opening  Bottom indexes correspond to 1′st and 2′nd sub−positionsEV - equity\ value;\\ DV - debt\ value;\\ PV - sum\ value\ of\ assets\ in\ liquidity\ pool\ , associated\ with\ position;\\ C - collateral\ value;\\ l - leverage; \\ S - current\ asset\ price; S_{0} - asset\ price\ at\ position\ opening;\\ r_{B} - borrowing\ rate; r_{Y} - yield\ farming\ rate;\\ T - time\ from\ opening\; \\ \\ Bottom\ indexes\ correspond\ to\ 1'st\ and\ 2'nd\ sub-positionsEV−equity value;DV−debt value;PV−sum value of assets in liquidity pool ,associated with position;C−collateral value;l−leverage;S−current asset price;S0​−asset price at position opening;rB​−borrowing rate;rY​−yield farming rate;T−time from openingBottom indexes correspond to 1′st and 2′nd sub−positions

1'st subPosition (borrowing notional)

DV1=C1×(l−1)×exp{rB1×T365};PV1=C1×l×SS0;FarmingYieldValue1=C1×l×exp{rY‾×T365};Delta1=∂EV1∂S=∂PV1∂S=C1×l×12S×S0DV_{1}=C_{1}\times(l-1)\times exp\{\frac{r_{B1}\times T}{365}\};\\ PV_{1} = C_{1} \times l \times \sqrt{\frac{S}{S_{0}}};\\ Farming Yield Value_{1} = C_{1} \times l \times exp\{\frac{\overline{r_{Y}}\times T}{365}\};\\ Delta_{1} = \frac{\partial{EV_{1}}}{\partial{S}} = \frac{\partial{PV_{1}}}{\partial{S}} = C_{1} \times l \times \frac{1}{2\sqrt{S\times S_{0}}}DV1​=C1​×(l−1)×exp{365rB1​×T​};PV1​=C1​×l×S0​S​​;FarmingYieldValue1​=C1​×l×exp{365rY​​×T​};Delta1​=∂S∂EV1​​=∂S∂PV1​​=C1​×l×2S×S0​​1​

2'nd subPosition (borrowing asset)

DV2=C2×(l−1)×exp{rB2×T365}×SS0;PV2=C2×l×SS0;FarmingYieldValue2=C2×l×exp{rY‾×T365};Delta2=∂EV2∂S=∂PV2∂S=C2×l2S×S0−C2×(l−1)S0×exp{rB2×T365};DV_{2}=C_{2}\times(l-1)\times exp\{\frac{r_{B2}\times T}{365}\} \times \frac{S}{S_{0}};\\ PV_{2} = C_{2} \times l \times \sqrt{\frac{S}{S_{0}}};\\ Farming Yield Value_{2} = C_{2} \times l \times exp\{\frac{\overline{r_{Y}}\times T}{365}\};\\ Delta_{2} = \frac{\partial{EV_{2}}}{\partial{S}} = \frac{\partial{PV_{2}}}{\partial{S}} = \frac{C_{2} \times l} {2\sqrt{S\times S_{0}}} - \frac{C_{2}\times (l-1)}{S_{0}}\times exp\{\frac{r_{B2}\times T}{365}\};DV2​=C2​×(l−1)×exp{365rB2​×T​}×S0​S​;PV2​=C2​×l×S0​S​​;FarmingYieldValue2​=C2​×l×exp{365rY​​×T​};Delta2​=∂S∂EV2​​=∂S∂PV2​​=2S×S0​​C2​×l​−S0​C2​×(l−1)​×exp{365rB2​×T​};

Delta-neutrality condition

Delta=Delta1+Delta2;Delta=l×(C1+C2)2SS0−C2×(l−1)S0×exp{rB2×T365};Delta = Delta_{1} + Delta_{2};\\ Delta = \frac{l \times (C_{1}+C_{2})}{2\sqrt{S S_{0}}} - \frac{C_{2}\times (l-1)}{S_{0}}\times exp\{\frac{r_{B2}\times T}{365}\}; Delta=Delta1​+Delta2​;Delta=2SS0​​l×(C1​+C2​)​−S0​C2​×(l−1)​×exp{365rB2​×T​};

Taken Delta = 0 at opening (T=0):

that's why we put N/4 in first subPosition and 3N/4 in second.

C1C2=l−2l\frac{C_{1}}{C_{2}} = \frac{l-2}{l} C2​C1​​=ll−2​

Generalized equation for delta of position​

Delta=C×l2S0×(S0S−exp{rB2×T365})Delta = \frac{C \times l}{2S_{0}}\times(\sqrt{\frac{S_{0}}{S}} - exp\{\frac{r_{B2}\times T}{365}\})Delta=2S0​C×l​×(SS0​​​−exp{365rB2​×T​})

Rebalancing

Definitions in terms of typical LYF-protocol interface (Tulip, Francium, Alpaca, Tarot)

Position 1−position with borrowed stablecoin;Position 2−position with borrowed asset;PV1−position 1 value (in stablecoins); DV1−position 1 debt value (in stablecoins);PV2−position 2 value (in asset quantity); DV2−position 2 debt value (in asset quantity);S−spot price;Position\ 1 - position\ with\ borrowed\ stablecoin;\\ Position\ 2 - position\ with\ borrowed\ asset;\\ PV_{1} - position\ 1\ value\ (in\ stablecoins);\ DV_{1} - position\ 1\ debt\ value\ (in\ stablecoins);\\ PV_{2} - position\ 2\ value\ (in\ asset\ quantity);\ DV_{2} - position\ 2\ debt\ value\ (in\ asset\ quantity);\\ S - spot\ price;Position 1−position with borrowed stablecoin;Position 2−position with borrowed asset;PV1​−position 1 value (in stablecoins); DV1​−position 1 debt value (in stablecoins);PV2​−position 2 value (in asset quantity); DV2​−position 2 debt value (in asset quantity);S−spot price;

​

Positions' and debts' values after rebalancing:

PV1∗=PV1+ΔPV1; DV1∗=DV1+ΔDV1;PV2∗=PV2+ΔPV2; DV2∗=DV2+ΔDV2; PV_{1}^{*} = PV_{1} +\Delta PV_{1};\ DV_{1}^{*} = DV_{1} + \Delta DV_{1};\\ PV_{2}^{*} = PV_{2} +\Delta PV_{2};\ DV_{2}^{*} = DV_{2} + \Delta DV_{2};\\PV1∗​=PV1​+ΔPV1​; DV1∗​=DV1​+ΔDV1​;PV2∗​=PV2​+ΔPV2​; DV2∗​=DV2​+ΔDV2​;

How to calculate those value changes:

DV1∗PV1∗=23; (subPOS1 leverage == 3 after rabalance)DV2∗PV2∗=23; (subPOS2 leverage == 3 after rabalance)PV2∗2+PV1∗2S−DV2∗=0 (Delta−neutrality condition)ΔPV1+ΔPV2∗S−ΔDV1−ΔDV2∗S=0 (We don′t add cash from outside) \frac{DV_{1}^{*}}{PV_{1}^{*}} = \frac{2}{3};\ (subPOS1\ leverage\ ==\ 3\ after\ rabalance)\\ \frac{DV_{2}^{*}}{PV_{2}^{*}} = \frac{2}{3};\ (subPOS2\ leverage\ ==\ 3\ after\ rabalance)\\ \frac{PV_{2}^{*}}{2} + \frac{PV_{1}^{*}}{2S} - DV_{2}^{*} = 0\ (Delta-neutrality\ condition)\\ \Delta PV_{1} + \Delta PV_{2}*S - \Delta DV_{1} - \Delta DV_{2}*S =0 \ (We\ don't\ add\ cash\ from\ outside)\\PV1∗​DV1∗​​=32​; (subPOS1 leverage == 3 after rabalance)PV2∗​DV2∗​​=32​; (subPOS2 leverage == 3 after rabalance)2PV2∗​​+2SPV1∗​​−DV2∗​=0 (Delta−neutrality condition)ΔPV1​+ΔPV2​∗S−ΔDV1​−ΔDV2​∗S=0 (We don′t add cash from outside)

The result

ΔPV1=34(−13PV1−DV1+PV2×S−DV2×S)ΔDV1=12(PV1−3DV1+PV2×S−DV2×S)ΔPV2=94S(PV1−DV1+59PV2×S−DV2×S)ΔDV2=32S(PV1−DV1+PV2×S−53DV2×S)\Delta PV_{1} = \frac{3}{4}(-\frac{1}{3}PV_{1}-DV_{1}+PV_{2}\times S - DV_{2}\times S)\\ \Delta DV_{1} = \frac{1}{2}(PV_{1} - 3DV_{1} + PV_{2}\times S - DV_{2}\times S)\\ \Delta PV_{2} = \frac{9}{4S}(PV_{1} - DV_{1} + \frac{5}{9}PV_{2}\times S - DV_{2}\times S)\\ \Delta DV_{2} = \frac{3}{2S}(PV_{1} - DV_{1} + PV_{2}\times S - \frac{5}{3}DV_{2}\times S)\\ΔPV1​=43​(−31​PV1​−DV1​+PV2​×S−DV2​×S)ΔDV1​=21​(PV1​−3DV1​+PV2​×S−DV2​×S)ΔPV2​=4S9​(PV1​−DV1​+95​PV2​×S−DV2​×S)ΔDV2​=2S3​(PV1​−DV1​+PV2​×S−35​DV2​×S)

This cash flows totally define the algorythm of rebalancing in general. It can be implemented in any LYF protocol after fitting to protocol's interface.

Here is the backtesting result of sample strategy, using Francium's SOL-USD pool characteristics with 3'rd leverage:

PreviousThe basic mechanicsNextComparison with existing algorithms

Last updated 2 years ago

🧞‍♂️
🌅
✨
The up-diagonal line return is the reason, why we here!