@icgio/clients-config 1.0.3 → 1.0.4

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.
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ secretread.js:b3d67c0c4f8a0747fd170ffb21bc6bcf9868dff17136a50c053ffb2fe54f4083
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ node_modules/
3
+ lib/test*
4
+ lib/bash.sh
5
+ *.key
6
+ test/
7
+ test*
@@ -0,0 +1,6 @@
1
+ {
2
+ "tabWidth": 2,
3
+ "semi": false,
4
+ "singleQuote": true,
5
+ "printWidth": 180
6
+ }
@@ -1,150 +1,74 @@
1
1
  {
2
2
  "client_exchange_pairs": {
3
3
  "AVAV": {
4
- "Bitget": [
5
- "AVAVUSDT"
6
- ]
4
+ "Bitget": ["AVAVUSDT"]
7
5
  },
8
6
  "CARE": {
9
- "Bitmart": [
10
- "CAREUSDT"
11
- ],
12
- "Gatev4": [
13
- "CAREUSDT"
14
- ],
15
- "Lbank": [
16
- "CAREUSDT"
17
- ],
18
- "Mexc": [
19
- "CAREUSDT"
20
- ],
21
- "Xt": [
22
- "CAREUSDT"
23
- ]
7
+ "Bitmart": ["CAREUSDT"],
8
+ "Gatev4": ["CAREUSDT"],
9
+ "Lbank": ["CAREUSDT"],
10
+ "Mexc": ["CAREUSDT"],
11
+ "Xt": ["CAREUSDT"]
24
12
  },
25
13
  "CTG": {
26
- "Mexc": [
27
- "CTGUSDT"
28
- ]
14
+ "Mexc": ["CTGUSDT"]
29
15
  },
30
16
  "FAI": {
31
- "Bitmart": [
32
- "FAIUSDT"
33
- ]
17
+ "Bitmart": ["FAIUSDT"]
34
18
  },
35
19
  "FREN": {
36
- "Swft": [
37
- "FRENUSDT"
38
- ]
20
+ "Swft": ["FRENUSDT"]
39
21
  },
40
22
  "HMTT": {
41
- "Bitget": [
42
- "HMTTUSDT"
43
- ],
44
- "Coinw": [
45
- "HMTTUSDT"
46
- ],
47
- "Mexc": [
48
- "HMTTUSDT"
49
- ]
23
+ "Bitget": ["HMTTUSDT"],
24
+ "Coinw": ["HMTTUSDT"],
25
+ "Mexc": ["HMTTUSDT"]
50
26
  },
51
27
  "MEGODS": {
52
- "Bitmart": [
53
- "MEGODSUSDT"
54
- ]
28
+ "Bitmart": ["MEGODSUSDT"]
55
29
  },
56
30
  "MGROK": {
57
- "Mexc": [
58
- "MGROKUSDT"
59
- ]
31
+ "Mexc": ["MGROKUSDT"]
60
32
  },
61
33
  "PIAS": {
62
- "Bitmart": [
63
- "PIASUSDT"
64
- ],
65
- "Gatev4": [
66
- "PIASUSDT"
67
- ],
68
- "Lbank": [
69
- "PIASUSDT"
70
- ],
71
- "Mexc": [
72
- "PIASUSDT"
73
- ],
74
- "Xt": [
75
- "PIASUSDT"
76
- ]
34
+ "Bitmart": ["PIASUSDT"],
35
+ "Gatev4": ["PIASUSDT"],
36
+ "Lbank": ["PIASUSDT"],
37
+ "Mexc": ["PIASUSDT"],
38
+ "Xt": ["PIASUSDT"]
77
39
  },
78
40
  "PRMX": {
79
- "Bitmart": [
80
- "PRMXUSDT"
81
- ],
82
- "Bkex": [
83
- "PRMXUSDT"
84
- ],
85
- "Coinsbit": [
86
- "PRMXUSDT"
87
- ],
88
- "Gatev4": [
89
- "PRMXUSDT"
90
- ],
91
- "Lbank": [
92
- "PRMXUSDT"
93
- ],
94
- "Phemex": [
95
- "PRMXUSDT"
96
- ],
97
- "Mexc": [
98
- "PRMXUSDT"
99
- ],
100
- "Xt": [
101
- "PRMXUSDT"
102
- ]
41
+ "Bitmart": ["PRMXUSDT"],
42
+ "Bkex": ["PRMXUSDT"],
43
+ "Coinsbit": ["PRMXUSDT"],
44
+ "Gatev4": ["PRMXUSDT"],
45
+ "Lbank": ["PRMXUSDT"],
46
+ "Phemex": ["PRMXUSDT"],
47
+ "Mexc": ["PRMXUSDT"],
48
+ "Xt": ["PRMXUSDT"]
103
49
  },
104
50
  "RED": {
105
- "Bitget": [
106
- "REDUSDT"
107
- ],
108
- "Bkex": [
109
- "REDUSDT"
110
- ],
111
- "Lbank": [
112
- "REDUSDT"
113
- ],
114
- "Phemex": [
115
- "REDUSDT"
116
- ],
117
- "Xt": [
118
- "REDUSDT"
119
- ]
51
+ "Bitget": ["REDUSDT"],
52
+ "Bkex": ["REDUSDT"],
53
+ "Lbank": ["REDUSDT"],
54
+ "Phemex": ["REDUSDT"],
55
+ "Xt": ["REDUSDT"]
120
56
  },
121
57
  "XERT": {
122
- "Mexc": [
123
- "XERTUSDT"
124
- ],
125
- "Xt": [
126
- "XERTUSDT"
127
- ]
58
+ "Mexc": ["XERTUSDT"],
59
+ "Xt": ["XERTUSDT"]
128
60
  },
129
61
  "VTC": {
130
- "Mexc": [
131
- "VTCUSDT"
132
- ]
62
+ "Mexc": ["VTCUSDT"]
133
63
  },
134
64
  "TV": {
135
- "Mexc": [
136
- "TVUSDT"
137
- ]
65
+ "Mexc": ["TVUSDT"]
138
66
  },
139
67
  "TGMT": {
140
- "Mexc": [
141
- "TGMTUSDT"
142
- ]
68
+ "Mexc": ["TGMTUSDT"]
143
69
  },
144
70
  "CARAC": {
145
- "Xt": [
146
- "CARACUSDT"
147
- ]
71
+ "Xt": ["CARACUSDT"]
148
72
  }
149
73
  },
150
74
  "client_not_include_exchanges": {
@@ -167,110 +91,66 @@
167
91
  },
168
92
  "client_pair_main_exchanges": {
169
93
  "AVAV": {
170
- "AVAVUSDT": [
171
- "Bitget"
172
- ]
94
+ "AVAVUSDT": ["Bitget"]
173
95
  },
174
96
  "CARE": {
175
- "CAREUSDT": [
176
- "Lbank"
177
- ]
97
+ "CAREUSDT": ["Lbank"]
178
98
  },
179
99
  "CTG": {
180
- "CTGUSDT": [
181
- "Mexc"
182
- ]
100
+ "CTGUSDT": ["Mexc"]
183
101
  },
184
102
  "FAI": {
185
- "FAIUSDT": [
186
- "Bitmart"
187
- ]
103
+ "FAIUSDT": ["Bitmart"]
188
104
  },
189
105
  "FREN": {
190
- "FRENUSDT": [
191
- "Swft"
192
- ]
106
+ "FRENUSDT": ["Swft"]
193
107
  },
194
108
  "HMTT": {
195
- "HMTTUSDT": [
196
- "Gatev4"
197
- ]
109
+ "HMTTUSDT": ["Gatev4"]
198
110
  },
199
111
  "MEGODS": {
200
- "MEGODSUSDT": [
201
- "Bitmart"
202
- ]
112
+ "MEGODSUSDT": ["Bitmart"]
203
113
  },
204
114
  "MGROK": {
205
- "MGROKUSDT": [
206
- "Mexc"
207
- ]
115
+ "MGROKUSDT": ["Mexc"]
208
116
  },
209
117
  "PIAS": {
210
- "PIASUSDT": [
211
- "Gatev4"
212
- ]
118
+ "PIASUSDT": ["Gatev4"]
213
119
  },
214
120
  "PRMX": {
215
- "PRMXUSDT": [
216
- "Lbank"
217
- ]
121
+ "PRMXUSDT": ["Lbank"]
218
122
  },
219
123
  "RED": {
220
- "REDUSDT": [
221
- "Lbank"
222
- ]
124
+ "REDUSDT": ["Lbank"]
223
125
  },
224
126
  "XERT": {
225
- "XERTUSDT": [
226
- "Mexc"
227
- ]
127
+ "XERTUSDT": ["Mexc"]
228
128
  },
229
129
  "VTC": {
230
- "VTCUSDT": [
231
- "Mexc"
232
- ]
130
+ "VTCUSDT": ["Mexc"]
233
131
  },
234
132
  "TV": {
235
- "TVUSDT": [
236
- "Mexc"
237
- ]
133
+ "TVUSDT": ["Mexc"]
238
134
  },
239
135
  "TGMT": {
240
- "TGMTUSDT": [
241
- "Mexc"
242
- ]
136
+ "TGMTUSDT": ["Mexc"]
243
137
  },
244
138
  "CARAC": {
245
- "CARACUSDT": [
246
- "Xt"
247
- ]
139
+ "CARACUSDT": ["Xt"]
248
140
  }
249
141
  },
250
142
  "client_exchange_currencies": {
251
143
  "VTC": {
252
- "Mexc": [
253
- "USDT",
254
- "VTC"
255
- ]
144
+ "Mexc": ["USDT", "VTC"]
256
145
  },
257
146
  "TV": {
258
- "Mexc": [
259
- "USDT",
260
- "TV"
261
- ]
147
+ "Mexc": ["USDT", "TV"]
262
148
  },
263
149
  "TGMT": {
264
- "Mexc": [
265
- "USDT",
266
- "TGMT"
267
- ]
150
+ "Mexc": ["USDT", "TGMT"]
268
151
  },
269
152
  "CARAC": {
270
- "Xt": [
271
- "USDT",
272
- "CARAC"
273
- ]
153
+ "Xt": ["USDT", "CARAC"]
274
154
  }
275
155
  },
276
156
  "clients_reporter_interval": {
@@ -376,152 +256,40 @@
376
256
  }
377
257
  },
378
258
  "client_levels": {
379
- "AVAV": [
380
- 2,
381
- 5,
382
- 10
383
- ],
384
- "CARE": [
385
- 2,
386
- 5,
387
- 10
388
- ],
389
- "CTG": [
390
- 2,
391
- 5,
392
- 10
393
- ],
394
- "FAI": [
395
- 2,
396
- 5,
397
- 10
398
- ],
399
- "FREN": [
400
- 2,
401
- 5,
402
- 10
403
- ],
404
- "HMTT": [
405
- 2,
406
- 5,
407
- 10
408
- ],
409
- "MEGODS": [
410
- 2,
411
- 5,
412
- 10
413
- ],
414
- "MGROK": [
415
- 2,
416
- 5,
417
- 10
418
- ],
419
- "PIAS": [
420
- 2,
421
- 5,
422
- 10
423
- ],
424
- "PRMX": [
425
- 2,
426
- 5,
427
- 10
428
- ],
429
- "RED": [
430
- 2,
431
- 5,
432
- 10
433
- ],
434
- "XERT": [
435
- 2,
436
- 5,
437
- 10
438
- ],
439
- "VTC": [
440
- 2,
441
- 5,
442
- 10
443
- ],
444
- "TV": [
445
- 2,
446
- 5,
447
- 10
448
- ],
449
- "TGMT": [
450
- 2,
451
- 5,
452
- 10
453
- ],
454
- "CARAC": [
455
- 2,
456
- 5,
457
- 10
458
- ]
259
+ "AVAV": [2, 5, 10],
260
+ "CARE": [2, 5, 10],
261
+ "CTG": [2, 5, 10],
262
+ "FAI": [2, 5, 10],
263
+ "FREN": [2, 5, 10],
264
+ "HMTT": [2, 5, 10],
265
+ "MEGODS": [2, 5, 10],
266
+ "MGROK": [2, 5, 10],
267
+ "PIAS": [2, 5, 10],
268
+ "PRMX": [2, 5, 10],
269
+ "RED": [2, 5, 10],
270
+ "XERT": [2, 5, 10],
271
+ "VTC": [2, 5, 10],
272
+ "TV": [2, 5, 10],
273
+ "TGMT": [2, 5, 10],
274
+ "CARAC": [2, 5, 10]
459
275
  },
460
276
  "client_benchmarks": {
461
- "AVAV": [
462
- "BTC",
463
- "ETH"
464
- ],
465
- "CARE": [
466
- "BTC",
467
- "ETH"
468
- ],
469
- "CTG": [
470
- "BTC",
471
- "ETH"
472
- ],
473
- "FAI": [
474
- "BTC",
475
- "ETH"
476
- ],
477
- "FREN": [
478
- "BTC",
479
- "ETH"
480
- ],
481
- "HMTT": [
482
- "BTC",
483
- "ETH"
484
- ],
485
- "MEGODS": [
486
- "BTC",
487
- "ETH"
488
- ],
489
- "MGROK": [
490
- "BTC",
491
- "ETH"
492
- ],
493
- "PIAS": [
494
- "BTC",
495
- "ETH"
496
- ],
497
- "PRMX": [
498
- "BTC",
499
- "ETH"
500
- ],
501
- "RED": [
502
- "BTC",
503
- "ETH"
504
- ],
505
- "XERT": [
506
- "BTC",
507
- "ETH"
508
- ],
509
- "VTC": [
510
- "BTC",
511
- "ETH"
512
- ],
513
- "TV": [
514
- "BTC",
515
- "ETH"
516
- ],
517
- "TGMT": [
518
- "BTC",
519
- "ETH"
520
- ],
521
- "CARAC": [
522
- "BTC",
523
- "ETH"
524
- ]
277
+ "AVAV": ["BTC", "ETH"],
278
+ "CARE": ["BTC", "ETH"],
279
+ "CTG": ["BTC", "ETH"],
280
+ "FAI": ["BTC", "ETH"],
281
+ "FREN": ["BTC", "ETH"],
282
+ "HMTT": ["BTC", "ETH"],
283
+ "MEGODS": ["BTC", "ETH"],
284
+ "MGROK": ["BTC", "ETH"],
285
+ "PIAS": ["BTC", "ETH"],
286
+ "PRMX": ["BTC", "ETH"],
287
+ "RED": ["BTC", "ETH"],
288
+ "XERT": ["BTC", "ETH"],
289
+ "VTC": ["BTC", "ETH"],
290
+ "TV": ["BTC", "ETH"],
291
+ "TGMT": ["BTC", "ETH"],
292
+ "CARAC": ["BTC", "ETH"]
525
293
  },
