Using Portfolio Optimization Methods for DeFi Yield Farming
It is a long established fact that a reader will be distracted by the readable content of a page when looking

Decentralized Finance (DeFi) plays a major role in blockchain space, especially yield farming which is a new way to earn rewards with cryptocurrency holdings using permissionless liquidity protocols. It allows anyone to earn passive income using the decentralized ecosystem of “money legos” built on a blockchain that supports smart contracts such as Ethereum, Solana or BSC.

Yield farming is a product of a mechanism called Automated Market Maker (AMM). It typically involves Liquidity Providers (LPs) and liquidity pools. Liquidity providers deposit funds into liquidity pools powered by smart contracts, and the liquidity provided powers a marketplace where users or traders can lend, borrow, or exchange tokens. The usage of these platforms typically incurs agreed upon fees, which are then paid out to liquidity providers according to their share of the liquidity pool. This is the foundation of how an AMM works.

In general, the estimated yield farming returns are calculated annualized. This estimates the return that you could expect over the course of a year. Annual Percentage Rate (APR) and Annual Percentage Yield (APY) are commonly used to measure the yield you earn within a year. Typically when users leave their funds to provide liquidity, they get rewarded with some kind of tokens. The platform allows them to claim the newly minted token whenever they like to. The difference between the APR and the APY is that APR calculates the annualized yield — assuming the rate of the token emission and price of the rewarded token stay the same — if the user had left their fund their for 365 days. The APY is slightly different, it assumes the user occasionally harvests the yield and compound it into the liquidity pool.

Most farms usually report high APRs and APYs. However there are some risks investors should consider.

Goose Finance Farm

Risks

One problem with yield farming is that investors with small funds might be at risk because founders and investors — whales — with large funds have more control over the protocol than investors with less funds.

With regards to yield farming’s architecture and tokenomics, there are some others risks factors which includes:

  • Smart Contract Risks: financial systems that are not well-designed can be subject to exploits. In the case of smart contracts, bad logic, design, or codes can have dire consequences to the money they hold
  • Composability Risks: Defi work like money legos, a smart contract may be integrated with other smart contracts, which by themselves have risks
  • Counterparty Risks (Rug Pulls): the owner of the farm can print unlimited amount of tokens and dump it on the farmers, essentially taking away all the money and paying farmers with billions/trillions of useless, printed token. This can also happen when the farm owner removes all liquidities and close away the website. The list of ways people can get rugged goes on.
  • Impermanent Loss Risks: AMMs work by balancing equal portion of two token pairs. When the price of one token decreases, the other token deposited is used to “buy the dip”, and vice versa
  • Liquidation Risks: depositing funds into a smart contract and borrowing against that collateral can be risky. If the total value of the collateral drops to a certain point, the borrower is at risk of liquidation.
  • Governance Token Price Risks: people who provide liquidity are rewarded with tokens from the farm. These tokens fluctuate in price, so the APR/APY can be misleading
  • Strategy Risks: not diversifying enough makes you exposed to all of the above risks in within one farm

Farms with higher APRs/APYs typically have higher risks, and vice versa.

A Rug Pull

Yield Optimization

At Simpli, we strive to build the next generation of Defi product by applying quantitative methods to optimize decision making on Defi investments. With the knowledge of smart contracts and data science, we are building a Yield Optimizer that aims to maximize users’ returns while minimizing the risks. The model takes into account the price fluctuations of the tokens and the farming emission rates, and uses Modern Portfolio Optimization methods to optimize yields and minimize risks.

ApeSwap Yield Farming Case Study

Ok. So you’ve entered ApeSwap to start farming. Then you notice there are dozens of farms you could enter. Which ones to choose, with what percentage of your portfolio?

By using our portfolio optimization algorithm on ApeSwap yield farming platform. In this experiment 3 yield farming pool have been selected into the portfolio to maximize yields in dollar term, while minimizing the volatility of the return. In order to achieve this goal, the actual yield in each pool has to be calculated before feeding into the portfolio optimization algorithm.

Fig 1. Actual yield for each pool for last 20 days

Actual yield takes into account the token prices, impermanent losses, as well as reward emitted. When the actual yield has been calculated this data is then ready to be optimized.

Efficient frontier of portfolio

The optimizer recommends optimal asset allocation as follows:

  • Invest in Banana-BNB pool 0%
  • Invest in Banana-BUSD pool 43.45%
  • Invest in Cake-BNB pool 56.55%

with the expected return of 122.46% yearly, and a 95% chance of 8.3% drawdown. However, the optimizer also calculates all the possible portfolio allocations and outcomes, which allows investors to be able to choose the Risk-Reward trade-off that best matches their risk profile.

About Us

Simpli Finance Lab is a Decentralized Financial (DeFi) research lab that pioneers in applying AI and Machine Learning to the Defi ecosystem. In the past few years, transactions on the blockchain through smart contracts have led to a new age of Big Data, where data is cheaply available, verifiable, and highly unified. In the traditional world of finance, a large quantity of quality data is a gold mine where businesses can utilize to supercharge their business. However, the space of quantitative modeling has been extremely competitive and has a high barrier of entry for a normal user. Hence the only benefiter of big financial data have been large financial institutions. We believe that the power of Big Data, AI and Machine Learning can build a better and fairer financial system for all in the years to come. Simpli Finance Lab will launch a series of AI-enhanced DeFi Products that allow users to have a competitive edge in the long run.

Visit our website or follow us on Twitter for more details and get latest updated.

Lorem Ipsum is simply dummy text

Simpli Finance Blogs