Skip to content

Commit

Permalink
Merge pull request #23 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v5.4.0
  • Loading branch information
adamant-al authored Mar 24, 2023
2 parents 6b19811 + 4ba1955 commit beff817
Show file tree
Hide file tree
Showing 15 changed files with 1,989 additions and 1,497 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ Trading is a mode when a bot runs orders according to some strategy. It can be p

# Supported exchanges

* [CoinDeal](https://coindeal.com)
* [Resfinex](https://resfinex.com)
* [P2PB2B](https://p2pb2b.com)
* [Azbit](https://azbit.com?referralCode=9YVWYAF)

To add other exchange support, see [marketmaking.app/services](https://marketmaking.app/services/).

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

## Requirements

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

## Setup

Expand All @@ -78,7 +77,7 @@ Parameters: see comments in config file.
You can start the Bot with the `node app` command, but it is recommended to use the process manager for this purpose.

```
pm2 start --name tradebot app.js
pm2 start app.js --name tradebot
```

## Add a Bot to cron
Expand All @@ -90,7 +89,7 @@ crontab -e
Add string:

```
@reboot cd /home/adamant/adamant-tradebot && pm2 start --name tradebot app.js
@reboot cd /home/adamant/adamant-tradebot && pm2 start app.js --name tradebot
```

## Updating
Expand Down
6 changes: 3 additions & 3 deletions config.default.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@

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

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

/** Pair to trade **/
"pair": "ADM/USDT",
Expand Down
1 change: 1 addition & 0 deletions helpers/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = {
LADDER_STATES: ['Not placed', 'Open', 'Filled', 'Partly filled', 'Cancelled', 'Missed', 'To be removed', 'Removed'],
LADDER_OPENED_STATES: ['Open', 'Partly filled'],
REGEXP_WHOLE_NUMBER: /^[0-9]+$/,
REGEXP_UUID: /^[a-f\d]{4}(?:[a-f\d]{4}-){4}[a-f\d]{12}$/,
};
25 changes: 16 additions & 9 deletions modules/commandTxs.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ async function enable(params, {}, isWebApi = false) {
if (!pwSourceInput) {
return {
msgNotify: '',
msgSendBack: `Wrong parameters. Example: */enable pw 0.1—0.2 USDT* or */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: `Wrong parameters. Example: */enable pw 0.1—0.2 USDT* or */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -376,7 +376,7 @@ async function enable(params, {}, isWebApi = false) {
return {
msgNotify: '',
isError: true,
msgSendBack: isWebApi ? `Trading pair ${pair.toUpperCase()} is not valid` : `Wrong price source. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: isWebApi ? `Trading pair ${pair.toUpperCase()} is not valid` : `Wrong price source. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -391,7 +391,7 @@ async function enable(params, {}, isWebApi = false) {
return {
msgNotify: '',
isError: true,
msgSendBack: isWebApi ? `Unknown exchange: ${exchange}` : `I don't support ${exchange} exchange. Supported exchanges: ${config.supported_exchanges}. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: isWebApi ? `Unknown exchange: ${exchange}` : `I don't support ${exchange} exchange. Supported exchanges: ${config.supported_exchanges}. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -404,7 +404,7 @@ async function enable(params, {}, isWebApi = false) {
return {
msgNotify: '',
isError: true,
msgSendBack: `Trading pair ${pair.toUpperCase()} is not valid. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: `Trading pair ${pair.toUpperCase()} is not valid. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -425,7 +425,7 @@ async function enable(params, {}, isWebApi = false) {
return {
msgNotify: '',
isError: true,
msgSendBack: isWebApi ? `Unable to set Price watcher to the same trading pair as I trade, ${pairObj.pair}@${exchangeName}` : `Unable to set Price watcher to the same trading pair as I trade, ${pairObj.pair}@${exchangeName}. Set price in numbers or watch other trading pair/exchange. Example: */enable pw 0.1—0.2 USDT* or */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: isWebApi ? `Unable to set Price watcher to the same trading pair as I trade, ${pairObj.pair}@${exchangeName}` : `Unable to set Price watcher to the same trading pair as I trade, ${pairObj.pair}@${exchangeName}. Set price in numbers or watch other trading pair/exchange. Example: */enable pw 0.1—0.2 USDT* or */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -452,15 +452,15 @@ async function enable(params, {}, isWebApi = false) {
if (!percentString || (percentString.slice(-1) !== '%')) {
return {
msgNotify: '',
msgSendBack: `Set a deviation in percentage. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: `Set a deviation in percentage. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
percentValue = +percentString.slice(0, -1);
if (percentValue === Infinity || percentValue < 0 || percentValue > 90) {
return {
msgNotify: '',
msgSendBack: `Set correct deviation in percentage. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: `Set correct deviation in percentage. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand All @@ -474,7 +474,7 @@ async function enable(params, {}, isWebApi = false) {
if (!['smart', 'strict'].includes(pwSourcePolicy)) {
return {
msgNotify: '',
msgSendBack: `Wrong deviation policy. Allowed _smart_ or _strict_. Example: */enable pw ADM/USDT@CoinDeal 0.5% smart*.`,
msgSendBack: `Wrong deviation policy. Allowed _smart_ or _strict_. Example: */enable pw ADM/USDT@Azbit 0.5% smart*.`,
notifyType: 'log',
};
}
Expand Down Expand Up @@ -1582,11 +1582,18 @@ async function stats(params) {
let average = (exchangeRates.high+exchangeRates.low)/2;
let deltaPercent = delta/average * 100;
output += `\nVol: ${utils.formatNumber(+exchangeRates.volume.toFixed(coin1Decimals), true)} ${coin1}${volumeInCoin2String}.`;
output += `\nLow: ${exchangeRates.low.toFixed(coin2Decimals)}, high: ${exchangeRates.high.toFixed(coin2Decimals)}, delta: _${(delta).toFixed(coin2Decimals)}_ ${coin2} (${(deltaPercent).toFixed(2)}%).`;
if (exchangeRates.low && exchangeRates.high) {
output += `\nLow: ${exchangeRates.low.toFixed(coin2Decimals)}, high: ${exchangeRates.high.toFixed(coin2Decimals)}, delta: _${(delta).toFixed(coin2Decimals)}_ ${coin2} (${(deltaPercent).toFixed(2)}%).`;
} else {
output += `\nNo low and high rates available.`;
}
delta = exchangeRates.ask-exchangeRates.bid;
average = (exchangeRates.ask+exchangeRates.bid)/2;
deltaPercent = delta/average * 100;
output += `\nBid: ${exchangeRates.bid.toFixed(coin2Decimals)}, ask: ${exchangeRates.ask.toFixed(coin2Decimals)}, spread: _${(delta).toFixed(coin2Decimals)}_ ${coin2} (${(deltaPercent).toFixed(2)}%).`;
if (exchangeRates.last) {
output += `\nLast price: _${(exchangeRates.last).toFixed(coin2Decimals)}_ ${coin2}.`;
}
} else {
output += `Unable to get ${config.exchangeName} stats for ${pairObj.pair}. Try again later.`;
}
Expand Down
Loading

0 comments on commit beff817

Please sign in to comment.