The Trading Strategy team won in the TheGraph category in the EthLisbon hackathon in Lisbon blockchain week in October 2021.
What did we build
Our team created a prototype of an ETH-USDC trading strategy that accrues interest in Aave's USDC lending pool while a trade position is not open. We backtested using USDC-ETH trading data from Uniswap. When the algorithm closes the trading position, or sells its ETH, the resulting USDC is immediately deposited in to the Aave pool in the same smart contract transaction. No single heartbeat of accrued interest is missed. The usage of "money legos" is specific to decentralised finance and such capital efficiency optimisations would not be possible in the traditional finance world.
We backtested this using Trading Strategy protocol's DEX backtesting data and historical Aave lending rates obtained using TheGraph protocol. The backtest was performed on a "double 7" trading strategy - an old stock market trading strategy. Double 7 is not very efficient, but very easy to understand, making it suitable for demonstrations like this.
Once live on the protocol, the strategy is investable by anyone. Trading Strategy oracle network feeds the smart contract with trading instructions. For the EthLisbon hackathon, the live trading happened using 1inch order aggregator on Polygon mainnet.
See the EthLisbon hackathon demo page for more information.
TheGraph is the "indexer protocol" for blockchains. While a developer can easily extract raw transactions over Ethereum JSON-RPC protocol, for any non-trivial use case more complex queries than "give me all transactions" need to be performed. In our case, we had to query historical Aave lending rates for backtesting. Because Aave pools offer variable index rates which may fluctuate wildly, we had to query this data down one-day accuracy.
By using TheGraph, and the existing Aave Subgraph, we managed to fetch the data in one working day instead of spending a lot of time to come up with our own historical lending rate indexing method.
By using Aave DeFi integration, we managed to boost the strategy's performance from 17% profit to 21% profit. See the EthLisbon hackathon page with the backtested performance numbers.
As many hackathon participants confirmed, the Polygon mainnet can act as the new testnet. Because the fees on Polygon mainnet are so low and you can do trades down to the fractions of $0.0000000000001, there is no need to go to a specific testnet. Furthermore, the Polygon mainnet has all the main DeFi legos deployed (USDC, Aave, Curve, 1inch, Quickswap) so a developer does not need to spend time to deploy or mock these services.
Our only grief was that Aave Subgraph is poorly documented and we had to reverse engineer the existing Aavescan service to understand how to perform the query.
Please follow the development of the Trading Strategy protocol in our Discord. Currently, we are aiming to have the first private live trading going on in December 2021. We are also raising a seed round, so if you are a DeFi angel please reach out to the team members in our Discord.
Thank you for the hard work
Our team members were
Trading Strategy is an algorithmic trading protocol for decentralised markets, enabling automated trading on decentralised exchanges (DEXs). Learn more about algorithmic trading here.
Join our community of traders and developers on Discord.