Perfectly balanced, as all things should be.

-- Thanos

Initially we wanted to build it because this is something that we wanted as crypto users / investors. We all hold multiple assets and want to manage our portfolios efficiently, but the rebalancing process it quite time consuming and isn't exactly the most the simple thing in the world. Not to mention, most automated solutions don't use decentralised architecture.

As the idea developed, we realised that the rebalancing contract idea could be used in a multitude of contexts beyond managing an individual's assets and so we got stuck into making it a reality.

What it does

This implementation of the contract is called Snap.

Rebalancing your portfolio can be a difficult task, especially in a decentralised context, but Snap makes your life a little easier by letting you create rebalancing contracts (Snapfunds). Just choose your assets and split, set a time period and top it up with funds and you're on your way to a balanced crypto fund.

How we built it

We built Snap using Solidity and Vyper for the contract element, and vue for the front end.

How we data scienced

We got 10 months historic data for ETH and +10 ERC20 tokens. Ran analyses applying simple rebalancing methods on this historic data with multiple portfolios and testing it against HODL strategies. Strategies involved periodic rebalancing on multiple frequencies, as well as threshold rebalancing (when an asset in the portfolio deviates significantly from the desired allocation). More sophisticated rebalancers need to be explored and developed, and other factors such as transaction costs, tax efficiency, minimum investment amounts, as well as liquidity taken into account.

In addition we ran simulations on the historic data in order to identify correlation between assets and investigate maximum sharpe ratio and minimum volatility portfolios.

We built a prototype of a backtesting web application that allows users to choose a portfolio and multiple rebalancing parameters and backtest its performance against a HODL strategy (

Challenges we ran into

We had some major late-game drama when we ran into a vyper bug. We are using Uniswap as our decentralized exchange, and their contracts are on a rather old version of vyper. The particular issue we ran into was fixed, just two versions later. But in order to write our vyper contract in the bug-free version, we would need to update the Uniswap contracts and no matter what we threw at them the self updated version would not work. So we accepted defeat with the consolation that our vyper contract is ready, should Uniswap release an update.

Accomplishments that we're proud of

Great contracts, GIFs, memes and team <3.

What we learned

Vyper is hard.

What's next for Snapfund

We have a pretty minimum viable contract system (vyper compiler bug is kinda beyond the scope of the hack to fix) and a pretty minimum viable front end. At this point, it's a matter of updating our vyper version to a version sans bug, refactoring and doing a lot of user testing.

We'd like to make it so that this is a standardised format for rebalancing the content of a contract. We see that there are a few interesting use cases outside the one we've presented (rebalancing / trading bot for an individual). We might even tackle some of those use cases just for funnies.

Video demo from Ethcapetown during presentation:

Built With

Share this project: