Skip to content

Commit

Permalink
Merge pull request #15 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v5.0.0
  • Loading branch information
adamant-al authored Jul 8, 2022
2 parents 884d1c6 + 57de087 commit b805b26
Show file tree
Hide file tree
Showing 37 changed files with 20,998 additions and 2,454 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
tab_width = 4
indent_style = space
indent_size = 2
[*.md]
max_line_length = off
trim_trailing_whitespace = false
12 changes: 10 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
node_modules/
logs/
.vscode/
package-lock.json
tests.js
config.test
config.json
.DS_Store
trade/settings/
.idea/
test_*.js
errcase.py
error.list
jsconfig.json
balances.out
trade/tests/debug_trader.js
client.py
test_encode.py
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ADAMANT Trading & Market making bot is a software that allows to run trades on crypto exchanges, make trade volume, maintain spread and liquidity, set price range, and build live-like dynamic order book.

This is a free version. For premium features, see [marketmaking.app/services](https://marketmaking.app/services/).

# Market making

In Market making mode, the bot places orders and executes them by itself, making a trade volume, maintaining spread and liquidity; builds live-like dynamic order books and watches a token price. Market making helps:
Expand All @@ -20,24 +22,22 @@ Trading is a mode when a bot runs orders according to some strategy. It can be p
# Features

* Easy to install and configure
* Free and open source
* Fill order books
* Place buy and sell limit or market orders
* Market making
* Initial fill order books
* Dynamic order book building
* Place buy and sell limit or market orders
* Market making with 3 policies: spread, orderbook, optimal
* Spread & liquidity maintenance
* Price range setting
* Arbitrage token price on other trade pairs or exchanges
* Stores and displays statistics
* Managed with your commands using ADAMANT Messenger

# Supported exchanges

If the bot don't support the exchange you need, code it by yourself, or [hire developers](https://marketmaking.app/services/).
* [CoinDeal](https://coindeal.com)
* [Resfinex](https://resfinex.com)
* [P2PB2B](https://p2pb2b.com)

* [CoinDeal](https://coindeal.com/ref/9WZN)
* [Resfinex](https://trade.resfinex.com?ref=7ccb34d867&pair=ADM_USDT)
* [P2PB2B](https://p2pb2b.io?referral=d5ef5f6e)
To add other exchange support, see [marketmaking.app/services](https://marketmaking.app/services/).

# Usage and Installation

Expand All @@ -49,8 +49,8 @@ We can run market-making for you, see [marketmaking.app/services](https://market

## Requirements

* Ubuntu 18 or 20 (we didn't test others)
* NodeJS v12+
* Ubuntu 18–22, centOS 7 or 8 (we didn't test others)
* NodeJS v16+
* MongoDB ([installation instructions](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/))

## Setup
Expand All @@ -64,7 +64,10 @@ npm i

## Pre-launch tuning

The bot will use `config.json`, if available, or `config.default.json` otherwise.

```
cp config.default.json config.json
nano config.json
```

Expand Down Expand Up @@ -96,7 +99,10 @@ Add string:
su - adamant
cd ./adamant-tradebot
pm2 stop tradebot
mv config.json config_bup.json && git pull && mv config_bup.json config.json
git pull
npm i
pm2 start --name tradebot app.js
```

Update `config.json` if `config.default.json` changed.

Then `pm2 restart tradebot`.
96 changes: 96 additions & 0 deletions config.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
/** The bot's secret passphrase. Create separate ADM account for the bot.
Bot's ADM address will correspond this passPhrase.
**/
"passPhrase": "distance expect praise frequent..",

/** List of nodes to fetch transactions.
If one become unavailable, bot will choose live one.
**/
"node_ADM": [
"https://bid.adamant.im",
"http://localhost:36666",
"https://endless.adamant.im",
"https://clown.adamant.im",
"https://unusual.adamant.im",
"https://debate.adamant.im",
"http://185.231.245.26:36666",
"https://lake.adamant.im"
],

/** Socket connection is recommended for better user experience **/
"socket": true,

/** Choose socket connection protocol, "ws" or "wss" depending on your server **/
"ws_type": "ws",

/** List of ADAMANT InfoServices for catching exchange rates **/
"infoservice": [
"https://info.adamant.im"
],

/** ADAMANT accounts to accept commands from. Commands from other accounts will not be executed. **/
"admin_accounts": [
"U123.."
],

/** Notify non-admins that they are not admins. If false, bot will be silent. **/
"notify_non_admins": false,

/** List of supported exchanges **/
"exchanges": [
"CoinDeal",
"Resfinex",
"P2PB2B"
],

/** Exchange to work with. Case insensitive. **/
"exchange": "Resfinex",

/** Pair to trade **/
"pair": "ADM/USDT",

/** Interval in minutes to clear all of Unknown (which are not placed by the bot) opened orders.
Some exchanges has API issues with closing or matching orders.
Because of this, your account can accumulate open orders and lead to frozen balances.
In such a case you can run "/clear unk" command manually, or set this parameter for automatic clearing.
Note: this command cancels all of Unknown orders for the pair, including ones you placed on exchange's website.
0 means disabled.
**/
"clearAllOrdersInterval": 0,

/** Exchange's account API key for connection **/
"apikey": "YOUR-KEY..",

/** Exchange's account API secret for connection **/
"apisecret": "YOUR-SECRET..",

/** Exchange's account trade password. **/
"apipassword": "YOUR-TRADE-PASS",

/** How to reply user in-chat, if first unknown command received. **/
"welcome_string": "Hi! 😊 I'm a trade and market making bot. ℹ️ Learn more on https://marketmaking.app or type **/help**.",

/** Bot's name for notifications **/
"bot_name": "Lovely Trade Bot",

/** ADAMANT addresses for notifications and monitoring. Optional. **/
"adamant_notify": [""],

/** Slack keys for notifications and monitoring. Optional. **/
"slack": ["https://hooks.slack.com/services/.."],

/** If you don't want to receive "not enough balance" notifications, set this to "true" **/
"silent_mode": false,

/** The software will use verbosity according to log_level.
It can be none < error < warn < info < log.
**/
"log_level": "log",

/** Port for getting debug info.
Do not set for live bots, use only for debugging.
Allows to get DBs records like http://ip:port/db?tb=incomingTxsDb
**/
"debug_api": false
}
96 changes: 0 additions & 96 deletions config.json

This file was deleted.

6 changes: 5 additions & 1 deletion helpers/const.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
module.exports = {
MINUTE: 60 * 1000,
HOUR: 60 * 60 * 1000,
DAY: 24 * 60 * 60 * 1000,
SAT: 100000000, // 1 ADM = 100000000
ADM_EXPLORER_URL: 'https://explorer.adamant.im',
EPOCH: Date.UTC(2017, 8, 2, 17, 0, 0, 0), // ADAMANT's epoch time
TX_CHECKER_INTERVAL: 4 * 1000, // Check for new Txs every 4 seconds; additionally Exchanger receives new Txs instantly via socket
UPDATE_CRYPTO_RATES_INVERVAL: 60 * 1000, // Update crypto rates every minute
UPDATE_CRYPTO_RATES_INTERVAL: 60 * 1000, // Update crypto rates every minute
PRECISION_DECIMALS: 8, // Accuracy for converting cryptos, 9.12345678 ETH
PRINT_DECIMALS: 8, // For pretty print, 9.12345678 ETH
MAX_ADM_MESSAGE_LENGTH: 10000,
DEFAULT_ORDERBOOK_ORDERS_COUNT: 15,
};
2 changes: 1 addition & 1 deletion helpers/cryptos/adm_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const config = require('../../modules/configReader');
const utils = require('../utils');

const baseCoin = require('./baseCoin');
module.exports = class admCoin extends baseCoin {

module.exports = class admCoin extends baseCoin {
constructor() {
super();
this.token = 'ADM';
Expand Down
4 changes: 2 additions & 2 deletions helpers/cryptos/baseCoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ module.exports = class baseCoin {
this[data].value = value;
this[data].timestamp = Date.now();
},
}
};

account = {
passPhrase: undefined,
privateKey: undefined,
keyPair: undefined,
address: undefined,
}
};

};
Loading

0 comments on commit b805b26

Please sign in to comment.