-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathokex3.js
3676 lines (3623 loc) · 170 KB
/
okex3.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'use strict';
// ---------------------------------------------------------------------------
const Exchange = require ('./base/Exchange');
const { ExchangeError, ExchangeNotAvailable, OnMaintenance, ArgumentsRequired, BadRequest, AccountSuspended, InvalidAddress, PermissionDenied, DDoSProtection, InsufficientFunds, InvalidNonce, CancelPending, InvalidOrder, OrderNotFound, AuthenticationError, RequestTimeout, NotSupported, BadSymbol, RateLimitExceeded } = require ('./base/errors');
const { TICK_SIZE, TRUNCATE } = require ('./base/functions/number');
const Precise = require ('./base/Precise');
// ---------------------------------------------------------------------------
module.exports = class okex3 extends Exchange {
describe () {
return this.deepExtend (super.describe (), {
'id': 'okex3',
'name': 'OKEX',
'countries': [ 'CN' ],
'version': 'v3',
'rateLimit': 1000, // up to 3000 requests per 5 minutes ≈ 600 requests per minute ≈ 10 requests per second ≈ 100 ms
'pro': true,
'has': {
'cancelOrder': true,
'CORS': undefined,
'createOrder': true,
'fetchBalance': true,
'fetchClosedOrders': true,
'fetchCurrencies': undefined, // see below
'fetchDepositAddress': true,
'fetchDeposits': true,
'fetchLedger': true,
'fetchMarkets': true,
'fetchMyTrades': true,
'fetchOHLCV': true,
'fetchOpenOrders': true,
'fetchOrder': true,
'fetchOrderBook': true,
'fetchOrders': undefined,
'fetchOrderTrades': true,
'fetchTicker': true,
'fetchTickers': true,
'fetchTime': true,
'fetchTrades': true,
'fetchTransactions': undefined,
'fetchWithdrawals': true,
'futures': true,
'withdraw': true,
},
'timeframes': {
'1m': '60',
'3m': '180',
'5m': '300',
'15m': '900',
'30m': '1800',
'1h': '3600',
'2h': '7200',
'4h': '14400',
'6h': '21600',
'12h': '43200',
'1d': '86400',
'1w': '604800',
'1M': '2678400',
'3M': '8035200',
'6M': '16070400',
'1y': '31536000',
},
'hostname': 'okex.com',
'urls': {
'logo': 'https://user-images.githubusercontent.com/1294454/32552768-0d6dd3c6-c4a6-11e7-90f8-c043b64756a7.jpg',
'api': {
'rest': 'https://www.{hostname}',
},
'www': 'https://www.okex.com',
'doc': 'https://www.okex.com/docs/en/',
'fees': 'https://www.okex.com/pages/products/fees.html',
'referral': 'https://www.okex.com/join/1888677',
'test': {
'rest': 'https://testnet.okex.com',
},
},
'api': {
'general': {
'get': [
'time',
],
},
'account': {
'get': [
'wallet',
'sub-account',
'asset-valuation',
'wallet/{currency}',
'withdrawal/history',
'withdrawal/history/{currency}',
'ledger',
'deposit/address',
'deposit/history',
'deposit/history/{currency}',
'currencies',
'withdrawal/fee',
],
'post': [
'transfer',
'withdrawal',
],
},
'spot': {
'get': [
'accounts',
'accounts/{currency}',
'accounts/{currency}/ledger',
'orders',
'amend_order/{instrument_id}',
'orders_pending',
'orders/{order_id}',
'orders/{client_oid}',
'trade_fee',
'fills',
'algo',
// public
'instruments',
'instruments/{instrument_id}/book',
'instruments/ticker',
'instruments/{instrument_id}/ticker',
'instruments/{instrument_id}/trades',
'instruments/{instrument_id}/candles',
'instruments/{instrument_id}/history/candles',
],
'post': [
'order_algo',
'orders',
'batch_orders',
'cancel_orders/{order_id}',
'cancel_orders/{client_oid}',
'cancel_batch_algos',
'cancel_batch_orders',
],
},
'margin': {
'get': [
'accounts',
'accounts/{instrument_id}',
'accounts/{instrument_id}/ledger',
'accounts/availability',
'accounts/{instrument_id}/availability',
'accounts/borrowed',
'accounts/{instrument_id}/borrowed',
'orders',
'accounts/{instrument_id}/leverage',
'orders/{order_id}',
'orders/{client_oid}',
'orders_pending',
'fills',
// public
'instruments/{instrument_id}/mark_price',
],
'post': [
'accounts/borrow',
'accounts/repayment',
'orders',
'batch_orders',
'cancel_orders',
'cancel_orders/{order_id}',
'cancel_orders/{client_oid}',
'cancel_batch_orders',
'accounts/{instrument_id}/leverage',
],
},
'futures': {
'get': [
'position',
'{instrument_id}/position',
'accounts',
'accounts/{underlying}',
'accounts/{underlying}/leverage',
'accounts/{underlying}/ledger',
'order_algo/{instrument_id}',
'orders/{instrument_id}',
'orders/{instrument_id}/{order_id}',
'orders/{instrument_id}/{client_oid}',
'fills',
'trade_fee',
'accounts/{instrument_id}/holds',
'order_algo/{instrument_id}',
// public
'instruments',
'instruments/{instrument_id}/book',
'instruments/ticker',
'instruments/{instrument_id}/ticker',
'instruments/{instrument_id}/trades',
'instruments/{instrument_id}/candles',
'instruments/{instrument_id}/history/candles',
'instruments/{instrument_id}/index',
'rate',
'instruments/{instrument_id}/estimated_price',
'instruments/{instrument_id}/open_interest',
'instruments/{instrument_id}/price_limit',
'instruments/{instrument_id}/mark_price',
'instruments/{instrument_id}/liquidation',
],
'post': [
'accounts/{underlying}/leverage',
'order',
'amend_order/{instrument_id}',
'orders',
'cancel_order/{instrument_id}/{order_id}',
'cancel_order/{instrument_id}/{client_oid}',
'cancel_batch_orders/{instrument_id}',
'accounts/margin_mode',
'close_position',
'cancel_all',
'order_algo',
'cancel_algos',
],
},
'swap': {
'get': [
'position',
'{instrument_id}/position',
'accounts',
'{instrument_id}/accounts',
'accounts/{instrument_id}/settings',
'accounts/{instrument_id}/ledger',
'orders/{instrument_id}',
'orders/{instrument_id}/{order_id}',
'orders/{instrument_id}/{client_oid}',
'fills',
'accounts/{instrument_id}/holds',
'trade_fee',
'order_algo/{instrument_id}',
// public
'instruments',
'instruments/{instrument_id}/depth',
'instruments/ticker',
'instruments/{instrument_id}/ticker',
'instruments/{instrument_id}/trades',
'instruments/{instrument_id}/candles',
'instruments/{instrument_id}/history/candles',
'instruments/{instrument_id}/index',
'rate',
'instruments/{instrument_id}/open_interest',
'instruments/{instrument_id}/price_limit',
'instruments/{instrument_id}/liquidation',
'instruments/{instrument_id}/funding_time',
'instruments/{instrument_id}/mark_price',
'instruments/{instrument_id}/historical_funding_rate',
],
'post': [
'accounts/{instrument_id}/leverage',
'order',
'amend_order/{instrument_id}',
'orders',
'cancel_order/{instrument_id}/{order_id}',
'cancel_order/{instrument_id}/{client_oid}',
'cancel_batch_orders/{instrument_id}',
'order_algo',
'cancel_algos',
'close_position',
'cancel_all',
'order_algo',
'cancel_algos',
],
},
'option': {
'get': [
'accounts',
'position',
'{underlying}/position',
'accounts/{underlying}',
'orders/{underlying}',
'fills/{underlying}',
'accounts/{underlying}/ledger',
'trade_fee',
'orders/{underlying}/{order_id}',
'orders/{underlying}/{client_oid}',
// public
'underlying',
'instruments/{underlying}',
'instruments/{underlying}/summary',
'instruments/{underlying}/summary/{instrument_id}',
'instruments/{instrument_id}/book',
'instruments/{instrument_id}/trades',
'instruments/{instrument_id}/ticker',
'instruments/{instrument_id}/candles',
],
'post': [
'order',
'orders',
'cancel_order/{underlying}/{order_id}',
'cancel_order/{underlying}/{client_oid}',
'cancel_batch_orders/{underlying}',
'amend_order/{underlying}',
'amend_batch_orders/{underlying}',
],
},
'information': {
'get': [
'{currency}/long_short_ratio',
'{currency}/volume',
'{currency}/taker',
'{currency}/sentiment',
'{currency}/margin',
],
},
'index': {
'get': [
'{instrument_id}/constituents',
],
},
},
'fees': {
'trading': {
'taker': 0.0015,
'maker': 0.0010,
},
'spot': {
'taker': 0.0015,
'maker': 0.0010,
},
'futures': {
'taker': 0.0005,
'maker': 0.0002,
},
'swap': {
'taker': 0.00075,
'maker': 0.00020,
},
},
'requiredCredentials': {
'apiKey': true,
'secret': true,
'password': true,
},
'exceptions': {
// http error codes
// 400 Bad Request — Invalid request format
// 401 Unauthorized — Invalid API Key
// 403 Forbidden — You do not have access to the requested resource
// 404 Not Found
// 429 Client Error: Too Many Requests for url
// 500 Internal Server Error — We had a problem with our server
'exact': {
'1': ExchangeError, // { "code": 1, "message": "System error" }
// undocumented
'failure to get a peer from the ring-balancer': ExchangeNotAvailable, // { "message": "failure to get a peer from the ring-balancer" }
'Server is busy, please try again.': ExchangeNotAvailable, // { "message": "Server is busy, please try again." }
'An unexpected error occurred': ExchangeError, // { "message": "An unexpected error occurred" }
'System error': ExchangeError, // {"error_message":"System error","message":"System error"}
'4010': PermissionDenied, // { "code": 4010, "message": "For the security of your funds, withdrawals are not permitted within 24 hours after changing fund password / mobile number / Google Authenticator settings " }
// common
// '0': ExchangeError, // 200 successful,when the order placement / cancellation / operation is successful
'4001': ExchangeError, // no data received in 30s
'4002': ExchangeError, // Buffer full. cannot write data
// --------------------------------------------------------
'30001': AuthenticationError, // { "code": 30001, "message": 'request header "OK_ACCESS_KEY" cannot be blank'}
'30002': AuthenticationError, // { "code": 30002, "message": 'request header "OK_ACCESS_SIGN" cannot be blank'}
'30003': AuthenticationError, // { "code": 30003, "message": 'request header "OK_ACCESS_TIMESTAMP" cannot be blank'}
'30004': AuthenticationError, // { "code": 30004, "message": 'request header "OK_ACCESS_PASSPHRASE" cannot be blank'}
'30005': InvalidNonce, // { "code": 30005, "message": "invalid OK_ACCESS_TIMESTAMP" }
'30006': AuthenticationError, // { "code": 30006, "message": "invalid OK_ACCESS_KEY" }
'30007': BadRequest, // { "code": 30007, "message": 'invalid Content_Type, please use "application/json" format'}
'30008': RequestTimeout, // { "code": 30008, "message": "timestamp request expired" }
'30009': ExchangeError, // { "code": 30009, "message": "system error" }
'30010': AuthenticationError, // { "code": 30010, "message": "API validation failed" }
'30011': PermissionDenied, // { "code": 30011, "message": "invalid IP" }
'30012': AuthenticationError, // { "code": 30012, "message": "invalid authorization" }
'30013': AuthenticationError, // { "code": 30013, "message": "invalid sign" }
'30014': DDoSProtection, // { "code": 30014, "message": "request too frequent" }
'30015': AuthenticationError, // { "code": 30015, "message": 'request header "OK_ACCESS_PASSPHRASE" incorrect'}
'30016': ExchangeError, // { "code": 30015, "message": "you are using v1 apiKey, please use v1 endpoint. If you would like to use v3 endpoint, please subscribe to v3 apiKey" }
'30017': ExchangeError, // { "code": 30017, "message": "apikey's broker id does not match" }
'30018': ExchangeError, // { "code": 30018, "message": "apikey's domain does not match" }
'30019': ExchangeNotAvailable, // { "code": 30019, "message": "Api is offline or unavailable" }
'30020': BadRequest, // { "code": 30020, "message": "body cannot be blank" }
'30021': BadRequest, // { "code": 30021, "message": "Json data format error" }, { "code": 30021, "message": "json data format error" }
'30022': PermissionDenied, // { "code": 30022, "message": "Api has been frozen" }
'30023': BadRequest, // { "code": 30023, "message": "{0} parameter cannot be blank" }
'30024': BadSymbol, // {"code":30024,"message":"\"instrument_id\" is an invalid parameter"}
'30025': BadRequest, // { "code": 30025, "message": "{0} parameter category error" }
'30026': DDoSProtection, // { "code": 30026, "message": "requested too frequent" }
'30027': AuthenticationError, // { "code": 30027, "message": "login failure" }
'30028': PermissionDenied, // { "code": 30028, "message": "unauthorized execution" }
'30029': AccountSuspended, // { "code": 30029, "message": "account suspended" }
'30030': ExchangeNotAvailable, // { "code": 30030, "message": "endpoint request failed. Please try again" }
'30031': BadRequest, // { "code": 30031, "message": "token does not exist" }
'30032': BadSymbol, // { "code": 30032, "message": "pair does not exist" }
'30033': BadRequest, // { "code": 30033, "message": "exchange domain does not exist" }
'30034': ExchangeError, // { "code": 30034, "message": "exchange ID does not exist" }
'30035': ExchangeError, // { "code": 30035, "message": "trading is not supported in this website" }
'30036': ExchangeError, // { "code": 30036, "message": "no relevant data" }
'30037': ExchangeNotAvailable, // { "code": 30037, "message": "endpoint is offline or unavailable" }
// '30038': AuthenticationError, // { "code": 30038, "message": "user does not exist" }
'30038': OnMaintenance, // {"client_oid":"","code":"30038","error_code":"30038","error_message":"Matching engine is being upgraded. Please try in about 1 minute.","message":"Matching engine is being upgraded. Please try in about 1 minute.","order_id":"-1","result":false}
'30044': RequestTimeout, // { "code":30044, "message":"Endpoint request timeout" }
// futures
'32001': AccountSuspended, // { "code": 32001, "message": "futures account suspended" }
'32002': PermissionDenied, // { "code": 32002, "message": "futures account does not exist" }
'32003': CancelPending, // { "code": 32003, "message": "canceling, please wait" }
'32004': ExchangeError, // { "code": 32004, "message": "you have no unfilled orders" }
'32005': InvalidOrder, // { "code": 32005, "message": "max order quantity" }
'32006': InvalidOrder, // { "code": 32006, "message": "the order price or trigger price exceeds USD 1 million" }
'32007': InvalidOrder, // { "code": 32007, "message": "leverage level must be the same for orders on the same side of the contract" }
'32008': InvalidOrder, // { "code": 32008, "message": "Max. positions to open (cross margin)" }
'32009': InvalidOrder, // { "code": 32009, "message": "Max. positions to open (fixed margin)" }
'32010': ExchangeError, // { "code": 32010, "message": "leverage cannot be changed with open positions" }
'32011': ExchangeError, // { "code": 32011, "message": "futures status error" }
'32012': ExchangeError, // { "code": 32012, "message": "futures order update error" }
'32013': ExchangeError, // { "code": 32013, "message": "token type is blank" }
'32014': ExchangeError, // { "code": 32014, "message": "your number of contracts closing is larger than the number of contracts available" }
'32015': ExchangeError, // { "code": 32015, "message": "margin ratio is lower than 100% before opening positions" }
'32016': ExchangeError, // { "code": 32016, "message": "margin ratio is lower than 100% after opening position" }
'32017': ExchangeError, // { "code": 32017, "message": "no BBO" }
'32018': ExchangeError, // { "code": 32018, "message": "the order quantity is less than 1, please try again" }
'32019': ExchangeError, // { "code": 32019, "message": "the order price deviates from the price of the previous minute by more than 3%" }
'32020': ExchangeError, // { "code": 32020, "message": "the price is not in the range of the price limit" }
'32021': ExchangeError, // { "code": 32021, "message": "leverage error" }
'32022': ExchangeError, // { "code": 32022, "message": "this function is not supported in your country or region according to the regulations" }
'32023': ExchangeError, // { "code": 32023, "message": "this account has outstanding loan" }
'32024': ExchangeError, // { "code": 32024, "message": "order cannot be placed during delivery" }
'32025': ExchangeError, // { "code": 32025, "message": "order cannot be placed during settlement" }
'32026': ExchangeError, // { "code": 32026, "message": "your account is restricted from opening positions" }
'32027': ExchangeError, // { "code": 32027, "message": "cancelled over 20 orders" }
'32028': ExchangeError, // { "code": 32028, "message": "account is suspended and liquidated" }
'32029': ExchangeError, // { "code": 32029, "message": "order info does not exist" }
'32030': InvalidOrder, // The order cannot be cancelled
'32031': ArgumentsRequired, // client_oid or order_id is required.
'32038': AuthenticationError, // User does not exist
'32040': ExchangeError, // User have open contract orders or position
'32044': ExchangeError, // { "code": 32044, "message": "The margin ratio after submitting this order is lower than the minimum requirement ({0}) for your tier." }
'32045': ExchangeError, // String of commission over 1 million
'32046': ExchangeError, // Each user can hold up to 10 trade plans at the same time
'32047': ExchangeError, // system error
'32048': InvalidOrder, // Order strategy track range error
'32049': ExchangeError, // Each user can hold up to 10 track plans at the same time
'32050': InvalidOrder, // Order strategy rang error
'32051': InvalidOrder, // Order strategy ice depth error
'32052': ExchangeError, // String of commission over 100 thousand
'32053': ExchangeError, // Each user can hold up to 6 ice plans at the same time
'32057': ExchangeError, // The order price is zero. Market-close-all function cannot be executed
'32054': ExchangeError, // Trade not allow
'32055': InvalidOrder, // cancel order error
'32056': ExchangeError, // iceberg per order average should between {0}-{1} contracts
'32058': ExchangeError, // Each user can hold up to 6 initiative plans at the same time
'32059': InvalidOrder, // Total amount should exceed per order amount
'32060': InvalidOrder, // Order strategy type error
'32061': InvalidOrder, // Order strategy initiative limit error
'32062': InvalidOrder, // Order strategy initiative range error
'32063': InvalidOrder, // Order strategy initiative rate error
'32064': ExchangeError, // Time Stringerval of orders should set between 5-120s
'32065': ExchangeError, // Close amount exceeds the limit of Market-close-all (999 for BTC, and 9999 for the rest tokens)
'32066': ExchangeError, // You have open orders. Please cancel all open orders before changing your leverage level.
'32067': ExchangeError, // Account equity < required margin in this setting. Please adjust your leverage level again.
'32068': ExchangeError, // The margin for this position will fall short of the required margin in this setting. Please adjust your leverage level or increase your margin to proceed.
'32069': ExchangeError, // Target leverage level too low. Your account balance is insufficient to cover the margin required. Please adjust the leverage level again.
'32070': ExchangeError, // Please check open position or unfilled order
'32071': ExchangeError, // Your current liquidation mode does not support this action.
'32072': ExchangeError, // The highest available margin for your order’s tier is {0}. Please edit your margin and place a new order.
'32073': ExchangeError, // The action does not apply to the token
'32074': ExchangeError, // The number of contracts of your position, open orders, and the current order has exceeded the maximum order limit of this asset.
'32075': ExchangeError, // Account risk rate breach
'32076': ExchangeError, // Liquidation of the holding position(s) at market price will require cancellation of all pending close orders of the contracts.
'32077': ExchangeError, // Your margin for this asset in futures account is insufficient and the position has been taken over for liquidation. (You will not be able to place orders, close positions, transfer funds, or add margin during this period of time. Your account will be restored after the liquidation is complete.)
'32078': ExchangeError, // Please cancel all open orders before switching the liquidation mode(Please cancel all open orders before switching the liquidation mode)
'32079': ExchangeError, // Your open positions are at high risk.(Please add margin or reduce positions before switching the mode)
'32080': ExchangeError, // Funds cannot be transferred out within 30 minutes after futures settlement
'32083': ExchangeError, // The number of contracts should be a positive multiple of %%. Please place your order again
// token and margin trading
'33001': PermissionDenied, // { "code": 33001, "message": "margin account for this pair is not enabled yet" }
'33002': AccountSuspended, // { "code": 33002, "message": "margin account for this pair is suspended" }
'33003': InsufficientFunds, // { "code": 33003, "message": "no loan balance" }
'33004': ExchangeError, // { "code": 33004, "message": "loan amount cannot be smaller than the minimum limit" }
'33005': ExchangeError, // { "code": 33005, "message": "repayment amount must exceed 0" }
'33006': ExchangeError, // { "code": 33006, "message": "loan order not found" }
'33007': ExchangeError, // { "code": 33007, "message": "status not found" }
'33008': InsufficientFunds, // { "code": 33008, "message": "loan amount cannot exceed the maximum limit" }
'33009': ExchangeError, // { "code": 33009, "message": "user ID is blank" }
'33010': ExchangeError, // { "code": 33010, "message": "you cannot cancel an order during session 2 of call auction" }
'33011': ExchangeError, // { "code": 33011, "message": "no new market data" }
'33012': ExchangeError, // { "code": 33012, "message": "order cancellation failed" }
'33013': InvalidOrder, // { "code": 33013, "message": "order placement failed" }
'33014': OrderNotFound, // { "code": 33014, "message": "order does not exist" }
'33015': InvalidOrder, // { "code": 33015, "message": "exceeded maximum limit" }
'33016': ExchangeError, // { "code": 33016, "message": "margin trading is not open for this token" }
'33017': InsufficientFunds, // { "code": 33017, "message": "insufficient balance" }
'33018': ExchangeError, // { "code": 33018, "message": "this parameter must be smaller than 1" }
'33020': ExchangeError, // { "code": 33020, "message": "request not supported" }
'33021': BadRequest, // { "code": 33021, "message": "token and the pair do not match" }
'33022': InvalidOrder, // { "code": 33022, "message": "pair and the order do not match" }
'33023': ExchangeError, // { "code": 33023, "message": "you can only place market orders during call auction" }
'33024': InvalidOrder, // { "code": 33024, "message": "trading amount too small" }
'33025': InvalidOrder, // { "code": 33025, "message": "base token amount is blank" }
'33026': ExchangeError, // { "code": 33026, "message": "transaction completed" }
'33027': InvalidOrder, // { "code": 33027, "message": "cancelled order or order cancelling" }
'33028': InvalidOrder, // { "code": 33028, "message": "the decimal places of the trading price exceeded the limit" }
'33029': InvalidOrder, // { "code": 33029, "message": "the decimal places of the trading size exceeded the limit" }
'33034': ExchangeError, // { "code": 33034, "message": "You can only place limit order after Call Auction has started" }
'33035': ExchangeError, // This type of order cannot be canceled(This type of order cannot be canceled)
'33036': ExchangeError, // Exceeding the limit of entrust order
'33037': ExchangeError, // The buy order price should be lower than 130% of the trigger price
'33038': ExchangeError, // The sell order price should be higher than 70% of the trigger price
'33039': ExchangeError, // The limit of callback rate is 0 < x <= 5%
'33040': ExchangeError, // The trigger price of a buy order should be lower than the latest transaction price
'33041': ExchangeError, // The trigger price of a sell order should be higher than the latest transaction price
'33042': ExchangeError, // The limit of price variance is 0 < x <= 1%
'33043': ExchangeError, // The total amount must be larger than 0
'33044': ExchangeError, // The average amount should be 1/1000 * total amount <= x <= total amount
'33045': ExchangeError, // The price should not be 0, including trigger price, order price, and price limit
'33046': ExchangeError, // Price variance should be 0 < x <= 1%
'33047': ExchangeError, // Sweep ratio should be 0 < x <= 100%
'33048': ExchangeError, // Per order limit: Total amount/1000 < x <= Total amount
'33049': ExchangeError, // Total amount should be X > 0
'33050': ExchangeError, // Time interval should be 5 <= x <= 120s
'33051': ExchangeError, // cancel order number not higher limit: plan and track entrust no more than 10, ice and time entrust no more than 6
'33059': BadRequest, // { "code": 33059, "message": "client_oid or order_id is required" }
'33060': BadRequest, // { "code": 33060, "message": "Only fill in either parameter client_oid or order_id" }
'33061': ExchangeError, // Value of a single market price order cannot exceed 100,000 USD
'33062': ExchangeError, // The leverage ratio is too high. The borrowed position has exceeded the maximum position of this leverage ratio. Please readjust the leverage ratio
'33063': ExchangeError, // Leverage multiple is too low, there is insufficient margin in the account, please readjust the leverage ratio
'33064': ExchangeError, // The setting of the leverage ratio cannot be less than 2, please readjust the leverage ratio
'33065': ExchangeError, // Leverage ratio exceeds maximum leverage ratio, please readjust leverage ratio
'33085': InvalidOrder, // The value of the position and buying order has reached the position limit, and no further buying is allowed.
// account
'21009': ExchangeError, // Funds cannot be transferred out within 30 minutes after swap settlement(Funds cannot be transferred out within 30 minutes after swap settlement)
'34001': PermissionDenied, // { "code": 34001, "message": "withdrawal suspended" }
'34002': InvalidAddress, // { "code": 34002, "message": "please add a withdrawal address" }
'34003': ExchangeError, // { "code": 34003, "message": "sorry, this token cannot be withdrawn to xx at the moment" }
'34004': ExchangeError, // { "code": 34004, "message": "withdrawal fee is smaller than minimum limit" }
'34005': ExchangeError, // { "code": 34005, "message": "withdrawal fee exceeds the maximum limit" }
'34006': ExchangeError, // { "code": 34006, "message": "withdrawal amount is lower than the minimum limit" }
'34007': ExchangeError, // { "code": 34007, "message": "withdrawal amount exceeds the maximum limit" }
'34008': InsufficientFunds, // { "code": 34008, "message": "insufficient balance" }
'34009': ExchangeError, // { "code": 34009, "message": "your withdrawal amount exceeds the daily limit" }
'34010': ExchangeError, // { "code": 34010, "message": "transfer amount must be larger than 0" }
'34011': ExchangeError, // { "code": 34011, "message": "conditions not met" }
'34012': ExchangeError, // { "code": 34012, "message": "the minimum withdrawal amount for NEO is 1, and the amount must be an integer" }
'34013': ExchangeError, // { "code": 34013, "message": "please transfer" }
'34014': ExchangeError, // { "code": 34014, "message": "transfer limited" }
'34015': ExchangeError, // { "code": 34015, "message": "subaccount does not exist" }
'34016': PermissionDenied, // { "code": 34016, "message": "transfer suspended" }
'34017': AccountSuspended, // { "code": 34017, "message": "account suspended" }
'34018': AuthenticationError, // { "code": 34018, "message": "incorrect trades password" }
'34019': PermissionDenied, // { "code": 34019, "message": "please bind your email before withdrawal" }
'34020': PermissionDenied, // { "code": 34020, "message": "please bind your funds password before withdrawal" }
'34021': InvalidAddress, // { "code": 34021, "message": "Not verified address" }
'34022': ExchangeError, // { "code": 34022, "message": "Withdrawals are not available for sub accounts" }
'34023': PermissionDenied, // { "code": 34023, "message": "Please enable futures trading before transferring your funds" }
'34026': RateLimitExceeded, // transfer too frequently(transfer too frequently)
'34036': ExchangeError, // Parameter is incorrect, please refer to API documentation
'34037': ExchangeError, // Get the sub-account balance interface, account type is not supported
'34038': ExchangeError, // Since your C2C transaction is unusual, you are restricted from fund transfer. Please contact our customer support to cancel the restriction
'34039': ExchangeError, // You are now restricted from transferring out your funds due to abnormal trades on C2C Market. Please transfer your fund on our website or app instead to verify your identity
// swap
'35001': ExchangeError, // { "code": 35001, "message": "Contract does not exist" }
'35002': ExchangeError, // { "code": 35002, "message": "Contract settling" }
'35003': ExchangeError, // { "code": 35003, "message": "Contract paused" }
'35004': ExchangeError, // { "code": 35004, "message": "Contract pending settlement" }
'35005': AuthenticationError, // { "code": 35005, "message": "User does not exist" }
'35008': InvalidOrder, // { "code": 35008, "message": "Risk ratio too high" }
'35010': InvalidOrder, // { "code": 35010, "message": "Position closing too large" }
'35012': InvalidOrder, // { "code": 35012, "message": "Incorrect order size" }
'35014': InvalidOrder, // { "code": 35014, "message": "Order price is not within limit" }
'35015': InvalidOrder, // { "code": 35015, "message": "Invalid leverage level" }
'35017': ExchangeError, // { "code": 35017, "message": "Open orders exist" }
'35019': InvalidOrder, // { "code": 35019, "message": "Order size too large" }
'35020': InvalidOrder, // { "code": 35020, "message": "Order price too high" }
'35021': InvalidOrder, // { "code": 35021, "message": "Order size exceeded current tier limit" }
'35022': BadRequest, // { "code": 35022, "message": "Contract status error" }
'35024': BadRequest, // { "code": 35024, "message": "Contract not initialized" }
'35025': InsufficientFunds, // { "code": 35025, "message": "No account balance" }
'35026': BadRequest, // { "code": 35026, "message": "Contract settings not initialized" }
'35029': OrderNotFound, // { "code": 35029, "message": "Order does not exist" }
'35030': InvalidOrder, // { "code": 35030, "message": "Order size too large" }
'35031': InvalidOrder, // { "code": 35031, "message": "Cancel order size too large" }
'35032': ExchangeError, // { "code": 35032, "message": "Invalid user status" }
'35037': ExchangeError, // No last traded price in cache
'35039': InsufficientFunds, // { "code": 35039, "message": "Open order quantity exceeds limit" }
'35040': InvalidOrder, // {"error_message":"Invalid order type","result":"true","error_code":"35040","order_id":"-1"}
'35044': ExchangeError, // { "code": 35044, "message": "Invalid order status" }
'35046': InsufficientFunds, // { "code": 35046, "message": "Negative account balance" }
'35047': InsufficientFunds, // { "code": 35047, "message": "Insufficient account balance" }
'35048': ExchangeError, // { "code": 35048, "message": "User contract is frozen and liquidating" }
'35049': InvalidOrder, // { "code": 35049, "message": "Invalid order type" }
'35050': InvalidOrder, // { "code": 35050, "message": "Position settings are blank" }
'35052': InsufficientFunds, // { "code": 35052, "message": "Insufficient cross margin" }
'35053': ExchangeError, // { "code": 35053, "message": "Account risk too high" }
'35055': InsufficientFunds, // { "code": 35055, "message": "Insufficient account balance" }
'35057': ExchangeError, // { "code": 35057, "message": "No last traded price" }
'35058': ExchangeError, // { "code": 35058, "message": "No limit" }
'35059': BadRequest, // { "code": 35059, "message": "client_oid or order_id is required" }
'35060': BadRequest, // { "code": 35060, "message": "Only fill in either parameter client_oid or order_id" }
'35061': BadRequest, // { "code": 35061, "message": "Invalid instrument_id" }
'35062': InvalidOrder, // { "code": 35062, "message": "Invalid match_price" }
'35063': InvalidOrder, // { "code": 35063, "message": "Invalid order_size" }
'35064': InvalidOrder, // { "code": 35064, "message": "Invalid client_oid" }
'35066': InvalidOrder, // Order interval error
'35067': InvalidOrder, // Time-weighted order ratio error
'35068': InvalidOrder, // Time-weighted order range error
'35069': InvalidOrder, // Time-weighted single transaction limit error
'35070': InvalidOrder, // Algo order type error
'35071': InvalidOrder, // Order total must be larger than single order limit
'35072': InvalidOrder, // Maximum 6 unfulfilled time-weighted orders can be held at the same time
'35073': InvalidOrder, // Order price is 0. Market-close-all not available
'35074': InvalidOrder, // Iceberg order single transaction average error
'35075': InvalidOrder, // Failed to cancel order
'35076': InvalidOrder, // LTC 20x leverage. Not allowed to open position
'35077': InvalidOrder, // Maximum 6 unfulfilled iceberg orders can be held at the same time
'35078': InvalidOrder, // Order amount exceeded 100,000
'35079': InvalidOrder, // Iceberg order price variance error
'35080': InvalidOrder, // Callback rate error
'35081': InvalidOrder, // Maximum 10 unfulfilled trail orders can be held at the same time
'35082': InvalidOrder, // Trail order callback rate error
'35083': InvalidOrder, // Each user can only hold a maximum of 10 unfulfilled stop-limit orders at the same time
'35084': InvalidOrder, // Order amount exceeded 1 million
'35085': InvalidOrder, // Order amount is not in the correct range
'35086': InvalidOrder, // Price exceeds 100 thousand
'35087': InvalidOrder, // Price exceeds 100 thousand
'35088': InvalidOrder, // Average amount error
'35089': InvalidOrder, // Price exceeds 100 thousand
'35090': ExchangeError, // No stop-limit orders available for cancelation
'35091': ExchangeError, // No trail orders available for cancellation
'35092': ExchangeError, // No iceberg orders available for cancellation
'35093': ExchangeError, // No trail orders available for cancellation
'35094': ExchangeError, // Stop-limit order last traded price error
'35095': BadRequest, // Instrument_id error
'35096': ExchangeError, // Algo order status error
'35097': ExchangeError, // Order status and order ID cannot exist at the same time
'35098': ExchangeError, // An order status or order ID must exist
'35099': ExchangeError, // Algo order ID error
'35102': RateLimitExceeded, // {"error_message":"The operation that close all at market price is too frequent","result":"true","error_code":"35102","order_id":"-1"}
// option
'36001': BadRequest, // Invalid underlying index.
'36002': BadRequest, // Instrument does not exist.
'36005': ExchangeError, // Instrument status is invalid.
'36101': AuthenticationError, // Account does not exist.
'36102': PermissionDenied, // Account status is invalid.
'36103': PermissionDenied, // Account is suspended due to ongoing liquidation.
'36104': PermissionDenied, // Account is not enabled for options trading.
'36105': PermissionDenied, // Please enable the account for option contract.
'36106': PermissionDenied, // Funds cannot be transferred in or out, as account is suspended.
'36107': PermissionDenied, // Funds cannot be transferred out within 30 minutes after option exercising or settlement.
'36108': InsufficientFunds, // Funds cannot be transferred in or out, as equity of the account is less than zero.
'36109': PermissionDenied, // Funds cannot be transferred in or out during option exercising or settlement.
'36201': PermissionDenied, // New order function is blocked.
'36202': PermissionDenied, // Account does not have permission to short option.
'36203': InvalidOrder, // Invalid format for client_oid.
'36204': ExchangeError, // Invalid format for request_id.
'36205': BadRequest, // Instrument id does not match underlying index.
'36206': BadRequest, // Order_id and client_oid can not be used at the same time.
'36207': InvalidOrder, // Either order price or fartouch price must be present.
'36208': InvalidOrder, // Either order price or size must be present.
'36209': InvalidOrder, // Either order_id or client_oid must be present.
'36210': InvalidOrder, // Either order_ids or client_oids must be present.
'36211': InvalidOrder, // Exceeding max batch size for order submission.
'36212': InvalidOrder, // Exceeding max batch size for oder cancellation.
'36213': InvalidOrder, // Exceeding max batch size for order amendment.
'36214': ExchangeError, // Instrument does not have valid bid/ask quote.
'36216': OrderNotFound, // Order does not exist.
'36217': InvalidOrder, // Order submission failed.
'36218': InvalidOrder, // Order cancellation failed.
'36219': InvalidOrder, // Order amendment failed.
'36220': InvalidOrder, // Order is pending cancel.
'36221': InvalidOrder, // Order qty is not valid multiple of lot size.
'36222': InvalidOrder, // Order price is breaching highest buy limit.
'36223': InvalidOrder, // Order price is breaching lowest sell limit.
'36224': InvalidOrder, // Exceeding max order size.
'36225': InvalidOrder, // Exceeding max open order count for instrument.
'36226': InvalidOrder, // Exceeding max open order count for underlying.
'36227': InvalidOrder, // Exceeding max open size across all orders for underlying
'36228': InvalidOrder, // Exceeding max available qty for instrument.
'36229': InvalidOrder, // Exceeding max available qty for underlying.
'36230': InvalidOrder, // Exceeding max position limit for underlying.
},
'broad': {
},
},
'precisionMode': TICK_SIZE,
'options': {
'fetchOHLCV': {
'type': 'Candles', // Candles or HistoryCandles
},
'createMarketBuyOrderRequiresPrice': true,
'fetchMarkets': [ 'spot', 'futures', 'swap', 'option' ],
'defaultType': 'spot', // 'account', 'spot', 'margin', 'futures', 'swap', 'option'
'auth': {
'time': 'public',
'currencies': 'private',
'instruments': 'public',
'rate': 'public',
'{instrument_id}/constituents': 'public',
},
},
'commonCurrencies': {
// OKEX refers to ERC20 version of Aeternity (AEToken)
'AE': 'AET', // https://github.com/ccxt/ccxt/issues/4981
'BOX': 'DefiBox',
'HOT': 'Hydro Protocol',
'HSR': 'HC',
'MAG': 'Maggie',
'SBTC': 'Super Bitcoin',
'TRADE': 'Unitrade',
'YOYO': 'YOYOW',
'WIN': 'WinToken', // https://github.com/ccxt/ccxt/issues/5701
},
});
}
async fetchTime (params = {}) {
const response = await this.generalGetTime (params);
//
// {
// "iso": "2015-01-07T23:47:25.201Z",
// "epoch": 1420674445.201
// }
//
return this.parse8601 (this.safeString (response, 'iso'));
}
async fetchMarkets (params = {}) {
const types = this.safeValue (this.options, 'fetchMarkets');
let result = [];
for (let i = 0; i < types.length; i++) {
const markets = await this.fetchMarketsByType (types[i], params);
result = this.arrayConcat (result, markets);
}
return result;
}
parseMarkets (markets) {
const result = [];
for (let i = 0; i < markets.length; i++) {
result.push (this.parseMarket (markets[i]));
}
return result;
}
parseMarket (market) {
//
// spot markets
//
// {
// base_currency: "EOS",
// instrument_id: "EOS-OKB",
// min_size: "0.01",
// quote_currency: "OKB",
// size_increment: "0.000001",
// tick_size: "0.0001"
// }
//
// futures markets
//
// {
// instrument_id: "XRP-USD-200320",
// underlying_index: "XRP",
// quote_currency: "USD",
// tick_size: "0.0001",
// contract_val: "10",
// listing: "2020-03-06",
// delivery: "2020-03-20",
// trade_increment: "1",
// alias: "this_week",
// underlying: "XRP-USD",
// base_currency: "XRP",
// settlement_currency: "XRP",
// is_inverse: "true",
// contract_val_currency: "USD",
// }
//
// swap markets
//
// {
// instrument_id: "BSV-USD-SWAP",
// underlying_index: "BSV",
// quote_currency: "USD",
// coin: "BSV",
// contract_val: "10",
// listing: "2018-12-21T07:53:47.000Z",
// delivery: "2020-03-14T08:00:00.000Z",
// size_increment: "1",
// tick_size: "0.01",
// base_currency: "BSV",
// underlying: "BSV-USD",
// settlement_currency: "BSV",
// is_inverse: "true",
// contract_val_currency: "USD"
// }
//
// options markets
//
// {
// instrument_id: 'BTC-USD-200327-4000-C',
// underlying: 'BTC-USD',
// settlement_currency: 'BTC',
// contract_val: '0.1000',
// option_type: 'C',
// strike: '4000',
// tick_size: '0.0005',
// lot_size: '1.0000',
// listing: '2019-12-25T08:30:36.302Z',
// delivery: '2020-03-27T08:00:00.000Z',
// state: '2',
// trading_start_time: '2019-12-25T08:30:36.302Z',
// timestamp: '2020-03-13T08:05:09.456Z',
// }
//
const id = this.safeString (market, 'instrument_id');
let marketType = 'spot';
let spot = true;
let future = false;
let swap = false;
let option = false;
let baseId = this.safeString (market, 'base_currency');
let quoteId = this.safeString (market, 'quote_currency');
const contractVal = this.safeNumber (market, 'contract_val');
if (contractVal !== undefined) {
if ('option_type' in market) {
marketType = 'option';
spot = false;
option = true;
const underlying = this.safeString (market, 'underlying');
const parts = underlying.split ('-');
baseId = this.safeString (parts, 0);
quoteId = this.safeString (parts, 1);
} else {
marketType = 'swap';
spot = false;
swap = true;
const futuresAlias = this.safeString (market, 'alias');
if (futuresAlias !== undefined) {
swap = false;
future = true;
marketType = 'futures';
baseId = this.safeString (market, 'underlying_index');
}
}
}
const base = this.safeCurrencyCode (baseId);
const quote = this.safeCurrencyCode (quoteId);
const symbol = spot ? (base + '/' + quote) : id;
const lotSize = this.safeNumber2 (market, 'lot_size', 'trade_increment');
const minPrice = this.safeString (market, 'tick_size');
const precision = {
'amount': this.safeNumber (market, 'size_increment', lotSize),
'price': this.parseNumber (minPrice),
};
const minAmountString = this.safeString2 (market, 'min_size', 'base_min_size');
const minAmount = this.parseNumber (minAmountString);
let minCost = undefined;
if ((minAmount !== undefined) && (minPrice !== undefined)) {
minCost = this.parseNumber (Precise.stringMul (minPrice, minAmountString));
}
const active = true;
const fees = this.safeValue2 (this.fees, marketType, 'trading', {});
return this.extend (fees, {
'id': id,
'symbol': symbol,
'base': base,
'quote': quote,
'baseId': baseId,
'quoteId': quoteId,
'info': market,
'type': marketType,
'spot': spot,
'futures': future,
'swap': swap,
'option': option,
'active': active,
'precision': precision,
'limits': {
'amount': {
'min': minAmount,
'max': undefined,
},
'price': {
'min': precision['price'],
'max': undefined,
},
'cost': {
'min': minCost,
'max': undefined,
},
},
});
}
async fetchMarketsByType (type, params = {}) {
if (type === 'option') {
const underlying = await this.optionGetUnderlying (params);
let result = [];
for (let i = 0; i < underlying.length; i++) {
const response = await this.optionGetInstrumentsUnderlying ({
'underlying': underlying[i],
});
//
// options markets
//
// [
// {
// instrument_id: 'BTC-USD-200327-4000-C',
// underlying: 'BTC-USD',
// settlement_currency: 'BTC',
// contract_val: '0.1000',
// option_type: 'C',
// strike: '4000',
// tick_size: '0.0005',
// lot_size: '1.0000',
// listing: '2019-12-25T08:30:36.302Z',
// delivery: '2020-03-27T08:00:00.000Z',
// state: '2',
// trading_start_time: '2019-12-25T08:30:36.302Z',
// timestamp: '2020-03-13T08:05:09.456Z',
// },
// ]
//
result = this.arrayConcat (result, response);
}
return this.parseMarkets (result);
} else if ((type === 'spot') || (type === 'futures') || (type === 'swap')) {
const method = type + 'GetInstruments';
const response = await this[method] (params);
//
// spot markets
//
// [
// {
// base_currency: "EOS",
// instrument_id: "EOS-OKB",
// min_size: "0.01",
// quote_currency: "OKB",
// size_increment: "0.000001",
// tick_size: "0.0001"
// }
// ]
//
// futures markets
//
// [
// {
// instrument_id: "XRP-USD-200320",
// underlying_index: "XRP",
// quote_currency: "USD",
// tick_size: "0.0001",
// contract_val: "10",
// listing: "2020-03-06",
// delivery: "2020-03-20",
// trade_increment: "1",
// alias: "this_week",
// underlying: "XRP-USD",
// base_currency: "XRP",
// settlement_currency: "XRP",
// is_inverse: "true",
// contract_val_currency: "USD",
// }
// ]
//
// swap markets
//
// [
// {
// instrument_id: "BSV-USD-SWAP",
// underlying_index: "BSV",
// quote_currency: "USD",
// coin: "BSV",
// contract_val: "10",
// listing: "2018-12-21T07:53:47.000Z",
// delivery: "2020-03-14T08:00:00.000Z",
// size_increment: "1",
// tick_size: "0.01",
// base_currency: "BSV",
// underlying: "BSV-USD",
// settlement_currency: "BSV",
// is_inverse: "true",
// contract_val_currency: "USD"
// }
// ]
//
return this.parseMarkets (response);
} else {
throw new NotSupported (this.id + ' fetchMarketsByType does not support market type ' + type);
}
}
async fetchCurrencies (params = {}) {
// has['fetchCurrencies'] is currently set to false
// despite that their docs say these endpoints are public:
// https://www.okex.com/api/account/v3/withdrawal/fee
// https://www.okex.com/api/account/v3/currencies
// it will still reply with { "code":30001, "message": "OK-ACCESS-KEY header is required" }
// if you attempt to access it without authentication
const response = await this.accountGetCurrencies (params);
//
// [
// {
// name: '',
// currency: 'BTC',
// can_withdraw: '1',
// can_deposit: '1',
// min_withdrawal: '0.0100000000000000'
// },
// ]
//
const result = {};