526
294
  "client_telegram_ids": {
527
295
  "AVAV": "-4199615909",
@@ -541,4 +309,4 @@
541
309
  "TGMT": "-1002053322082",
542
310
  "CARAC": "-4103921001"
543
311
  }
544
- }
312
+ }
package/config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const _ = require('lodash')
2
- const config_data = require('./config.json');
2
+ const config_data = require('./config.json')
3
3
 
4
4
  const client_exchange_pairs = config_data.client_exchange_pairs
5
5
  module.exports.client_exchange_pairs = client_exchange_pairs
package/config.json CHANGED
@@ -377,6 +377,7 @@
377
377
  "AXL": [2, 5, 10],
378
378
  "BONG": [2, 5, 10],
379
379
  "CAVADA": [2, 5, 10],
380
+ "CELO": [2, 5, 10],
380
381
  "DIS": [2, 5, 10],
381
382
  "DMC": [2, 10, 20],
382
383
  "GHD": [2, 5, 10],
package/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  module.exports = {
2
- 'config': require('./config.js'),
3
- // 'credentials': require('./credentials.js'),
4
- // 'data-source': require('./data-source.js')
5
- }
6
-
2
+ config: require('./config.js'),
3
+ // 'credentials': require('./credentials.js'),
4
+ // 'data-source': require('./data-source.js')
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/clients-config",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
Binary file
@@ -1,27 +1,27 @@
1
- const fs = require("fs");
2
- const prompt = require("prompt");
1
+ const fs = require('fs')
2
+ const prompt = require('prompt')
3
3
 
