@icgio/clients-config 1.0.264 → 1.0.266
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/keys/crls.d/DIR.txt +1 -1
- package/.gitsecret/paths/mapping.cfg +1 -1
- package/config-archive.json +25 -0
- package/config-benchmarks.js +25 -25
- package/config.json +0 -25
- package/data-source.js.secret +0 -0
- package/index.js +19 -19
- package/package.json +27 -27
- package/secretread.js.secret +0 -0
- package/update-config-json.js +278 -278
|
@@ -1 +1 @@
|
|
|
1
|
-
v:1:
|
|
1
|
+
v:1:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
secretread.js:
|
|
1
|
+
secretread.js:1debaa92d9f5725c273b950128def5d8dd6cf057630a00188618dae4ff434130
|
|
2
2
|
data-source.js:a88043810676f6017be94bbcc357f8f0d439890c6698cc0b02941b605e7dbd9a
|
package/config-archive.json
CHANGED
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
"GO": {
|
|
107
107
|
"Lbank": ["GOUSDT"]
|
|
108
108
|
},
|
|
109
|
+
"GRIPPY": {
|
|
110
|
+
"Mexc": ["GRIPPYUSDT"]
|
|
111
|
+
},
|
|
109
112
|
"HMTT": {
|
|
110
113
|
"Bitget": ["HMTTUSDT"],
|
|
111
114
|
"Coinw": ["HMTTUSDT"],
|
|
@@ -332,6 +335,7 @@
|
|
|
332
335
|
"GHD": [],
|
|
333
336
|
"GKB": [],
|
|
334
337
|
"GO": [],
|
|
338
|
+
"GRIPPY": [],
|
|
335
339
|
"HMTT": [],
|
|
336
340
|
"ILMT": [],
|
|
337
341
|
"IONX": [],
|
|
@@ -475,6 +479,9 @@
|
|
|
475
479
|
"GO": {
|
|
476
480
|
"GOUSDT": ["Lbank"]
|
|
477
481
|
},
|
|
482
|
+
"GRIPPY": {
|
|
483
|
+
"GRIPPYUSDT": ["Mexc"]
|
|
484
|
+
},
|
|
478
485
|
"HMTT": {
|
|
479
486
|
"HMTTUSDT": ["Gate"]
|
|
480
487
|
},
|
|
@@ -794,6 +801,12 @@
|
|
|
794
801
|
"trades": 1,
|
|
795
802
|
"orderbook": 1
|
|
796
803
|
},
|
|
804
|
+
"GRIPPY": {
|
|
805
|
+
"balance": 1,
|
|
806
|
+
"trades": 1,
|
|
807
|
+
"orderbook": 1,
|
|
808
|
+
"deposits_withdrawals": 1
|
|
809
|
+
},
|
|
797
810
|
"HMTT": {
|
|
798
811
|
"balance": 1,
|
|
799
812
|
"trades": 1,
|
|
@@ -1064,6 +1077,7 @@
|
|
|
1064
1077
|
"GHD": true,
|
|
1065
1078
|
"GKB": true,
|
|
1066
1079
|
"GO": true,
|
|
1080
|
+
"GRIPPY": true,
|
|
1067
1081
|
"HMTT": true,
|
|
1068
1082
|
"ILMT": true,
|
|
1069
1083
|
"JASMY": true,
|
|
@@ -1113,6 +1127,7 @@
|
|
|
1113
1127
|
"XERT": true
|
|
1114
1128
|
},
|
|
1115
1129
|
"deposits_withdrawals": {
|
|
1130
|
+
"GRIPPY": true,
|
|
1116
1131
|
"TACC": true
|
|
1117
1132
|
},
|
|
1118
1133
|
"total_in_usd": {
|
|
@@ -1153,6 +1168,7 @@
|
|
|
1153
1168
|
"GHD": true,
|
|
1154
1169
|
"GKB": true,
|
|
1155
1170
|
"GO": true,
|
|
1171
|
+
"GRIPPY": true,
|
|
1156
1172
|
"HMTT": true,
|
|
1157
1173
|
"ILMT": true,
|
|
1158
1174
|
"IONX": true,
|
|
@@ -1241,6 +1257,7 @@
|
|
|
1241
1257
|
"GHD": [2, 5, 10],
|
|
1242
1258
|
"GKB": [2, 5, 10],
|
|
1243
1259
|
"GO": [1, 2, 5, 10, 20, 50, 100],
|
|
1260
|
+
"GRIPPY": [1, 2, 5, 10, 20, 50, 100],
|
|
1244
1261
|
"HMTT": [2, 5, 10],
|
|
1245
1262
|
"ILMT": [1, 2, 5, 10, 20, 50, 100],
|
|
1246
1263
|
"IONX": [1, 2, 5, 10, 20, 50, 100],
|
|
@@ -1325,6 +1342,7 @@
|
|
|
1325
1342
|
"GHD": ["BTC", "ETH"],
|
|
1326
1343
|
"GKB": ["BTC", "ETH"],
|
|
1327
1344
|
"GO": ["BTC", "ETH"],
|
|
1345
|
+
"GRIPPY": ["BTC", "ETH"],
|
|
1328
1346
|
"HMTT": ["BTC", "ETH"],
|
|
1329
1347
|
"ILMT": ["BTC", "ETH"],
|
|
1330
1348
|
"IONX": ["BTC", "ETH"],
|
|
@@ -1410,6 +1428,7 @@
|
|
|
1410
1428
|
"GHD": "-4268297189",
|
|
1411
1429
|
"GKB": "-4213454386",
|
|
1412
1430
|
"GO": "-4822577824",
|
|
1431
|
+
"GRIPPY": "-4809911024",
|
|
1413
1432
|
"HMTT": "-1002035174196",
|
|
1414
1433
|
"ILMT": "-4802252746",
|
|
1415
1434
|
"IONX": "-1002085059560",
|
|
@@ -1506,6 +1525,7 @@
|
|
|
1506
1525
|
"ELON": "icg",
|
|
1507
1526
|
"EPEP": "icg",
|
|
1508
1527
|
"GO": "icg",
|
|
1528
|
+
"GRIPPY": "icg",
|
|
1509
1529
|
"ILMT": "icg",
|
|
1510
1530
|
"IONX": "icg",
|
|
1511
1531
|
"JASMY": "icg",
|
|
@@ -1589,6 +1609,10 @@
|
|
|
1589
1609
|
"username": "go@icg.io",
|
|
1590
1610
|
"password": "oSr7T7CeEEOibrQ"
|
|
1591
1611
|
},
|
|
1612
|
+
"GRIPPY": {
|
|
1613
|
+
"username": "grippy@icg.io",
|
|
1614
|
+
"password": "x6y8eLLeaYB5dDh"
|
|
1615
|
+
},
|
|
1592
1616
|
"ILMT": {
|
|
1593
1617
|
"username": "ilmt@icg.io",
|
|
1594
1618
|
"password": "b8X06ltUjvpF0Pt"
|
|
@@ -1691,6 +1715,7 @@
|
|
|
1691
1715
|
"server_config_admin_whitelist_ips": {
|
|
1692
1716
|
"BVT": [],
|
|
1693
1717
|
"GO": [],
|
|
1718
|
+
"GRIPPY": ["172.105.237.102"],
|
|
1694
1719
|
"LST": [],
|
|
1695
1720
|
"MAK": ["172.105.237.102"],
|
|
1696
1721
|
"TACC": ["172.105.237.102"]
|
package/config-benchmarks.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
const benchmarks = {
|
|
2
2
|
min_balance: {
|
|
3
|
-
MIX: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
3
|
+
// MIX: {
|
|
4
|
+
// bybit_1: {
|
|
5
|
+
// MIX: 10000000,
|
|
6
|
+
// USDT: 7000,
|
|
7
|
+
// },
|
|
8
|
+
// bybit_2: {
|
|
9
|
+
// MIX: 5000000,
|
|
10
|
+
// USDT: 2000,
|
|
11
|
+
// },
|
|
12
|
+
// },
|
|
13
13
|
},
|
|
14
14
|
orderbook_depth_in_quote_cur: {
|
|
15
|
-
MIX: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
15
|
+
// MIX: {
|
|
16
|
+
// Bybit: {
|
|
17
|
+
// MIXUSDT: [[0.02, 1500]],
|
|
18
|
+
// },
|
|
19
|
+
// },
|
|
20
20
|
OPUL: {
|
|
21
21
|
Kucoin: {
|
|
22
22
|
OPULUSDT: [[0.002, 1000]],
|
|
@@ -24,18 +24,18 @@ const benchmarks = {
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
ask_bid_spread: {
|
|
27
|
-
MIX: {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
27
|
+
// MIX: {
|
|
28
|
+
// Bybit: {
|
|
29
|
+
// MIXUSDT: 0.01,
|
|
30
|
+
// },
|
|
31
|
+
// },
|
|
32
32
|
},
|
|
33
33
|
volume_24h_in_quote_cur: {
|
|
34
|
-
MIX: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
34
|
+
// MIX: {
|
|
35
|
+
// Bybit: {
|
|
36
|
+
// MIXUSDT: 20000,
|
|
37
|
+
// },
|
|
38
|
+
// },
|
|
39
39
|
SWFTC: {
|
|
40
40
|
Gate: {
|
|
41
41
|
SWFTCUSDT: 50000,
|
package/config.json
CHANGED
|
@@ -12,9 +12,6 @@
|
|
|
12
12
|
"Mexc": ["CCDOGUSDT"],
|
|
13
13
|
"Xt": ["CCDOGUSDT"]
|
|
14
14
|
},
|
|
15
|
-
"GRIPPY": {
|
|
16
|
-
"Mexc": ["GRIPPYUSDT"]
|
|
17
|
-
},
|
|
18
15
|
"HKBITEX-BTC": {
|
|
19
16
|
"Hkbitex": ["BTCUSD", "BTCHKD"]
|
|
20
17
|
},
|
|
@@ -63,7 +60,6 @@
|
|
|
63
60
|
"ARMY": [],
|
|
64
61
|
"B3TR": [],
|
|
65
62
|
"CCDOG": [],
|
|
66
|
-
"GRIPPY": [],
|
|
67
63
|
"HKBITEX-BTC": [],
|
|
68
64
|
"HKBITEX-ETH": [],
|
|
69
65
|
"JYAI": [],
|
|
@@ -84,9 +80,6 @@
|
|
|
84
80
|
"CCDOG": {
|
|
85
81
|
"CCDOGUSDT": ["Xt"]
|
|
86
82
|
},
|
|
87
|
-
"GRIPPY": {
|
|
88
|
-
"GRIPPYUSDT": ["Mexc"]
|
|
89
|
-
},
|
|
90
83
|
"HKBITEX-BTC": {
|
|
91
84
|
"BTCUSD": ["Hkbitex"],
|
|
92
85
|
"BTCHKD": ["Hkbitex"]
|
|
@@ -140,12 +133,6 @@
|
|
|
140
133
|
"orderbook": 1,
|
|
141
134
|
"deposits_withdrawals": 1
|
|
142
135
|
},
|
|
143
|
-
"GRIPPY": {
|
|
144
|
-
"balance": 1,
|
|
145
|
-
"trades": 1,
|
|
146
|
-
"orderbook": 1,
|
|
147
|
-
"deposits_withdrawals": 1
|
|
148
|
-
},
|
|
149
136
|
"HKBITEX-BTC": {
|
|
150
137
|
"balance": 1,
|
|
151
138
|
"trades": 1,
|
|
@@ -206,7 +193,6 @@
|
|
|
206
193
|
"ARMY": true,
|
|
207
194
|
"B3TR": true,
|
|
208
195
|
"CCDOG": true,
|
|
209
|
-
"GRIPPY": true,
|
|
210
196
|
"HKBITEX-BTC": true,
|
|
211
197
|
"HKBITEX-ETH": true,
|
|
212
198
|
"JYAI": true,
|
|
@@ -222,7 +208,6 @@
|
|
|
222
208
|
"ARMY": true,
|
|
223
209
|
"B3TR": true,
|
|
224
210
|
"CCDOG": true,
|
|
225
|
-
"GRIPPY": true,
|
|
226
211
|
"HKBITEX-BTC": true,
|
|
227
212
|
"HKBITEX-ETH": true,
|
|
228
213
|
"JYAI": true,
|
|
@@ -241,7 +226,6 @@
|
|
|
241
226
|
"ARMY": true,
|
|
242
227
|
"B3TR": true,
|
|
243
228
|
"CCDOG": true,
|
|
244
|
-
"GRIPPY": true,
|
|
245
229
|
"HKBITEX-BTC": true,
|
|
246
230
|
"HKBITEX-ETH": true,
|
|
247
231
|
"JYAI": true,
|
|
@@ -258,7 +242,6 @@
|
|
|
258
242
|
"ARMY": [1, 2, 5, 10, 20, 50, 100],
|
|
259
243
|
"B3TR": [1, 2, 5, 10, 20, 50, 100],
|
|
260
244
|
"CCDOG": [1, 2, 5, 10, 20, 50, 100],
|
|
261
|
-
"GRIPPY": [1, 2, 5, 10, 20, 50, 100],
|
|
262
245
|
"HKBITEX-BTC": [1, 2, 5, 10, 20, 50, 100],
|
|
263
246
|
"HKBITEX-ETH": [1, 2, 5, 10, 20, 50, 100],
|
|
264
247
|
"JYAI": [1, 2, 5, 10, 20, 50, 100],
|
|
@@ -273,7 +256,6 @@
|
|
|
273
256
|
"ARMY": ["BTC", "ETH"],
|
|
274
257
|
"B3TR": ["BTC", "ETH"],
|
|
275
258
|
"CCDOG": ["BTC", "ETH"],
|
|
276
|
-
"GRIPPY": ["BTC", "ETH"],
|
|
277
259
|
"HKBITEX-BTC": ["BTC", "ETH"],
|
|
278
260
|
"HKBITEX-ETH": ["BTC", "ETH"],
|
|
279
261
|
"JYAI": ["BTC", "ETH"],
|
|
@@ -288,7 +270,6 @@
|
|
|
288
270
|
"ARMY": "-4733838023",
|
|
289
271
|
"B3TR": "-4957633893",
|
|
290
272
|
"CCDOG": "-4866473272",
|
|
291
|
-
"GRIPPY": "-4809911024",
|
|
292
273
|
"HKBITEX-BTC": "-4837808085",
|
|
293
274
|
"HKBITEX-ETH": "-4837808085",
|
|
294
275
|
"JYAI": "-4787448589",
|
|
@@ -312,7 +293,6 @@
|
|
|
312
293
|
"ARMY": "icg",
|
|
313
294
|
"B3TR": "icg",
|
|
314
295
|
"CCDOG": "icg",
|
|
315
|
-
"GRIPPY": "icg",
|
|
316
296
|
"HKBITEX-BTC": "icg",
|
|
317
297
|
"HKBITEX-ETH": "icg",
|
|
318
298
|
"JYAI": "icg",
|
|
@@ -340,10 +320,6 @@
|
|
|
340
320
|
"username": "ccdog@icg.io",
|
|
341
321
|
"password": "s9d1kmkNcRIsDN3"
|
|
342
322
|
},
|
|
343
|
-
"GRIPPY": {
|
|
344
|
-
"username": "grippy@icg.io",
|
|
345
|
-
"password": "x6y8eLLeaYB5dDh"
|
|
346
|
-
},
|
|
347
323
|
"HKBITEX-BTC": {
|
|
348
324
|
"username": "hkbitex-btc@icg.io",
|
|
349
325
|
"password": "FR82krftI0QCoYr"
|
|
@@ -391,7 +367,6 @@
|
|
|
391
367
|
"ARMY": ["172.105.237.102"],
|
|
392
368
|
"B3TR": ["172.105.237.102"],
|
|
393
369
|
"CCDOG": ["172.105.237.102"],
|
|
394
|
-
"GRIPPY": ["172.105.237.102"],
|
|
395
370
|
"HKBITEX-BTC": ["172.105.237.102"],
|
|
396
371
|
"HKBITEX-ETH": ["172.105.237.102"],
|
|
397
372
|
"JYAI": ["172.105.237.102"],
|
package/data-source.js.secret
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
function safe_require(path) {
|
|
2
|
-
try {
|
|
3
|
-
return require(path)
|
|
4
|
-
} catch (error) {
|
|
5
|
-
if (error.code === 'MODULE_NOT_FOUND') {
|
|
6
|
-
return {}
|
|
7
|
-
} else {
|
|
8
|
-
throw error
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
config: safe_require('./config.js'),
|
|
15
|
-
secretread: safe_require('./secretread.js').secret,
|
|
16
|
-
secretread_shared: safe_require('./secretread.js').shared,
|
|
17
|
-
'data-source': safe_require('./data-source.js'),
|
|
18
|
-
benchmarks: safe_require('./config-benchmarks.js'),
|
|
19
|
-
}
|
|
1
|
+
function safe_require(path) {
|
|
2
|
+
try {
|
|
3
|
+
return require(path)
|
|
4
|
+
} catch (error) {
|
|
5
|
+
if (error.code === 'MODULE_NOT_FOUND') {
|
|
6
|
+
return {}
|
|
7
|
+
} else {
|
|
8
|
+
throw error
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
config: safe_require('./config.js'),
|
|
15
|
+
secretread: safe_require('./secretread.js').secret,
|
|
16
|
+
secretread_shared: safe_require('./secretread.js').shared,
|
|
17
|
+
'data-source': safe_require('./data-source.js'),
|
|
18
|
+
benchmarks: safe_require('./config-benchmarks.js'),
|
|
19
|
+
}
|
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.266",
|
|
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", "Gate"]} )',
|
|
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", "Gate"]} )',
|
|
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()
|