Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from Adamant-im/dev
Browse files Browse the repository at this point in the history
v3.3.5
  • Loading branch information
dev-adamant-im authored Feb 15, 2022
2 parents f793706 + 28c4a86 commit a729615
Show file tree
Hide file tree
Showing 19 changed files with 823 additions and 3,715 deletions.
87 changes: 34 additions & 53 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,35 @@
module.exports = {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"rules": {
"semi": "warn", // обязательно ;
"semi-spacing": ["error", {
"before": false,
"after": true
}],
"indent": ["error", "tab"],
"space-infix-ops": "error", // отступы вокруг + - * / = и тд
"eqeqeq": "error", // обязательно === и !== (нельзя == и !=)
// "no-eq-null": "error", // обязательно === и !== (нельзя == и !=) но тоько в отношении null
"curly": "error", // проверка шаблонов `${name}`
"space-before-function-paren": [ // отступ до и после function
"error", {
"anonymous": "always",
"named": "always",
"asyncArrow": "ignore"
}
],
"key-spacing": ["error", {
"mode": "strict"
}], // оформление обЪекта
"space-in-parens": ["error", "never"], // запрет отступов ( a,b)
"computed-property-spacing": ["error", "never"], // запрет лишних отступов в выражениях a[ i]
"array-bracket-spacing": ["error", "never"],
"no-multi-spaces": "error", // запрет лишних пробелов var a = 2
"no-sparse-arrays": "warn", // предупреждение при дырке в массиве
"no-mixed-spaces-and-tabs": "error", // нельзя миксовать табы и пробелы
"keyword-spacing": ["error", {
"after": true
}],
"comma-spacing": ["error", {
"before": false,
"after": true
}], // отступ после запятой, а перед нельзя
"no-undef": "error",
"array-callback-return": "error" // коллбек методов массива типа arr.map arr.filter должны иметь return в коллбеке
},
"env": {
"node": true
},
"globals": {
"Promise": true,
"Symbol": true
},
"plugins": []
}
env: {
commonjs: true,
es2021: true,
node: true,
},
extends: [
'google',
],
parserOptions: {
ecmaVersion: 12,
},
rules: {
'object-curly-spacing': ['error', 'always'],
'max-len': ['error',
{ 'code': 131,
'ignoreTrailingComments': true,
'ignoreUrls': true,
'ignoreStrings': true,
'ignoreTemplateLiterals': true,
'ignoreRegExpLiterals': true,
}],
'require-jsdoc': ['off'],
'valid-jsdoc': ['off'],
'no-array-constructor': ['off'],
'no-caller': ['off'],
'prefer-promise-reject-errors': ['off'],
'guard-for-in': ['off'],
'no-unused-vars': ['off'],
'padded-blocks': ['off'],
'new-cap': ['off'],
'camelcase': ['off'],
'eqeqeq': ['error', 'always'],
},
};
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
node_modules/
logs/
config.test
.vscode/
config.test
config.test2
package-lock.json
tests.js
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
ADAMANT InfoServices is a crypto and fiat currency rates service provider. It collects rates from MOEX, Coinmarketcap, CryptoCompare and Coingecko and calculates cross-rates, and provides information via API.
ADAMANT InfoServices is a crypto and fiat currency rates service provider. It collects rates from MOEX, Currency-Api, Coinmarketcap, CryptoCompare and Coingecko and calculates cross-rates, and provides information via API.

Features:

- Collects rates from MOEX for fiat tickers
- Collects rates from Currency-Api for fiat tickers
- Collects rates from Coinmarketcap for crypto tickers
- Collects rates from CryptoCompare for crypto tickers
- Collects rates from Coingecko for crypto tickers
- Reliable: uses different sources for one coin, and notifies about significant deviation
- Minimum API calls. Free API keys fit.
- Notifications in case of errors to ADAMANT and Slack
- Notifications in case of errors to Slack
- Stores history on server, no need to make additional request
- Easy setup, settings in config file
- Easy setup, settings are in a config file
- Provides [RESTful API](https://github.com/Adamant-im/adamant-currencyinfo-services/wiki/InfoServices-API-documentation)
- Fast and low hardware requirements
- It is fast; low hardware requirements
- Open source
- Free use for any purposes
- Free to use for any purposes

# Installation

## Requirements
- Ubuntu 16 / Ubuntu 18 (other OS had not been tested)
- NodeJS v 8+ (already installed if you have a node on your machine)

- Ubuntu 18 / 20 (we didn't test with others)
- NodeJS v12+
- MongoDB ([installation instructions](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/))

## Setup

```
su - adamant
git clone https://github.com/Adamant-im/adamant-currencyinfo-services
Expand All @@ -29,12 +35,14 @@ npm i
```

## Pre-launch tuning

```
nano config.json
```

Parameters:
- `crypto_cmc` <array> List of coins to fetch rates from Coincarketcap

- `crypto_cmc` <array> List of coins to fetch rates from Coinmarketcap
- `crypto_cc` <array> List of coins to fetch rates from Cryptocompare
- `crypto_cg` <array> List of coins to fetch rates from Coingecko. Better use `crypto_cg_coinids`.
- `crypto_cg_coinids` <array> List of Coingecko coin Ids to fetch rates from Coingecko. Used when one coin symbol is used for different coins. Coin ids can be seen on https://api.coingecko.com/api/v3/coins/list.
Expand All @@ -49,20 +57,24 @@ Parameters:
- `adamant_notify` <string> ADM address to receive alerts for InfoService administrator. Recommended.
- `passPhrase` <string> The secret phrase for account you want to send alerts from. Obligatory in case of you set `adamant_notify`
- `node_ADM` <string, array> List of nodes for API work, obligatorily in case of you set `adamant_notify`
- `log_level` <string> The software will use verbosity according to `log_level`. It can be `none` < `error` < `warn` < `info` < `log`.

## Launching

You can start ADAMANT InfoServices with `node app` command, but it is recommended to use process manager:

```
pm2 start --name info-service app.js
pm2 start --name info-service app.js
```

## Add info-service to cron:
## Add info-service to cron

```
crontab -e
```

Add string:

```
@reboot cd /home/adamant/adamant-currencyinfo-services && pm2 start --name info-service app.js
```
Expand Down
Loading

0 comments on commit a729615

Please sign in to comment.