Logo HETHA.IO

What is Arbitrage

Cryptocurrency arbitrage is the process of generating profit from price differences of the same asset across different exchanges or trading pairs. These price discrepancies appear because cryptocurrency markets are fragmented — each exchange operates its own orderbook and liquidity pool.

In practice, arbitrage is not a single trade but a sequence of trades executed across multiple markets. Such sequences are called arbitrage chains. An arbitrage chain is a structured sequence of trading operations that must be executed quickly to capture a temporary price imbalance between markets.

Example of a chain:


Binance: BTC/USD → Bitfinex: ETH/USD → Binance: ETH/BTC

The goal of the chain is to start and end with the same base currency while generating a profit after accounting for trading fees.

In modern cryptocurrency markets, arbitrage opportunities appear and disappear within fractions of a second. Because of this, manual trading is ineffective. Efficient arbitrage requires automated systems capable of monitoring thousands of trading pairs and recalculating arbitrage chains in real time.

How our product helps you

HETHA.IO provides a platform for analyzing arbitrage activity and managing automated trading infrastructure. Users work with the system through three main sections of the platform:

  • The Market section is designed for analyzing market data and arbitrage activity. It provides access to generated chains, orderbooks, market streams, and analytical tools that help evaluate where and how arbitrage opportunities appear.
  • The Statistics section displays system-level performance metrics. It shows how the infrastructure operates internally, including incoming tick flow, workers load, chain generation flow, and other processing indicators. This section helps users monitor the operational state of the system.
  • The Server section provides access to the trading infrastructure and execution environment. Here users can configure trading parameters, manage API keys, monitor balances, review orders, chains, logs, discounts, and moneyflow, and control how the trading bot operates.

How it works

HETHA.IO processes market data from connected cryptocurrency exchanges in real time. The system continuously receives orderbook updates and reconstructs the current state of the market. Based on this data, the platform generates potential arbitrage chains — sequences of trades that start and end with the same base currency.

Each generated chain is evaluated by the system using internal validation rules. These checks include profitability thresholds, execution conditions, and other parameters configured by the user.

Chains that meet the configured criteria can be forwarded to the simulation layer, where the system calculates the result as if the trades were executed using current market data. This allows users to observe potential performance and analyze chain behavior without executing real trades. If real trading is enabled, validated chains can also be sent to the execution layer, where trading operations are performed automatically through exchange APIs according to the configured parameters.

While operating, the system also tracks balances across connected exchanges to ensure that sufficient funds are available for executing arbitrage chains when opportunities appear. This process runs continuously, allowing the platform to detect and execute arbitrage opportunities as market conditions change.

What do chains look like

Chains generated by the system are represented as JSON arrays. Each element of the array corresponds to one trading step in the arbitrage chain. The example below shows the structure of a chain element and the parameters used by the system during chain calculation and execution evaluation.


[{
"orderBook": "bfx",
- name of the exchange (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)

"pair": "btcusd",
- currency pair that takes part in the deal

"amount": 0.016,
- input deal amount

"currency": "btc",
- input currency

"arr_size": 1,
- dimension of the part of cup, depending on the type of operation (Bid or Ask)

"rate": 12370,
- rate at which the deal was made

"side": "sell",
- input currency operation

"time": 1597690279466,
- deal timecode

"market": {

"bB": [
["12370", 6.23317874]
],
- Bid book – bid – orders list

"bW": 12370,
- Bid weight – average-weighted price of all bid orders in a glass

"bL": "12370",
- Bid last – best price

"bSW": 12370,
- Not used

"bSL": "12370",
- Not used

"aB": [
["12371", 27.0618301]
],
- Ask book – ask – orders list

"aW": 12371,
"aL": "12371",

"aSW": 12371,
- average weighted price for reduced position

"aSL": "12371",
- Best Ask price for reduced position

"sV": "0.015",
- Reduced position volume

"s": 0,
- Status – only cups with status "0" are accepted for processing. Statuses can also be 1,2,3 but they are incorrect.

"t": 1597690279466
- Timecode
},

"market_ping": 0.472,
- connection speed at a given time

"average_ping": 0.6154,
- average connection speed with the exchange

"long_tick": 17.04413025210084,
- average long-term gap between ticks

"short_tick": 6.138285714285715,
- average short-term gap between ticks

"current_volume": 0.016,
- normalized deal volume adjusted to BTC

"market_volume": 27.0618301,
- normalized cup volume adjusted to BTC

"long_volume": 11.721547461176456,
- average long-term market volume

"short_volume": 27.60135947428572,
- average short-term market volume

"current_deep": 1,
- current market depth

"long_deep": 1.1134453781512605,
- long-term market depth

"short_deep": 1,
- short-term market depth

"estimate": 0.7965347766876221
- parameter is calculated using a neural network taking into account all the above parameters for determining order execution order. The range of the indicator from zero to one. The lower the indicator, the more unstable the market and the faster you need to make a deal. In the case of chain processing by sequential orders, it is recommended that first was executed orders in which the "estimate" parameter tends to zero (less than 0.1).
}]

Where can you find chains

Arbitrage chains generated by the system can be viewed in several sections of the platform.

Chains that are executed or simulated by the system are available in the Chains section of the server interface, where users can review the sequence of operations and the calculated results. Detailed information about chain processing is also available in the Logs section. Logs contain records of system activity, including chain generation, validation, simulation, and execution events.

