Rebalance

There's 2 types of rebalance:

  1. Natural Rebalance: Occurs at regular, predefined intervals. This type of rebalance is scheduled and happens automatically according to the set time periods.

  2. Early Rebalance: Triggered by severe market downturn. Specifically, this occurs when RiskON is close to going to zero as a result of breaching the threshold pre-defined in the RiskON/RiskOFF Product Specs.

The Net Token Value (NTV) calculation code is crucial in managing rebalances. It monitors the market conditions and determines when a rebalance is necessary, whether it’s a scheduled Natural Rebalance or an Early Rebalance due to market distress (such as the bankruptcy of a Risk On/Off asset).

The main actors in the rebalance operation are as follows:

  1. NTV calculation codes The NTV (Net Token Value) calculation system is an architectural masterpiece, integrating various services such as AWS SQS, AWS Lambda, Aurora Databases, and a Python engine. This system is responsible for determining when a rebalance operation should occur based on its calculations. Upon deciding a rebalance is necessary, it performs the following actions:

    • Creates a new record in the database to document the rebalance event.

    • Triggers OpenZeppelin Defender’s webhook to initiate the rebalance process.

  2. OpenZeppelin Defender

    OpenZeppelin Defender is a serverless JavaScript application hosted on AWS Lambda. It is activated by its webhook, which is triggered by the NAV calculation system. In our protocol, Defender performs the following critical tasks:

    • Executes the rebalance method on the Orchestrator Contract, initiating the rebalance operation and retrieving transaction details.

    • Calls the updateRebalanceStatus endpoint of our API to update the status of that particular rebalance in our database.

  3. API The API serves two primary use cases:

    • General Users: Provides endpoints accessible by general users, frontend applications, and flashloan bots.

    • Defender: After the rebalance transaction is confirmed on the Orchestrator Contract, Defender calls the updateRebalanceStatus endpoint to update the relevant records in the database.

  4. Token Factory Smart Contract The executeRebalance method in the Token Factory Smart Contract is invoked with the necessary parameters (encodedValues, signature). In this setup, only the Orchestrator Contract is authorized to call this method.

  5. Orchestrator Contract The Orchestrator Contract serves two main purposes: 1. Rebalance Operation: It triggers the rebalance by calling the executeRebalance method of the Token Factory with the required parameters. 2. Post-Rebalance Operations: The contract also manages operations that need to be performed after the rebalance. These operations are modular and can be added or removed as needed. An example is the Balancer Resync Operation, which adjusts the weights of RiskON/OFF assets in Balancer pools following a rebalance.

Rebalance Operation Flow

  1. NTV Calculation Code Initiates the Process:

    • The NTV calculation code updates the database with all necessary data for the upcoming rebalance.

    • It then triggers Defender’s webhook, passing the parameters required for the next rebalance.

  2. Defender Executes Rebalance:

    • Upon receiving the webhook trigger, Defender calls the rebalance method on the Orchestrator Contract.

  3. Orchestrator Contract Orchestrates the Rebalance:

    • The Orchestrator Contract invokes the executeRebalance method on the TokenFactory Contract.

    • Additionally, any other rebalance-related methods, such as resyncWeights on the Balancer, will be executed as part of the post-rebalance operations.

  4. Parameter Validation:

    • Within the executeRebalance method, the parameters are thoroughly checked for validity, especially the SequenceNumber.

    • If the SequenceNumber is valid and matches the expected value, the rebalance operation is carried out successfully.

Rebalance Math

At the outset, we divide the underlying cryptocurrency, XYZ, into two equal-value parts: RiskON and RiskOFF. As the market fluctuates, the prices of the RiskON and RiskOFF tokens diverge. However, by design, the sum of the Risk-on and Risk-off token prices always equals the price of the underlying asset. For instance, if just before rebalancing, the Risk-on token is priced higher than the Risk-off token, Risk-on investors hold more than half of the underlying value, while Risk-off investors hold less.

