@icgio/clients-config 1.0.157 → 1.0.159
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitsecret/paths/mapping.cfg +1 -1
- package/config-benchmarks.js +61 -61
- package/config.js +107 -107
- package/config.json +44 -0
- package/data-source.js.secret +0 -0
- package/package.json +27 -27
- package/secretread.js.secret +0 -0
- package/update-config-json.js +278 -278
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
secretread.js:
|
|
1
|
+
secretread.js:6c0df938aee51d377d4bbb4d218d669a380d0df2de4b2e727c3e29b0a8a32d8c
|
|
2
2
|
data-source.js:7914c8a583a6dc1ed54909da44dbaf3b76c39adb98a63706ad277cc23de7b81b
|
package/config-benchmarks.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
const benchmarks = {
|
|
2
|
-
min_balance: {
|
|
3
|
-
ULTI: {
|
|
4
|
-
bybitv5_1: {
|
|
5
|
-
USDT: 7000,
|
|
6
|
-
},
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
orderbook_depth_in_quote_cur: {
|
|
10
|
-
AVALOX: {
|
|
11
|
-
|
|
12
|
-
AVALOXUSDT: [[0.01, 1000]],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
LUCIC: {
|
|
16
|
-
|
|
17
|
-
LUCICUSDT: [[0.01, 1000]],
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
MAK: {
|
|
21
|
-
|
|
22
|
-
MAKUSDT: [[0.01, 500]],
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
MAKUSDT: [[0.01, 500]],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
ask_bid_spread: {
|
|
30
|
-
AVALOX: {
|
|
31
|
-
|
|
32
|
-
AVALOXUSDT: 0.01,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
MAK: {
|
|
36
|
-
|
|
37
|
-
MAKUSDT: 0.01,
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
MAKUSDT: 0.01,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
volume_24h_in_quote_cur: {
|
|
45
|
-
ETHF: {
|
|
46
|
-
|
|
47
|
-
ETHFUSDT: 50000,
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
ETHFUSDT: 50000,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
MAK: {
|
|
54
|
-
|
|
55
|
-
MAKUSDT: 300000,
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = benchmarks
|
|
1
|
+
const benchmarks = {
|
|
2
|
+
min_balance: {
|
|
3
|
+
ULTI: {
|
|
4
|
+
bybitv5_1: {
|
|
5
|
+
USDT: 7000,
|
|
6
|
+
},
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
orderbook_depth_in_quote_cur: {
|
|
10
|
+
AVALOX: {
|
|
11
|
+
Gatev4: {
|
|
12
|
+
AVALOXUSDT: [[0.01, 1000]],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
LUCIC: {
|
|
16
|
+
Xt: {
|
|
17
|
+
LUCICUSDT: [[0.01, 1000]],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
MAK: {
|
|
21
|
+
Bitget: {
|
|
22
|
+
MAKUSDT: [[0.01, 500]],
|
|
23
|
+
},
|
|
24
|
+
Bybitv5: {
|
|
25
|
+
MAKUSDT: [[0.01, 500]],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
ask_bid_spread: {
|
|
30
|
+
AVALOX: {
|
|
31
|
+
Gatev4: {
|
|
32
|
+
AVALOXUSDT: 0.01,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
MAK: {
|
|
36
|
+
Bitget: {
|
|
37
|
+
MAKUSDT: 0.01,
|
|
38
|
+
},
|
|
39
|
+
Bybitv5: {
|
|
40
|
+
MAKUSDT: 0.01,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
volume_24h_in_quote_cur: {
|
|
45
|
+
ETHF: {
|
|
46
|
+
Mexc: {
|
|
47
|
+
ETHFUSDT: 50000,
|
|
48
|
+
},
|
|
49
|
+
Htx: {
|
|
50
|
+
ETHFUSDT: 50000,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
MAK: {
|
|
54
|
+
Bitget: {
|
|
55
|
+
MAKUSDT: 300000,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
module.exports = benchmarks
|
package/config.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
const _ = require('lodash')
|
|
2
|
-
const config_data = require('./config.json')
|
|
3
|
-
|
|
4
|
-
const client_exchange_pairs = config_data.client_exchange_pairs
|
|
5
|
-
module.exports.client_exchange_pairs = client_exchange_pairs
|
|
6
|
-
|
|
7
|
-
const client_not_include_exchanges = config_data.client_not_include_exchanges
|
|
8
|
-
module.exports.client_not_include_exchanges = client_not_include_exchanges
|
|
9
|
-
|
|
10
|
-
const client_pair_main_exchanges = config_data.client_pair_main_exchanges
|
|
11
|
-
module.exports.client_pair_main_exchanges = client_pair_main_exchanges
|
|
12
|
-
|
|
13
|
-
let client_exchange_currencies = {}
|
|
14
|
-
for (let client in client_exchange_pairs) {
|
|
15
|
-
for (let exchange in client_exchange_pairs[client]) {
|
|
16
|
-
_.set(
|
|
17
|
-
client_exchange_currencies,
|
|
18
|
-
[client, exchange],
|
|
19
|
-
client_exchange_pairs[client][exchange].map((pair) => pair.replace(client, ''))
|
|
20
|
-
)
|
|
21
|
-
client_exchange_currencies[client][exchange].push(client)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
module.exports.client_exchange_currencies = client_exchange_currencies
|
|
25
|
-
|
|
26
|
-
/*
|
|
27
|
-
{
|
|
28
|
-
AAAXXX: [Huobi, Okx],
|
|
29
|
-
CCCXXX: [Binance, Bitz]
|
|
30
|
-
}
|
|
31
|
-
*/
|
|
32
|
-
let client_pair_exchanges = {}
|
|
33
|
-
_.keys(client_exchange_pairs).map((cur) =>
|
|
34
|
-
_.keys(client_exchange_pairs[cur]).map((exchange) => {
|
|
35
|
-
client_exchange_pairs[cur][exchange].map((pair) => {
|
|
36
|
-
if (!client_pair_exchanges[cur] || !client_pair_exchanges[cur][pair]) {
|
|
37
|
-
_.set(client_pair_exchanges, [cur, pair], [])
|
|
38
|
-
}
|
|
39
|
-
client_pair_exchanges[cur][pair].push(exchange)
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
module.exports.client_pair_exchanges = client_pair_exchanges
|
|
44
|
-
|
|
45
|
-
/*
|
|
46
|
-
{
|
|
47
|
-
Binance: [AAAXXX, AAAYYY, BBBYYY, BBBZZZ],
|
|
48
|
-
Huobi: [CCCXXX, CCCYYY, DDDZZZ]
|
|
49
|
-
}
|
|
50
|
-
*/
|
|
51
|
-
let exchange_pairs = {}
|
|
52
|
-
_.values(client_exchange_pairs).map((exchange_pair_dict) => _.forEach(exchange_pair_dict, (v, k) => (exchange_pairs[k] = _.concat(exchange_pairs[k] ? exchange_pairs[k] : [], v))))
|
|
53
|
-
module.exports.exchange_pairs = exchange_pairs
|
|
54
|
-
|
|
55
|
-
/*
|
|
56
|
-
{
|
|
57
|
-
CVT: [CVTBTC, CVTETH],
|
|
58
|
-
HSC: [HSCETH, HSCUSDT]
|
|
59
|
-
}
|
|
60
|
-
*/
|
|
61
|
-
module.exports.client_pairs = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.union(..._.values(client_exchange_pairs[cur]))]))
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
{
|
|
65
|
-
CVT: [Binance, Bitz],
|
|
66
|
-
HSC: [Gatev4, Kkcoin]
|
|
67
|
-
}
|
|
68
|
-
*/
|
|
69
|
-
module.exports.client_exchanges = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.keys(client_exchange_pairs[cur])]))
|
|
70
|
-
|
|
71
|
-
/*
|
|
72
|
-
{
|
|
73
|
-
CVT: [CVT, BTC, ETH, USDT],
|
|
74
|
-
HSC: [HSC, ETH, USDT]
|
|
75
|
-
}
|
|
76
|
-
*/
|
|
77
|
-
module.exports.client_currencies_with_stables = _.fromPairs(
|
|
78
|
-
Object.keys(client_exchange_pairs).map((cur) => [cur, [cur, 'BTC', 'ETH', 'USD', 'USDT', 'USDC', 'CNYT', 'KRW', 'THB', 'TUSD', 'BNB', 'PAX']])
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
const clients_reporter_interval = config_data.clients_reporter_interval
|
|
82
|
-
module.exports.clients_reporter_interval = clients_reporter_interval
|
|
83
|
-
|
|
84
|
-
const balance_premium = config_data.balance_premium
|
|
85
|
-
module.exports.balance_premium = balance_premium
|
|
86
|
-
|
|
87
|
-
const client_enabled = config_data.client_enabled
|
|
88
|
-
module.exports.client_enabled = client_enabled
|
|
89
|
-
|
|
90
|
-
const client_levels = config_data.client_levels
|
|
91
|
-
module.exports.client_levels = client_levels
|
|
92
|
-
|
|
93
|
-
const client_price_index_curs = config_data.client_price_index_curs
|
|
94
|
-
module.exports.client_price_index_curs = client_price_index_curs
|
|
95
|
-
|
|
96
|
-
const client_telegram_ids = config_data.client_telegram_ids
|
|
97
|
-
module.exports.client_telegram_ids = client_telegram_ids
|
|
98
|
-
module.exports.telegram_id_clients = _.invertBy(client_telegram_ids)
|
|
99
|
-
|
|
100
|
-
const client_additional_telegram_ids = config_data.client_additional_telegram_ids
|
|
101
|
-
module.exports.client_additional_telegram_ids = client_additional_telegram_ids
|
|
102
|
-
|
|
103
|
-
const client_telegram_sender = config_data.client_telegram_sender
|
|
104
|
-
module.exports.client_telegram_sender = client_telegram_sender
|
|
105
|
-
|
|
106
|
-
const client_dashboard_credentials = config_data.client_dashboard_credentials
|
|
107
|
-
module.exports.client_dashboard_credentials = client_dashboard_credentials
|
|
1
|
+
const _ = require('lodash')
|
|
2
|
+
const config_data = require('./config.json')
|
|
3
|
+
|
|
4
|
+
const client_exchange_pairs = config_data.client_exchange_pairs
|
|
5
|
+
module.exports.client_exchange_pairs = client_exchange_pairs
|
|
6
|
+
|
|
7
|
+
const client_not_include_exchanges = config_data.client_not_include_exchanges
|
|
8
|
+
module.exports.client_not_include_exchanges = client_not_include_exchanges
|
|
9
|
+
|
|
10
|
+
const client_pair_main_exchanges = config_data.client_pair_main_exchanges
|
|
11
|
+
module.exports.client_pair_main_exchanges = client_pair_main_exchanges
|
|
12
|
+
|
|
13
|
+
let client_exchange_currencies = {}
|
|
14
|
+
for (let client in client_exchange_pairs) {
|
|
15
|
+
for (let exchange in client_exchange_pairs[client]) {
|
|
16
|
+
_.set(
|
|
17
|
+
client_exchange_currencies,
|
|
18
|
+
[client, exchange],
|
|
19
|
+
client_exchange_pairs[client][exchange].map((pair) => pair.replace(client, ''))
|
|
20
|
+
)
|
|
21
|
+
client_exchange_currencies[client][exchange].push(client)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
module.exports.client_exchange_currencies = client_exchange_currencies
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
{
|
|
28
|
+
AAAXXX: [Huobi, Okx],
|
|
29
|
+
CCCXXX: [Binance, Bitz]
|
|
30
|
+
}
|
|
31
|
+
*/
|
|
32
|
+
let client_pair_exchanges = {}
|
|
33
|
+
_.keys(client_exchange_pairs).map((cur) =>
|
|
34
|
+
_.keys(client_exchange_pairs[cur]).map((exchange) => {
|
|
35
|
+
client_exchange_pairs[cur][exchange].map((pair) => {
|
|
36
|
+
if (!client_pair_exchanges[cur] || !client_pair_exchanges[cur][pair]) {
|
|
37
|
+
_.set(client_pair_exchanges, [cur, pair], [])
|
|
38
|
+
}
|
|
39
|
+
client_pair_exchanges[cur][pair].push(exchange)
|
|
40
|
+
})
|
|
41
|
+
})
|
|
42
|
+
)
|
|
43
|
+
module.exports.client_pair_exchanges = client_pair_exchanges
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
{
|
|
47
|
+
Binance: [AAAXXX, AAAYYY, BBBYYY, BBBZZZ],
|
|
48
|
+
Huobi: [CCCXXX, CCCYYY, DDDZZZ]
|
|
49
|
+
}
|
|
50
|
+
*/
|
|
51
|
+
let exchange_pairs = {}
|
|
52
|
+
_.values(client_exchange_pairs).map((exchange_pair_dict) => _.forEach(exchange_pair_dict, (v, k) => (exchange_pairs[k] = _.concat(exchange_pairs[k] ? exchange_pairs[k] : [], v))))
|
|
53
|
+
module.exports.exchange_pairs = exchange_pairs
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
{
|
|
57
|
+
CVT: [CVTBTC, CVTETH],
|
|
58
|
+
HSC: [HSCETH, HSCUSDT]
|
|
59
|
+
}
|
|
60
|
+
*/
|
|
61
|
+
module.exports.client_pairs = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.union(..._.values(client_exchange_pairs[cur]))]))
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
{
|
|
65
|
+
CVT: [Binance, Bitz],
|
|
66
|
+
HSC: [Gatev4, Kkcoin]
|
|
67
|
+
}
|
|
68
|
+
*/
|
|
69
|
+
module.exports.client_exchanges = _.fromPairs(Object.keys(client_exchange_pairs).map((cur) => [cur, _.keys(client_exchange_pairs[cur])]))
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
{
|
|
73
|
+
CVT: [CVT, BTC, ETH, USDT],
|
|
74
|
+
HSC: [HSC, ETH, USDT]
|
|
75
|
+
}
|
|
76
|
+
*/
|
|
77
|
+
module.exports.client_currencies_with_stables = _.fromPairs(
|
|
78
|
+
Object.keys(client_exchange_pairs).map((cur) => [cur, [cur, 'BTC', 'ETH', 'USD', 'USDT', 'USDC', 'CNYT', 'KRW', 'THB', 'TUSD', 'BNB', 'PAX']])
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
const clients_reporter_interval = config_data.clients_reporter_interval
|
|
82
|
+
module.exports.clients_reporter_interval = clients_reporter_interval
|
|
83
|
+
|
|
84
|
+
const balance_premium = config_data.balance_premium
|
|
85
|
+
module.exports.balance_premium = balance_premium
|
|
86
|
+
|
|
87
|
+
const client_enabled = config_data.client_enabled
|
|
88
|
+
module.exports.client_enabled = client_enabled
|
|
89
|
+
|
|
90
|
+
const client_levels = config_data.client_levels
|
|
91
|
+
module.exports.client_levels = client_levels
|
|
92
|
+
|
|
93
|
+
const client_price_index_curs = config_data.client_price_index_curs
|
|
94
|
+
module.exports.client_price_index_curs = client_price_index_curs
|
|
95
|
+
|
|
96
|
+
const client_telegram_ids = config_data.client_telegram_ids
|
|
97
|
+
module.exports.client_telegram_ids = client_telegram_ids
|
|
98
|
+
module.exports.telegram_id_clients = _.invertBy(client_telegram_ids)
|
|
99
|
+
|
|
100
|
+
const client_additional_telegram_ids = config_data.client_additional_telegram_ids
|
|
101
|
+
module.exports.client_additional_telegram_ids = client_additional_telegram_ids
|
|
102
|
+
|
|
103
|
+
const client_telegram_sender = config_data.client_telegram_sender
|
|
104
|
+
module.exports.client_telegram_sender = client_telegram_sender
|
|
105
|
+
|
|
106
|
+
const client_dashboard_credentials = config_data.client_dashboard_credentials
|
|
107
|
+
module.exports.client_dashboard_credentials = client_dashboard_credentials
|
package/config.json
CHANGED
|
@@ -15,10 +15,16 @@
|
|
|
15
15
|
"CP": {
|
|
16
16
|
"Mexc": ["CPUSDT"]
|
|
17
17
|
},
|
|
18
|
+
"DCC": {
|
|
19
|
+
"Mexc": ["DCCUSDT"]
|
|
20
|
+
},
|
|
18
21
|
"ETHF": {
|
|
19
22
|
"Htx": ["ETHFUSDT"],
|
|
20
23
|
"Mexc": ["ETHFUSDT"]
|
|
21
24
|
},
|
|
25
|
+
"ILMT": {
|
|
26
|
+
"Mexc": ["ILMTUSDT"]
|
|
27
|
+
},
|
|
22
28
|
"IONX": {
|
|
23
29
|
"Gatev4": ["IONXUSDT"],
|
|
24
30
|
"Mexc": ["IONXUSDT"]
|
|
@@ -72,7 +78,9 @@
|
|
|
72
78
|
"AVALOX": [],
|
|
73
79
|
"BVT": [],
|
|
74
80
|
"CP": [],
|
|
81
|
+
"DCC": [],
|
|
75
82
|
"ETHF": [],
|
|
83
|
+
"ILMT": [],
|
|
76
84
|
"IONX": [],
|
|
77
85
|
"JYAI": [],
|
|
78
86
|
"LANLAN": [],
|
|
@@ -99,9 +107,15 @@
|
|
|
99
107
|
"CP": {
|
|
100
108
|
"CPUSDT": ["Mexc"]
|
|
101
109
|
},
|
|
110
|
+
"DCC": {
|
|
111
|
+
"DCCUSDT": ["Mexc"]
|
|
112
|
+
},
|
|
102
113
|
"ETHF": {
|
|
103
114
|
"ETHFUSDT": ["Htx", "Mexc"]
|
|
104
115
|
},
|
|
116
|
+
"ILMT": {
|
|
117
|
+
"ILMTUSDT": ["Mexc"]
|
|
118
|
+
},
|
|
105
119
|
"IONX": {
|
|
106
120
|
"IONXUSDT": ["Gatev4", "Mexc"]
|
|
107
121
|
},
|
|
@@ -162,11 +176,21 @@
|
|
|
162
176
|
"trades": 1,
|
|
163
177
|
"orderbook": 1
|
|
164
178
|
},
|
|
179
|
+
"DCC": {
|
|
180
|
+
"balance": 1,
|
|
181
|
+
"trades": 1,
|
|
182
|
+
"orderbook": 1
|
|
183
|
+
},
|
|
165
184
|
"ETHF": {
|
|
166
185
|
"balance": 1,
|
|
167
186
|
"trades": 1,
|
|
168
187
|
"orderbook": 1
|
|
169
188
|
},
|
|
189
|
+
"ILMT": {
|
|
190
|
+
"balance": 1,
|
|
191
|
+
"trades": 1,
|
|
192
|
+
"orderbook": 1
|
|
193
|
+
},
|
|
170
194
|
"IONX": {
|
|
171
195
|
"balance": 1,
|
|
172
196
|
"trades": 1,
|
|
@@ -234,7 +258,9 @@
|
|
|
234
258
|
"AVALOX": true,
|
|
235
259
|
"BVT": true,
|
|
236
260
|
"CP": true,
|
|
261
|
+
"DCC": true,
|
|
237
262
|
"ETHF": true,
|
|
263
|
+
"ILMT": true,
|
|
238
264
|
"JYAI": true,
|
|
239
265
|
"LANLAN": true,
|
|
240
266
|
"LUCIC": true,
|
|
@@ -260,7 +286,9 @@
|
|
|
260
286
|
"AVALOX": true,
|
|
261
287
|
"BVT": true,
|
|
262
288
|
"CP": true,
|
|
289
|
+
"DCC": true,
|
|
263
290
|
"ETHF": true,
|
|
291
|
+
"ILMT": true,
|
|
264
292
|
"IONX": true,
|
|
265
293
|
"JYAI": true,
|
|
266
294
|
"LANLAN": true,
|
|
@@ -283,7 +311,9 @@
|
|
|
283
311
|
"AVALOX": [1, 2, 5, 10, 20, 50, 100],
|
|
284
312
|
"BVT": [1, 2, 5, 10, 20, 50, 100],
|
|
285
313
|
"CP": [1, 2, 5, 10, 20, 50, 100],
|
|
314
|
+
"DCC": [1, 2, 5, 10, 20, 50, 100],
|
|
286
315
|
"ETHF": [1, 2, 5, 10, 20, 50, 100],
|
|
316
|
+
"ILMT": [1, 2, 5, 10, 20, 50, 100],
|
|
287
317
|
"IONX": [1, 2, 5, 10, 20, 50, 100],
|
|
288
318
|
"JYAI": [1, 2, 5, 10, 20, 50, 100],
|
|
289
319
|
"LANLAN": [1, 2, 5, 10, 20, 50, 100],
|
|
@@ -302,7 +332,9 @@
|
|
|
302
332
|
"AVALOX": ["BTC", "ETH"],
|
|
303
333
|
"BVT": ["BTC", "ETH"],
|
|
304
334
|
"CP": ["BTC", "ETH"],
|
|
335
|
+
"DCC": ["BTC", "ETH"],
|
|
305
336
|
"ETHF": ["BTC", "ETH"],
|
|
337
|
+
"ILMT": ["BTC", "ETH"],
|
|
306
338
|
"IONX": ["BTC", "ETH"],
|
|
307
339
|
"JYAI": ["BTC", "ETH"],
|
|
308
340
|
"LANLAN": ["BTC", "ETH"],
|
|
@@ -321,7 +353,9 @@
|
|
|
321
353
|
"AVALOX": "-1002106426914",
|
|
322
354
|
"BVT": "-4802263491",
|
|
323
355
|
"CP": "-4718906035",
|
|
356
|
+
"DCC": "-4971137298",
|
|
324
357
|
"ETHF": "-4698418127",
|
|
358
|
+
"ILMT": "-4802252746",
|
|
325
359
|
"IONX": "-1002085059560",
|
|
326
360
|
"JYAI": "-4787448589",
|
|
327
361
|
"LANLAN": "-4886059689",
|
|
@@ -359,7 +393,9 @@
|
|
|
359
393
|
"AVALOX": "icg",
|
|
360
394
|
"BVT": "icg",
|
|
361
395
|
"CP": "icg",
|
|
396
|
+
"DCC": "icg",
|
|
362
397
|
"ETHF": "icg",
|
|
398
|
+
"ILMT": "icg",
|
|
363
399
|
"IONX": "icg",
|
|
364
400
|
"JYAI": "icg",
|
|
365
401
|
"LANLAN": "icg",
|
|
@@ -390,10 +426,18 @@
|
|
|
390
426
|
"username": "cp@icg.io",
|
|
391
427
|
"password": "Lonk3jbU0xQsMVO"
|
|
392
428
|
},
|
|
429
|
+
"DCC": {
|
|
430
|
+
"username": "dcc@icg.io",
|
|
431
|
+
"password": "T7y7y6fll5K87Nr"
|
|
432
|
+
},
|
|
393
433
|
"ETHF": {
|
|
394
434
|
"username": "ethf@icg.io",
|
|
395
435
|
"password": "m0ULpp3o4FoVey4"
|
|
396
436
|
},
|
|
437
|
+
"ILMT": {
|
|
438
|
+
"username": "ilmt@icg.io",
|
|
439
|
+
"password": "b8X06ltUjvpF0Pt"
|
|
440
|
+
},
|
|
397
441
|
"IONX": {
|
|
398
442
|
"username": "ionx@icg.io",
|
|
399
443
|
"password": "gW5vZbXQp3BseNH"
|
package/data-source.js.secret
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@icgio/clients-config",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/icgio/clients-config.git"
|
|
12
|
-
},
|
|
13
|
-
"author": "",
|
|
14
|
-
"license": "ISC",
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/icgio/clients-config/issues"
|
|
17
|
-
},
|
|
18
|
-
"homepage": "https://github.com/icgio/clients-config#readme",
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"lodash": "^4.17.20"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"fs-extra": "^11.2.0",
|
|
24
|
-
"node-cmd": "^5.0.0",
|
|
25
|
-
"prompt": "^1.3.0"
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@icgio/clients-config",
|
|
3
|
+
"version": "1.0.159",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/icgio/clients-config.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/icgio/clients-config/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/icgio/clients-config#readme",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"lodash": "^4.17.20"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"fs-extra": "^11.2.0",
|
|
24
|
+
"node-cmd": "^5.0.0",
|
|
25
|
+
"prompt": "^1.3.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
package/secretread.js.secret
CHANGED
|
Binary file
|
package/update-config-json.js
CHANGED
|
@@ -1,278 +1,278 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const prompt = require('prompt')
|
|
3
|
-
|
|
4
|
-
const config_file_path = './config.json'
|
|
5
|
-
const config_archive_file_path = './config-archive.json'
|
|
6
|
-
|
|
7
|
-
prompt.start()
|
|
8
|
-
|
|
9
|
-
function read_config_file(path) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
fs.readFile(path, 'utf8', (err, data) => {
|
|
12
|
-
if (err) reject(err)
|
|
13
|
-
else resolve(data)
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function write_config_file(data, path) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
fs.writeFile(path, JSON.stringify(data, null, 2), 'utf8', (err) => {
|
|
21
|
-
if (err) return reject(err)
|
|
22
|
-
else resolve()
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function process_config() {
|
|
28
|
-
try {
|
|
29
|
-
const schema = {
|
|
30
|
-
properties: {
|
|
31
|
-
action: {
|
|
32
|
-
description: 'Enter the action ( add, delete )',
|
|
33
|
-
pattern: /^(add|delete)$/,
|
|
34
|
-
message: 'Action must be one of "add", "delete"',
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
client_name: {
|
|
38
|
-
description: 'Enter the client name you want to perform the action on',
|
|
39
|
-
required: true,
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
prompt.get(schema, (err, result) => {
|
|
45
|
-
if (err) {
|
|
46
|
-
console.error(err)
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
switch (result.action) {
|
|
51
|
-
case 'add':
|
|
52
|
-
add_client(result.client_name)
|
|
53
|
-
break
|
|
54
|
-
case 'delete':
|
|
55
|
-
delete_client(result.client_name)
|
|
56
|
-
break
|
|
57
|
-
default:
|
|
58
|
-
console.log('Invalid action')
|
|
59
|
-
break
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
} catch (error) {
|
|
63
|
-
console.error(`Error processing the config file: ${error}`)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function delete_client(client_name) {
|
|
68
|
-
read_config_file(config_file_path)
|
|
69
|
-
.then((config_file_data) => {
|
|
70
|
-
config_file_data = JSON.parse(config_file_data)
|
|
71
|
-
|
|
72
|
-
update_config_archive(config_file_data, client_name)
|
|
73
|
-
.then(() => {
|
|
74
|
-
delete config_file_data.client_exchange_pairs[client_name]
|
|
75
|
-
delete config_file_data.client_pair_main_exchanges[client_name]
|
|
76
|
-
delete config_file_data.client_not_include_exchanges[client_name]
|
|
77
|
-
delete config_file_data.client_levels[client_name]
|
|
78
|
-
delete config_file_data.client_price_index_curs[client_name]
|
|
79
|
-
delete config_file_data.client_telegram_ids[client_name]
|
|
80
|
-
delete config_file_data.clients_reporter_interval[client_name]
|
|
81
|
-
|
|
82
|
-
for (let key in config_file_data.client_enabled) {
|
|
83
|
-
if (config_file_data.client_enabled.hasOwnProperty(key)) {
|
|
84
|
-
delete config_file_data.client_enabled[key][client_name]
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
write_config_file(config_file_data, config_file_path)
|
|
89
|
-
.then(() => {
|
|
90
|
-
console.log(`Client '${client_name}' has been deleted successfully.`)
|
|
91
|
-
})
|
|
92
|
-
.catch((err) => {
|
|
93
|
-
console.error(`Error writing to config file: ${err}`)
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
.catch((err) => {
|
|
97
|
-
console.error(`Error updating config archive: ${err}`)
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
.catch((err) => {
|
|
101
|
-
console.error(`Error reading config file: ${err}`)
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function add_client(client_name) {
|
|
106
|
-
const schema = {
|
|
107
|
-
properties: {
|
|
108
|
-
client_exchange_pairs: {
|
|
109
|
-
description: 'Enter client exchange pairs (JSON format i.e { "Mexc": ["RWXUSDT"], "Bitget": ["RWXUSDT"] } )',
|
|
110
|
-
required: true,
|
|
111
|
-
pattern: /^\{.*\}$/,
|
|
112
|
-
message: 'Please enter a valid JSON object.',
|
|
113
|
-
},
|
|
114
|
-
client_not_include_exchanges: {
|
|
115
|
-
description: 'Enter client not include exchanges (Comma-separated values, e.g., Jubi, Lbank)',
|
|
116
|
-
required: false,
|
|
117
|
-
},
|
|
118
|
-
client_pair_main_exchanges: {
|
|
119
|
-
description: 'Enter client pair main exchanges (JSON format i.e {"ETHUSDT": ["Bitget", "Gatev4"]} )',
|
|
120
|
-
required: true,
|
|
121
|
-
pattern: /^\{.*\}$/,
|
|
122
|
-
message: 'Please enter a valid JSON object.',
|
|
123
|
-
},
|
|
124
|
-
clients_reporter_interval: {
|
|
125
|
-
description: 'Enter clients reporter interval (JSON format i.e { "balance": 1, "trades": 1, "orderbook": 1} )',
|
|
126
|
-
required: true,
|
|
127
|
-
pattern: /^\{.*\}$/,
|
|
128
|
-
message: 'Please enter a valid JSON object.',
|
|
129
|
-
},
|
|
130
|
-
client_levels: {
|
|
131
|
-
description: 'Enter client levels (Comma-separated values, e.g. 2, 5, 10 ) ',
|
|
132
|
-
required: true,
|
|
133
|
-
},
|
|
134
|
-
client_price_index_curs: {
|
|
135
|
-
description: 'Enter client benchmarks (Comma-separated values, e.g., BTC,ETH)',
|
|
136
|
-
required: false,
|
|
137
|
-
},
|
|
138
|
-
client_telegram_ids: {
|
|
139
|
-
description: 'Enter client telegram ids i.e 1233457 ',
|
|
140
|
-
required: true,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
}
|
|
144
|
-
read_config_file(config_file_path)
|
|
145
|
-
.then((config_file_data) => {
|
|
146
|
-
prompt.get(schema, (err, result) => {
|
|
147
|
-
if (err) {
|
|
148
|
-
console.error(err)
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
config_file_data = JSON.parse(config_file_data)
|
|
152
|
-
|
|
153
|
-
let exchange_pairs = result.client_exchange_pairs.trim()
|
|
154
|
-
exchange_pairs = JSON.parse(exchange_pairs)
|
|
155
|
-
|
|
156
|
-
let pair_exchanges = result.client_pair_main_exchanges.trim()
|
|
157
|
-
pair_exchanges = JSON.parse(pair_exchanges)
|
|
158
|
-
|
|
159
|
-
let reporter_interval = result.clients_reporter_interval.trim()
|
|
160
|
-
reporter_interval = JSON.parse(reporter_interval)
|
|
161
|
-
|
|
162
|
-
let not_include_exchanges = []
|
|
163
|
-
if (result.client_not_include_exchanges) {
|
|
164
|
-
not_include_exchanges = result.client_not_include_exchanges.split(',').map((value) => value.trim())
|
|
165
|
-
not_include_exchanges.sort()
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
let benchmarks = []
|
|
169
|
-
if (result.client_price_index_curs) {
|
|
170
|
-
benchmarks = result.client_price_index_curs.split(',').map((value) => value.trim())
|
|
171
|
-
benchmarks.sort()
|
|
172
|
-
}
|
|
173
|
-
let levels = result.client_levels.split(',').map((value) => Number(value.trim()))
|
|
174
|
-
|
|
175
|
-
config_file_data.client_exchange_pairs[client_name] = exchange_pairs
|
|
176
|
-
config_file_data.client_pair_main_exchanges[client_name] = pair_exchanges
|
|
177
|
-
|
|
178
|
-
config_file_data.clients_reporter_interval[client_name] = reporter_interval
|
|
179
|
-
|
|
180
|
-
config_file_data.client_not_include_exchanges[client_name] = not_include_exchanges
|
|
181
|
-
config_file_data.client_levels[client_name] = levels
|
|
182
|
-
config_file_data.client_price_index_curs[client_name] = benchmarks
|
|
183
|
-
|
|
184
|
-
config_file_data.client_telegram_ids[client_name] = result.client_telegram_ids
|
|
185
|
-
|
|
186
|
-
config_file_data.client_exchange_pairs = sort(config_file_data.client_exchange_pairs)
|
|
187
|
-
config_file_data.client_pair_main_exchanges = sort(config_file_data.client_pair_main_exchanges)
|
|
188
|
-
config_file_data.clients_reporter_interval = sort(config_file_data.clients_reporter_interval)
|
|
189
|
-
config_file_data.client_not_include_exchanges = sort(config_file_data.client_not_include_exchanges)
|
|
190
|
-
config_file_data.client_levels = sort(config_file_data.client_levels)
|
|
191
|
-
config_file_data.client_price_index_curs = sort(config_file_data.client_price_index_curs)
|
|
192
|
-
config_file_data.client_telegram_ids = sort(config_file_data.client_telegram_ids)
|
|
193
|
-
|
|
194
|
-
write_config_file(config_file_data, config_file_path)
|
|
195
|
-
.then(() => {
|
|
196
|
-
console.log(`Client '${client_name}' has been added successfully.`)
|
|
197
|
-
})
|
|
198
|
-
.catch((err) => {
|
|
199
|
-
console.error(`Error writing to config file: ${err}`)
|
|
200
|
-
})
|
|
201
|
-
})
|
|
202
|
-
})
|
|
203
|
-
.catch((err) => {
|
|
204
|
-
console.error(`Error reading config file: ${err}`)
|
|
205
|
-
})
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function update_config_archive(config_file_data, client_name) {
|
|
209
|
-
return new Promise((resolve, reject) => {
|
|
210
|
-
read_config_file(config_archive_file_path)
|
|
211
|
-
.then((config_archive_data) => {
|
|
212
|
-
try {
|
|
213
|
-
config_archive_data = JSON.parse(config_archive_data)
|
|
214
|
-
} catch (error) {
|
|
215
|
-
console.error(`Error parsing config archive data: ${error}`)
|
|
216
|
-
reject(error)
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
config_archive_data.client_exchange_pairs[client_name] = config_file_data.client_exchange_pairs[client_name]
|
|
220
|
-
config_archive_data.client_pair_main_exchanges[client_name] = config_file_data.client_pair_main_exchanges[client_name]
|
|
221
|
-
config_archive_data.clients_reporter_interval[client_name] = config_file_data.clients_reporter_interval[client_name]
|
|
222
|
-
config_archive_data.client_not_include_exchanges[client_name] = config_file_data.client_not_include_exchanges[client_name]
|
|
223
|
-
config_archive_data.client_levels[client_name] = config_file_data.client_levels[client_name]
|
|
224
|
-
config_archive_data.client_price_index_curs[client_name] = config_file_data.client_price_index_curs[client_name]
|
|
225
|
-
config_archive_data.client_telegram_ids[client_name] = config_file_data.client_telegram_ids[client_name]
|
|
226
|
-
|
|
227
|
-
if (!config_archive_data.client_enabled) {
|
|
228
|
-
config_archive_data.client_enabled = {}
|
|
229
|
-
}
|
|
230
|
-
for (let key in config_file_data.client_enabled) {
|
|
231
|
-
if (config_file_data.client_enabled.hasOwnProperty(key)) {
|
|
232
|
-
if (!config_archive_data.client_enabled[key]) {
|
|
233
|
-
config_archive_data.client_enabled[key] = {}
|
|
234
|
-
}
|
|
235
|
-
config_archive_data.client_enabled[key][client_name] = config_file_data.client_enabled[key][client_name]
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
config_archive_data.client_exchange_pairs = sort(config_archive_data.client_exchange_pairs)
|
|
240
|
-
config_archive_data.client_pair_main_exchanges = sort(config_archive_data.client_pair_main_exchanges)
|
|
241
|
-
config_archive_data.clients_reporter_interval = sort(config_archive_data.clients_reporter_interval)
|
|
242
|
-
config_archive_data.client_not_include_exchanges = sort(config_archive_data.client_not_include_exchanges)
|
|
243
|
-
config_archive_data.client_levels = sort(config_archive_data.client_levels)
|
|
244
|
-
config_archive_data.client_price_index_curs = sort(config_archive_data.client_price_index_curs)
|
|
245
|
-
config_archive_data.client_telegram_ids = sort(config_archive_data.client_telegram_ids)
|
|
246
|
-
|
|
247
|
-
for (let key in config_archive_data.client_enabled) {
|
|
248
|
-
if (config_archive_data.client_enabled.hasOwnProperty(key)) {
|
|
249
|
-
config_archive_data.client_enabled[key] = sort(config_archive_data.client_enabled[key])
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
write_config_file(config_archive_data, config_archive_file_path)
|
|
254
|
-
.then(() => {
|
|
255
|
-
resolve()
|
|
256
|
-
})
|
|
257
|
-
.catch((err) => {
|
|
258
|
-
console.error(`Error writing to config file: ${err}`)
|
|
259
|
-
reject(err)
|
|
260
|
-
})
|
|
261
|
-
})
|
|
262
|
-
.catch((err) => {
|
|
263
|
-
console.error(`Error reading config archive file: ${err}`)
|
|
264
|
-
reject(err)
|
|
265
|
-
})
|
|
266
|
-
})
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function sort(obj) {
|
|
270
|
-
return Object.keys(obj)
|
|
271
|
-
.sort()
|
|
272
|
-
.reduce((result, key) => {
|
|
273
|
-
result[key] = obj[key]
|
|
274
|
-
return result
|
|
275
|
-
}, {})
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
process_config()
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const prompt = require('prompt')
|
|
3
|
+
|
|
4
|
+
const config_file_path = './config.json'
|
|
5
|
+
const config_archive_file_path = './config-archive.json'
|
|
6
|
+
|
|
7
|
+
prompt.start()
|
|
8
|
+
|
|
9
|
+
function read_config_file(path) {
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
fs.readFile(path, 'utf8', (err, data) => {
|
|
12
|
+
if (err) reject(err)
|
|
13
|
+
else resolve(data)
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function write_config_file(data, path) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
fs.writeFile(path, JSON.stringify(data, null, 2), 'utf8', (err) => {
|
|
21
|
+
if (err) return reject(err)
|
|
22
|
+
else resolve()
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function process_config() {
|
|
28
|
+
try {
|
|
29
|
+
const schema = {
|
|
30
|
+
properties: {
|
|
31
|
+
action: {
|
|
32
|
+
description: 'Enter the action ( add, delete )',
|
|
33
|
+
pattern: /^(add|delete)$/,
|
|
34
|
+
message: 'Action must be one of "add", "delete"',
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
client_name: {
|
|
38
|
+
description: 'Enter the client name you want to perform the action on',
|
|
39
|
+
required: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
prompt.get(schema, (err, result) => {
|
|
45
|
+
if (err) {
|
|
46
|
+
console.error(err)
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
switch (result.action) {
|
|
51
|
+
case 'add':
|
|
52
|
+
add_client(result.client_name)
|
|
53
|
+
break
|
|
54
|
+
case 'delete':
|
|
55
|
+
delete_client(result.client_name)
|
|
56
|
+
break
|
|
57
|
+
default:
|
|
58
|
+
console.log('Invalid action')
|
|
59
|
+
break
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`Error processing the config file: ${error}`)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function delete_client(client_name) {
|
|
68
|
+
read_config_file(config_file_path)
|
|
69
|
+
.then((config_file_data) => {
|
|
70
|
+
config_file_data = JSON.parse(config_file_data)
|
|
71
|
+
|
|
72
|
+
update_config_archive(config_file_data, client_name)
|
|
73
|
+
.then(() => {
|
|
74
|
+
delete config_file_data.client_exchange_pairs[client_name]
|
|
75
|
+
delete config_file_data.client_pair_main_exchanges[client_name]
|
|
76
|
+
delete config_file_data.client_not_include_exchanges[client_name]
|
|
77
|
+
delete config_file_data.client_levels[client_name]
|
|
78
|
+
delete config_file_data.client_price_index_curs[client_name]
|
|
79
|
+
delete config_file_data.client_telegram_ids[client_name]
|
|
80
|
+
delete config_file_data.clients_reporter_interval[client_name]
|
|
81
|
+
|
|
82
|
+
for (let key in config_file_data.client_enabled) {
|
|
83
|
+
if (config_file_data.client_enabled.hasOwnProperty(key)) {
|
|
84
|
+
delete config_file_data.client_enabled[key][client_name]
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
write_config_file(config_file_data, config_file_path)
|
|
89
|
+
.then(() => {
|
|
90
|
+
console.log(`Client '${client_name}' has been deleted successfully.`)
|
|
91
|
+
})
|
|
92
|
+
.catch((err) => {
|
|
93
|
+
console.error(`Error writing to config file: ${err}`)
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
.catch((err) => {
|
|
97
|
+
console.error(`Error updating config archive: ${err}`)
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
.catch((err) => {
|
|
101
|
+
console.error(`Error reading config file: ${err}`)
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function add_client(client_name) {
|
|
106
|
+
const schema = {
|
|
107
|
+
properties: {
|
|
108
|
+
client_exchange_pairs: {
|
|
109
|
+
description: 'Enter client exchange pairs (JSON format i.e { "Mexc": ["RWXUSDT"], "Bitget": ["RWXUSDT"] } )',
|
|
110
|
+
required: true,
|
|
111
|
+
pattern: /^\{.*\}$/,
|
|
112
|
+
message: 'Please enter a valid JSON object.',
|
|
113
|
+
},
|
|
114
|
+
client_not_include_exchanges: {
|
|
115
|
+
description: 'Enter client not include exchanges (Comma-separated values, e.g., Jubi, Lbank)',
|
|
116
|
+
required: false,
|
|
117
|
+
},
|
|
118
|
+
client_pair_main_exchanges: {
|
|
119
|
+
description: 'Enter client pair main exchanges (JSON format i.e {"ETHUSDT": ["Bitget", "Gatev4"]} )',
|
|
120
|
+
required: true,
|
|
121
|
+
pattern: /^\{.*\}$/,
|
|
122
|
+
message: 'Please enter a valid JSON object.',
|
|
123
|
+
},
|
|
124
|
+
clients_reporter_interval: {
|
|
125
|
+
description: 'Enter clients reporter interval (JSON format i.e { "balance": 1, "trades": 1, "orderbook": 1} )',
|
|
126
|
+
required: true,
|
|
127
|
+
pattern: /^\{.*\}$/,
|
|
128
|
+
message: 'Please enter a valid JSON object.',
|
|
129
|
+
},
|
|
130
|
+
client_levels: {
|
|
131
|
+
description: 'Enter client levels (Comma-separated values, e.g. 2, 5, 10 ) ',
|
|
132
|
+
required: true,
|
|
133
|
+
},
|
|
134
|
+
client_price_index_curs: {
|
|
135
|
+
description: 'Enter client benchmarks (Comma-separated values, e.g., BTC,ETH)',
|
|
136
|
+
required: false,
|
|
137
|
+
},
|
|
138
|
+
client_telegram_ids: {
|
|
139
|
+
description: 'Enter client telegram ids i.e 1233457 ',
|
|
140
|
+
required: true,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
read_config_file(config_file_path)
|
|
145
|
+
.then((config_file_data) => {
|
|
146
|
+
prompt.get(schema, (err, result) => {
|
|
147
|
+
if (err) {
|
|
148
|
+
console.error(err)
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
config_file_data = JSON.parse(config_file_data)
|
|
152
|
+
|
|
153
|
+
let exchange_pairs = result.client_exchange_pairs.trim()
|
|
154
|
+
exchange_pairs = JSON.parse(exchange_pairs)
|
|
155
|
+
|
|
156
|
+
let pair_exchanges = result.client_pair_main_exchanges.trim()
|
|
157
|
+
pair_exchanges = JSON.parse(pair_exchanges)
|
|
158
|
+
|
|
159
|
+
let reporter_interval = result.clients_reporter_interval.trim()
|
|
160
|
+
reporter_interval = JSON.parse(reporter_interval)
|
|
161
|
+
|
|
162
|
+
let not_include_exchanges = []
|
|
163
|
+
if (result.client_not_include_exchanges) {
|
|
164
|
+
not_include_exchanges = result.client_not_include_exchanges.split(',').map((value) => value.trim())
|
|
165
|
+
not_include_exchanges.sort()
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
let benchmarks = []
|
|
169
|
+
if (result.client_price_index_curs) {
|
|
170
|
+
benchmarks = result.client_price_index_curs.split(',').map((value) => value.trim())
|
|
171
|
+
benchmarks.sort()
|
|
172
|
+
}
|
|
173
|
+
let levels = result.client_levels.split(',').map((value) => Number(value.trim()))
|
|
174
|
+
|
|
175
|
+
config_file_data.client_exchange_pairs[client_name] = exchange_pairs
|
|
176
|
+
config_file_data.client_pair_main_exchanges[client_name] = pair_exchanges
|
|
177
|
+
|
|
178
|
+
config_file_data.clients_reporter_interval[client_name] = reporter_interval
|
|
179
|
+
|
|
180
|
+
config_file_data.client_not_include_exchanges[client_name] = not_include_exchanges
|
|
181
|
+
config_file_data.client_levels[client_name] = levels
|
|
182
|
+
config_file_data.client_price_index_curs[client_name] = benchmarks
|
|
183
|
+
|
|
184
|
+
config_file_data.client_telegram_ids[client_name] = result.client_telegram_ids
|
|
185
|
+
|
|
186
|
+
config_file_data.client_exchange_pairs = sort(config_file_data.client_exchange_pairs)
|
|
187
|
+
config_file_data.client_pair_main_exchanges = sort(config_file_data.client_pair_main_exchanges)
|
|
188
|
+
config_file_data.clients_reporter_interval = sort(config_file_data.clients_reporter_interval)
|
|
189
|
+
config_file_data.client_not_include_exchanges = sort(config_file_data.client_not_include_exchanges)
|
|
190
|
+
config_file_data.client_levels = sort(config_file_data.client_levels)
|
|
191
|
+
config_file_data.client_price_index_curs = sort(config_file_data.client_price_index_curs)
|
|
192
|
+
config_file_data.client_telegram_ids = sort(config_file_data.client_telegram_ids)
|
|
193
|
+
|
|
194
|
+
write_config_file(config_file_data, config_file_path)
|
|
195
|
+
.then(() => {
|
|
196
|
+
console.log(`Client '${client_name}' has been added successfully.`)
|
|
197
|
+
})
|
|
198
|
+
.catch((err) => {
|
|
199
|
+
console.error(`Error writing to config file: ${err}`)
|
|
200
|
+
})
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
.catch((err) => {
|
|
204
|
+
console.error(`Error reading config file: ${err}`)
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function update_config_archive(config_file_data, client_name) {
|
|
209
|
+
return new Promise((resolve, reject) => {
|
|
210
|
+
read_config_file(config_archive_file_path)
|
|
211
|
+
.then((config_archive_data) => {
|
|
212
|
+
try {
|
|
213
|
+
config_archive_data = JSON.parse(config_archive_data)
|
|
214
|
+
} catch (error) {
|
|
215
|
+
console.error(`Error parsing config archive data: ${error}`)
|
|
216
|
+
reject(error)
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
config_archive_data.client_exchange_pairs[client_name] = config_file_data.client_exchange_pairs[client_name]
|
|
220
|
+
config_archive_data.client_pair_main_exchanges[client_name] = config_file_data.client_pair_main_exchanges[client_name]
|
|
221
|
+
config_archive_data.clients_reporter_interval[client_name] = config_file_data.clients_reporter_interval[client_name]
|
|
222
|
+
config_archive_data.client_not_include_exchanges[client_name] = config_file_data.client_not_include_exchanges[client_name]
|
|
223
|
+
config_archive_data.client_levels[client_name] = config_file_data.client_levels[client_name]
|
|
224
|
+
config_archive_data.client_price_index_curs[client_name] = config_file_data.client_price_index_curs[client_name]
|
|
225
|
+
config_archive_data.client_telegram_ids[client_name] = config_file_data.client_telegram_ids[client_name]
|
|
226
|
+
|
|
227
|
+
if (!config_archive_data.client_enabled) {
|
|
228
|
+
config_archive_data.client_enabled = {}
|
|
229
|
+
}
|
|
230
|
+
for (let key in config_file_data.client_enabled) {
|
|
231
|
+
if (config_file_data.client_enabled.hasOwnProperty(key)) {
|
|
232
|
+
if (!config_archive_data.client_enabled[key]) {
|
|
233
|
+
config_archive_data.client_enabled[key] = {}
|
|
234
|
+
}
|
|
235
|
+
config_archive_data.client_enabled[key][client_name] = config_file_data.client_enabled[key][client_name]
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
config_archive_data.client_exchange_pairs = sort(config_archive_data.client_exchange_pairs)
|
|
240
|
+
config_archive_data.client_pair_main_exchanges = sort(config_archive_data.client_pair_main_exchanges)
|
|
241
|
+
config_archive_data.clients_reporter_interval = sort(config_archive_data.clients_reporter_interval)
|
|
242
|
+
config_archive_data.client_not_include_exchanges = sort(config_archive_data.client_not_include_exchanges)
|
|
243
|
+
config_archive_data.client_levels = sort(config_archive_data.client_levels)
|
|
244
|
+
config_archive_data.client_price_index_curs = sort(config_archive_data.client_price_index_curs)
|
|
245
|
+
config_archive_data.client_telegram_ids = sort(config_archive_data.client_telegram_ids)
|
|
246
|
+
|
|
247
|
+
for (let key in config_archive_data.client_enabled) {
|
|
248
|
+
if (config_archive_data.client_enabled.hasOwnProperty(key)) {
|
|
249
|
+
config_archive_data.client_enabled[key] = sort(config_archive_data.client_enabled[key])
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
write_config_file(config_archive_data, config_archive_file_path)
|
|
254
|
+
.then(() => {
|
|
255
|
+
resolve()
|
|
256
|
+
})
|
|
257
|
+
.catch((err) => {
|
|
258
|
+
console.error(`Error writing to config file: ${err}`)
|
|
259
|
+
reject(err)
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
.catch((err) => {
|
|
263
|
+
console.error(`Error reading config archive file: ${err}`)
|
|
264
|
+
reject(err)
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function sort(obj) {
|
|
270
|
+
return Object.keys(obj)
|
|
271
|
+
.sort()
|
|
272
|
+
.reduce((result, key) => {
|
|
273
|
+
result[key] = obj[key]
|
|
274
|
+
return result
|
|
275
|
+
}, {})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
process_config()
|