-
01
Type of technology
Algorithm to automate work at an exchange
-
02
Tasks it solves
Analyzes different currencies and exchanges
Finds profitable differences in exchange rates
Buy and sell cryptocurrencies
Reports transactions in a convenient format, for example via Telegram chatbot
Resolves problems in case of failures
Reliably predicts currency price based on analytics
Ensures data privacy and stability
-
03
Companies it’s intended for
Traders on cryptocurrency and currency exchanges
Traders profit on exchanges from exchange rate difference
Traders are active participants on exchanges. They monitor exchange rates, and conduct buy and sell transactions to make a profit.
Cryptocurrency exchanges work on a similar principle, only with bitcoin, Ethereum, and other digital currencies.
Profit from transactions depends on a trader’s ability to analyze the market situation and on their quick reaction time. The more effective the transactions, the higher the player’s profit.
Objective: to create an algorithm for trading on cryptocurrency exchanges
In 2017, an American company approached OrbitSoft to develop a bot for cryptocurrency transactions. The task was to automate the buying and selling of cryptocurrencies on an exchange for profit.
They needed an algorithm that works like a trader: it would analyze cryptocurrency rates and make deals. The greater the difference (spread) between the buy and sell price, the higher the profit.
To maximize customer revenue, the algorithm had to be able to:
- Constantly monitor the market to buy currency at a favorable price
- Submit orders to buy and sell
- Transfer money to different exchanges where the desired cryptocurrency is traded
- Collect analytics on transactions, and forecast price changes
- Send reports to the customer regarding transactions
Solution: development of an algorithm for transactions, data analysis, and reporting
OrbitSoft provided the customer with a complete solution that automatically buys and sells cryptocurrencies on different exchanges using an API. The system consists of 3 modules:
Data collection and analysis
Constantly collects data via API: rates of cryptocurrencies, transactions during the period, and last transactions. After analyzing the data, the program offers a solution according to the trader’s strategy.
Interaction with stock exchanges
Creates and cancels exchange orders, opens and closes positions on deals, updates deal status.
Statistics on transactions
Processes transaction data, calculates efficiency, and keeps detailed records.
Let’s talk more about how the algorithm works and what it can do.
The system uses a strategy of arbitrage and triangulation
Exchange arbitrage — consecutive trades that generate income from price differences on different exchanges.
For example, the bot selects a bitcoin/dollar (BTC/USD) pair on exchanges A and B. It tracks when there is a difference in bitcoin prices on the two exchanges and makes successive steps: it buys on exchange A and sells on exchange B.
Triangulation strategy uses the divergence of three cryptocurrencies and identifies currency pairs with the highest profits. The algorithm simultaneously places three orders on the selected pairs: two to buy and one to sell. Profits appear due to the difference in rates.
All transactions can take place within the framework of one exchange, or on several exchanges at once.
For example, the bot buys the cryptocurrency DASH for U.S. dollars, then the cryptocurrency EMC for DASH and sells EMC for U.S. dollars.
USD → DASH → EMC → USD
Compares not only exchange rates, but also exchange commissions for transactions
The exchange commission must be deducted from the profit on the trades. It can range from 1 to 15% of the profit. The bot takes into account the amount of these commissions when calculating the efficiency of a transaction.
Receives data and calculates spreads within and between exchanges
On a regular basis, the bot requests tables of orders from exchanges for specified pairs and then performs analysis. The results are stored in the database and are available for display on a chart.
Receives data and calculates spreads within and between exchanges
On a regular basis, the bot requests tables of orders from exchanges for specified pairs and then performs analysis. The results are stored in the database and are available for display on a chart.
The algorithm determines the likely time intervals in which the spread between exchanges will be at the required level. It finds the most profitable spread value for purchases, and when the maximum spread values are reached, it signals the system to place a buy or sell order.
At the moment the following exchanges are integrated:
- kraken.com
- bittrex.com
- bitfinex.com
- binance.com
- poloniex.com
- hitbtc.com
- livecoin.net
- dsx.uk
- bitstamp.net
- gatecoin.com
- bitmex.com
- xbtce.com
- cryptopia.co.nz
We did integration with all currency pairs represented on the exchanges.
Predicts the likely price and analyzes available volumes of currency
To perform an arbitrage strategy, a trader determines the market prices for a given volume of cryptocurrency. The algorithm predicts the price based on order analysis. It takes into account hidden orders, and stop-loss and take-profit orders. It analyzes buy and sell offers in the order book, and the available volume of currency.
Can simultaneously place, cancel, and check the status of orders on an exchange
The bot works with the following types of orders: market, limit, fill, or kill. The a priori order of the market type is used. If it is not found or not supported, the bot applies fill or kill or limit.
Work with orders is carried out for the following exchanges:
- kraken.com
- bittrex.com
- poloniex.com
- hitbtc.com
- livecoin.net
- dsx.uk
- xbtce.com
Solves problems with cancellation, or failure to place an order
The following problems may arise during the bidding and execution process:
— Price change after sending an order
— Transaction cancellation
— Incomplete bidding or incomplete transaction
OrbitSoft ran a series of tests on the algorithm in case, for example, an order is placed on one exchange, and not placed, canceled, or reset on a second exchange.
As a result, we have taken possible problems into account, and developed a protective mechanism that allows you to successfully place an order within the existing spread.
Presents analysis and reporting in a convenient, clear form
The bot shows spreads and order bases in the form of a clear graph.
A Telegram bot was developed to transmit data to the customer. It receives all delivery, cancellation, and execution notifications and sends them via Telegram.
Conditions and restrictions of the algorithm
The proposed solution is effective under the following conditions:
1) Sufficient spread and trade volumes.
For arbitrage between exchanges:
- Volume of the spread between exchanges as a percentage exceeds the total commission on transactions
- Convergence and divergence of spreads within an acceptable time frame
- Necessary volume of trading on exchanges to conduct transactions and execute orders at specified intervals of time
To triangulate within a single exchange:
- Exchange rate difference between currency pairs exceeds the commission for transactions with orders on the exchange
- Required number of currency pairs on the exchange
- Necessary volume of trades on exchanges for carrying out operations of execution of orders in the given intervals of time
2) Strong cryptocurrency market volatility for effective trading
3) Ability to work with the exchange API to send requests and receive data
4) The ability to work with exchanges on sockets to keep unbreakable connectivity and data exchange