At the moment of rebalancing, the prices of Risk-on and Risk-off tokens are reset to equal values. To ensure the investors' total value remains the same before and after rebalancing, we adjust the number of Risk-on and Risk-off tokens each investor holds. For example, if the Risk-on price is higher than the Risk-off price before rebalancing, Risk-on investors will need to acquire some Risk-off tokens after the rebalance, as part of the Risk-on value will be redistributed into Risk-off value.

Example:

  • Initially, the XYZ token price is 100, and both Risk-on and Risk-off tokens are priced at 50.

  • Over time, the XYZ token price increases to 200, and the Risk-on token rises to 120, while the Risk-off token increases to 80 just before the rebalance.

  • After the rebalance, both the Risk-on and Risk-off token prices are reset to 100.

In this scenario:

  • A Risk-off investor holding 1 unit of Risk-off tokens, valued at 1 × 80 = 80 before rebalancing, will receive 0.8 units of the new Risk-off token, with a value of 0.8 × 100 = 80. Thus, the value before and after rebalancing remains unchanged for the Risk-off investor.

  • Similarly, a Risk-on investor holding 1 unit of Risk-on tokens, valued at 1 × 120 = 120 before rebalancing, will receive 1 unit of the new Risk-on token, valued at 1 × 100 = 100, and an additional 0.2 units of the new Risk-off token, valued at 0.2 × 100 = 20. Therefore, the total value before and after rebalancing remains the same at 120.

Mathematically, it's derived as follows:

The Rebalance Math: RiskON/RiskOFF Strategy