4
- const config_file_path = "./config.json";
5
- const config_archive_file_path = "./config-archive.json";
4
+ const config_file_path = './config.json'
5
+ const config_archive_file_path = './config-archive.json'
6
6
 
7
- prompt.start();
7
+ prompt.start()
8
8
 
9
9
  function read_config_file(path) {
10
10
  return new Promise((resolve, reject) => {
11
- fs.readFile(path, "utf8", (err, data) => {
12
- if (err) reject(err);
13
- else resolve(data);
14
- });
15
- });
11
+ fs.readFile(path, 'utf8', (err, data) => {
12
+ if (err) reject(err)
13
+ else resolve(data)
14
+ })
15
+ })
16
16
  }
17
17
 
18
18
  function write_config_file(data, path) {
19
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
- });
20
+ fs.writeFile(path, JSON.stringify(data, null, 2), 'utf8', (err) => {
21
+ if (err) return reject(err)
22
+ else resolve()
23
+ })
24
+ })
25
25
  }
26
26
 
27
27
  function process_config() {
@@ -29,185 +29,167 @@ function process_config() {
29
29
  const schema = {
30
30
  properties: {
31
31
  action: {
32
- description: "Enter the action ( add, delete )",
32
+ description: 'Enter the action ( add, delete )',
33
33
  pattern: /^(add|delete)$/,
34
34
  message: 'Action must be one of "add", "delete"',
35
35
  required: true,
36
36
  },
37
37
  client_name: {
38
- description:
39
- "Enter the client name you want to perform the action on",
38
+ description: 'Enter the client name you want to perform the action on',
40
39
  required: true,
41
40
  },
42
41
  },
43
- };
42
+ }
44
43
 
45
44
  prompt.get(schema, (err, result) => {
46
45
  if (err) {
47
- console.error(err);
48
- return;
46
+ console.error(err)
47
+ return
49
48
  }
50
49
 
51
50
  switch (result.action) {
52
- case "add":
53
- add_client(result.client_name);
54
- break;
55
- case "delete":
56
- delete_client(result.client_name);
57
- break;
51
+ case 'add':
52
+ add_client(result.client_name)
53
+ break
54
+ case 'delete':
55
+ delete_client(result.client_name)
56
+ break
58
57
  default:
59
- console.log("Invalid action");
60
- break;
58
+ console.log('Invalid action')
59
+ break
61
60
  }
62
- });
61
+ })
63
62
  } catch (error) {
64
- console.error(`Error processing the config file: ${error}`);
63
+ console.error(`Error processing the config file: ${error}`)
65
64
  }
66
65
  }
67
66
 