These sections allow users to analyze how chains are processed by the system and monitor the behavior of the trading infrastructure.

How to get an access to the server?

The trading environment is provided as part of the local PRO version of HETHA.IO.

After downloading the package from your personal account and launching the virtual machine, you gain terminal access to the local environment where the trading modules operate. The virtual machine runs the trading infrastructure and provides access to system tools, logs, configuration files, and debugging utilities.

Detailed instructions for installing and launching the local version are provided in the PRO Local Version Installation Guide.

Example of chains in logs

The following section demonstrates how arbitrage chains appear in system logs during processing. The examples illustrate different stages of the execution pipeline, including validation checks, balance verification, order placement, and responses from exchanges. These logs provide insight into how the system evaluates chains and manages trading operations internally.

The first is blocked chains. What does this mean and why are chains blocked? The minimum allowable profit in this example that our program passes is for Full - 0.1%, and for Lite - 0.2%. If you want to change these parameters, you need to enter the params.json file. You need to change the value in the line "percent_accept". If the chain does not satisfy the minimum profit requirements, it is automatically blocked. Also, the chain can be temporarily blocked until the balance information on the accounts is updated. Let see the example:

Chain №1


Incoming chain: lite profit: 100.18528302013945 chain: bnc:btc/usd-bts:xrp/usd-bnc:xrp/btc time: 2.342

That’s actually is the chain itself. lite – it a type of chain (Remember that there are Lite and Full) profit: 100.18528302013945 – it is the profit that this chain can make. As we see, profit is 0.18%, respectively, the chain is blocked.


chain: bnc:btc/usd-bts:xrp/usd-bnc:xrp/btc - a chain that takes part in deal.
bnc: btc/usd-bts: xrp/usd-bnc: xrp/btc - cryptocurrency exchange (bfx - Bitfinex; bnc – Binance;
btx – Bitrex; bts – Bitstamp; cex - CEX.IO): currency pair that takes part in the first deal (btc/usd)
- cryptocurrency exchange: currency pair that takes part in the second deal (xrp/usd)
- cryptocurrency exchange: currency pair that takes part in the third deal (xrp/btc).

time: 2.342 – timecode

Chain №2


NOT BLOCKED: Chain: bnc:btc/usd-bts:xrp/usd-bnc:xrp/btc timestamp: 1606377703681
{"orderBook":"bnc","Pair":"btcusd","Side":"sell","Timestamp":1606377703681,"b_lock":0,"a_lock":0,"Status":"Unlocked"}
Check equity sell direct:
{"orderBook":"bnc","pair":"btcusd","amount":0.032,"currency":"btc","arr_size":20,"rate":17563.57822095,"side":"sell","time":1606377700519}
Balance a: 0.09880529
Amount LESS than balance. Accepted
Actual price is more that acceptable (type BUY): bts:xrpusd:0.51302:0.51353302:0.513648

NOT BLOCKED - the same chain was not launched during the period specified in the parameters.

Chain: bnc:btc/usd-bts:xrp/usd-bnc:xrp/btc – the chain that takes part in deals.
timestamp: 1606377703681 – timecode.

{"orderBook":"bnc","Pair":"btcusd","Side":"sell","Timestamp":1606377703681,"b_lock":0,"a_lock":0,"Status":"Unlocked"}

"orderBook":"bnc" – exchange from which the orderbook was taken  
"Pair":"btcusd" – currency pair  
"Side":"sell" – input currency operation  
"b_lock":0 – if the timestamp is greater than the current timestamp, the first element of the currency pair is temporarily locked  
"a_lock":0 – if the timestamp is greater than the current timestamp, the second element of the currency pair is temporarily locked  
"Status":"Unlocked" – Chain status – not locked because of using this currency after the last balance update.

Now the program is checking sold currency.

Check equity sell direct:
{"orderBook":"bnc","pair":"btcusd","amount":0.032,"currency":"btc","arr_size":20,"rate":17563.57822095,"side":"sell","time":1606377700519}
Balance a: 0.09880529
Amount LESS than balance. Accepted

{"orderBook":"bnc" - exchange from which the orderbook was taken (bfx – Bitfinex; bnc –
Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)
"pair":"btcusd" – currency pair
"amount":0.032 – amount of sold currency
"currency":"btc" – input currency
"arr_size":20 – dimension of the part of cup, depending on the type of operation (Bid or Ask)
"rate":17563.57822095 – rate at which the deal was made
"side":"sell" – deal with input currency
"time":1606377700519} – timestamp
Balance a: 0.09880529 – balance of sold currency.  
Amount LESS than balance. Accepted – the amount of the sold currency must not exceed the set value of the total balance on the currency account. You can change this parameter in the settings.

Actual price is more than that acceptable (type BUY): - parameter of deviation in the cup. Initially it is set 0.05. You can change the parameter in your personal account.
bts:xrpusd:0.51302:0.51353302:0.513648
1st parameter - rate at which the deal is to be made (rate from the chain)
2nd parameter - calculated allowed deviation
3rd parameter - current deviation

The second option is not blocked chains, which take part in deals.

