These are the rebalancing formulas implemented in the _calcDeltasForRatio() and _calcDeltasToClose() functions of CPMMBaseLongStrategy.sol and CPMMLongStrategy.sol.

calcDeltasToClose

calcDeltasForRatio