68
67
  function delete_client(client_name) {
69
68
  read_config_file(config_file_path)
70
69
  .then((config_file_data) => {
71
- config_file_data = JSON.parse(config_file_data);
70
+ config_file_data = JSON.parse(config_file_data)
72
71
 
73
72
  update_config_archive(config_file_data, client_name)
74
73
  .then(() => {
75
- delete config_file_data.client_exchange_pairs[client_name];
76
- delete config_file_data.client_pair_main_exchanges[client_name];
77
- delete config_file_data.client_not_include_exchanges[client_name];
78
- delete config_file_data.client_exchange_currencies[client_name];
79
- delete config_file_data.client_levels[client_name];
80
- delete config_file_data.client_benchmarks[client_name];
81
- delete config_file_data.client_telegram_ids[client_name];
82
- delete config_file_data.clients_reporter_interval[client_name];
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_exchange_currencies[client_name]
78
+ delete config_file_data.client_levels[client_name]
79
+ delete config_file_data.client_benchmarks[client_name]
80
+ delete config_file_data.client_telegram_ids[client_name]
81
+ delete config_file_data.clients_reporter_interval[client_name]
83
82
 
84
83
  write_config_file(config_file_data, config_file_path)
85
84
  .then(() => {
86
- console.log(
87
- `Client '${client_name}' has been deleted successfully.`
88
- );
85
+ console.log(`Client '${client_name}' has been deleted successfully.`)
89
86
  })
90
87
  .catch((err) => {
91
- console.error(`Error writing to config file: ${err}`);
92
- });
88
+ console.error(`Error writing to config file: ${err}`)
89
+ })
93
90
  })
94
91
  .catch((err) => {
95
- console.error(`Error updating config archive: ${err}`);
96
- });
92
+ console.error(`Error updating config archive: ${err}`)
93
+ })
97
94
  })
98
95
  .catch((err) => {
99
- console.error(`Error reading config file: ${err}`);
100
- });
96
+ console.error(`Error reading config file: ${err}`)
97
+ })
101
98
  }
102
99
 
103
100
  function add_client(client_name) {
104
101
  const schema = {
105
102
  properties: {
106
103
  client_exchange_pairs: {
107
- description:
108
- 'Enter client exchange pairs (JSON format i.e { "Mexc": ["RWXUSDT"], "Bitget": ["RWXUSDT"] } )',
104
+ description: 'Enter client exchange pairs (JSON format i.e { "Mexc": ["RWXUSDT"], "Bitget": ["RWXUSDT"] } )',
109
105
  required: true,
110
106
  pattern: /^\{.*\}$/,
111
- message: "Please enter a valid JSON object.",
107
+ message: 'Please enter a valid JSON object.',
112
108
  },
113
109
  client_not_include_exchanges: {
114
- description:
115
- "Enter client not include exchanges (Comma-separated values, e.g., Jubi, Lbank)",
110
+ description: 'Enter client not include exchanges (Comma-separated values, e.g., Jubi, Lbank)',
116
111
  required: true,
117
112
  },
118
113
  client_pair_main_exchanges: {
119
- description:
120
- 'Enter client pair main exchanges (JSON format i.e {"ETHUSDT": ["Bitget", "Gatev4"]} )',
114
+ description: 'Enter client pair main exchanges (JSON format i.e {"ETHUSDT": ["Bitget", "Gatev4"]} )',
121
115
  required: true,
122
116
  pattern: /^\{.*\}$/,
123
- message: "Please enter a valid JSON object.",
117
+ message: 'Please enter a valid JSON object.',
124
118
  },
125
119
  client_exchange_currencies: {
126
120
  description: 'Enter client exchange currencies (JSON format i.e { "Gatev4": ["USDT"], "Mexc": ["AVALOX"] } )',
127
121
  required: true,
128
122
  pattern: /^\{.*\}$/,
129
- message: "Please enter a valid JSON object.",
123
+ message: 'Please enter a valid JSON object.',
130
124
  },
131
125
  clients_reporter_interval: {
132
126
  description: 'Enter clients reporter interval (JSON format i.e { "balance": 1, "trades": 1, "orderbook": 1} )',
133
127
  required: true,
134
128
  pattern: /^\{.*\}$/,
135
- message: "Please enter a valid JSON object.",
129
+ message: 'Please enter a valid JSON object.',
136
130
  },
137
131
  client_levels: {
138
- description:
139
- "Enter client levels (Comma-separated values, e.g. 2, 5, 10 ) ",
132
+ description: 'Enter client levels (Comma-separated values, e.g. 2, 5, 10 ) ',
140
133
  required: true,
141
134
  },
142
135
  client_benchmarks: {
143
- description:
144
- "Enter client benchmarks (Comma-separated values, e.g., BTC,ETH)",
136
+ description: 'Enter client benchmarks (Comma-separated values, e.g., BTC,ETH)',
145
137
  required: true,
146
138
  },
147
139
  client_telegram_ids: {
148
- description: "Enter client telegram ids i.e 1233457 ",
140
+ description: 'Enter client telegram ids i.e 1233457 ',
149
141
  required: true,
150
142
  },
151
143
  },
152
- };
144
+ }
153
145
  read_config_file(config_file_path)
