# Automated Market Making of Collateral Rebalancing Pool Collateral pools of many DeFi platforms typically comprise a single asset reflecting a borrower’s crypto ownership and risk appetite. While single asset pools benefit from asset appreciation, a pool's value can diminish swiftly in volatile market conditions. The increasing chance of default and potential shortening of the loan term affect both borrowers and lenders who enter fixed-term and fixed-rate contract hoping to remove uncertainties. Unlike many DeFi platforms, ALEX uses diversified rather than single collateral pools. Diversified pools consist of a risky asset and risk-free asset. As a result, diversified pools reduce default risk while maintaining potential upside gains. Diversified pools are similar to portfolios with equity and government bonds, where the former represents the risky asset while the latter represents the risk-free asset. Importantly, diversified collateral pools are systematically managed. An algorithmic engine dynamically adjusts the split of the risky and risk-free asset in the diversified pool, based on Black-Scholes' model. ALEX's algorithmic engine and diversified pools minimize the risk of a borrower defaulting. The result is a smoother lending and borrowing experience. Parties have more peace of mind, are interrupted less frequently, and achieve robust returns even in volatile market conditions. This represents a radical improvement over existing alternatives. ## Introduction Protocols for loanable funds \(PLF\) enable borrowing and lending activities. Examples PLFs are Compound and Aave on Ethereum. The lender provides a token in need and earns interest in return. The borrower deposits collateral and gets access to a preferred asset. The borrower must pay back the borrowed asset in due time. Protocols enabling this borrowing and lending functionality are incredibly useful. Simply, they enable the present consumption on future earnings. This idea is powerful, and has been at the core of DeFi's rise, including the rise of protocols such as Uniswap. However, one of the risks posed to market participants in existing PLFs is default risk. While each loan must be secured with collateral, the price of crypto collateral can fluctuate wildly and quickly. As a result, many PLFs ask borrows to significantly overcollateralise their positions. Overcollateralisation refers to value of collateralised assets being higher than the value of the loaned assets. The proportion of the collateral value to loaned value is often called "collateralisation ratio" \(CR\), the inverse of "loan to value" \(LTV\). For simplicity sake, we use the term LTV throughout the paper. The higher the LTV is, the more likely the default occurs. A LTV larger than 1 means the value of collateral cannot cover the value of the loaned asset. In variable rate platforms, such as Aave, collateral in the form of more liquid assets tends to have a higher LTV. In fixed-rate fixed-term protocols, such as YieldSpace, using ETH as collateral to borrow Dai requires a LTV of 67%. In the event that the portfolio is underfunded, three scenarios could emerge in the existing protocols: \(i\) a borrower could top up the collateral asset to stay afloat; \(ii\) a borrower could return some of the borrowing asset to decrease the LTV; and \(iii\) the loan could be unwound by a third party such as liquidator if the borrower defaults. A third party unwinds a borrower's position by paying back the loan, and in return earns certain fees. In cases when a collateral asset is illiquid, fees can be as high as 15% on Aave, representing a significant penalty to defaulting borrowers. This also poses disruption to borrowing/lending activity, as a pre-agreed loan is terminated early. ALEX abolishes liquidation. ALEX keeps the loan active until maturity, regardless of market condition, solving problems plaguing many existing PLFs. The basis for ALEX's superior solution is based on an innovative combination of asset management and collateral pools. This is how it works. First, unlike many others, ALEX does not use a static collateral pool with a single asset. Instead, ALEX maintains robust performance in the collateral pool by splitting the deposited asset between a risky and a riskless asset. The collateral pool systematically rebalances the allocation of these two assets based on market conditions. Typically, the better the performance of one asset relative to the other asset, the higher its relative allocation. In mathematical terms, weight is calculated and modified from option delta derived from Black-Scholes model. So the collateral pool consists of two assets. This opens up new opportunities. For example, ALEX can enable borrowers to gain additional income by engaging in automated market marking \(AMM\). Automated market making helps guarantee a constant proportion of assets in the collateral pool. The AMM takes the form a geometric mean, made popular by [Balancer](https://balancer.fi/whitepaper.pdf). The notion that users _get paid_ is different from much of conventional finance, where portfolio holders are typically required to pay fees to rebalance the portfolio. Importantly, in market downturns, a risky asset may constantly depreciate. In these cases, ALEX's relative allocation of a riskless asset will gradually increase by design. In the event of a loan close to being under-collateralized or defaulting, ALEX converts the remaining portion of the risky asset so that only the riskless asset remains. This ensures no interruption to borrowing/lending activities. Similarly, the agreed rate and maturity remains unaffected. This is different from liquidation. In other platforms, liquidations usually unwind the loan partially, or even fully, resulting in the early termination of a loan. ALEX's design allows for borrowing and lending activity to unfold without the interruptions that plague many of ALEX's alternatives. ## Two-Asset Collateral Pool: Rationale Most loanable funds assume a single asset in the collateral pool. While this type of pool benefits when prices of collateral assets appreciate, a pool's value can depreciate rapidly when volatility is large and prices of collateral assets plummet. In conventional finance, whether or not to hold a risky asset depends on investors' risk appetite and their perception of the market environment. A "risk on" market environment entices investors to purchase risky assets and to seek larger returns. In our view, collateral pools made up of single assets are more suitable during "risk on" environments. In these environments, "risk-seeking" borrowers worry less about defaulting and believe risky assets will rally further. This contrasts with "risk-off" environments, when market uncertainty increases. Investors become more risk-averse and tend to hold riskless assets which exhibit small volatility and smaller return. Many investors would like to profit in both "risk on" and "risk off" periods by holding a diversified portfolio comprised of both risky and riskless assets. A typical example is a portfolio consisting of an S&P 500 index and of US Treasury bonds. Diversification is essential to portfolio management. Diversification ensures portfolios are not overly exposed to one specific asset. Diversifications reduces unsystematic risk. Thus, diversification is a core reason why ALEX creates collateral pools with more than one asset: diversified collateral pools reduce pool volatility while enhancing returns. ## AMM: Geometric Mean Market Maker AMMs are the key drivers behind many DeFi trading platforms. We discuss its general features in our [first white paper](https://docs.alexgo.io/whitepaper/automated-market-making-of-alex). Our AMM design adopts a "generalised mean market maker". This design is powerful because it incorporates time to maturity features while aligning various AMM derivations with traditional financial pricing theory. In the collateral pool, as weights of the underlying assets change regularly, we employ an AMM which has embedded weights in its expression: the geometric mean market maker \(GMMM\). Each weight of the GMMM corresponds to the proportion of a relevant asset's value to the whole portfolio's value. This is a desirable property for any portfolio manager who sets target weights for a portfolio's assets. GMMMs were first introduced by Balancer. A GMMM represents an extension to the AMM of the popular AMM platform Uniswap. Uniswap's AMM is a special case of Balancer's GMMM by imposing weights of 50% each on two assets in a given pool. Mathematically, a GMMM consisting of two assets can be expressed as follows: $$ x(t)^{w_{x}(t)}\times y(t)^{w_{y}(t)}=L(t) $$ where $$x(t)$$ and $$y(t)$$ are the balance of the risky asset and the riskless asset respectively, whereas $$w_{x}(t)$$ and $$w_{y}(t)$$ are the corresponding weights and $$w_{x}(t)+w_{y}(t)=1$$. $$L(t)$$ is the invariant constant, which remains unchanged when weights are fixed in between rebalancing time. Prices $$p_{x}(t)$$ and $$p_{y}(t)$$, which share the same numeraire such as USD, satisfy the following no-arbitrage condition: $$ \frac{\frac{y(t)}{w_{y}(t)}}{\frac{x(t)}{w_{x}(t)}}=\frac{p_{x}(t)}{p_{y}(t)} $$ Denote the pool value as $$v(t)=x(t)p_{x}(t)+y(t)p_{y}(t)$$. Combining with a no-arbitrage condition, we can show that: $$ \begin{split} w_{x}(t)&=\frac{x(t)p_{x}(t)}{v(t)}\\ w_{y}(t)&=\frac{y(t)p_{y}(t)}{v(t)}\\ \end{split} $$ This means that a pool's weight represents the underlying asset value in proportion to the pool's value. Lastly, GMMM is related to the generalised mean AMM employed in the Yield Token Pool by setting $$w_{x}(t)=w_{y}(t)=0.5$$ because: $$ \lim_{p\rightarrow0}\left[w_{x}(t)x(t)^{p}+w_{y}(t)y(t)^{p}\right]^{\frac{1}{p}}=x(t)^{w_{x}(t)}y(t)^{w_{y}(t)} $$ ## Rebalancing Set-up and Collateral Pool Valuation In conventional finance, rebalancing results in updated allocation of underlying assets without altering the portfolio value. However, this is not the case when an AMM is implemented in DeFi. The portfolio value changes reflecting the effort in preserving the price, while adjusting the invariant function with the newly calibrated weights. Assume the loan is borrowed at time 0 and returned at time T. There are k-1 rebalancing events throughout the life time of the loan, $$t_{1},t_{2},\cdots,t_{k-1}$$ , satisfying $$0=t_{0}