@icgio/clients-config 1.0.208 → 1.0.210

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.
@@ -1,2 +1,2 @@
1
- secretread.js:d21555444e73f2957bf6f20bf5e844cfaac0169aecf71f6c73c52087f8ef5957
1
+ secretread.js:ea3b99c7df3a36c844e1479a7750ff882fb49472f7a8aa52bd290cae8abd02d7
2
2
  data-source.js:a88043810676f6017be94bbcc357f8f0d439890c6698cc0b02941b605e7dbd9a
@@ -1,5 +1,8 @@
1
1
  {
2
2
  "client_exchange_pairs": {
3
+ "AAI": {
4
+ "Mexc": ["AAIUSDT"]
5
+ },
3
6
  "ACL": {
4
7
  "Gate": ["ACLUSDT"]
5
8
  },
@@ -229,6 +232,9 @@
229
232
  "TIPS": {
230
233
  "Bitmart": ["TIPSUSDT"]
231
234
  },
235
+ "TKT": {
236
+ "Mexc": ["TKTUSDT"]
237
+ },
232
238
  "TLAND": {
233
239
  "Fastex": ["TLANDUSDT"]
234
240
  },
@@ -261,11 +267,15 @@
261
267
  "XPRESS": {
262
268
  "Gate": ["XPRESSUSDT"]
263
269
  },
270
+ "XPUNK": {
271
+ "Mexc": ["XPUNKUSDT"]
272
+ },
264
273
  "ZUSHI": {
265
274
  "Bitmart": ["ZUSHIUSDT"]
266
275
  }
267
276
  },
268
277
  "client_not_include_exchanges": {
278
+ "AAI": [],
269
279
  "ACL": [],
270
280
  "AVALOX": [],
271
281
  "AVAV": [],
@@ -326,6 +336,7 @@
326
336
  "TGMT": [],
327
337
  "TIN": [],
328
338
  "TIPS": [],
339
+ "TKT": [],
329
340
  "TLAND": [],
330
341
  "TOROG": [],
331
342
  "TROLLMP": [],
@@ -336,9 +347,13 @@
336
347
  "VTC": [],
337
348
  "XERT": [],
338
349
  "XPRESS": [],
350
+ "XPUNK": [],
339
351
  "ZUSHI": []
340
352
  },
341
353
  "client_pair_main_exchanges": {
354
+ "AAI": {
355
+ "AAIUSDT": ["Mexc"]
356
+ },
342
357
  "ACL": {
343
358
  "ACLUSDT": ["Gate"]
344
359
  },
@@ -525,6 +540,9 @@
525
540
  "TIPS": {
526
541
  "TIPSUSDT": ["Bitmart"]
527
542
  },
543
+ "TKT": {
544
+ "TKTUSDT": ["Mexc"]
545
+ },
528
546
  "TLAND": {
529
547
  "TLANDUSDT": ["Fastex"]
530
548
  },
@@ -555,6 +573,9 @@
555
573
  "XPRESS": {
556
574
  "XPRESSUSDT": ["Gate"]
557
575
  },
576
+ "XPUNK": {
577
+ "XPUNKUSDT": ["Mexc"]
578
+ },
558
579
  "ZUSHI": {
559
580
  "ZUSHIUSDT": ["Bitmart"]
560
581
  }
@@ -574,6 +595,11 @@
574
595
  }
575
596
  },