154
146
  .then((config_file_data) => {
155
147
  prompt.get(schema, (err, result) => {
156
148
  if (err) {
157
- console.error(err);
158
- return;
149
+ console.error(err)
150
+ return
159
151
  }
160
- config_file_data = JSON.parse(config_file_data);
152
+ config_file_data = JSON.parse(config_file_data)
161
153
 
162
- let exchange_pairs = result.client_exchange_pairs.trim();
163
- exchange_pairs = JSON.parse(exchange_pairs);
154
+ let exchange_pairs = result.client_exchange_pairs.trim()
155
+ exchange_pairs = JSON.parse(exchange_pairs)
164
156
 
165
- let pair_exchanges = result.client_pair_main_exchanges.trim();
166
- pair_exchanges = JSON.parse(pair_exchanges);
157
+ let pair_exchanges = result.client_pair_main_exchanges.trim()
158
+ pair_exchanges = JSON.parse(pair_exchanges)
167
159
 
168
- let exchange_currencies = result.client_exchange_currencies.trim();
169
- exchange_currencies = JSON.parse(exchange_currencies);
160
+ let exchange_currencies = result.client_exchange_currencies.trim()
161
+ exchange_currencies = JSON.parse(exchange_currencies)
170
162
 
171
163
  let reporter_interval = result.clients_reporter_interval.trim()
172
- reporter_interval = JSON.parse(reporter_interval);
164
+ reporter_interval = JSON.parse(reporter_interval)
173
165
 
174
- let not_include_exchanges = result.client_not_include_exchanges
175
- .split(",")
176
- .map((value) => value.trim());
177
- let benchmarks = result.client_benchmarks
178
- .split(",")
179
- .map((value) => value.trim());
180
- let levels = result.client_levels
181
- .split(",")
182
- .map((value) => Number(value.trim()));
166
+ let not_include_exchanges = result.client_not_include_exchanges.split(',').map((value) => value.trim())
167
+ let benchmarks = result.client_benchmarks.split(',').map((value) => value.trim())
168
+ let levels = result.client_levels.split(',').map((value) => Number(value.trim()))
183
169
 
184
- config_file_data.client_exchange_pairs[client_name] = exchange_pairs;
185
- config_file_data.client_pair_main_exchanges[client_name] =
186
- pair_exchanges;
187
- config_file_data.client_exchange_currencies[client_name] =
188
- exchange_currencies;
170
+ config_file_data.client_exchange_pairs[client_name] = exchange_pairs
171
+ config_file_data.client_pair_main_exchanges[client_name] = pair_exchanges
172
+ config_file_data.client_exchange_currencies[client_name] = exchange_currencies
189
173
  config_file_data.clients_reporter_interval[client_name] = reporter_interval
190
174
 
191
- config_file_data.client_not_include_exchanges[client_name] =
192
- not_include_exchanges;
193
- config_file_data.client_levels[client_name] = levels;
194
- config_file_data.client_benchmarks[client_name] = benchmarks;
175
+ config_file_data.client_not_include_exchanges[client_name] = not_include_exchanges
176
+ config_file_data.client_levels[client_name] = levels
177
+ config_file_data.client_benchmarks[client_name] = benchmarks
195
178
 
196
- config_file_data.client_telegram_ids[client_name] =
197
- result.client_telegram_ids;
179
+ config_file_data.client_telegram_ids[client_name] = result.client_telegram_ids
198
180
 
199
181
  write_config_file(config_file_data, config_file_path)
200
182
  .then(() => {
201
- console.log(`Client '${client_name}' has been added successfully.`);
183
+ console.log(`Client '${client_name}' has been added successfully.`)
202
184
  })
203
185
  .catch((err) => {
204
- console.error(`Error writing to config file: ${err}`);
205
- });
206
- });
186
+ console.error(`Error writing to config file: ${err}`)
187
+ })
188
+ })
207
189
  })
