@icgio/clients-config 1.0.286 → 1.0.288
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 +13 -2
- package/config.js +5 -3
- package/config.json +13 -30
- package/data-source.js.secret +0 -0
- package/index.js +18 -19
- package/package.json +27 -27
- package/secretread.js.secret +0 -0
- package/update-config-json.js +278 -278
- package/config-benchmarks.js +0 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
v:1:
|
|
1
|
+
v:1:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
secretread.js:
|
|
1
|
+
secretread.js:a0d95e1f2f4568b3feea36f9129bc082460869b98aaac09923702322f4c4e66a
|
|
2
2
|
data-source.js:440e328f62856d665e4b66a66f55406e0c9f3a974d2be3c000041fd1c552652b
|
package/config-archive.json
CHANGED
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"AVALOX": {
|
|
13
13
|
"Gate": ["AVALOXUSDT"],
|
|
14
|
-
"Bitmart": ["AVALOXUSDT"]
|
|
14
|
+
"Bitmart": ["AVALOXUSDT"],
|
|
15
|
+
"Mexc": ["AVALOXUSDT"]
|
|
15
16
|
},
|
|
16
17
|
"AVAV": {
|
|
17
18
|
"Bitget": ["AVAVUSDT"]
|
|
@@ -405,7 +406,7 @@
|
|
|
405
406
|
"AVUSDT": ["Mexc"]
|
|
406
407
|
},
|
|
407
408
|
"AVALOX": {
|
|
408
|
-
"AVALOXUSDT": ["Bitmart"]
|
|
409
|
+
"AVALOXUSDT": ["Bitmart", "Mexc"]
|
|
409
410
|
},
|
|
410
411
|
"AVAV": {
|
|
411
412
|
"AVAVUSDT": ["Bitget"]
|
|
@@ -1065,6 +1066,7 @@
|
|
|
1065
1066
|
"AAI": true,
|
|
1066
1067
|
"ACL": true,
|
|
1067
1068
|
"AV": true,
|
|
1069
|
+
"AVALOX": true,
|
|
1068
1070
|
"AVAV": true,
|
|
1069
1071
|
"AXL": true,
|
|
1070
1072
|
"BCHEM": true,
|
|
@@ -1138,6 +1140,7 @@
|
|
|
1138
1140
|
"XERT": true
|
|
1139
1141
|
},
|
|
1140
1142
|
"deposits_withdrawals": {
|
|
1143
|
+
"AVALOX": true,
|
|
1141
1144
|
"GRIPPY": true,
|
|
1142
1145
|
"TACC": true
|
|
1143
1146
|
},
|
|
@@ -1157,6 +1160,7 @@
|
|
|
1157
1160
|
"AAI": true,
|
|
1158
1161
|
"ACL": true,
|
|
1159
1162
|
"AV": true,
|
|
1163
|
+
"AVALOX": true,
|
|
1160
1164
|
"AVAV": true,
|
|
1161
1165
|
"AXL": true,
|
|
1162
1166
|
"BCHEM": true,
|
|
@@ -1242,6 +1246,7 @@
|
|
|
1242
1246
|
"AAI": [1, 2, 5, 10, 20, 50, 100],
|
|
1243
1247
|
"ACL": [10, 50, 100],
|
|
1244
1248
|
"AV": [1, 2, 5, 10, 20, 50, 100],
|
|
1249
|
+
"AVALOX": [1, 2, 5, 10, 20, 50, 100],
|
|
1245
1250
|
"AVAV": [2, 5, 10],
|
|
1246
1251
|
"AXL": [10, 50, 100],
|
|
1247
1252
|
"BCHEM": [1, 2, 5, 10, 20, 50, 100],
|
|
@@ -1328,6 +1333,7 @@
|
|
|
1328
1333
|
"AAI": ["BTC", "ETH"],
|
|
1329
1334
|
"ACL": ["BTC, ETH"],
|
|
1330
1335
|
"AV": ["BTC", "ETH"],
|
|
1336
|
+
"AVALOX": ["BTC", "ETH"],
|
|
1331
1337
|
"AVAV": ["BTC", "ETH"],
|
|
1332
1338
|
"AXL": ["BTC", "ETH"],
|
|
1333
1339
|
"BCHEM": ["BTC", "ETH"],
|
|
@@ -1413,6 +1419,7 @@
|
|
|
1413
1419
|
"AAI": "-4873414367",
|
|
1414
1420
|
"ACL": "-4283734918",
|
|
1415
1421
|
"AV": "-5059409056",
|
|
1422
|
+
"AVALOX": "-1002106426914",
|
|
1416
1423
|
"AVAV": "-4199615909",
|
|
1417
1424
|
"AXL": "-1002044946729",
|
|
1418
1425
|
"BCHEM": "-4802690196",
|
|
@@ -1523,6 +1530,7 @@
|
|
|
1523
1530
|
"client_telegram_sender": {
|
|
1524
1531
|
"AAI": "icg",
|
|
1525
1532
|
"AV": "icg",
|
|
1533
|
+
"AVALOX": "icg",
|
|
1526
1534
|
"AXL": "icg",
|
|
1527
1535
|
"BCHEM": "icg",
|
|
1528
1536
|
"BVT": "icg",
|
|
@@ -1572,6 +1580,7 @@
|
|
|
1572
1580
|
"username": "av@icg.io",
|
|
1573
1581
|
"password": "av@icg.io"
|
|
1574
1582
|
},
|
|
1583
|
+
"AVALOX": { "username": "avalox@icg.io" },
|
|
1575
1584
|
"AXL": {
|
|
1576
1585
|
"username": "axl@icg.io",
|
|
1577
1586
|
"password": "lUzpE7Ku0elfayb"
|
|
@@ -1718,6 +1727,7 @@
|
|
|
1718
1727
|
}
|
|
1719
1728
|
},
|
|
1720
1729
|
"server_config_enabled": {
|
|
1730
|
+
"AVALOX": true,
|
|
1721
1731
|
"MAK": true
|
|
1722
1732
|
},
|
|
1723
1733
|
"server_config_whitelist_ips": {
|
|
@@ -1725,6 +1735,7 @@
|
|
|
1725
1735
|
"MAK": ["172.105.237.102", "52.221.185.198", "178.157.58.210"]
|
|
1726
1736
|
},
|
|
1727
1737
|
"server_config_admin_whitelist_ips": {
|
|
1738
|
+
"AVALOX": ["172.105.237.102", "139.162.84.139"],
|
|
1728
1739
|
"BVT": [],
|
|
1729
1740
|
"GO": [],
|
|
1730
1741
|
"GRIPPY": ["172.105.237.102"],
|
package/config.js
CHANGED
|
@@ -84,9 +84,11 @@ module.exports.client_exchanges = _.fromPairs(Object.keys(client_exchange_pairs)
|
|
|
84
84
|
HSC: [HSC, ETH, USDT]
|
|
85
85
|
}
|
|
86
86
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
// Currencies that use forex rate directly (not from orderbook pairs)
|
|
88
|
+
const forex_rate_currencies = ['BTC', 'ETH', 'BNB', 'USD', 'USDC', 'USDT', 'HKD', 'KRW', 'THB']
|
|
89
|
+
module.exports.forex_rate_currencies = forex_rate_currencies
|
|
90
|
+
|
|
91
|
+
module.exports.client_currencies_with_stables = _.fromPairs(_.keys(client_exchange_pairs).map((cur) => [cur, _.uniq([..._.split(cur, '-'), ...forex_rate_currencies])]))
|
|
90
92
|
|
|
91
93
|
const clients_reporter_interval = config_data.clients_reporter_interval
|
|
92
94
|
module.exports.clients_reporter_interval = clients_reporter_interval
|
package/config.json
CHANGED
|
@@ -4,9 +4,6 @@
|
|
|
4
4
|
"Bitrue": ["ARMYUSDT"],
|
|
5
5
|
"Mexc": ["ARMYUSDT"]
|
|
6
6
|
},
|
|
7
|
-
"AVALOX": {
|
|
8
|
-
"Mexc": ["AVALOXUSDT"]
|
|
9
|
-
},
|
|
10
7
|
"B3TR": {
|
|
11
8
|
"Biconomy": ["B3TRUSDT"],
|
|
12
9
|
"Bitrue": ["B3TRUSDT"],
|
|
@@ -15,7 +12,8 @@
|
|
|
15
12
|
},
|
|
16
13
|
"CCDOG": {
|
|
17
14
|
"Bitmart": ["CCDOGUSDT"],
|
|
18
|
-
"Mexc": ["CCDOGUSDT"]
|
|
15
|
+
"Mexc": ["CCDOGUSDT"],
|
|
16
|
+
"Xt": ["CCDOGUSDT"]
|
|
19
17
|
},
|
|
20
18
|
"FREEZONE": {
|
|
21
19
|
"Mexc": ["FREEZONEUSDT"]
|
|
@@ -27,22 +25,25 @@
|
|
|
27
25
|
"Hkbitex": ["ETHUSD", "ETHHKD"]
|
|
28
26
|
},
|
|
29
27
|
"JYAI": {
|
|
30
|
-
"Biconomy": ["JYAIBTC"],
|
|
28
|
+
"Biconomy": ["JYAIBTC","JYAIUSDC", "JYAIUSDT"],
|
|
31
29
|
"Bingx": ["JYAIUSDT"],
|
|
32
30
|
"Bitmart": ["JYAIUSDC", "JYAIUSDT"],
|
|
33
31
|
"Lbank": ["JYAIUSDT"],
|
|
34
|
-
"Mexc": ["JYAIUSDT"]
|
|
32
|
+
"Mexc": ["JYAIUSDT"],
|
|
33
|
+
"Xt": ["JYAIUSDC", "JYAIUSDT"]
|
|
35
34
|
},
|
|
36
35
|
"LBAI": {
|
|
37
36
|
"Bitmart": ["LBAIUSDT"],
|
|
38
|
-
"Mexc": ["LBAIUSDT"]
|
|
37
|
+
"Mexc": ["LBAIUSDT"],
|
|
38
|
+
"Xt": ["LBAIUSDC", "LBAIUSDT"]
|
|
39
39
|
},
|
|
40
40
|
"LUCIC": {
|
|
41
41
|
"Xt": ["LUCICUSDT"]
|
|
42
42
|
},
|
|
43
43
|
"MINDFAK": {
|
|
44
44
|
"Bitmart": ["MINDFAKUSDC", "MINDFAKUSDT"],
|
|
45
|
-
"Mexc": ["MINDFAKUSDT"]
|
|
45
|
+
"Mexc": ["MINDFAKUSDT"],
|
|
46
|
+
"Xt": ["MINDFAKUSDT"]
|
|
46
47
|
},
|
|
47
48
|
"MECO": {
|
|
48
49
|
"Mexc": ["MECOUSDT"]
|
|
@@ -70,7 +71,6 @@
|
|
|
70
71
|
},
|
|
71
72
|
"client_not_include_exchanges": {
|
|
72
73
|
"ARMY": [],
|
|
73
|
-
"AVALOX": [],
|
|
74
74
|
"B3TR": [],
|
|
75
75
|
"CCDOG": [],
|
|
76
76
|
"FREEZONE": [],
|
|
@@ -91,14 +91,11 @@
|
|
|
91
91
|
"ARMY": {
|
|
92
92
|
"ARMYUSDT": ["Mexc"]
|
|
93
93
|
},
|
|
94
|
-
"AVALOX": {
|
|
95
|
-
"AVALOXUSDT": ["Mexc"]
|
|
96
|
-
},
|
|
97
94
|
"B3TR": {
|
|
98
95
|
"B3TRUSDT": ["Mexc"]
|
|
99
96
|
},
|
|
100
97
|
"CCDOG": {
|
|
101
|
-
"CCDOGUSDT": ["
|
|
98
|
+
"CCDOGUSDT": ["Xt"]
|
|
102
99
|
},
|
|
103
100
|
"FREEZONE": {
|
|
104
101
|
"FREEZONEUSDT": ["Mexc"]
|
|
@@ -113,11 +110,12 @@
|
|
|
113
110
|
},
|
|
114
111
|
"JYAI": {
|
|
115
112
|
"JYAIBTC": ["Biconomy"],
|
|
116
|
-
"JYAIUSDC": ["Bitmart"],
|
|
113
|
+
"JYAIUSDC": ["Bitmart", "Xt"],
|
|
117
114
|
"JYAIUSDT": ["Mexc"]
|
|
118
115
|
},
|
|
119
116
|
"LBAI": {
|
|
120
|
-
"
|
|
117
|
+
"LBAIUSDC": ["Xt"],
|
|
118
|
+
"LBAIUSDT": ["Mexc", "Xt"]
|
|
121
119
|
},
|
|
122
120
|
"LUCIC": {
|
|
123
121
|
"LUCICUSDT": ["Xt"]
|
|
@@ -151,11 +149,6 @@
|
|
|
151
149
|
"orderbook": 1,
|
|
152
150
|
"deposits_withdrawals": 1
|
|
153
151
|
},
|
|
154
|
-
"AVALOX": {
|
|
155
|
-
"balance": 1,
|
|
156
|
-
"trades": 1,
|
|
157
|
-
"orderbook": 1
|
|
158
|
-
},
|
|
159
152
|
"B3TR": {
|
|
160
153
|
"balance": 1,
|
|
161
154
|
"trades": 1,
|
|
@@ -250,7 +243,6 @@
|
|
|
250
243
|
"client_enabled": {
|
|
251
244
|
"balance": {
|
|
252
245
|
"ARMY": true,
|
|
253
|
-
"AVALOX": true,
|
|
254
246
|
"B3TR": true,
|
|
255
247
|
"CCDOG": true,
|
|
256
248
|
"FREEZONE": true,
|
|
@@ -270,7 +262,6 @@
|
|
|
270
262
|
"balance_cur": {},
|
|
271
263
|
"deposits_withdrawals": {
|
|
272
264
|
"ARMY": true,
|
|
273
|
-
"AVALOX": true,
|
|
274
265
|
"B3TR": true,
|
|
275
266
|
"CCDOG": true,
|
|
276
267
|
"FREEZONE": true,
|
|
@@ -293,7 +284,6 @@
|
|
|
293
284
|
"trades_detail": {},
|
|
294
285
|
"trades": {
|
|
295
286
|
"ARMY": true,
|
|
296
|
-
"AVALOX": true,
|
|
297
287
|
"B3TR": true,
|
|
298
288
|
"CCDOG": true,
|
|
299
289
|
"FREEZONE": true,
|
|
@@ -314,7 +304,6 @@
|
|
|
314
304
|
},
|
|
315
305
|
"client_levels": {
|
|
316
306
|
"ARMY": [1, 2, 5, 10, 20, 50, 100],
|
|
317
|
-
"AVALOX": [1, 2, 5, 10, 20, 50, 100],
|
|
318
307
|
"B3TR": [1, 2, 5, 10, 20, 50, 100],
|
|
319
308
|
"CCDOG": [1, 2, 5, 10, 20, 50, 100],
|
|
320
309
|
"FREEZONE": [1, 2, 5, 10, 20, 50, 100],
|
|
@@ -333,7 +322,6 @@
|
|
|
333
322
|
},
|
|
334
323
|
"client_price_index_curs": {
|
|
335
324
|
"ARMY": ["BTC", "ETH"],
|
|
336
|
-
"AVALOX": ["BTC", "ETH"],
|
|
337
325
|
"B3TR": ["BTC", "ETH"],
|
|
338
326
|
"CCDOG": ["BTC", "ETH"],
|
|
339
327
|
"FREEZONE": ["BTC", "ETH"],
|
|
@@ -352,7 +340,6 @@
|
|
|
352
340
|
},
|
|
353
341
|
"client_telegram_ids": {
|
|
354
342
|
"ARMY": "-4733838023",
|
|
355
|
-
"AVALOX": "-1002106426914",
|
|
356
343
|
"B3TR": "-4957633893",
|
|
357
344
|
"CCDOG": "-4866473272",
|
|
358
345
|
"FREEZONE": "-5013286765",
|
|
@@ -386,7 +373,6 @@
|
|
|
386
373
|
"client_additional_telegram_ids": {},
|
|
387
374
|
"client_telegram_sender": {
|
|
388
375
|
"ARMY": "icg",
|
|
389
|
-
"AVALOX": "icg",
|
|
390
376
|
"B3TR": "icg",
|
|
391
377
|
"CCDOG": "icg",
|
|
392
378
|
"FREEZONE": "icg",
|
|
@@ -406,7 +392,6 @@
|
|
|
406
392
|
"dashboard_users": {
|
|
407
393
|
"ADMIN": { "username": "admin@icg.io" },
|
|
408
394
|
"ARMY": { "username": "army@icg.io" },
|
|
409
|
-
"AVALOX": { "username": "avalox@icg.io" },
|
|
410
395
|
"B3TR": { "username": "b3tr@icg.io" },
|
|
411
396
|
"CCDOG": { "username": "ccdog@icg.io" },
|
|
412
397
|
"FREEZONE": { "username": "freezone@icg.io" },
|
|
@@ -433,7 +418,6 @@
|
|
|
433
418
|
"MINDFAK": "https://api.geckoterminal.com/api/v2/networks/eth/pools/0x40c03fb952df5f4ec72414efb0b378d70cded263"
|
|
434
419
|
},
|
|
435
420
|
"server_config_enabled": {
|
|
436
|
-
"AVALOX": true,
|
|
437
421
|
"FREEZONE": true,
|
|
438
422
|
"HKBITEX-BTC": true,
|
|
439
423
|
"HKBITEX-ETH": true,
|
|
@@ -443,7 +427,6 @@
|
|
|
443
427
|
"server_config_whitelist_ips": {},
|
|
444
428
|
"server_config_admin_whitelist_ips": {
|
|
445
429
|
"ARMY": ["172.105.237.102", "139.162.90.70"],
|
|
446
|
-
"AVALOX": ["172.105.237.102", "139.162.84.139"],
|
|
447
430
|
"B3TR": ["172.105.237.102", "139.162.122.208", "172.104.97.165"],
|
|
448
431
|
"CCDOG": ["172.105.237.102", "139.162.102.147"],
|
|
449
432
|
"FREEZONE": ["172.105.237.102", "172.104.114.32"],
|
package/data-source.js.secret
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
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
|
-
|
|
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
|
+
}
|
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.288",
|
|
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()
|
package/config-benchmarks.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const benchmarks = {
|
|
2
|
-
min_balance: {
|
|
3
|
-
// MIX: {
|
|
4
|
-
// bybit_1: {
|
|
5
|
-
// MIX: 10000000,
|
|
6
|
-
// USDT: 7000,
|
|
7
|
-
// },
|
|
8
|
-
// bybit_2: {
|
|
9
|
-
// MIX: 5000000,
|
|
10
|
-
// USDT: 2000,
|
|
11
|
-
// },
|
|
12
|
-
// },
|
|
13
|
-
},
|
|
14
|
-
orderbook_depth_in_quote_cur: {
|
|
15
|
-
// MIX: {
|
|
16
|
-
// Bybit: {
|
|
17
|
-
// MIXUSDT: [[0.02, 1500]],
|
|
18
|
-
// },
|
|
19
|
-
// },
|
|
20
|
-
OPUL: {
|
|
21
|
-
Kucoin: {
|
|
22
|
-
OPULUSDT: [[0.002, 1000]],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
ask_bid_spread: {
|
|
27
|
-
// MIX: {
|
|
28
|
-
// Bybit: {
|
|
29
|
-
// MIXUSDT: 0.01,
|
|
30
|
-
// },
|
|
31
|
-
// },
|
|
32
|
-
},
|
|
33
|
-
volume_24h_in_quote_cur: {
|
|
34
|
-
// MIX: {
|
|
35
|
-
// Bybit: {
|
|
36
|
-
// MIXUSDT: 20000,
|
|
37
|
-
// },
|
|
38
|
-
// },
|
|
39
|
-
SWFTC: {
|
|
40
|
-
Gate: {
|
|
41
|
-
SWFTCUSDT: 50000,
|
|
42
|
-
},
|
|
43
|
-
Htx: {
|
|
44
|
-
SWFTCUSDT: 50000,
|
|
45
|
-
},
|
|
46
|
-
Kucoin: {
|
|
47
|
-
SWFTCUSDT: 50000,
|
|
48
|
-
},
|
|
49
|
-
Okx: {
|
|
50
|
-
SWFTCUSDT: 50000,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = benchmarks
|