Smart trading using crypto price difference on two markets: DEX and WaveFlow.xyz.
Oct, 24 a new application was launched on Waves: https://www.dappocean.io/dapps/waveflow. This project allows crypto holders to create and use exsiting crypto pairs for trading. The price is determined in an algorithmic way: the more popular the token is, the higher its price is set.
So, WaveFlow pricing model has no relations to DEX which is the main Waves based exchange client. That means there could be an arbitrage opportunity: traders can buy crypto asset on WaveFlow for a price P1
and sell it on DEX for a price P2
making P2 - P1
profit in a few seconds. Learn more about arbitrage at Investopedia for a better understanding if needed.
This bot is made to find the arbitrage opportunities and immediately use them doing the exchange operations on DEX and WaveFlow. Right now bot does trading operations for a pair WAVES/BTC only. Welcome any contributions =)
Bot algorithm for WAVES/BTC pair arbitrage trading is following:
functionality of waveflow_handler.get_optimum_amount():
- Getting
current_dex_price
for a pair - Determining if BTC is under- or overrated on WaveFlow and storing this value to
dest
- Finding the most profitable
amount
of WAVES to trade using reversed WaveFlow algorithm
functionality of bot.trade()
- If BTC underrated: buy BTC on WaveFlow spending
amount
WAVES -> sell BTC on DEX - If BTC overrated: buy BTC on DEX spending
amount
WAVES -> sell BTC on WaveFlow
Assume, BTC price on WaveFlow is cheaper than the price on DEX. It will stay cheaper if we spend less than amount
WAVES for buying BTC on WaveFlow. amount
is determined following the reversed WaveFlow algorithm.
We decide to sell amount
WAVES on WaveFlow and get amount/wf_price
BTC
Now we can exchange these amount/wf_price
BTC back to WAVES on DEX. The price for this will be dex_price
. We will get amount*dex_price/wf_price
WAVES from selling our BTC
The final profit will be amount*dex_price/wf_price - amount
= amount*(dex_price/wf_price - 1)
You will need Python 3.4+ to run the bot.
Please install requests
and pywaves
libraries and run trade()
function in bot.py
.
The WAVES/BTC pair is ready for the arbitrage trading. Please feel free to use this bot for "printing" money and contribute for adding new pairs like WAVES/ETH.