576
597
  "clients_reporter_interval": {
598
+ "AAI": {
599
+ "balance": 1,
600
+ "trades": 1,
601
+ "orderbook": 1
602
+ },
577
603
  "ACL": {
578
604
  "balance": 1,
579
605
  "trades": 1,
@@ -844,6 +870,11 @@
844
870
  "trades": 1,
845
871
  "orderbook": 1
846
872
  },
873
+ "TKT": {
874
+ "balance": 1,
875
+ "trades": 1,
876
+ "orderbook": 1
877
+ },
847
878
  "TLAND": {
848
879
  "balance": 1,
849
880
  "trades": 1,
@@ -884,6 +915,11 @@
884
915
  "trades": 1,
885
916
  "orderbook": 1
886
917
  },
918
+ "XPUNK": {
919
+ "balance": 1,
920
+ "trades": 1,
921
+ "orderbook": 1
922
+ },
887
923
  "ZUSHI": {
888
924
  "balance": 1,
889
925
  "trades": 1,
@@ -892,6 +928,7 @@
892
928
  },
893
929
  "client_enabled": {
894
930
  "balance": {
931
+ "AAI": true,
895
932
  "ACL": true,
896
933
  "AVALOX": true,
897
934
  "AVAV": true,
@@ -942,12 +979,14 @@
942
979
  "TAZZ": true,
943
980
  "TES": true,
944
981
  "TIPS": true,
982
+ "TKT": true,
945
983
  "TLAND": true,
946
984
  "TOROG": true,
947
985
  "TRRUE": true,
948
986
  "ULTI": true,
949
987
  "VOIP": true,
950
988
  "XPRESS": true,
989
+ "XPUNK": true,
951
990
  "ZUSHI": true
952
991
  },
953
992
  "balance_cur": {
@@ -967,6 +1006,7 @@
967
1006
  "DMC": true
968
1007
  },
969
1008
  "trades": {
1009
+ "AAI": true,
970
1010
  "ACL": true,
971
1011
  "AVALOX": true,
972
1012
  "AVAV": true,
@@ -1017,6 +1057,7 @@
1017
1057
  "TES": true,
1018
1058
  "TIN": true,
1019
1059
  "TIPS": true,
1060
+ "TKT": true,
1020
1061
  "TLAND": true,
1021
1062
  "TOROG": true,
1022
1063
  "TROLLMP": true,
@@ -1025,6 +1066,7 @@
1025
1066
  "VOIP": true,
1026
1067
  "XERT": true,
1027
1068
  "XPRESS": true,
1069
+ "XPUNK": true,
1028
1070
  "ZUSHI": true
1029
1071
  },
1030
1072
  "orderbook": {
@@ -1038,6 +1080,7 @@
1038
1080
  }
1039
1081
  },
1040
1082
  "client_levels": {
1083
+ "AAI": [1, 2, 5, 10, 20, 50, 100],
1041
1084
  "ACL": [10, 50, 100],
1042
1085
  "AVALOX": [1, 2, 5, 10, 20, 50, 100],
1043
1086
  "AVAV": [2, 5, 10],
@@ -1098,6 +1141,7 @@
1098
1141
  "TGMT": [2, 5, 10],
1099
1142
  "TIN": [10, 50, 100],
1100
1143
  "TIPS": [2, 5, 10],
1144
+ "TKT": [1, 2, 5, 10, 20, 50, 100],
1101
1145
  "TLAND": [10, 50, 100],
1102
1146
  "TOROG": [10, 50, 100],
1103
1147
  "TROLLMP": [2, 5, 10],
@@ -1108,9 +1152,11 @@
1108
1152
  "VTC": [2, 5, 10],
1109
1153
  "XERT": [2, 5, 10],
1110
1154
  "XPRESS": [10, 50, 100],
1155
+ "XPUNK": [1, 2, 5, 10, 20, 50, 100],
1111
1156
  "ZUSHI": [2, 5, 10]
1112
1157
  },
1113
1158
  "client_price_index_curs": {
1159
+ "AAI": ["BTC", "ETH"],
1114
1160
  "ACL": ["BTC, ETH"],
1115
1161
  "AVALOX": ["BTC", "ETH"],
1116
1162
  "AVAV": ["BTC", "ETH"],
@@ -1170,6 +1216,7 @@
1170
1216
  "TGMT": ["BTC", "ETH"],
1171
1217
  "TIN": ["BTC", "ETH"],
1172
1218
  "TIPS": ["BTC", "ETH"],
1219
+ "TKT": ["BTC", "ETH"],
1173
1220
  "TLAND": ["BTC", "ETH"],
1174
1221
  "TOROG": ["BTC", "ETH"],
1175
1222
  "TROLLMP": ["BTC", "ETH"],
@@ -1180,9 +1227,11 @@
1180
1227
  "VTC": ["BTC", "ETH"],
1181
1228
  "XERT": ["BTC", "ETH"],
1182
1229
  "XPRESS": ["BTC", "ETH"],
1230
+ "XPUNK": ["BTC", "ETH"],
1183
1231
  "ZUSHI": ["BTC", "ETH"]
1184
1232
  },
1185
1233
  "client_telegram_ids": {
1234
+ "AAI": "-4873414367",
1186
1235
  "ACL": "-4283734918",
1187
1236
  "AVALOX": "-1002106426914",
1188
1237
  "AVAV": "-4199615909",
@@ -1243,6 +1292,7 @@
1243
1292
  "TGMT": "-1002053322082",
1244
1293
  "TIN": "-1002085447080",
1245
1294
  "TIPS": "-4151715633",
1295
+ "TKT": "-4946654975",
1246
1296
  "TLAND": "-4594805572",
1247
1297
  "TOROG": "-4646841347",
1248
1298
  "TROLLMP": "-4278849346",
@@ -1253,6 +1303,7 @@
1253
1303
  "VTC": "-1002045767005",
1254
1304
  "XERT": "-1002139475658",
1255
1305
  "XPRESS": "-1002205487574",
1306
+ "XPUNK": "-4866909186",
1256
1307
  "ZUSHI": "-4279552239"
1257
1308
  },
1258
1309
  "balance_premium": {
@@ -1271,6 +1322,7 @@
1271
1322
  "DMC": "-1002106853406"
1272
1323
  },
1273
1324
  "client_telegram_sender": {
1325
+ "AAI": "icg",
1274
1326
  "AVALOX": "icg",
1275
1327
  "AXL": "icg",
1276
1328
  "BCHEM": "icg",
@@ -1295,12 +1347,18 @@
1295
1347
  "SHROOMY": "icg",
1296
1348
  "SPONSTAR": "icg",
1297
1349
  "TAZZ": "icg",
1350
+ "TKT": "icg",
1298
1351
  "TLAND": "icg",
1299
1352
  "TOROG": "icg",
1300
1353
  "TRRUE": "icg",
1301
- "XPRESS": "icg"
1354
+ "XPRESS": "icg",
1355
+ "XPUNK": "icg"
1302
1356
  },
1303
1357
  "client_dashboard_credentials": {
1358
+ "AAI": {
1359
+ "username": "aai@icg.io",
1360
+ "password": "beaHR4UKtHRKEuY"
1361
+ },
1304
1362
  "AVALOX": {
1305
1363
  "username": "avalox@icg.io",
1306
1364
  "password": "omXfKUcHl2whb4W"
@@ -1385,6 +1443,10 @@
1385
1443
  "username": "sponstar@icg.io",
1386
1444
  "password": "pqVJQPuuPThfjZp"
1387
1445
  },
1446
+ "TKT": {
1447
+ "username": "tkt@icg.io",
1448
+ "password": "oEwbg6MmKnTym1O"
1449
+ },
1388
1450
  "TLAND": {
1389
1451
  "username": "tland@icg.io",
1390
1452
  "password": "0txFptjPFCExIyS"
@@ -1400,6 +1462,10 @@
1400
1462
  "XPRESS": {
1401
1463
  "username": "xpress@icg.io",
1402
1464
  "password": "keWRuKXXCk3lEJ9"
1465
+ },
1466
+ "XPUNK": {
1467
+ "username": "xpunk@icg.io",
1468
+ "password": "8RzbhsGazXnjVpn"
1403
1469
  }
1404
1470
  }
1405
1471
  }
package/config.json CHANGED
@@ -1,8 +1,5 @@
1
1
  {
2
2
  "client_exchange_pairs": {
3
- "AAI": {
4
- "Mexc": ["AAIUSDT"]
5
- },
6
3
  "ARMY": {
7
4
  "Bitrue": ["ARMYUSDT"],
8
5
  "Mexc": ["ARMYUSDT"]
@@ -10,6 +7,9 @@
10
7
  "BVT": {
11
8
  "Mexc": ["BVTUSDT"]
12
9
  },
10
+ "CCDOG": {
11
+ "Xt": ["CCDOGUSDT"]
12
+ },
13
13
  "ETHF": {
14
14
  "Htx": ["ETHFUSDT"],
15
15
  "Mexc": ["ETHFUSDT"]
@@ -71,18 +71,12 @@
71
71
  },
72
72
  "TITAN": {
73
73
  "Gate": ["TITANUSDT"]
74
- },
75
- "TKT": {
76
- "Mexc": ["TKTUSDT"]
77
- },
78
- "XPUNK": {
79
- "Mexc": ["XPUNKUSDT"]
80
74
  }
81
75
  },
82
76
  "client_not_include_exchanges": {
83
- "AAI": [],
84
77
  "ARMY": [],
85
78
  "BVT": [],
79
+ "CCDOG": [],
86
80
  "ETHF": [],
87
81
  "GO": [],
88
82
  "HKBITEX-BTC": [],
@@ -99,20 +93,18 @@
99
93
  "SLOR": [],
100
94
  "SWFTC": ["Lbank"],
101
95
  "TACC": [],
102
- "TITAN": [],
103
- "TKT": [],
104
- "XPUNK": []
96
+ "TITAN": []
105
97
  },
106
98
  "client_pair_main_exchanges": {
107
- "AAI": {
108
- "AAIUSDT": ["Mexc"]
109
- },
110
99
  "ARMY": {
111
100
  "ARMYUSDT": ["Mexc"]
112
101
  },
113
102
  "BVT": {
114
103
  "BVTUSDT": ["Mexc"]
115
104
  },
105
+ "CCDOG": {
106
+ "CCDOGUSDT": ["Xt"]
107
+ },
116
108
  "ETHF": {
117
109
  "ETHFUSDT": ["Htx", "Mexc"]
118
110
  },
@@ -166,26 +158,20 @@
166
158
  },
167
159
  "TITAN": {
168
160
  "TITANUSDT": ["Gate"]
169
- },
170
- "TKT": {
171
- "TKTUSDT": ["Mexc"]
172
- },
173
- "XPUNK": {
174
- "XPUNKUSDT": ["Mexc"]
175
161
  }
176
162
  },
177
163
  "clients_reporter_interval": {
178
- "AAI": {
164
+ "ARMY": {
179
165
  "balance": 1,
180
166
  "trades": 1,
181
167
  "orderbook": 1
182
168
  },
183
- "ARMY": {
169
+ "BVT": {
184
170
  "balance": 1,
185
171
  "trades": 1,
186
172
  "orderbook": 1
187
173
  },
188
- "BVT": {
174
+ "CCDOG": {
189
175
  "balance": 1,
190
176
  "trades": 1,
191
177
  "orderbook": 1
@@ -274,23 +260,13 @@
274
260
  "balance": 1,
275
261
  "trades": 1,
276
262
  "orderbook": 1
277
- },
278
- "TKT": {
279
- "balance": 1,
280
- "trades": 1,
281
- "orderbook": 1
282
- },
283
- "XPUNK": {
284
- "balance": 1,
285
- "trades": 1,
286
- "orderbook": 1
287
263
  }
288
264
  },
289
265
  "client_enabled": {
290
266
  "balance": {
291
- "AAI": true,
292
267
  "ARMY": true,
293
268
  "BVT": true,
269
+ "CCDOG": true,
294
270
  "ETHF": true,
295
271
  "GO": true,
296
272
  "HKBITEX-BTC": true,
@@ -306,9 +282,7 @@
306
282
  "SLOR": true,
307
283
  "SWFTC": true,
308
284
  "TACC": true,
309
- "TITAN": true,
310
- "TKT": true,
311
- "XPUNK": true
285
+ "TITAN": true
312
286
  },
313
287
  "balance_cur": {
314
288
  "IONX": true
@@ -318,9 +292,9 @@
318
292
  },
319
293
  "trades_detail": {},
320
294
  "trades": {
321
- "AAI": true,
322
295
  "ARMY": true,
323
296
  "BVT": true,
297
+ "CCDOG": true,
324
298
  "ETHF": true,
325
299
  "GO": true,
326
300
  "HKBITEX-BTC": true,
@@ -337,9 +311,7 @@
337
311
  "SLOR": true,
338
312
  "SWFTC": true,
339
313
  "TACC": true,
340
- "TITAN": true,
341
- "TKT": true,
342
- "XPUNK": true
314
+ "TITAN": true
343
315
  },
344
316
  "orderbook": {
345
317
  "MAK": true,
@@ -347,9 +319,9 @@
347
319
  }
348
320
  },
349
321
  "client_levels": {
350
- "AAI": [1, 2, 5, 10, 20, 50, 100],
351
322
  "ARMY": [1, 2, 5, 10, 20, 50, 100],
352
323
  "BVT": [1, 2, 5, 10, 20, 50, 100],
324
+ "CCDOG": [1, 2, 5, 10, 20, 50, 100],
353
325
  "ETHF": [1, 2, 5, 10, 20, 50, 100],
354
326
  "GO": [1, 2, 5, 10, 20, 50, 100],
355
327
  "HKBITEX-BTC": [1, 2, 5, 10, 20, 50, 100],
@@ -366,14 +338,12 @@
366
338
  "SLOR": [1, 2, 5, 10, 20, 50, 100],
367
339
  "SWFTC": [1, 2, 5, 10, 20, 50, 100],
368
340
  "TACC": [1, 2, 5, 10, 20, 50, 100],
369
- "TITAN": [1, 2, 5, 10, 20, 50, 100],
370
- "TKT": [1, 2, 5, 10, 20, 50, 100],
371
- "XPUNK": [1, 2, 5, 10, 20, 50, 100]
341
+ "TITAN": [1, 2, 5, 10, 20, 50, 100]
372
342
  },
373
343
  "client_price_index_curs": {
374
- "AAI": ["BTC", "ETH"],
375
344
  "ARMY": ["BTC", "ETH"],
376
345
  "BVT": ["BTC", "ETH"],
346
+ "CCDOG": ["BTC", "ETH"],
377
347
  "ETHF": ["BTC", "ETH"],
378
348
  "GO": ["BTC", "ETH"],
379
349
  "HKBITEX-BTC": ["BTC", "ETH"],
@@ -390,14 +360,12 @@
390
360
  "SLOR": ["BTC", "ETH"],
391
361
  "SWFTC": ["BTC", "ETH"],
392
362
  "TACC": ["BTC", "ETH"],
393
- "TITAN": ["BTC", "ETH"],
394
- "TKT": ["BTC", "ETH"],
395
- "XPUNK": ["BTC", "ETH"]
363
+ "TITAN": ["BTC", "ETH"]
396
364
  },
397
365
  "client_telegram_ids": {
398
- "AAI": "-4873414367",
399
366
  "ARMY": "-4733838023",
400
367
  "BVT": "-4802263491",
368
+ "CCDOG": "-4866473272",
401
369
  "ETHF": "-4698418127",
402
370
  "GO": "-4822577824",
403
371
  "HKBITEX-BTC": "-4837808085",
@@ -414,9 +382,7 @@
414
382
  "SLOR": "-4721907187",
415
383
  "SWFTC": "-1002067948127",
416
384
  "TACC": "-4874959768",
417
- "TITAN": "-4710863832",
418
- "TKT": "-4946654975",
419
- "XPUNK": "-4866909186"
385
+ "TITAN": "-4710863832"
420
386
  },
421
387
  "balance_premium": {
422
388
  "BVT": {
@@ -438,9 +404,9 @@
438
404
  },
439
405
  "client_additional_telegram_ids": {},
440
406
  "client_telegram_sender": {
441
- "AAI": "icg",
442
407
  "ARMY": "icg",
443
408
  "BVT": "icg",
409
+ "CCDOG": "icg",
444
410
  "ETHF": "icg",
445
411
  "GO": "icg",
446
412
  "HKBITEX-BTC": "icg",
@@ -457,19 +423,13 @@
457
423
  "SLOR": "icg",
458
424
  "SWFTC": "icg",
459
425
  "TACC": "icg",
460
- "TITAN": "icg",
461
- "TKT": "icg",
462
- "XPUNK": "icg"
426
+ "TITAN": "icg"
463
427
  },
464
428
  "client_dashboard_credentials": {
465
429
  "ADMIN": {
466
430
  "username": "admin@icg.io",
467
431
  "password": "XSoexiSvGkLuCyY"
468
432
  },
469
- "AAI": {
470
- "username": "aai@icg.io",
471
- "password": "beaHR4UKtHRKEuY"
472
- },
473
433
  "ARMY": {
474
434
  "username": "army@icg.io",
475
435
  "password": "GUeDh6im6W3ZSXL"
@@ -478,6 +438,10 @@
478
438
  "username": "bvt@icg.io",
479
439
  "password": "DhnK4CXBaenTQR9"
480
440
  },
441
+ "CCDOG": {
442
+ "username": "ccdog@icg.io",
443
+ "password": "s9d1kmkNcRIsDN3"
444
+ },
481
445
  "ETHF": {
482
446
  "username": "ethf@icg.io",
483
447
  "password": "m0ULpp3o4FoVey4"
@@ -545,14 +509,6 @@
545
509
  "TITAN": {
546
510
  "username": "titan@icg.io",
547
511
  "password": "PWW8Te4dPDoDS76"
548
- },
549
- "TKT": {
550
- "username": "tkt@icg.io",
551
- "password": "oEwbg6MmKnTym1O"
552
- },
553
- "XPUNK": {
554
- "username": "xpunk@icg.io",
555
- "password": "8RzbhsGazXnjVpn"
556
512
  }
557
513
  },
558
514
  "server_config_enabled": {
Binary file
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
- {
2
- "name": "@icgio/clients-config",
3
- "version": "1.0.208",
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.210",
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
+ }
Binary file
@@ -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()