CryptoMPT - A Solidity Implementation of Modern Portfolio Theory (MPT)
Prize Pool
Modern Portfolio Theory (MPT) is a mathematical framework used to optimize investments by balancing risk and return. MPT suggests how to allocate assets in a portfolio to achieve maximum returns for a given level of risk or minimize risk for a desired level of return. The Sharpe ratio is often used as a metric for performance in this context, representing the return-to-risk efficiency of a portfolio.
This smart contract enables storing and retrieving weekly portfolio data for multiple crypto assets, allowing for a structured record of allocations and their associated metrics like yield, volatility, and Sharpe ratio. The contract ensures only the owner can update the data, making it suitable for decentralized financial (DeFi) applications.
The project comprises of 3 mains parts:
The first uses an on-chain oracle (ChainLink) to extract historical pricing data. This step is not super trivial since this step required a couple of binary searches to find the round_ids for a certain time frame. This data then needed to be standardized and holes filled in.
Once we have enough data to calculate variance and correlations between assets, we can model how they should interact together and create portfolios that provide certain trade-offs between risk and reward.
We then select the portfolio with the best Sharpe Ratio (i.e. highest risk adjusted return) and make it available on a variety of chains so that this information can be used as building block for other DeFi operations.