208
190
  .catch((err) => {
209
- console.error(`Error reading config file: ${err}`);
210
- });
191
+ console.error(`Error reading config file: ${err}`)
192
+ })
211
193
  }
212
194
 
213
195
  function update_config_archive(config_file_data, client_name) {
@@ -215,43 +197,36 @@ function update_config_archive(config_file_data, client_name) {
215
197
  read_config_file(config_archive_file_path)
216
198
  .then((config_archive_data) => {
217
199
  try {
218
- config_archive_data = JSON.parse(config_archive_data);
200
+ config_archive_data = JSON.parse(config_archive_data)
219
201
  } catch (error) {
220
- console.error(`Error parsing config archive data: ${error}`);
221
- reject(error);
202
+ console.error(`Error parsing config archive data: ${error}`)
203
+ reject(error)
222
204
  }
223
205
 
224
- config_archive_data.client_exchange_pairs[client_name] =
225
- config_file_data.client_exchange_pairs[client_name];
226
- config_archive_data.client_pair_main_exchanges[client_name] =
227
- config_file_data.client_pair_main_exchanges[client_name];
228
- config_archive_data.client_exchange_currencies[client_name] =
229
- config_file_data.client_exchange_currencies[client_name];
206
+ config_archive_data.client_exchange_pairs[client_name] = config_file_data.client_exchange_pairs[client_name]
207
+ config_archive_data.client_pair_main_exchanges[client_name] = config_file_data.client_pair_main_exchanges[client_name]
208
+ config_archive_data.client_exchange_currencies[client_name] = config_file_data.client_exchange_currencies[client_name]
230
209
 
231
- config_archive_data.client_not_include_exchanges[client_name] =
232
- config_file_data.client_not_include_exchanges[client_name];
233
- config_archive_data.client_levels[client_name] =
234
- config_file_data.client_levels[client_name];
235
- config_archive_data.client_benchmarks[client_name] =
236
- config_file_data.client_benchmarks[client_name];
210
+ config_archive_data.client_not_include_exchanges[client_name] = config_file_data.client_not_include_exchanges[client_name]
211
+ config_archive_data.client_levels[client_name] = config_file_data.client_levels[client_name]
212
+ config_archive_data.client_benchmarks[client_name] = config_file_data.client_benchmarks[client_name]
237
213
 
238
- config_archive_data.client_telegram_ids[client_name] =
239
- config_file_data.client_telegram_ids[client_name];
214
+ config_archive_data.client_telegram_ids[client_name] = config_file_data.client_telegram_ids[client_name]
240
215
 
241
216
  write_config_file(config_archive_data, config_archive_file_path)
242
217
  .then(() => {
243
- resolve();
218
+ resolve()
244
219
  })
245
220
  .catch((err) => {
246
- console.error(`Error writing to config file: ${err}`);
247
- reject(err);
248
- });
221
+ console.error(`Error writing to config file: ${err}`)
222
+ reject(err)
223
+ })
249
224
  })
250
225
  .catch((err) => {
251
- console.error(`Error reading config archive file: ${err}`);
252
- reject(err);
253
- });
254
- });
226
+ console.error(`Error reading config archive file: ${err}`)
227
+ reject(err)
228
+ })
229
+ })
255
230
  }
256
231
 
257
- process_config();
232
+ process_config()