Assume the market prices of token X (risk-on) and Y (risk-off) at time t are PtX and PtY respectively, further assume that PtU is the market price for the underlying at time t and OPt is the market price of the option portion of token X and token Y. At the start time t=t0, we havePt0X=Pt0U/2+OPt0,Pt0Y=Pt0U/2OPt0.By our design OPt0=0 so that Pt0X=Pt0Y=Pt0U/2.As time evolves and trades happening, OPt will have a market value that is most likely not zero, and we have at any time tPtX=PtU/2+OPt, (1)PtY=PtU/2OPt, (2)PtX+PtY=PtU.Next we assume that there are a total of n investors with investor i (i=1,2,,n) at time t holds Bt,iX units of token X and Bt,iY units of token Y. The total amount of token X and token Y held by all the investors at time t areBtX=i=1nBt,iX,BtY=i=1nBt,iY.We must have BtU=BtX=BtY, where BtU is the total number of tokens of the underlying that all the investors hold.At time t=t1 the market price of token X and token Y are Pt1X and Pt1Y respectively, the market value of token X and token Y are Bt1XPt1X=Bt1UPt1X and Bt1YPt1Y=Bt1UPt1Y respectively. We want to do a rebalance of the risk-on and the risk-off token at this moment so that after the rebalance, the price of the NEW risk-on token will be equal to the price of the NEW risk-off token, i.e., right after time t1 at time t1+ we want to reset Pt1+X=Pt1+Y=Pt1+U/2.We want to know how many NEW tokens X and Y each investor is going to get after the rebalance such that the market value of his/her holdings right after the rebalance will be exactly the same as right before the rebalance.The market value of investor i’s holdings before the rebalance is Bt1,iXPt1X+Bt1,iYPt1Y.Now assume after the rebalance, investor i will get Bt1+,iX of the NEW token X and Bt1+,iY of the NEW token Y, then the total market value of investor i’s combined NEW tokens isBt1+,iXPt1+X+Bt1+,iYPt1+Y=(Bt1+,iX+Bt1+,iY)Pt1+U/2.Each investor’s market value will be kept the same before and after the rebalance, i.e.,(Bt1+,iX+Bt1+,iY)Pt1+U/2=Bt1,iXPt1X+Bt1,iYPt1Y, (3)soBt1+,iX+Bt1+,iY2=Bt1,iXst1X+Bt1,iYst1Y, (4)where st1X=Pt1XPt1+U=Pt1XPt1U and st1Y=Pt1YPt1+U=Pt1YPt1U=1st1X are the scaling factors for X and Y rebalance at time t=t1 respectively. Please note that in the above derivation, we assumed that the underlying cryptocurrency’s market price is changing continuously so that Pt1+U=Pt1U as t1+t1.The next question is how many Bt1+,iX and Bt1+,iY investor i should get after the rebalance. There can be multiple solutions. Our solution is based on the assumption that each investor will invest as much portion of his/her value to his/her original choice of risk-on or risk-off token as possible. The part that cannot be invested in his/her original choice will be put in the other instrument.For example, assume by time t=t1, the price (hence the NAV) of risk-on token is larger than the price (hence the NAV) of risk-off token, i.e., Pt1X>Pt1Y (hence Bt1XPt1X>Bt1YPt1Y), then after rebalance, all the risk-off token holders can still hold risk-off tokens since the total market value of the risk-off token is less than half of the total underlying value. In this situation, the total market value of the risk-off token investor i holds isBt1,iYPt1Y.After rebalance, the price of the NEW risk-off token isPt1+Y=Pt1+U/2.The number of the NEW risk-off tokens investor i can get for his original Bt1,iY unit of risk-off token holdings is then:Bt1+,iY=Bt1,iYPt1YPt1+Y=Bt1,iYPt1YPt1+U/2=2Bt1,iYPt1YPt1+U=2st1YBt1,iY, (5)i.e., for every unit of risk-off token holds, investor i will get 2st1Y unit of the NEW risk-off token.However, for the risk-on token holders, we will assign a total of (note that BtU=BtX=BtY holds at any time)12(Bt1XPt1XBt1YPt1Y)=12Bt1X(Pt1XPt1Y), (6)market value to risk-off tokens.For each individual investor i, the number of NEW risk-off tokens she/he will get from her/his original holdings of risk-on token Bt1,iX isBt1+,iY=Bt1,iX(Pt1XPt1Y)/2Pt1+Y=Bt1,iX(Pt1XPt1+UPt1YPt1+U)=Bt1,iX(st1Xst1Y), (7)and the total number of NEW risk-on token she/he is going to get isBt1+,iX=Bt1,iXPt1XBt1,iX(Pt1XPt1Y)/2Pt1+X=Bt1,iX(Pt1X+Pt1Y)/2Pt1+U/2=Bt1,iX, (8)i.e., the risk-on token holder (investor i) is going to get the same number of risk-on tokens as before in addition to the NEW risk-off tokens she/he is going to get as in Equation (6).The situation that the price (hence the NAV) of risk-off token is larger than the price (hence the NAV) of risk-on token by time t=t1 can be treated similarly.The final formula for the amount of the NEW risk-on and risk-off tokens for each individual investor is as follows:If Pt1XPt1Y thenBt1+,iX=Bt1,iX, (9)Bt1+,iY=2Bt1,iYst1Y+Bt1,iX(st1Xst1Y), (10)If Pt1X<Pt1Y thenBt1+,iX=2Bt1,iXst1X+Bt1,iY(st1Yst1X), (11)Bt1+,iY=Bt1,iY, (12)Or we can write more succinctly in one equation withBt1+,iX=Bt1,iXmin(2st1X,1)+Bt1,iYmax(st1Yst1X,0), (13)Bt1+,iY=Bt1,iYmin(2st1Y,1)+Bt1,iXmax(st1Xst1Y,0), (14)\begin{aligned} &\text{Assume the market prices of token X (risk-on) and Y (risk-off) at time } t \text{ are } P_t^X \text{ and } P_t^Y \text{ respectively, further assume that } P_t^U \text{ is the market price for the underlying at time } t \text{ and } OP_t \text{ is the market price of the option portion of token X and token Y. At the start time } t = t_0, \text{ we have} \\ &P_{t_0}^X = P_{t_0}^U/2 + OP_{t_0}, \\ &P_{t_0}^Y = P_{t_0}^U/2 - OP_{t_0}. \\ &\text{By our design } OP_{t_0} = 0 \text{ so that } P_{t_0}^X = P_{t_0}^Y = P_{t_0}^U/2. \\ &\text{As time evolves and trades happening, } OP_t \text{ will have a market value that is most likely not zero, and we have at any time } t \\ &P_t^X = P_t^U/2 + OP_t, \text{ (1)} \\ &P_t^Y = P_t^U/2 - OP_t, \text{ (2)} \\ &P_t^X + P_t^Y = P_t^U. \\ &\text{Next we assume that there are a total of } n \text{ investors with investor } i \text{ (} i=1,2,\cdots ,n\text{) at time } t \text{ holds } B_{t,i}^X \text{ units of token X and } B_{t,i}^Y \text{ units of token Y. The total amount of token X and token Y held by all the investors at time } t \text{ are} \\ &B_t^X = \sum_{i=1}^n B_{t,i}^X, \\ &B_t^Y = \sum_{i=1}^n B_{t,i}^Y. \\ &\text{We must have } B_t^U = B_t^X = B_t^Y, \text{ where } B_t^U \text{ is the total number of tokens of the underlying that all the investors hold.} \\ &\text{At time } t = t_1 \text{ the market price of token X and token Y are } P_{t_1}^X \text{ and } P_{t_1}^Y \text{ respectively, the market value of token X and token Y are } B_{t_1}^X P_{t_1}^X = B_{t_1}^U P_{t_1}^X \text{ and } B_{t_1}^Y P_{t_1}^Y = B_{t_1}^U P_{t_1}^Y \text{ respectively. We want to do a rebalance of the risk-on and the risk-off token at this moment so that after the rebalance, the price of the NEW risk-on token will be equal to the price of the NEW risk-off token, i.e., right after time } t_1 \text{ at time } t_{1}^+ \text{ we want to reset } \\ &P_{t_{1}^+}^X = P_{t_{1}^+}^Y = P_{t_{1}^+}^U/2. \\ &\text{We want to know how many NEW tokens X and Y each investor is going to get after the rebalance such that the market value of his/her holdings right after the rebalance will be exactly the same as right before the rebalance.} \\ &\text{The market value of investor } i\text{'s holdings before the rebalance is } \\ &B_{t_{1},i}^X P_{t_{1}}^X + B_{t_{1},i}^Y P_{t_{1}}^Y. &\text{Now assume after the rebalance, investor } i \text{ will get } B_{t_{1}^{+},i}^{X} \text{ of the NEW token X and } B_{t_{1}^{+},i}^{Y} \text{ of the NEW token Y, then the total market value of investor } i\text{’s combined NEW tokens is} \\ &B_{t_{1}^{+},i}^{X}P_{t_{1}^{+}}^{X} + B_{t_{1}^{+},i}^{Y}P_{t_{1}^{+}}^{Y} = (B_{t_{1}^{+},i}^{X} + B_{t_{1}^{+},i}^{Y})P_{t_{1}^{+}}^{U}/2. \\ &\text{Each investor’s market value will be kept the same before and after the rebalance, i.e.,} \\ &(B_{t_{1}^{+},i}^{X} + B_{t_{1}^{+},i}^{Y})P_{t_{1}^{+}}^{U}/2 = B_{t_{1},i}^{X}P_{t_{1}}^{X} + B_{t_{1},i}^{Y}P_{t_{1}}^{Y}, \text{ (3)} \\ &\text{so} \\ &\frac{B_{t_{1}^{+},i}^{X} + B_{t_{1}^{+},i}^{Y}}{2} = B_{t_{1},i}^{X}s_{t_{1}}^{X} + B_{t_{1},i}^{Y}s_{t_{1}}^{Y}, \text{ (4)} \\ &\text{where } s_{t_{1}}^{X} = \frac{P_{t_{1}}^{X}}{P_{t_{1}^{+}}^{U}} = \frac{P_{t_{1}}^{X}}{P_{t_{1}}^{U}} \text{ and } s_{t_{1}}^{Y} = \frac{P_{t_{1}}^{Y}}{P_{t_{1}^{+}}^{U}} = \frac{P_{t_{1}}^{Y}}{P_{t_{1}}^{U}} = 1-s_{t_{1}}^{X} \text{ are the scaling factors for X and Y rebalance at time } t=t_{1} \text{ respectively. Please note that in the above derivation, we assumed that the underlying cryptocurrency’s market price is changing continuously so that } P_{t_{1}^{+}}^{U} = P_{t_{1}}^{U} \text{ as } t_{1}^{+} \to t_{1}. \\ &\text{The next question is how many } B_{t_{1}^{+},i}^{X} \text{ and } B_{t_{1}^{+},i}^{Y} \text{ investor } i \text{ should get after the rebalance. There can be multiple solutions. Our solution is based on the assumption that each investor will invest as much portion of his/her value to his/her original choice of risk-on or risk-off token as possible. The part that cannot be invested in his/her original choice will be put in the other instrument.} \\ &\text{For example, assume by time } t=t_{1}, \text{ the price (hence the NAV) of risk-on token is larger than the price (hence the NAV) of risk-off token, i.e., } P_{t_{1}}^{X} > P_{t_{1}}^{Y} \text{ (hence } B_{t_{1}}^{X}P_{t_{1}}^{X} > B_{t_{1}}^{Y}P_{t_{1}}^{Y}\text{), then after rebalance, all the risk-off token holders can still hold risk-off tokens since the total market value of the risk-off token is less than half of the total underlying value. In this situation, the total market value of the risk-off token investor } i \text{ holds is} \\ &B_{t_{1},i}^{Y}P_{t_{1}}^{Y}. \\ &\text{After rebalance, the price of the NEW risk-off token is} \\ &P_{t_{1}^{+}}^{Y} = P_{t_{1}^{+}}^{U}/2. \\ &\text{The number of the NEW risk-off tokens investor } i \text{ can get for his original } B_{t_{1},i}^{Y} \text{ unit of risk-off token holdings is then:} \\ &B_{t_{1}^{+},i}^{Y} = \frac{B_{t_{1},i}^{Y}P_{t_{1}}^{Y}}{P_{t_{1}^{+}}^{Y}} = \frac{B_{t_{1},i}^{Y}P_{t_{1}}^{Y}}{P_{t_{1}^{+}}^{U}/2} = 2B_{t_{1},i}^{Y}\frac{P_{t_{1}}^{Y}}{P_{t_{1}^{+}}^{U}} = 2s_{t_{1}}^{Y}B_{t_{1},i}^{Y}, \text{ (5)} &\text{i.e., for every unit of risk-off token holds, investor } i \text{ will get } 2s_{t_{1}}^{Y} \text{ unit of the NEW risk-off token.} \\ &\text{However, for the risk-on token holders, we will assign a total of (note that } B_t^U = B_t^X = B_t^Y \text{ holds at any time)} \\ &\frac{1}{2}\left( B_{t_{1}}^{X}P_{t_{1}}^{X} - B_{t_{1}}^{Y}P_{t_{1}}^{Y} \right) = \frac{1}{2}B_{t_{1}}^{X}\left( P_{t_{1}}^{X} - P_{t_{1}}^{Y} \right), \text{ (6)} \\ &\text{market value to risk-off tokens.} \\ &\text{For each individual investor } i, \text{ the number of NEW risk-off tokens she/he will get from her/his original holdings of risk-on token } B_{t_{1},i}^{X} \text{ is} \\ &B_{t_{1}^{+},i}^{Y} = \frac{B_{t_{1},i}^{X}\left( P_{t_{1}}^{X} - P_{t_{1}}^{Y} \right)/2}{P_{t_{1}^{+}}^{Y}} = B_{t_{1},i}^{X}\left( \frac{P_{t_{1}}^{X}}{P_{t_{1}^{+}}^{U}} - \frac{P_{t_{1}}^{Y}}{P_{t_{1}^{+}}^{U}} \right) = B_{t_{1},i}^{X}(s_{t_{1}}^{X} - s_{t_{1}}^{Y}), \text{ (7)} \\ &\text{and the total number of NEW risk-on token she/he is going to get is} \\ &B_{t_{1}^{+},i}^{X} = \frac{B_{t_{1},i}^{X}P_{t_{1}}^{X} - B_{t_{1},i}^{X}\left( P_{t_{1}}^{X} - P_{t_{1}}^{Y} \right)/2}{P_{t_{1}^{+}}^{X}} = \frac{B_{t_{1},i}^{X}\left( P_{t_{1}}^{X} + P_{t_{1}}^{Y} \right)/2}{P_{t_{1}^{+}}^{U}/2} = B_{t_{1},i}^{X}, \text{ (8)} \\ &\text{i.e., the risk-on token holder (investor } i\text{) is going to get the same number of risk-on tokens as before in addition to the NEW risk-off tokens she/he is going to get as in Equation (6).} \\ &\text{The situation that the price (hence the NAV) of risk-off token is larger than the price (hence the NAV) of risk-on token by time } t=t_{1} \text{ can be treated similarly.} \\ &\text{The final formula for the amount of the NEW risk-on and risk-off tokens for each individual investor is as follows:} \\ &\text{If } P_{t_{1}}^{X} \ge P_{t_{1}}^{Y}\text{ then} \\ &B_{t_{1}^{+},i}^{X} = B_{t_{1},i}^{X}, \text{ (9)} \\ &B_{t_{1}^{+},i}^{Y} = 2B_{t_{1},i}^{Y}s_{t_{1}}^{Y} + B_{t_{1},i}^{X}(s_{t_{1}}^{X} - s_{t_{1}}^{Y}), \text{ (10)} \\ &\text{If } P_{t_{1}}^{X} < P_{t_{1}}^{Y}\text{ then} \\ &B_{t_{1}^{+},i}^{X} = 2B_{t_{1},i}^{X}s_{t_{1}}^{X} + B_{t_{1},i}^{Y}(s_{t_{1}}^{Y} - s_{t_{1}}^{X}), \text{ (11)} \\ &B_{t_{1}^{+},i}^{Y} = B_{t_{1},i}^{Y}, \text{ (12)} \\ &\text{Or we can write more succinctly in one equation with} \\ &B_{t_{1}^{+},i}^{X} = B_{t_{1},i}^{X} \min (2s_{t_{1}}^{X}, 1) + B_{t_{1},i}^{Y} \max (s_{t_{1}}^{Y} - s_{t_{1}}^{X}, 0), \text{ (13)} \\ &B_{t_{1}^{+},i}^{Y} = B_{t_{1},i}^{Y} \min (2s_{t_{1}}^{Y}, 1) + B_{t_{1},i}^{X} \max (s_{t_{1}}^{X} - s_{t_{1}}^{Y}, 0), \text{ (14)} \end{aligned}

User Balance Calculation for RiskON and RiskOFF

Assume at time t=0, invest 1 unit in risk-on token (X), i.e., B0X=B1X=1,B0Y=B1Y=0.Let B~t+X denote the net risk-on token (excludes the part that is contained in the underlying) the investor holds right after the rebalance at time t,and Bt+UX denote the total underlying token the risk-on investor holds right after the rebalance at time t.Then B~0+X=1 and B0+UX=0.The net risk-on token the investor holds, B~t+X, can be generated using the following recursive formula:B~t+X=B~t1+Xmin(2stX,2stY), (15)andBt+UX=Bt1+UX+B~t1+Xmax(0,stXstY). (16)where stX=PtXPtU is the scaling factor for risk-on token at time t, and stY=PtYPtU=1stX is thescaling factor for risk-off token at time t.stX and stY satisfy the following equation:stX+stY=1 for all t. (17)Similarly, if at time t=0, someone invests 1 unit in risk-off token (Y), i.e., B0Y=B1Y=1,B0X=B1X=0. Then B~0+Y=1 and B0+UY=0,and for time t we haveB~t+Y=B~t1+Ymin(2stX,2stY)=B~t+X, (18)andBt+UY=Bt1+UY+B~t1+Ymax(0,stYstX). (19)where Bt+UYdenote the total underlying token the risk-on investor holds right after the rebalance at time t.There are only four common numbers (same for everyone in the universe) need to be calculated andrecorded after each rebalance: stX,B~t+X,Bt+UX and Bt+UY.For any investor i, assume we know that she/he holds B~tk+,iX net risk-on token, Btk+,iUX underlying token right when she/he becomes dormant at time tk,then at time t when she/he becomes active again, investor i’s risk-on token holding net of the underlying is:B~t+,iX=B~t+XB~tk+XB~tk+,iX, (20)and her/his underlying holding is:Bt+,iUX=Bt+UXBtk+UXB~tk+XB~tk+,iX+Btk+,iUX. (21)So at time t+ (right after the rebalance at time t), investor i’s total risk-on holding is:Bt+,iX=B~t+,iX+Bt+,iUX=B~t+XB~tk+XB~tk+,iX+Bt+UXBtk+UXB~tk+XB~tk+,iX+Btk+,iUX=B~t+X+Bt+UXBtk+UXB~tk+XB~tk+,iX+Btk+,iUX (22)and her/his total risk-off token holding is:Bt+,iY=Bt+,iUX=Bt+UXBtk+UXB~tk+XB~tk+,iX+Btk+,iUX. (23)The holdings of a risk-off investor can be derived similarly. \begin{aligned} &\text{Assume at time } t=0, \text{ invest 1 unit in risk-on token (X), i.e., } B_0^X = B_1^X = 1, B_0^Y = B_1^Y = 0. \\ &\text{Let } \tilde{B}_{t^+}^X \text{ denote the net risk-on token (excludes the part that is contained in the underlying) the investor holds right after the rebalance at time } t, \\ &\text{and } B_{t^+}^{U_X} \text{ denote the total underlying token the risk-on investor holds right after the rebalance at time } t. \\ &\text{Then } \tilde{B}_{0^+}^X = 1 \text{ and } B_{0^+}^{U_X} = 0. \\ &\text{The net risk-on token the investor holds, } \tilde{B}_{t^+}^X, \text{ can be generated using the following recursive formula:}\\ &\tilde{B}_{t^+}^X = \tilde{B}_{t-1^+}^X \min(2s_t^X, 2s_t^Y), \text{ (15)} \\ &\text{and} \\ &B_{t^+}^{U_X} = B_{t-1^+}^{U_X} + \tilde{B}_{t-1^+}^X \max(0, s_t^X - s_t^Y). \text{ (16)}\\ &\text{where } s_t^X = \frac{P_t^X}{P_t^U} \text{ is the scaling factor for risk-on token at time } t, \text{ and } s_t^Y = \frac{P_t^Y}{P_t^U} = 1 - s_t^X \text{ is the} \\ &\text{scaling factor for risk-off token at time } t. \\ &s_t^X \text{ and } s_t^Y \text{ satisfy the following equation:} \\ &s_t^X + s_t^Y = 1 \text{ for all } t. \text{ (17)} \\ &\text{Similarly, if at time } t=0, \text{ someone invests 1 unit in risk-off token (Y), i.e., } \\ &B_0^Y = B_1^Y = 1, B_0^X = B_1^X = 0. \text{ Then } \tilde{B}_{0^+}^Y = 1 \text{ and } B_{0^+}^{U_Y} = 0, \\ &\text{and for time } t \text{ we have} \\ &\tilde{B}_{t^+}^Y = \tilde{B}_{t-1^+}^Y \min(2s_t^X, 2s_t^Y) = \tilde{B}_{t^+}^X, \text{ (18)} \\ &\text{and} \\ &B_{t^+}^{U_Y} = B_{t-1^+}^{U_Y} + \tilde{B}_{t-1^+}^Y \max(0, s_t^Y - s_t^X). \text{ (19)} &\text{where } B_{t^+}^{U_Y} \\ &\text{denote the total underlying token the risk-on investor holds right after the rebalance at time } t. \\ &\text{There are only four common numbers (same for everyone in the universe) need to be calculated and} \\ &\text{recorded after each rebalance: } s_t^X, \tilde{B}_{t^+}^X, B_{t^+}^{U_X} \text{ and } B_{t^+}^{U_Y}. \\ &\text{For any investor } i, \text{ assume we know that she/he holds } \tilde{B}_{t-k^+,i}^X \text{ net risk-on token, } B_{t-k^+,i}^{U_X} \\ &\text{ underlying token right when she/he becomes dormant at time } t-k, \\ &\text{then at time } t \text{ when she/he becomes active again, investor } i\text{’s risk-on token holding net of the } \\ &\text{underlying is:} \\ &\tilde{B}_{t^+,i}^X = \frac{\tilde{B}_{t^+}^X}{\tilde{B}_{t-k^+}^X}\tilde{B}_{t-k^+,i}^X, \text{ (20)} \\ &\text{and her/his underlying holding is:} \\ &B_{t^+,i}^{U_X} = \frac{B_{t^+}^{U_X} - B_{t-k^+}^{U_X}}{\tilde{B}_{t-k^+}^X}\tilde{B}_{t-k^+,i}^X + B_{t-k^+,i}^{U_X}. \text{ (21)} \\ &\text{So at time } t^+ \text{ (right after the rebalance at time } t\text{), investor } i\text{’s total risk-on holding is:} \\ &B_{{{t}^{+}},i}^{X}=\tilde{B}_{{{t}^{+}},i}^{X}+B_{{{t}^{+}},i}^{{{U}_{X}}}=\frac{\tilde{B}_{{{t}^{+}}}^{X}}{\tilde{B}_{t-{{k}^{+}}}^{X}}\tilde{B}_{t-{{k}^{+}},i}^{X}+\frac{B_{{{t}^{+}}}^{{{U}_{X}}}-B_{t-{{k}^{+}}}^{{{U}_{X}}}}{\tilde{B}_{t-{{k}^{+}}}^{X}}\tilde{B}_{t-{{k}^{+}},i}^{X}+B_{t-{{k}^{+}},i}^{{{U}_{X}}} \\ &=\frac{\tilde{B}_{{{t}^{+}}}^{X}+B_{{{t}^{+}}}^{{{U}_{X}}}-B_{t-{{k}^{+}}}^{{{U}_{X}}}}{\tilde{B}_{t-{{k}^{+}}}^{X}}\tilde{B}_{t-{{k}^{+}},i}^{X}+B_{t-{{k}^{+}},i}^{{{U}_{X}}} \text{ (22)} \\ &\text{and her/his total risk-off token holding is:} \\ &B_{t^+,i}^Y = B_{t^+,i}^{U_X} = \frac{B_{t^+}^{U_X} - B_{t-k^+}^{U_X}}{\tilde{B}_{t-k^+}^X}\tilde{B}_{t-k^+,i}^X + B_{t-k^+,i}^{U_X}. \text{ (23)} \\ &\text{The holdings of a risk-off investor can be derived similarly.} \end{aligned}

Last updated