Arbitrage opportunities allow traders to purchase a cryptocurrency on a difference exchange where cryptocurrency’s price has not adjusted according to major crypto exchanges. These opportunities are considered to be low-risk.
Why is there a price difference between various cryptocurrency exchanges?
Cryptocurrency and stock markets are not perfectly efficient which leads multitude of arbitrage opportunities. There are so many cryptocurrency exchanges and due to that, arbitrage traders can benefit from price differences across exchanges.
When bid price for one crypto asset on one exchange is higher than asking price on another cryptocurrency exchange, this creates a perfect arbitrage opportunity. Large price differences between exchanges can also emerge due to large buy or sell orders.
For example: Stellar Lumens (XLM) trades on both Coinbase Pro and Stellar decentralized exchange. On a given day, let’s say that the price of XLM on Coinbase Pro is $0.11 while on Stellar decentralized exchange like Stellarport, the price is $0.108. This means, a trader can purchase XLM on Stellar exchange and sell it on Coinbase for profit of $0.002 per XLM ($0.11 – $0.108).
Liquidity and Market Making
Before you start arbitraging, you must take liquidity of that exchange into account.
Liquidity refers to the ease with which you can trade any crypto asset for another asset without affecting price of that crypto asset. If there is high price slippage, this means liquidity is poor. Similarly, if price slippage is low, then liquidity is said to be good.
High and Low liquidity
Lower liquidity means less price stability of that crypto asset. Flash crashes are common whenever you are trading an asset with low liquidity.
High liquid markets are manipulation resistant. Large buy or sell orders have small effect on the price. This also helps increasing accuracy of technical analysis. Charts look better and it is easier to form strategies for trading that crypto asset.
To avoid low liquidity, price manipulation by bad actors, market making is done. A market maker provides liquidity to ensure high liquidity, higher trading volume and lower probability of price manipulation.
How is Market Making done?
Market making is usually provided by bot(s) by providing bid and ask limit orders on cryptocurrency exchanges. A bid price is always less than ask price. Example: if bid price of BTC is $10950 and ask price is $11000, giving it a spread of $50. If my buy order at $10950 is filled and I am able to sell it immediately at $11000, then I have just made a profit of $50.
In a trade, maker and taker are involved. Whenever you want a bid to be filled by seller, it should be equal to or above the current bid. These maker orders refer to liquidity. More the bids, better the liquidity.
Fees also play an important part. Since most exchanges want to provide high liquidity, they charge higher fees on taker orders (ask bids) compared to maker orders. In many cases, centralized cryptocurrency exchanges charge 0% on maker orders and around 0.75% on taker orders.
Stellar decentralized exchanges do not charge any maker or taker fees. The only fees involved are transaction fees that is 100 stroops (0.00001 XLM).
What is Kelp bot and how you can make use of it?
Kelp https://kelpbot.io/ is an open-source trading bot for Stellar decentralized exchanges as-well-as for the centralized exchanges like Binance, Bittrex, Coinbase Pro and so on.
You can use Kelp bot to benefit from arbitrage opportunities. For instance, if price of Bitcoin decreases on Binance, you can setup a bot to decrease price on Stellar DEX, thus allowing you to profit from this trade.
You can also use Kelp to create liquidity for a Stellar token that trades on Stellar decentralized exchanges like Stellarport, Stellarterm, StellarX etc. In similar fashion, you can use Kelp for doing market making for a stablecoin. Depending on your usecase, you can adopt Sell, BuySell, Balanced, Pendulum or Mirror strategy.
Setting up Kelp bot
Kelp bot is available for all desktop platforms. This includes Mac OS Darwin (64-bit), Windows (64-bit) and Linux (64-bit, 64-bit ARM, 32-bit arm5/6/7). Find the latest release on Kelp’s Github page.
It is also possible to compile directly from source. Windows users are suggested to use Bash Shell to work in UNIX environment. This is required to run bash scripts correctly. Find more information about compiling here.
Some crypto assets are illiquid and this means dealing with volatile assets. This means you should be extremely careful with what token you choose for bot trading. There is no guarantee of profit and in many cases, you might lose money. It is suggested to check the token’s website and whitepaper before deploying your bot.
Transaction costs or trading fees must be kept in mind when doing arbitrage trades manually or using bots. For instance, trading fees on Coinbase Pro are much higher compared to ones on a Stellar decentralized exchange like Stellarterm.com or StellarPort.io.
Transaction costs must be kept in mind when buying and selling assets on exchanges. If the difference is negligible, then you may or may not make any profit due to trading fees.
Kelp Bot in Action
We made a new Stellar token called “MOON” with fixed supply of 100 tokens. Our team set up a bot called SU to create liquidity and promote price discovery of our token “MOON”.
We used the balanced configuration for this. Once you have downloaded the latest release from their github page, unzip it. You will find an executable file, kelp.exe and some pre-configured bots. You can edit them with any text editing app. We chose Notepad++ for this, which is quite popular among coders.
Developer of this amazing bot, Nikhil Saraf, has provided detailed explanation of each variable. Now, all you have to do is change the values according to your wish and save the configuration file. We renamed the sample_balanced.cfg to stellarupdate.cfg.
Contents of stellarupdate bot
# Stellar Update bot
# what % deviation from the ideal price is allowed before we reset the price, specified as a decimal (0 < PRICE_TOLERANCE < 1.00)
# what % deviation from the ideal amount is allowed before we reset the price, specified as a decimal (0 < AMOUNT_TOLERANCE < 1.00)
# define the bid/ask spread that you are willing to provide. spread is a percentage specified as a decimal number (0 < spread < 1.00) - here it is 0.1%
# reduces the order size by this percentage (specified as a decimal number). if someone buys and sells the full order amount placed you will end up with a profit equaling this percentage multiplied by the full order amount, effectively making this a spread.
MIN_AMOUNT_SPREAD = 0.0005
MAX_AMOUNT_SPREAD = 0.0005
# max number of levels to have on either side. Defines how deep of an orderbook you want to make.
MAX_LEVELS = 25
# value between 0.0 to 1.0 used as a probability of adding orders at a given price level. Setting this to 1.0 will give a more jagged look to the orderbook.
LEVEL_DENSITY = 1.0
# always adds the first N levels. If your LEVEL_DENSITY is < 1.0 then this will ensure you have your first N levels at the "tip" of the orderbook on either side.
ENSURE_FIRST_N_LEVELS = 10
# if the LEVEL_DENSITY is < 1.0 then we accummulate the amount that was "left over", calling it the "amountCarryover". This spread configuration (specified as a decimal number) reduces the amount we carryover which can provide some randomness to the depth chart produced while still keeping a relatively deep orderbook. This increases the profits seen by the bot if the bot buys and sells at the same spread level (assuming the same center price).
MIN_AMOUNT_CARRYOVER_SPREAD = 0.0100
MAX_AMOUNT_CARRYOVER_SPREAD = 0.0100
# probability of including the carryover at a level that will be added, i.e. given that the bot decides to add the level then this is the probability that the carryover amount will be added to that level
CARRYOVER_INCLUSION_PROBABILITY = 1.00
# virtual balance to use so we can smoothen out the curve. This also has the benefit of increasing order amounts placed by the bot. However, if this is set to a value greater than 0.0 then there is a likelihood that the bot will run out of the asset that has a virtual balance set.
VIRTUAL_BALANCE_BASE = 0.0
VIRTUAL_BALANCE_QUOTE = 0.0
Once the configuration file is ready, it is now time to fill in details in sample_trader.cfg file where we will provide information about the token and secret key so that it can place orders for us. Once you have filed in the details, we renamed it to trader.cfg
Here are contents of trader.cfg file.
# the trading account, this is the account that "owns" the trades (GDNUTFIDU3EY7GPWUZT3STPYHLZPRSGS2BW7FPE5L36G4P6ZXVJMF667)
# (optional) the source account, this is the account used to deduct fees and consume the sequence number (GBHXGGUD3LIAWJHFO7737C4TFNDDDLZ74C6VBEPF5H53XNRCVIUWZA5I)
# the base asset and issuer.
# uncomment the ISSUER_A if your base asset is not XLM
# the counter (or quote) asset and issuer
# Issuer seed: SBNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# how often you want the bot to run
# randomized interval delay in millis
# the mode to use when submitting - maker_only, both (default)
# when trading on a non-SDEX exchange the only supported mode is "both"
Run the bot in command prompt using this command. Make sure to rename the files.
kelp trade --botConf trader.cfg --strategy balanced --stratConf stellarupdate.cfg
Kelp bot https://kelpbot.io/ is an incredible tool. It takes complexity out of way and allow non-developers to set up trading bots on both centralized and decentralized exchanges. On top of that, Kelp is free, so why not give it a try.