Lessons learned: how we tried to build a trading bot on EtherDelta.

Alexis - -
IBBC.io
Published in
3 min readSep 14, 2018

About EtherDelta

EtherDelta is a decentralized trading platform, meaning that customers can exchange ERC20 tokens without any central authority or third party holding customers funds.

Some ERC20 tokens are only available on EtherDelta (especially after an ICO), which is key in the success of the platform. EtherDelta is among the 150 biggest exchanges in the world (source: coinmarketcap.com)

Let’s avoid the tutorial part on how to subscribe and use EtherDelta. Having played with it during two months, I wouldn’t advice anybody to buy a coin using EtherDelta.

Every order placed is converted into a smart contract. For more information about how works decentralized exchanges and how works trading through the smart contract technology, see Hackernoon’s article: https://hackernoon.com/understanding-decentralized-exchanges-51b70ed3fe67

Building a trading bot

What we could see on the EtherDelta UI gave us some ideas.

EtherDelta interface (with an arbitrage opportunity)

For exemple, we saw here someone ready to sell some GRX token @0.013405 and someone else ready to buy the same token at a price equal to 0.0136 ETH.

The price difference seen could lead to an arbitrage, a profit without any loss risk.

With some Ethers, we could buy GRX tokens and sell them right after while making a profit.

Testing this manually actually led to profit (less than 5 dollars, but still we could consider it a successful proof of concept, waiting to be scaled)

Having spotted these opportunities, me and my fellow developers decided to play with EtherDelta API (javascript code), and built a little bot, that would detect and execute arbitration opportunities.

Unfortunately, reproduce the simple steps we did manually using the API happened to be impossible. Mainly because what we see in the UI is not often refreshed (same for the API), and some of the available orders that we see on the interface are actually executed since a long time (more than one minute).

But we just couldn’t stop there.

Market-making strategy

Noticing that the difference between the best bid price (highest buying price) and the ask price (lowest selling price) was usually high (a lot higher than the fees), we decided to try market making.

The idea is simple: buy low, sell high. The market-maker benefits from the bid-ask difference (called “spread”), to place buy orders right above the highest ones and sell orders right below the lowest ones, and waits for the orders to be taken by someone.

The potential risk of this strategy comes from market volatility. If you place a buy order to buy some token at 2 dollars, someone takes it, and later the market moves down and the highest selling price is 1 dollar, it means that you can’t sell your tokens (previously bought 2 dollars) at a better price than 1 dollar.

Simple market making strategy to benefit from the spread

Again, we tested manually, and again we won at our first try a few dollars from it. We build a bot that followed this exact strategy. But opportunities were rare (the number of daily trades done per coin is low), and the risk was too big (high coin price volatility) to cover the possible gains.

Conclusion

Test your proofs of concept twice.

About us

IBBC is a community of crypto-enthusiasts looking for the next big thing. If you want to follow us and get access to more reviews, feel free to visit our space: https://medium.com/ibbc-io

Important: Never invest money you can’t afford to lose. Always do your own research and due diligence before placing a trade. Read our Terms & Conditions here.

--

--