Incoming chain: lite profit: 100.25263472578926 chain: bts:btc/usd-bnc:xlm/btc-bnc:xlm/usd time: 2.206
NOT BLOCKED – the same chain was not launched during the time period specified in the parameters.
Chain: bts:btc/usd-bnc:xlm/btc-bnc:xlm/usd - the chain that takes part in deals.
timestamp: 1606379598874 – timecode

{"orderBook":"bts","Pair":"btcusd","Side":"buy","Timestamp":1606379598874,"b_lock":0,"a_lock":0,"Status":"Unlocked"}

{"orderBook":"bts" - exchange from which the orderbook was taken (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)
"Pair":"btcusd" – currency pair
"Side":"buy" – input currency operation
"Timestamp":1606379598874 – timecode
"b_lock":0 – if the timestamp is greater than the current timestamp, the first element of the currency pair is temporarily locked
"a_lock":0 – if the timestamp is greater than the current timestamp, the second element of the currency pair is temporarily locked
"Status":"Unlocked" – Chain status – not locked because of using this currency after the last balance update.

Now the program is checking sold currency.

Check equity sell opposite:

{"orderBook":"bts","pair":"btcusd","amount":200,"currency":"usd","arr_size":4,"volume":"0.22000000","rate":16615.54,"side":"buy","time":1606379596668}
Balance b: 444.41

"pair":"btcusd" – currency pair
"amount":200 – sold currency amount
"currency":"usd" – input currency
"arr_size":4 – dimension of the part of cup, depending on the type of operation (Bid or Ask)
"volume":"0.22000000" – cup volume reduced to BTC
"rate":16615.54 – rate at which the deal was made
"side":"buy" – deal with input currency
"time":1606379596668 – timecode

Balance b: 444.41 – sold currency balance
Amount LESS than balance. Accepted – the amount of the sold currency must not exceed the set value of the total balance on the currency account. You can change this parameter in the settings.

{"orderBook":"bnc","Pair":"xlmbtc","Side":"buy","Timestamp":1606379598875,"b_lock":0,"a_lock":0,"Status":"Unlocked"}

{"orderBook":"bts" - exchange from which the orderbook was taken (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)
"pair":"xlmbtc" – currency pair
"Side":"buy" - deal with input currency
"Timestamp":1606379598875 – timecode
"b_lock":0 – if the timestamp is greater than the current timestamp, the first element of the currency pair is temporarily locked
"a_lock":0 – if the timestamp is greater than the current timestamp, the second element of the currency pair is temporarily locked
"Status":"Unlocked" – Chain status – not locked because of using this currency after the last balance update.

Now the program is checking sold currency Check equity sell opposite:

{"orderBook":"bnc","pair":"xlmbtc","amount":0.01201285062056364,"currency":"btc","arr_size":5,"volume":10020,"rate":0.00000896,"side":"buy","time":1606379596483}
Balance b: 0.11486897

"pair":"xlmbtc" – currency pair
"amount":0.01201285062056364 – sold currency pair
"currency":"btc" – input currency
"arr_size":5 - dimension of the part of cup, depending on the type of operation (Bid or Ask)
"volume":"10020" – cup volume reduced to BTC
"rate":0.00000896 – rate at which the deal was made
"side":"buy" – deal with input currency
"time":1606379596483 – timecode

Balance b: 0.11486897 – sold currency balance
Amount LESS than balance. Accepted – the amount of the sold currency must not exceed the set value of the total balance on the currency account. You can change this parameter in the settings.

{"orderBook":"bnc","Pair":"xlmusd","Side":"sell","Timestamp":1606379598875,"b_lock":0,"a_lock":0,"Status":"Unlocked"}

{"orderBook":"bnc" - exchange from which the orderbook was taken (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)
"Pair":"xlmusd" – currency pair
"Side":"sell" – deal with input currency
"Timestamp":1606379598875 – timecode
"b_lock":0 – if the timestamp is greater than the current timestamp, the first element of the currency pair is temporarily locked
"a_lock":0 – if the timestamp is greater than the current timestamp, the second element of the currency pair is temporarily locked
"Status":"Unlocked" – Chain status – not locked because of using this currency after the last balance update.

Now the program is checking sold currency Check equity sell direct:

{"orderBook":"bnc","pair":"xlmusd","amount":1339.3792153954325,"currency":"xlm","arr_size":8,"volume":4087.3,"rate":0.14985,"side":"sell","time":1606379595503}
Balance a: 4145.92365885

"pair":"xlmusd" – currency pair
"amount":1339.3792153954325 – sold currency pair
"currency":"xlm" – input currency
"arr_size":8 - dimension of the part of cup, depending on the type of operation (Bid or Ask)
"volume":"4087.3" – cup volume reduced to BTC
"rate":0.14985 – rate at which the deal was made
"side":"sell" – deal with input currency
"time":1606379595503 – timecode

Balance a: 4145.92365885 – bought currency balance
Amount LESS than balance. Accepted – the amount of the sold currency must not exceed the set value of the total balance on the currency account. You can change this parameter in the settings.

Node sequence estimation: 0.32777199149131775
Node sequence estimation: 0.2544032037258148
Node sequence estimation: 0.3438597321510315

The parameter is calculated using a neural network, taking into account all the above parameters
for determining the execution order. The indicator ranges from zero to one. The lower the indicator,
the more unstable the market, and the faster a deal needs to be made. In the case of chain processing
by sequential orders, it is recommended that orders in which the "estimate" parameter tends toward
zero be executed first (less than 0.1).

{"0":{"chain":{"orderBook":"bts","pair":"btcusd","amount":200,"currency":"usd","arr_size":4,"
volume":"0.22000000","rate":16615.54,"side":"buy","time":1606379596668,"market_ping":0.28
8,"average_ping":0.26513513513513526,"long_tick":3.3233552400947666,"short_tick":1.81059
00621118012,"current_volume":0.0075448500000000005,"market_volume":0.15,"long_volume
":0.7094511138309072,"short_volume":2.4360050367701853,"current_deep":1,"long_deep":1,"
short_deep":1,"estimate":0.32777199149131775,
"orderBook": "bts",
- name of the exchange (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex –
CEX.IO) "pair": "btcusd",
- currency pair that takes part in the deal
"amount": 200,
- input deal amount
"currency": "usd",
- input currency
"arr_size": 4,
- dimension of the part of cup, depending on the type of operation (Bid or Ask) "rate": 16615.54,
- rate at which the deal was made
"side": "buy",
- input currency operation
"time": 1606379596668,
- deal timecode
"market_ping": 0.288,
- current connection speed
"average_ping": 0.26513513513513526,
- average connection speed with the exchange
"long_tick": 3.3233552400947666,
- average long-term gap between ticks
"short_tick": 1.8105900621118012,
- average short-term gap between ticks
"current_volume": 0.0075448500000000005,
- normalized deal volume adjusted to BTC "market_volume": 0.15,
- normalized cup volume adjusted to BTC
"long_volume": 0.7094511138309072,
11
- average long-term market volume
"short_volume": 2.4360050367701853,
- average short-term market volume
"current_deep": 1,
- current market depth
"long_deep": 1,
- long-term market depth "short_deep": 1,
- short-term market depth
"estimate": 0.32777199149131775
- The parameter is calculated using a neural network, taking into account all the above
parameters for determining the execution order. The indicator ranges from zero to one. The
lower the indicator, the more unstable the market, and the faster a deal needs to be made. In the
case of chain processing by sequential orders, it is recommended that orders in which the
"estimate" parameter tends toward zero be executed first (less than 0.1).
{"chain":{"orderBook":"bnc","pair":"xlmbtc","amount":0.01201285062056364,"currency":"btc"
,"arr_size":5,"volume":10020,"rate":0.00000896,"side":"buy","time":1606379596483,"market_p
ing":0.516,"average_ping":0.7484459459459453,"long_tick":3.1913774785439477,"short_tick":
1.82190625,"current_volume":0.0075448500000000005,"market_volume":0.007544850000000
0005,"long_volume":0.2913235742113055,"short_volume":0.1484563523749999,"current_deep
":1,"long_deep":1,"short_deep":1,"estimate":0.2544032037258148,
"orderBook": "bnc",
- name of the exchange (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex –
CEX.IO) "pair": "xlmbtc",
- currency pair that takes part in the deal
"amount": 0.01201285062056364,
- input deal amount
"currency": "btc",
- input currency
"arr_size": 5,
- dimension of the part of cup, depending on the type of operation (Bid or Ask) "rate":
0.00000896,,
- rate at which the deal was made
"side": "buy",
- input currency operation
"time": 1606379596483,
- deal timecode
"market_ping": 0.516,
- current connection speed
"average_ping": 0.7484459459459453,
- average connection speed with the exchange
"long_tick": 3.191377478543947,
- average long-term gap between ticks
"short_tick": 1. 82190625,
- average short-term gap between ticks
"current_volume": 0.0075448500000000005,
- normalized deal volume adjusted to BTC
"market_volume": 0.0075448500000000005,
12
- normalized cup volume adjusted to BTC
"long_volume": 0.2913235742113055,
- average long-term market volume
"short_volume": 0.1484563523749999,
- average short-term market volume
"current_deep": 1,
- current market depth
"long_deep": 1,
- long-term market depth
"short_deep": 1,
- short-term market depth
"estimate": 0.2544032037258148
- The parameter is calculated using a neural network, taking into account all the above
parameters for determining the execution order. The indicator ranges from zero to one. The
lower the indicator, the more unstable the market, and the faster a deal needs to be made. In the
case of chain processing by sequential orders, it is recommended that orders in which the
"estimate" parameter tends toward zero be executed first (less than 0.1).
This text informs us about the currency pairs that are currently blocked. They are blocked due to
the initiation of a new chain. These currency pairs will remain blocked until the balance
information is updated.
"ltcbtc":["b_lock",1606379778875],"ethbtc":["b_lock",1606379778875],"zecbtc":["b_lock",160
6379778875],"dashbtc":["b_lock",1606379778875],"xrpbtc":["b_lock",1606379778875],"xmrbt
c":["b_lock",1606379778875],"btcusd":["a_lock",1606379778875],"eosbtc":["b_lock",16063797
78875],"xlmbtc":["b_lock",1606379778875],"trxbtc":["b_lock",1606379778875],"neobtc":["b_l
ock",1606379778875],"etcbtc":["b_lock",1606379778875]},"lockedCurrency":"btc"},"2"
{"chain":{"orderBook":"bnc","pair":"xlmusd","amount":1339.3792153954325,"currency":"xlm"
,"arr_size":8,"volume":4087.3,"rate":0.14985,"side":"sell","time":1606379595503,"market_ping
":0.516,"average_ping":0.7484459459459453,"long_tick":3.1471942980136074,"short_tick":1.8
3337106918239,"current_volume":0.0075448500000000005,"market_volume":0.696281259488
8916,"long_volume":0.10486859781497908,"short_volume":0.16531981790056835,"current_de
ep":1,"long_deep":1,"short_deep":1,"estimate":0.3438597321510315,
"orderBook": "bnc",
- name of the exchange (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)
"pair": "xlmusd",
- currency pair that takes part in the deal
"amount": 1339.3792153954325,
- input deal amount
"currency": "xlm",
- input currency
"arr_size": 8,
- dimension of the part of cup, depending on the type of operation (Bid or Ask)
"rate": 0.14985,
- rate at which the deal was made
"side": "sell",
13
- input currency operation
"time": 1606379595503
- deal timecode
"market_ping": 0.516,
- current connection speed
"average_ping": 0.7484459459459453,
- average connection speed with the exchange
"long_tick": 3.1471942980136074,
- average long-term gap between ticks
"short_tick": 1.83337106918239,
- average short-term gap between ticks
"current_volume": 0.0075448500000000005,
- normalized deal volume adjusted to BTC
"market_volume": 0.6962812594888916,
- normalized cup volume adjusted to BTC
"long_volume": 0.10486859781497908,
- average long-term market volume
"short_volume": 0.16531981790056835,
- average short-term market volume
"current_deep": 1,
- current market depth
"long_deep": 1,
- long-term market depth
"short_deep": 1,
- short-term market depth
"estimate": 0.3438597321510315
- The parameter is calculated using a neural network, taking into account all the above parameters
for determining the execution order. The indicator ranges from zero to one. The lower the
indicator, the more unstable the market, and the faster a deal needs to be made. In the case of
chain processing by sequential orders, it is recommended that orders in which the "estimate"
parameter tends toward zero be executed first (less than 0.1).

Now the chain is ready to start. Below is the represented the described chain. The code is exactly
the same as in the chain above.

Chain is ready to start:

{"lite":true,"history":"[{\"orderBook\":\"bts\",\"pair\":\"btcusd\",\"amount\":200,\"currency\":\"u
sd\",\"arr_size\":4,\"volume\":\"0.22000000\",\"rate\":16615.54,\"side\":\"buy\",\"time\":1606379
596668,\"market_ping\":0.288,\"average_ping\":0.26513513513513526,\"long_tick\":3.3233552
400947666,\"short_tick\":1.8105900621118012,\"current_volume\":0.0075448500000000005,\"
market_volume\":0.15,\"long_volume\":0.7094511138309072,\"short_volume\":2.43600503677
01853,\"current_deep\":1,\"long_deep\":1,\"short_deep\":1,\"estimate\":0.32777199149131775,\"
btcusd\":[\"b_lock\",1606379778875],\"ethusd\":[\"b_lock\",1606379778875],\"ltcusd\":[\"b_loc
k\",1606379778875],\"xrpusd\":[\"b_lock\",1606379778875],\"bchusd\":[\"b_lock\",1606379778
875]},{\"orderBook\":\"bnc\",\"pair\":\"xlmbtc\",\"amount\":0.01201285062056364,\"currency\":
\"btc\",\"arr_size\":5,\"volume\":10020,\"rate\":0.00000896,\"side\":\"buy\",\"time\":1606379596
483,\"market_ping\":0.516,\"average_ping\":0.7484459459459453,\"long_tick\":3.19137747854
39477,\"short_tick\":1.82190625,\"current_volume\":0.0075448500000000005,\"market_volume
14
\":0.0075448500000000005,\"long_volume\":0.2913235742113055,\"short_volume\":0.1484563
523749999,\"current_deep\":1,\"long_deep\":1,\"short_deep\":1,\"estimate\":0.254403203725814
8,\"ltcbtc\":[\"b_lock\",1606379778875],\"ethbtc\":[\"b_lock\",1606379778875],\"zecbtc\":[\"b_l
ock\",1606379778875],\"dashbtc\":[\"b_lock\",1606379778875],\"xrpbtc\":[\"b_lock\",16063797
78875],\"xmrbtc\":[\"b_lock\",1606379778875],\"btcusd\":[\"a_lock\",1606379778875],\"eosbtc\
":[\"b_lock\",1606379778875],\"xlmbtc\":[\"b_lock\",1606379778875],\"trxbtc\":[\"b_lock\",160
6379778875],\"neobtc\":[\"b_lock\",1606379778875],\"etcbtc\":[\"b_lock\",1606379778875]},{\
"orderBook\":\"bnc\",\"pair\":\"xlmusd\",\"amount\":1339.3792153954325,\"currency\":\"xlm\",\
"arr_size\":8,\"volume\":4087.3,\"rate\":0.14985,\"side\":\"sell\",\"time\":1606379595503,\"mark
et_ping\":0.516,\"average_ping\":0.7484459459459453,\"long_tick\":3.1471942980136074,\"sh
ort_tick\":1.83337106918239,\"current_volume\":0.0075448500000000005,\"market_volume\":
0.6962812594888916,\"long_volume\":0.10486859781497908,\"short_volume\":0.16531981790
056835,\"current_deep\":1,\"long_deep\":1,\"short_deep\":1,\"estimate\":0.3438597321510315,\"
xlmusd\":[\"a_lock\",1606379778875]}]","deep":3,"profit":100.25263472578926,"chain":"bts:bt
c/usd-bnc:xlm/btc-
bnc:xlm/usd","base":"usd","num":"2","created":1606379598874,"time":1606379596668}

Limit order - Market: bts pair: btcusd amount: 0.01203692 rate: 16615.54 type: buy
Limit order - Market: bnc pair: XLMBTC amount: 1341 rate: 0.00000896 type: buy rate round: 8 lot round: 0
Limit order - Market: bnc pair: XLMUSD amount: 1339.4 rate: 0.14985 type: sell rate round: 5 lot round: 1

Limit order
– order type

Market: bts
- name of the exchange (bfx – Bitfinex; bnc – Binance; btx – Bitrex; bts – Bitstamp; cex – CEX.IO)

"pair": "xlmusd",
- currency pair that takes part in the deal

"amount": 1339.4,
- input deal amount

"rate": 0.14985,
- rate at which the deal was made

"side": "sell",
- input currency operation

Replies from exchanges

BTS response:

{"id":"1300662781132800","price":"16615.54","amount":"0.01203692","pair":"btcusd","type":"
buy","response":"{\"price\":\"16615.54\",\"amount\":\"0.01203692\",\"type\":\"0\",\"id\":\"13006
62781132800\",\"datetime\":\"2020-11-26 08:33:18.990621\"}"}

"id":"1300662781132800" – deal id
"price":"16615.54" – purchase price
"amount":"0.01203692" – input deal amount
"pair":"btcusd" – currency pair
"type":"buy" – deal type (input currency)
\",\"datetime\":\"2020-11-26 08:33:18.990621 – order time


Order processing spent time: 0.132 – order processing time
Chain processing time: 2.338 – chain processing time

This text informs us that the position has been placed, but the deal has not yet been executed
because the order type is Limit, and the price has already changed. The deal will be completed
as soon as the rate returns to its previous value.

BNC response:

{"id":192832386,"price":0,"amount":"0.00000000","pair":"xlmbtc","type":"buy","response":{"s
ymbol":"XLMBTC","orderId":192832386,"orderListId":-
1,"clientOrderId":"jDIE3MJh4PLUX5sADhtn4D","transactTime":1606379599011,"price":"0.00
000896","origQty":"1341.00000000","executedQty":"0.00000000","cummulativeQuoteQty":"0.
00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"BUY","fills":[]}}

"id":"192832386" – deal id
"price":"0" – purchase price
"amount":"0.0000000" – input deal amount
"pair":"xlmbtc" – currency pair
"type":"buy" – deal type (input currency)
“response” – reply from the exchange. All values before "response" decrypt the response from the
exchange.

Order processing spent time: 0.971 – order processing time
Chain processing time: 3.177 – chain processing time

BNC response:

{"id":391186997,"price":0,"amount":"0.00000000","pair":"xlmusd","type":"sell","response":{"s
ymbol":"XLMUSDT","orderId":391186997,"orderListId":-
1,"clientOrderId":"XDJXMyT6yIzPDOW2vxv6NI","transactTime":1606379599016,"price":"0.1
4985000","origQty":"1339.40000000","executedQty":"0.00000000","cummulativeQuoteQty":"0
.00000000","status":"NEW","timeInForce":"GTC","type":"LIMIT","side":"SELL","fills":[]}}

"id":"391186997" – deal id
"price":"0" – purchase price
"amount":"0.0000000" – input deal amount
"pair":"xlmbtc" – currency pair
"type":"buy" – deal type (input currency)
“response” – reply from the exchange. All values before "response" decrypt the response from the
exchange.

Order processing spent time: 0.975 – order processing time
Chain processing time: 3.181 – chain processing time

Setting the parameters

When you get a product, you also get a set of default settings, but you can change them if you want. To do this, go to the server, go to the/home/trader/libs folder. There you will find the file called params.json. To change the settings, you must open the file and change its values to the desired.

Below are all these parameters with an explanation of the values:

ROOT Module

Parameter Description
"release": 2.4.5 Version.
"mode pro": true Version type (Pro or Standart).
"debug": false Enable/disable system messages.
"lock_timeout": 3 Timeout when new chains using the same currency as the previous one will not start. The time is in milliseconds, it means that by default it is set 3 minutes from the last deal in the last chain to start a new deal in the new chain using the same currency as a previous one.
"percent_balance": 0.9 The deal amount must not exceed the specified value of funds on the account. By default it is set 90%.
"gentime limit": 1 Max. allowable chain generation time, sec.
"profit limit": 110 Display in the logs the chains with profitability from VALUE, %.
"chainlog limit": 1000 Display VALUE rows in chains.log.
"ws interval": 1 Reconnect to the server in VALUE, min.
"balance interval": 2 Balance information is requested every VALUE, min.
"allow get balance": true Enable/disable displaying balances in the personal account.
"allow update": false Enable/disable "Update" button.
"callback port": 3003 Callback port.
"allow callback": true Enable/disable the use of callback connections.
"ws url": ws://feed.hetha.io:8080/ws/ Server address.

WS PORT Module

ParameterDescription
"pro": 8080Pro version port.
"standard": 8000Standard version port.

WS PARAMS Module

ParameterDescription
"event": cups,chains Event - If "chain" is specified, all chains with profitability greater than 100% will be transmitted. If the minimum profitability percentage is higher, it is specified as "chain_100.05". "cups" - all cups are transmitted.
"market": bnc knc bbt bfx Receive data from VALUE exchanges.
"currency": btc usd ada avax eth sol sui trx Receive chains with VALUE currencies.
"profit": 100.02 Receive chains with profitability above VALUE, %.

CHAIN BASE Module

ParameterDescription
"0,1,2": btc usd Base currency. If the chain doesn’t include the base currency, it won’t be processed.

TRADING Module

ParameterDescription
"accept": true Enable or disable trading. If simulate: true, trading is disabled even if accept: true.
"simulate": true Enable or disable simulation. During simulation, real funds are not used. The service demonstrates how effective trading can be with the selected settings.

STORAGE Module

ParameterDescription
"balance": truePermit or prohibit the retention of balance information.
"balance backup hour": 18Balance information is saved every day at VALUE, h.
"chain": truePermit or prohibit the retention of chains.
"order": trueEnable/disable order saving.

AI Module

ParameterDescription
"accept": trueEnable/disable AI usage. If this setting is enabled, order data will be available to the service for model training.
"pro enable": trueEnable/disable forecasting of chain execution time.
"pro threshold": 0Threshold value for chain execution time. Below this value - allow execution, above this value - prohibit execution, min.
"base enable": trueEnable/disable forecasting of chain execution.
"base threshold": 0Threshold value. Chains are not executed with a coefficient higher than the VALUE.

FORCE REVERSE Module

ParameterDescription
"accept": trueEnable/disable balance distribution mode.
"chain length": 2Max. allowable chain length.
"percent_accept": 0Min. allowable profit for the reverse deal.
"activator": 4Force reverse is activated if the number of base dimensions ($100 or equivalent) is less than VALUE.
"multiplier": 8Increase the sum of the chain by VALUE times relative to the base dimension ($100 or equivalent).

LITE Module

ParameterDescription
"accept": trueIf the previous conditions were executed or were not executed, the chain is either accepted or not accepted.
"percent_accept": 0.2Minimum profit is not less than the specified value. By default it is set 0.2%.
"force_trading": 3Use "Market" order placement type if profit exceeds set value (%).
"rate_diff": 0.05The chain is accepted if the deviation from the initial rate is not more than the specified value (%).
"multiplier": 2Multiplies chain sum.

TREND Module

ParameterDescription
"accept": falseAccept Trend deals.
"usd": longLong - Buy at the current price (limited order) and sell when the price increases by «Offset by VALUE, %». Short - Sell at the current price (limited order) and buy when the price decreases by «Offset by VALUE, %». Flat - Sell at price «½*Offset by VALUE, %» higher than current, and buy «½*Offset by VALUE, %» lower.
"btc": flatSame logic as above for BTC.
"force against": trueIf True is selected, market orders are used against the trend.
"offset by": 0.2Sale or purchase when the price changes by VALUE, %.

FULL Module

ParameterDescription
"accept": trueIf the previous conditions were executed or were not executed, the chain is either accepted or not accepted.
"percent_accept": 0.1Minimum profit is not less than the specified value. By default it is set 0.1%.
"force_trading": 1.5Use "Market" order placement type if profit exceeds set value (%).
"rate_diff": 0.1The chain is accepted if the deviation from the initial rate is not more than the specified value (%).
"multiplier": 4Multiplies chain sum on a specified number of times.

Exchange API Keys

To execute trades, the system must be connected to exchange accounts through API keys. HETHA.IO supports two ways of storing API credentials:

1. In the personal account
Users can enter API keys directly in the personal account interface. In this case the credentials are stored in the account configuration and used by the system automatically.

2. Locally on the user's server
For users who prefer not to store API keys in the personal account, credentials can be configured locally. In this case the keys must be added to the /home/trader/libs/params.json configuration file.

Example structure:


"bfx": {
"key": "…….",
"secret": "….…"
- Bitfinex keys },
"bnc": {
"key": " .......... ",
"secret": " ......... "
- Binance keys
},
"bts": {
"key": " .......... ",
"secret": " ........ ",
"client_id": " ........ ",
"timeout": ……,
"host": www.bitstamp.net
- Bitstamp keys
},
"btx": {
"key": " ......... ",
"secret": " ........ "
- Bittrex keys },
"cex": {
"user_id": " ......... ",
"key": " ......... ",
"secret": "……"
- CEX.IO keys
}

API. The result of a call to the server

Here are some examples. The latest data can be found in your personal account.

server/credentials - Getting script settings.

Description:

Returns the server settings that are in the personal account. The personal account settings are set in JSON format. Note, that in the personal account the correctness of the JSON format is not checked. Therefore, an incorrect format may cause an error when running the script.

Incoming Parameters:

Result:


{
"lock_timeout": 180000,
"percent_balance": 0.9,
"lite": {
"accept": true,
"percent_accept": 0.2,
"force_trading": 3,
"rate_diff": 0.05,
"multiplier": 2
},
"full": {
"accept": true,
"percent_accept": 0.1,
"force_trading": 1.5,
"rate_diff": 0.1,
"multiplier": 4
},
"bfx": {
"key": "",
"secret": ""
},
"bnc": {
"key": "",
"secret": ""
},
"bts": {
"key": "",
"secret": "",
"client_id": "",
"timeout": 10000,
"host": "www.bitstamp.net"
},
"btx": {
"key": "",
"secret": ""
},
"cex": {
"user_id": "",
"key": "",
"secret": ""
}
}

Call Example:


api.request('server/credentials', {}, function ( response ) {});

save/chain – Saving chains to appear in the user's personal account.

Description:

The request transfers the data in a chain that need to be saved to display information in the user's personal account. All information in chains is transferred directly from the chains, but the fields orderId (varchar 25), status (varchar 50), comment (text) can be arbitrary and transfer any value the user need.

Incoming Parameters:

lite – 0 (full) or 1 (lite); orderId – arbitrary field;
history – JSON, The whole chain’s history;
deep – deep of the chain; profit – chain’s profit;
chain – edited chain’s transcript;
status – arbitrary field; comment - arbitrary field;

Result:

Ок — no saving’s errors.
Error — in any other cases.

Call Example:


var params = {'lite': feed.lite, 'orderId': orderId, 'history': feed.history, 'deep': feed.deep, 'profit':
feed.profit, 'chain': feed.chain, status:”done”, comment: “”}; api.request('save/chain',
params, function ( response ) {});

market/status – Obtaining the current status of the exchanges.

Description:

The request returns JSON with data about all exchanges, including the speed of connection, average speed parameters for the last period, e.t.c.

Incoming Parameters:

Result:


[
{ id: 1, short_name: 'bts', name: 'Bitstamp', av_ping: 1.53, last_ping: 1.8, uptime: 100, status: 0 },
{ id: 2, short_name: 'bfx', name: 'Bitfinex', av_ping: 1.522, last_ping: 1.878, uptime: 100, status: 0 },
{ id: 3, short_name: 'bnc', name: 'Binance', av_ping: 0.474, last_ping: 0.486, uptime: 100, status: 0 },
{ id: 4, short_name: 'btx', name: 'Bittrex', av_ping: 0.551, last_ping: 0.52, uptime: 100, status: 0 },
{ id: 5, short_name: 'cex', name: 'CEX.IO', av_ping: 0.686, last_ping: 0.786, uptime: 100, status: 0 }
]

Call Example:


api.request('market/status', {}, function ( response ) {});

report/chains – Obtaining data from a chain analyzer. Data can also be obtained in the personal account.

Description:

The request returns JSON with data to the direct and reverse chains.

Incoming Parameters:

Chain – The parameter fetches a portion of the chain. You can use different choices to search the chain field. Example "xrp," "bnc: trx," "usd-cex," etc.;

dateFrom, dateTo — the search takes place between these dates. Parameter value '' - remove the search boundary. Note that the search for the specified parameters can be extremely long. Therefore, the call should be done carefully to avoid blocking the request. In the case of frequent or long requests, this API feature may be restricted in use;

lite – permissible values: -1 – leave out, 0 — full, 1 – lite;

profit –transactions profitability is not lower than declared;

reverse – true/ false - check reverse chains within the same time period.

What is a reverse chain?

If a new chain completely mirrors a direct chain in reverse order, it is called a reverse chain. These chains are necessary to understand the frequency of events where funds transferred to one market using a direct chain will return using reverse chains. The presence of reverse chains automatically balances the distribution of funds across markets. Ideally, there should be an equal number of direct and reverse chains.

Examples of direct and reverse chains:

bts:bch/usd-cex:bch/usd и cex:bch/usd-bts:bch/usd

Result:


[
{ chain: 'btx:btc/usd-bfx:xrp/usd-bnc:xrp/btc',
direct_count: 2, direct_profit: 0.6,
direct_days: 1,
direct_history: '2020-09-03:2', reverse_count: 10,
reverse_profit: 3.05, reverse_days: 3, reverse_history: '2020-
09-02:3,2020-09-03:6,2020-09-23:1' },

{ chain: 'btx:xrp/btc-bfx:xrp/usd-bnc:btc/usd',
direct_count: 5, direct_profit: 1.68,
direct_days: 2,
direct_history: '2020-09-02:3,2020-09-
23:2', reverse_count: 1, reverse_profit: 0.23,
reverse_days: 1, reverse_history: '2020-09-
03:1' },

{ chain: 'cex:btc/usd-cex:xrp/usd-bnc:xrp/btc',
direct_count: 2, direct_profit: 0.47,
direct_days: 1,
direct_history: '2020-08-18:2',
reverse_count: 151,
reverse_profit: 41.93,
reverse_days: 9,
reverse_history:
'2020-08-25:1,2020-09-03:11,2020-09-04:25,2020-09-05:19,2020-09-13:16,2020-09-
14:1,2020-09-16:16,2020-08-19:9,2020-08-22:53' }
]

Call Example:


params = {"chain": "xrp", "dateFrom":"2020-08-15", "dateTo":"2020-09-24",
"reverse":true, "profit":"100.2", "lite":"0"};

api.request( 'report/chains', params, function ( response ) {});