gate-io-api 0.0.65__py3-none-any.whl → 0.0.100__py3-none-any.whl
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.
Potentially problematic release.
This version of gate-io-api might be problematic. Click here for more details.
- gate/ccxt/__init__.py +2 -1
- gate/ccxt/abstract/gate.py +62 -18
- gate/ccxt/async_support/__init__.py +2 -1
- gate/ccxt/async_support/base/exchange.py +165 -27
- gate/ccxt/async_support/base/throttler.py +1 -1
- gate/ccxt/async_support/base/ws/client.py +194 -64
- gate/ccxt/async_support/base/ws/future.py +27 -50
- gate/ccxt/async_support/gate.py +356 -253
- gate/ccxt/base/decimal_to_precision.py +14 -10
- gate/ccxt/base/errors.py +6 -0
- gate/ccxt/base/exchange.py +606 -119
- gate/ccxt/base/types.py +4 -0
- gate/ccxt/gate.py +356 -253
- gate/ccxt/pro/__init__.py +2 -89
- gate/ccxt/pro/gate.py +14 -7
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/METADATA +70 -25
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/RECORD +18 -19
- gate/ccxt/async_support/base/ws/aiohttp_client.py +0 -147
- {gate_io_api-0.0.65.dist-info → gate_io_api-0.0.100.dist-info}/WHEEL +0 -0
gate/ccxt/gate.py
CHANGED
|
@@ -32,7 +32,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
32
32
|
def describe(self) -> Any:
|
|
33
33
|
return self.deep_extend(super(gate, self).describe(), {
|
|
34
34
|
'id': 'gate',
|
|
35
|
-
'name': 'Gate
|
|
35
|
+
'name': 'Gate',
|
|
36
36
|
'countries': ['KR'],
|
|
37
37
|
'rateLimit': 50, # 200 requests per 10 second or 50ms
|
|
38
38
|
'version': 'v4',
|
|
@@ -40,8 +40,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
40
40
|
'pro': True,
|
|
41
41
|
'urls': {
|
|
42
42
|
'logo': 'https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85',
|
|
43
|
-
'doc': 'https://www.gate.
|
|
44
|
-
'www': 'https://gate.
|
|
43
|
+
'doc': 'https://www.gate.com/docs/developers/apiv4/en/',
|
|
44
|
+
'www': 'https://gate.com',
|
|
45
45
|
'api': {
|
|
46
46
|
'public': {
|
|
47
47
|
'wallet': 'https://api.gateio.ws/api/v4',
|
|
@@ -71,18 +71,28 @@ class gate(Exchange, ImplicitAPI):
|
|
|
71
71
|
},
|
|
72
72
|
'test': {
|
|
73
73
|
'public': {
|
|
74
|
-
'futures': 'https://
|
|
75
|
-
'delivery': 'https://
|
|
76
|
-
'options': 'https://
|
|
74
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
75
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
76
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
77
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
78
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
79
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
80
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
81
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
77
82
|
},
|
|
78
83
|
'private': {
|
|
79
|
-
'futures': 'https://
|
|
80
|
-
'delivery': 'https://
|
|
81
|
-
'options': 'https://
|
|
84
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
85
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
86
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
87
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
88
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
89
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
90
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
91
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
82
92
|
},
|
|
83
93
|
},
|
|
84
94
|
'referral': {
|
|
85
|
-
'url': 'https://www.gate.
|
|
95
|
+
'url': 'https://www.gate.com/share/CCXTGATE',
|
|
86
96
|
'discount': 0.2,
|
|
87
97
|
},
|
|
88
98
|
},
|
|
@@ -125,7 +135,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
125
135
|
'fetchCurrencies': True,
|
|
126
136
|
'fetchDepositAddress': True,
|
|
127
137
|
'fetchDepositAddresses': False,
|
|
128
|
-
'fetchDepositAddressesByNetwork':
|
|
138
|
+
'fetchDepositAddressesByNetwork': True,
|
|
129
139
|
'fetchDeposits': True,
|
|
130
140
|
'fetchDepositWithdrawFee': 'emulated',
|
|
131
141
|
'fetchDepositWithdrawFees': True,
|
|
@@ -195,6 +205,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
195
205
|
'currency_chains': 1,
|
|
196
206
|
},
|
|
197
207
|
},
|
|
208
|
+
'unified': {
|
|
209
|
+
'get': {
|
|
210
|
+
'currencies': 1,
|
|
211
|
+
'history_loan_rate': 1,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
198
214
|
'spot': {
|
|
199
215
|
'get': {
|
|
200
216
|
'currencies': 1,
|
|
@@ -206,22 +222,25 @@ class gate(Exchange, ImplicitAPI):
|
|
|
206
222
|
'trades': 1,
|
|
207
223
|
'candlesticks': 1,
|
|
208
224
|
'time': 1,
|
|
225
|
+
'insurance_history': 1,
|
|
209
226
|
},
|
|
210
227
|
},
|
|
211
228
|
'margin': {
|
|
212
229
|
'get': {
|
|
213
|
-
'currency_pairs': 1,
|
|
214
|
-
'currency_pairs/{currency_pair}': 1,
|
|
215
|
-
'funding_book': 1,
|
|
216
|
-
'cross/currencies': 1,
|
|
217
|
-
'cross/currencies/{currency}': 1,
|
|
218
230
|
'uni/currency_pairs': 1,
|
|
219
231
|
'uni/currency_pairs/{currency_pair}': 1,
|
|
232
|
+
'loan_margin_tiers': 1,
|
|
233
|
+
'currency_pairs': 1, # deprecated
|
|
234
|
+
'currency_pairs/{currency_pair}': 1, # deprecated
|
|
235
|
+
'funding_book': 1, # deprecated
|
|
236
|
+
'cross/currencies': 1, # deprecated
|
|
237
|
+
'cross/currencies/{currency}': 1, # deprecated
|
|
220
238
|
},
|
|
221
239
|
},
|
|
222
240
|
'flash_swap': {
|
|
223
241
|
'get': {
|
|
224
|
-
'
|
|
242
|
+
'currency_pairs': 1,
|
|
243
|
+
'currencies': 1, # deprecated
|
|
225
244
|
},
|
|
226
245
|
},
|
|
227
246
|
'futures': {
|
|
@@ -250,6 +269,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
250
269
|
'{settle}/candlesticks': 1,
|
|
251
270
|
'{settle}/tickers': 1,
|
|
252
271
|
'{settle}/insurance': 1,
|
|
272
|
+
'{settle}/risk_limit_tiers': 1,
|
|
253
273
|
},
|
|
254
274
|
},
|
|
255
275
|
'options': {
|
|
@@ -272,6 +292,17 @@ class gate(Exchange, ImplicitAPI):
|
|
|
272
292
|
'get': {
|
|
273
293
|
'uni/currencies': 1,
|
|
274
294
|
'uni/currencies/{currency}': 1,
|
|
295
|
+
'dual/investment_plan': 1,
|
|
296
|
+
'structured/products': 1,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
'loan': {
|
|
300
|
+
'get': {
|
|
301
|
+
'collateral/currencies': 1,
|
|
302
|
+
'multi_collateral/currencies': 1,
|
|
303
|
+
'multi_collateral/ltv': 1,
|
|
304
|
+
'multi_collateral/fixed_rate': 1,
|
|
305
|
+
'multi_collateral/current_rate': 1,
|
|
275
306
|
},
|
|
276
307
|
},
|
|
277
308
|
},
|
|
@@ -335,25 +366,28 @@ class gate(Exchange, ImplicitAPI):
|
|
|
335
366
|
'unified': {
|
|
336
367
|
'get': {
|
|
337
368
|
'accounts': 20 / 15,
|
|
338
|
-
'account_mode': 20 / 15,
|
|
339
369
|
'borrowable': 20 / 15,
|
|
340
370
|
'transferable': 20 / 15,
|
|
371
|
+
'transferables': 20 / 15,
|
|
372
|
+
'batch_borrowable': 20 / 15,
|
|
341
373
|
'loans': 20 / 15,
|
|
342
374
|
'loan_records': 20 / 15,
|
|
343
375
|
'interest_records': 20 / 15,
|
|
344
|
-
'estimate_rate': 20 / 15,
|
|
345
|
-
'currency_discount_tiers': 20 / 15,
|
|
346
376
|
'risk_units': 20 / 15,
|
|
347
377
|
'unified_mode': 20 / 15,
|
|
378
|
+
'estimate_rate': 20 / 15,
|
|
379
|
+
'currency_discount_tiers': 20 / 15,
|
|
348
380
|
'loan_margin_tiers': 20 / 15,
|
|
349
381
|
'leverage/user_currency_config': 20 / 15,
|
|
350
382
|
'leverage/user_currency_setting': 20 / 15,
|
|
383
|
+
'account_mode': 20 / 15, # deprecated
|
|
351
384
|
},
|
|
352
385
|
'post': {
|
|
353
|
-
'account_mode': 20 / 15,
|
|
354
386
|
'loans': 200 / 15, # 15r/10s cost = 20 / 1.5 = 13.33
|
|
355
387
|
'portfolio_calculator': 20 / 15,
|
|
356
388
|
'leverage/user_currency_setting': 20 / 15,
|
|
389
|
+
'collateral_currencies': 20 / 15,
|
|
390
|
+
'account_mode': 20 / 15, # deprecated
|
|
357
391
|
},
|
|
358
392
|
'put': {
|
|
359
393
|
'unified_mode': 20 / 15,
|
|
@@ -399,48 +433,49 @@ class gate(Exchange, ImplicitAPI):
|
|
|
399
433
|
'funding_accounts': 20 / 15,
|
|
400
434
|
'auto_repay': 20 / 15,
|
|
401
435
|
'transferable': 20 / 15,
|
|
402
|
-
'loans': 20 / 15,
|
|
403
|
-
'loans/{loan_id}': 20 / 15,
|
|
404
|
-
'loans/{loan_id}/repayment': 20 / 15,
|
|
405
|
-
'loan_records': 20 / 15,
|
|
406
|
-
'loan_records/{loan_record_id}': 20 / 15,
|
|
407
|
-
'borrowable': 20 / 15,
|
|
408
|
-
'cross/accounts': 20 / 15,
|
|
409
|
-
'cross/account_book': 20 / 15,
|
|
410
|
-
'cross/loans': 20 / 15,
|
|
411
|
-
'cross/loans/{loan_id}': 20 / 15,
|
|
412
|
-
'cross/repayments': 20 / 15,
|
|
413
|
-
'cross/interest_records': 20 / 15,
|
|
414
|
-
'cross/transferable': 20 / 15,
|
|
415
|
-
'cross/estimate_rate': 20 / 15,
|
|
416
|
-
'cross/borrowable': 20 / 15,
|
|
417
436
|
'uni/estimate_rate': 20 / 15,
|
|
418
437
|
'uni/loans': 20 / 15,
|
|
419
438
|
'uni/loan_records': 20 / 15,
|
|
420
439
|
'uni/interest_records': 20 / 15,
|
|
421
440
|
'uni/borrowable': 20 / 15,
|
|
441
|
+
'user/loan_margin_tiers': 20 / 15,
|
|
442
|
+
'user/account': 20 / 15,
|
|
443
|
+
'loans': 20 / 15, # deprecated
|
|
444
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
445
|
+
'loans/{loan_id}/repayment': 20 / 15, # deprecated
|
|
446
|
+
'loan_records': 20 / 15, # deprecated
|
|
447
|
+
'loan_records/{loan_record_id}': 20 / 15, # deprecated
|
|
448
|
+
'borrowable': 20 / 15, # deprecated
|
|
449
|
+
'cross/accounts': 20 / 15, # deprecated
|
|
450
|
+
'cross/account_book': 20 / 15, # deprecated
|
|
451
|
+
'cross/loans': 20 / 15, # deprecated
|
|
452
|
+
'cross/loans/{loan_id}': 20 / 15, # deprecated
|
|
453
|
+
'cross/repayments': 20 / 15, # deprecated
|
|
454
|
+
'cross/interest_records': 20 / 15, # deprecated
|
|
455
|
+
'cross/transferable': 20 / 15, # deprecated
|
|
456
|
+
'cross/estimate_rate': 20 / 15, # deprecated
|
|
457
|
+
'cross/borrowable': 20 / 15, # deprecated
|
|
422
458
|
},
|
|
423
459
|
'post': {
|
|
424
460
|
'auto_repay': 20 / 15,
|
|
425
|
-
'loans': 20 / 15,
|
|
426
|
-
'merged_loans': 20 / 15,
|
|
427
|
-
'loans/{loan_id}/repayment': 20 / 15,
|
|
428
|
-
'cross/loans': 20 / 15,
|
|
429
|
-
'cross/repayments': 20 / 15,
|
|
430
461
|
'uni/loans': 20 / 15,
|
|
462
|
+
'leverage/user_market_setting': 20 / 15,
|
|
463
|
+
'loans': 20 / 15, # deprecated
|
|
464
|
+
'merged_loans': 20 / 15, # deprecated
|
|
465
|
+
'loans/{loan_id}/repayment': 20 / 15, # deprecated
|
|
466
|
+
'cross/loans': 20 / 15, # deprecated
|
|
467
|
+
'cross/repayments': 20 / 15, # deprecated
|
|
431
468
|
},
|
|
432
469
|
'patch': {
|
|
433
|
-
'loans/{loan_id}': 20 / 15,
|
|
434
|
-
'loan_records/{loan_record_id}': 20 / 15,
|
|
470
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
471
|
+
'loan_records/{loan_record_id}': 20 / 15, # deprecated
|
|
435
472
|
},
|
|
436
473
|
'delete': {
|
|
437
|
-
'loans/{loan_id}': 20 / 15,
|
|
474
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
438
475
|
},
|
|
439
476
|
},
|
|
440
477
|
'flash_swap': {
|
|
441
478
|
'get': {
|
|
442
|
-
'currencies': 1,
|
|
443
|
-
'currency_pairs': 1,
|
|
444
479
|
'orders': 1,
|
|
445
480
|
'orders/{order_id}': 1,
|
|
446
481
|
},
|
|
@@ -465,7 +500,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
465
500
|
'{settle}/liquidates': 1,
|
|
466
501
|
'{settle}/auto_deleverages': 1,
|
|
467
502
|
'{settle}/fee': 1,
|
|
468
|
-
'{settle}/
|
|
503
|
+
'{settle}/risk_limit_table': 1,
|
|
469
504
|
'{settle}/price_orders': 1,
|
|
470
505
|
'{settle}/price_orders/{order_id}': 1,
|
|
471
506
|
},
|
|
@@ -473,6 +508,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
473
508
|
'{settle}/positions/{contract}/margin': 1,
|
|
474
509
|
'{settle}/positions/{contract}/leverage': 1,
|
|
475
510
|
'{settle}/positions/{contract}/risk_limit': 1,
|
|
511
|
+
'{settle}/positions/cross_mode': 1,
|
|
512
|
+
'{settle}/dual_comp/positions/cross_mode': 1,
|
|
476
513
|
'{settle}/dual_mode': 1,
|
|
477
514
|
'{settle}/dual_comp/positions/{contract}/margin': 1,
|
|
478
515
|
'{settle}/dual_comp/positions/{contract}/leverage': 1,
|
|
@@ -481,6 +518,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
481
518
|
'{settle}/batch_orders': 0.4,
|
|
482
519
|
'{settle}/countdown_cancel_all': 0.4,
|
|
483
520
|
'{settle}/batch_cancel_orders': 0.4,
|
|
521
|
+
'{settle}/batch_amend_orders': 0.4,
|
|
522
|
+
'{settle}/bbo_orders': 0.4,
|
|
484
523
|
'{settle}/price_orders': 0.4,
|
|
485
524
|
},
|
|
486
525
|
'put': {
|
|
@@ -548,19 +587,32 @@ class gate(Exchange, ImplicitAPI):
|
|
|
548
587
|
},
|
|
549
588
|
'earn': {
|
|
550
589
|
'get': {
|
|
551
|
-
'uni/currencies': 20 / 15,
|
|
552
|
-
'uni/currencies/{currency}': 20 / 15,
|
|
553
590
|
'uni/lends': 20 / 15,
|
|
554
591
|
'uni/lend_records': 20 / 15,
|
|
555
592
|
'uni/interests/{currency}': 20 / 15,
|
|
556
593
|
'uni/interest_records': 20 / 15,
|
|
557
594
|
'uni/interest_status/{currency}': 20 / 15,
|
|
595
|
+
'uni/chart': 20 / 15,
|
|
596
|
+
'uni/rate': 20 / 15,
|
|
597
|
+
'staking/eth2/rate_records': 20 / 15,
|
|
598
|
+
'dual/orders': 20 / 15,
|
|
599
|
+
'structured/orders': 20 / 15,
|
|
600
|
+
'staking/coins': 20 / 15,
|
|
601
|
+
'staking/order_list': 20 / 15,
|
|
602
|
+
'staking/award_list': 20 / 15,
|
|
603
|
+
'staking/assets': 20 / 15,
|
|
604
|
+
'uni/currencies': 20 / 15, # deprecated
|
|
605
|
+
'uni/currencies/{currency}': 20 / 15, # deprecated
|
|
558
606
|
},
|
|
559
607
|
'post': {
|
|
560
608
|
'uni/lends': 20 / 15,
|
|
609
|
+
'staking/eth2/swap': 20 / 15,
|
|
610
|
+
'dual/orders': 20 / 15,
|
|
611
|
+
'structured/orders': 20 / 15,
|
|
612
|
+
'staking/swap': 20 / 15,
|
|
561
613
|
},
|
|
562
614
|
'put': {
|
|
563
|
-
'uni/interest_reinvest': 20 / 15,
|
|
615
|
+
'uni/interest_reinvest': 20 / 15, # deprecated
|
|
564
616
|
},
|
|
565
617
|
'patch': {
|
|
566
618
|
'uni/lends': 20 / 15,
|
|
@@ -574,16 +626,16 @@ class gate(Exchange, ImplicitAPI):
|
|
|
574
626
|
'collateral/collaterals': 20 / 15,
|
|
575
627
|
'collateral/total_amount': 20 / 15,
|
|
576
628
|
'collateral/ltv': 20 / 15,
|
|
577
|
-
'collateral/currencies': 20 / 15,
|
|
578
629
|
'multi_collateral/orders': 20 / 15,
|
|
579
630
|
'multi_collateral/orders/{order_id}': 20 / 15,
|
|
580
631
|
'multi_collateral/repay': 20 / 15,
|
|
581
632
|
'multi_collateral/mortgage': 20 / 15,
|
|
582
633
|
'multi_collateral/currency_quota': 20 / 15,
|
|
583
|
-
'
|
|
584
|
-
'multi_collateral/
|
|
585
|
-
'multi_collateral/
|
|
586
|
-
'multi_collateral/
|
|
634
|
+
'collateral/currencies': 20 / 15, # deprecated
|
|
635
|
+
'multi_collateral/currencies': 20 / 15, # deprecated
|
|
636
|
+
'multi_collateral/ltv': 20 / 15, # deprecated
|
|
637
|
+
'multi_collateral/fixed_rate': 20 / 15, # deprecated
|
|
638
|
+
'multi_collateral/current_rate': 20 / 15, # deprecated
|
|
587
639
|
},
|
|
588
640
|
'post': {
|
|
589
641
|
'collateral/orders': 20 / 15,
|
|
@@ -597,14 +649,17 @@ class gate(Exchange, ImplicitAPI):
|
|
|
597
649
|
'account': {
|
|
598
650
|
'get': {
|
|
599
651
|
'detail': 20 / 15,
|
|
652
|
+
'main_keys': 20 / 15,
|
|
600
653
|
'rate_limit': 20 / 15,
|
|
601
654
|
'stp_groups': 20 / 15,
|
|
602
655
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
603
656
|
'stp_groups/debit_fee': 20 / 15,
|
|
657
|
+
'debit_fee': 20 / 15,
|
|
604
658
|
},
|
|
605
659
|
'post': {
|
|
606
660
|
'stp_groups': 20 / 15,
|
|
607
661
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
662
|
+
'debit_fee': 20 / 15,
|
|
608
663
|
},
|
|
609
664
|
'delete': {
|
|
610
665
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
@@ -614,6 +669,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
614
669
|
'get': {
|
|
615
670
|
'agency/transaction_history': 20 / 15,
|
|
616
671
|
'agency/commission_history': 20 / 15,
|
|
672
|
+
'partner/transaction_history': 20 / 15,
|
|
673
|
+
'partner/commission_history': 20 / 15,
|
|
674
|
+
'partner/sub_list': 20 / 15,
|
|
675
|
+
'broker/commission_history': 20 / 15,
|
|
676
|
+
'broker/transaction_history': 20 / 15,
|
|
677
|
+
'user/info': 20 / 15,
|
|
678
|
+
'user/sub_relation': 20 / 15,
|
|
617
679
|
},
|
|
618
680
|
},
|
|
619
681
|
},
|
|
@@ -684,9 +746,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
684
746
|
'BSC': 'BSC',
|
|
685
747
|
'BEP20': 'BSC',
|
|
686
748
|
'SOL': 'SOL',
|
|
687
|
-
'
|
|
688
|
-
'MATIC': 'POL',
|
|
689
|
-
'OP': 'OPETH',
|
|
749
|
+
'MATIC': 'MATIC',
|
|
690
750
|
'OPTIMISM': 'OPETH',
|
|
691
751
|
'ADA': 'ADA', # CARDANO
|
|
692
752
|
'AVAXC': 'AVAX_C',
|
|
@@ -766,6 +826,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
766
826
|
'option': 'options',
|
|
767
827
|
'options': 'options',
|
|
768
828
|
},
|
|
829
|
+
'fetchMarkets': {
|
|
830
|
+
'types': ['spot', 'swap', 'future', 'option'],
|
|
831
|
+
},
|
|
769
832
|
'swap': {
|
|
770
833
|
'fetchMarkets': {
|
|
771
834
|
'settlementCurrencies': ['usdt', 'btc'],
|
|
@@ -987,7 +1050,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
987
1050
|
},
|
|
988
1051
|
},
|
|
989
1052
|
},
|
|
990
|
-
# https://www.gate.
|
|
1053
|
+
# https://www.gate.com/docs/developers/apiv4/en/#label-list
|
|
991
1054
|
'exceptions': {
|
|
992
1055
|
'exact': {
|
|
993
1056
|
'INVALID_PARAM_VALUE': BadRequest,
|
|
@@ -1100,7 +1163,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1100
1163
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1101
1164
|
returns unifiedAccount so the user can check if the unified account is enabled
|
|
1102
1165
|
|
|
1103
|
-
https://www.gate.
|
|
1166
|
+
https://www.gate.com/docs/developers/apiv4/#get-account-detail
|
|
1104
1167
|
|
|
1105
1168
|
:returns boolean: True or False if the enabled unified account is enabled or not and sets the unifiedAccount option if it is None
|
|
1106
1169
|
"""
|
|
@@ -1135,7 +1198,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1135
1198
|
"""
|
|
1136
1199
|
fetches the current integer timestamp in milliseconds from the exchange server
|
|
1137
1200
|
|
|
1138
|
-
https://www.gate.
|
|
1201
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-server-current-time
|
|
1139
1202
|
|
|
1140
1203
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1141
1204
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
|
@@ -1222,11 +1285,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1222
1285
|
"""
|
|
1223
1286
|
retrieves data on all markets for gate
|
|
1224
1287
|
|
|
1225
|
-
https://www.gate.
|
|
1226
|
-
https://www.gate.
|
|
1227
|
-
https://www.gate.
|
|
1228
|
-
https://www.gate.
|
|
1229
|
-
https://www.gate.
|
|
1288
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-currency-pairs-supported # spot
|
|
1289
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading # margin
|
|
1290
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts # swap
|
|
1291
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts-2 # future
|
|
1292
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time # option
|
|
1230
1293
|
|
|
1231
1294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1232
1295
|
:returns dict[]: an array of objects representing market data
|
|
@@ -1235,21 +1298,24 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1235
1298
|
self.load_time_difference()
|
|
1236
1299
|
if self.check_required_credentials(False):
|
|
1237
1300
|
self.load_unified_status()
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1301
|
+
rawPromises = []
|
|
1302
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
|
1303
|
+
types = self.safe_list(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option'])
|
|
1304
|
+
for i in range(0, len(types)):
|
|
1305
|
+
marketType = types[i]
|
|
1306
|
+
if marketType == 'spot':
|
|
1307
|
+
# if not sandboxMode:
|
|
1308
|
+
# gate doesn't have a sandbox for spot markets
|
|
1309
|
+
rawPromises.append(self.fetch_spot_markets(params))
|
|
1310
|
+
# }
|
|
1311
|
+
elif marketType == 'swap':
|
|
1312
|
+
rawPromises.append(self.fetch_swap_markets(params))
|
|
1313
|
+
elif marketType == 'future':
|
|
1314
|
+
rawPromises.append(self.fetch_future_markets(params))
|
|
1315
|
+
elif marketType == 'option':
|
|
1316
|
+
rawPromises.append(self.fetch_option_markets(params))
|
|
1317
|
+
results = rawPromises
|
|
1318
|
+
return self.arrays_concat(results)
|
|
1253
1319
|
|
|
1254
1320
|
def fetch_spot_markets(self, params={}):
|
|
1255
1321
|
marginPromise = self.publicMarginGetCurrencyPairs(params)
|
|
@@ -1263,17 +1329,21 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1263
1329
|
# {
|
|
1264
1330
|
# "id": "QTUM_ETH",
|
|
1265
1331
|
# "base": "QTUM",
|
|
1332
|
+
# "base_name": "Quantum",
|
|
1266
1333
|
# "quote": "ETH",
|
|
1334
|
+
# "quote_name": "Ethereum",
|
|
1267
1335
|
# "fee": "0.2",
|
|
1268
1336
|
# "min_base_amount": "0.01",
|
|
1269
1337
|
# "min_quote_amount": "0.001",
|
|
1338
|
+
# "max_quote_amount": "50000",
|
|
1270
1339
|
# "amount_precision": 3,
|
|
1271
1340
|
# "precision": 6,
|
|
1272
1341
|
# "trade_status": "tradable",
|
|
1273
|
-
# "sell_start":
|
|
1274
|
-
# "buy_start":
|
|
1342
|
+
# "sell_start": 1607313600,
|
|
1343
|
+
# "buy_start": 1700492400,
|
|
1344
|
+
# "type": "normal",
|
|
1345
|
+
# "trade_url": "https://www.gate.com/trade/QTUM_ETH",
|
|
1275
1346
|
# }
|
|
1276
|
-
# ]
|
|
1277
1347
|
#
|
|
1278
1348
|
# Margin
|
|
1279
1349
|
#
|
|
@@ -1304,6 +1374,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1304
1374
|
tradeStatus = self.safe_string(market, 'trade_status')
|
|
1305
1375
|
leverage = self.safe_number(market, 'leverage')
|
|
1306
1376
|
margin = leverage is not None
|
|
1377
|
+
buyStart = self.safe_integer_product(spotMarket, 'buy_start', 1000) # buy_start is the trading start time, while sell_start is offline orders start time
|
|
1378
|
+
createdTs = buyStart if (buyStart != 0) else None
|
|
1307
1379
|
result.append({
|
|
1308
1380
|
'id': id,
|
|
1309
1381
|
'symbol': base + '/' + quote,
|
|
@@ -1353,15 +1425,16 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1353
1425
|
'max': self.safe_number(market, 'max_quote_amount') if margin else None,
|
|
1354
1426
|
},
|
|
1355
1427
|
},
|
|
1356
|
-
'created':
|
|
1428
|
+
'created': createdTs,
|
|
1357
1429
|
'info': market,
|
|
1358
1430
|
})
|
|
1359
1431
|
return result
|
|
1360
1432
|
|
|
1361
|
-
def
|
|
1433
|
+
def fetch_swap_markets(self, params={}):
|
|
1362
1434
|
result = []
|
|
1363
1435
|
swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
|
|
1364
|
-
|
|
1436
|
+
if self.options['sandboxMode']:
|
|
1437
|
+
swapSettlementCurrencies = ['usdt'] # gate sandbox only has usdt-margined swaps
|
|
1365
1438
|
for c in range(0, len(swapSettlementCurrencies)):
|
|
1366
1439
|
settleId = swapSettlementCurrencies[c]
|
|
1367
1440
|
request: dict = {
|
|
@@ -1371,6 +1444,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1371
1444
|
for i in range(0, len(response)):
|
|
1372
1445
|
parsedMarket = self.parse_contract_market(response[i], settleId)
|
|
1373
1446
|
result.append(parsedMarket)
|
|
1447
|
+
return result
|
|
1448
|
+
|
|
1449
|
+
def fetch_future_markets(self, params={}):
|
|
1450
|
+
if self.options['sandboxMode']:
|
|
1451
|
+
return [] # right now sandbox does not have inverse swaps
|
|
1452
|
+
result = []
|
|
1453
|
+
futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
|
|
1374
1454
|
for c in range(0, len(futureSettlementCurrencies)):
|
|
1375
1455
|
settleId = futureSettlementCurrencies[c]
|
|
1376
1456
|
request: dict = {
|
|
@@ -1411,13 +1491,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1411
1491
|
# "leverage_min": "1",
|
|
1412
1492
|
# "leverage_max": "100",
|
|
1413
1493
|
# "risk_limit_max": "8000000",
|
|
1414
|
-
# "maker_fee_rate": "-0.00025",
|
|
1415
|
-
# "taker_fee_rate": "0.00075",
|
|
1494
|
+
# "maker_fee_rate": "-0.00025", # not actual value for regular users
|
|
1495
|
+
# "taker_fee_rate": "0.00075", # not actual value for regular users
|
|
1416
1496
|
# "funding_rate": "0.002053",
|
|
1417
1497
|
# "order_size_max": 1000000,
|
|
1418
1498
|
# "funding_next_apply": 1610035200,
|
|
1419
1499
|
# "short_users": 977,
|
|
1420
1500
|
# "config_change_time": 1609899548,
|
|
1501
|
+
# "create_time": 1609800048,
|
|
1421
1502
|
# "trade_size": 28530850594,
|
|
1422
1503
|
# "position_size": 5223816,
|
|
1423
1504
|
# "long_users": 455,
|
|
@@ -1455,8 +1536,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1455
1536
|
# "risk_limit_base": "140.726652109199",
|
|
1456
1537
|
# "risk_limit_step": "1000000",
|
|
1457
1538
|
# "risk_limit_max": "8000000",
|
|
1458
|
-
# "maker_fee_rate": "-0.00025",
|
|
1459
|
-
# "taker_fee_rate": "0.00075",
|
|
1539
|
+
# "maker_fee_rate": "-0.00025", # not actual value for regular users
|
|
1540
|
+
# "taker_fee_rate": "0.00075", # not actual value for regular users
|
|
1460
1541
|
# "ref_discount_rate": "0",
|
|
1461
1542
|
# "ref_rebate_rate": "0.2",
|
|
1462
1543
|
# "order_price_deviate": "0.5",
|
|
@@ -1493,8 +1574,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1493
1574
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1494
1575
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1495
1576
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1496
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1497
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1498
1577
|
isLinear = quote == settle
|
|
1499
1578
|
contractSize = self.safe_string(market, 'quanto_multiplier')
|
|
1500
1579
|
# exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
|
|
@@ -1519,8 +1598,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1519
1598
|
'contract': True,
|
|
1520
1599
|
'linear': isLinear,
|
|
1521
1600
|
'inverse': not isLinear,
|
|
1522
|
-
'taker':
|
|
1523
|
-
'maker':
|
|
1601
|
+
'taker': None,
|
|
1602
|
+
'maker': None,
|
|
1524
1603
|
'contractSize': self.parse_number(contractSize),
|
|
1525
1604
|
'expiry': expiry,
|
|
1526
1605
|
'expiryDatetime': self.iso8601(expiry),
|
|
@@ -1548,7 +1627,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1548
1627
|
'max': None,
|
|
1549
1628
|
},
|
|
1550
1629
|
},
|
|
1551
|
-
'created':
|
|
1630
|
+
'created': self.safe_integer_product(market, 'create_time', 1000),
|
|
1552
1631
|
'info': market,
|
|
1553
1632
|
}
|
|
1554
1633
|
|
|
@@ -1619,8 +1698,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1619
1698
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1620
1699
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1621
1700
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1622
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1623
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1624
1701
|
result.append({
|
|
1625
1702
|
'id': id,
|
|
1626
1703
|
'symbol': symbol,
|
|
@@ -1640,12 +1717,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1640
1717
|
'contract': True,
|
|
1641
1718
|
'linear': True,
|
|
1642
1719
|
'inverse': False,
|
|
1643
|
-
'taker':
|
|
1644
|
-
'maker':
|
|
1720
|
+
'taker': None,
|
|
1721
|
+
'maker': None,
|
|
1645
1722
|
'contractSize': self.parse_number('1'),
|
|
1646
1723
|
'expiry': expiry,
|
|
1647
1724
|
'expiryDatetime': self.iso8601(expiry),
|
|
1648
|
-
'strike': strike,
|
|
1725
|
+
'strike': self.parse_number(strike),
|
|
1649
1726
|
'optionType': optionType,
|
|
1650
1727
|
'precision': {
|
|
1651
1728
|
'amount': self.parse_number('1'), # all options have self step size
|
|
@@ -1799,7 +1876,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1799
1876
|
"""
|
|
1800
1877
|
fetches all available currencies on an exchange
|
|
1801
1878
|
|
|
1802
|
-
https://www.gate.
|
|
1879
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-currencies-details
|
|
1803
1880
|
|
|
1804
1881
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1805
1882
|
:returns dict: an associative dictionary of currencies
|
|
@@ -1807,7 +1884,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1807
1884
|
# sandbox/testnet only supports future markets
|
|
1808
1885
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
|
1809
1886
|
if apiBackup is not None:
|
|
1810
|
-
return
|
|
1887
|
+
return {}
|
|
1811
1888
|
response = self.publicSpotGetCurrencies(params)
|
|
1812
1889
|
#
|
|
1813
1890
|
# [
|
|
@@ -1900,7 +1977,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1900
1977
|
"""
|
|
1901
1978
|
fetch the current funding rate
|
|
1902
1979
|
|
|
1903
|
-
https://www.gate.
|
|
1980
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-contract
|
|
1904
1981
|
|
|
1905
1982
|
:param str symbol: unified market symbol
|
|
1906
1983
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1962,7 +2039,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1962
2039
|
"""
|
|
1963
2040
|
fetch the funding rate for multiple markets
|
|
1964
2041
|
|
|
1965
|
-
https://www.gate.
|
|
2042
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
1966
2043
|
|
|
1967
2044
|
:param str[]|None symbols: list of unified market symbols
|
|
1968
2045
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2158,28 +2235,26 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2158
2235
|
chains = self.safe_value(response, 'multichain_addresses', [])
|
|
2159
2236
|
currencyId = self.safe_string(response, 'currency')
|
|
2160
2237
|
currency = self.safe_currency(currencyId, currency)
|
|
2161
|
-
parsed = self.parse_deposit_addresses(chains,
|
|
2162
|
-
'currency': currency['id'],
|
|
2163
|
-
})
|
|
2238
|
+
parsed = self.parse_deposit_addresses(chains, None, False)
|
|
2164
2239
|
return self.index_by(parsed, 'network')
|
|
2165
2240
|
|
|
2166
2241
|
def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
|
2167
2242
|
"""
|
|
2168
2243
|
fetch the deposit address for a currency associated with self account
|
|
2169
2244
|
|
|
2170
|
-
https://www.gate.
|
|
2245
|
+
https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address
|
|
2171
2246
|
|
|
2172
2247
|
:param str code: unified currency code
|
|
2173
2248
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2174
|
-
:param str [params.network]: unified network code(not used directly by gate.
|
|
2249
|
+
:param str [params.network]: unified network code(not used directly by gate.com but used by ccxt to filter the response)
|
|
2175
2250
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
2176
2251
|
"""
|
|
2177
2252
|
self.load_markets()
|
|
2178
2253
|
networkCode = None
|
|
2179
2254
|
networkCode, params = self.handle_network_code_and_params(params)
|
|
2180
2255
|
chainsIndexedById = self.fetch_deposit_addresses_by_network(code, params)
|
|
2181
|
-
|
|
2182
|
-
return chainsIndexedById[
|
|
2256
|
+
selectedNetworkIdOrCode = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
|
|
2257
|
+
return chainsIndexedById[selectedNetworkIdOrCode]
|
|
2183
2258
|
|
|
2184
2259
|
def parse_deposit_address(self, depositAddress, currency=None):
|
|
2185
2260
|
#
|
|
@@ -2205,7 +2280,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2205
2280
|
"""
|
|
2206
2281
|
fetch the trading fees for a market
|
|
2207
2282
|
|
|
2208
|
-
https://www.gate.
|
|
2283
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2209
2284
|
|
|
2210
2285
|
:param str symbol: unified market symbol
|
|
2211
2286
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2237,7 +2312,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2237
2312
|
"""
|
|
2238
2313
|
fetch the trading fees for multiple markets
|
|
2239
2314
|
|
|
2240
|
-
https://www.gate.
|
|
2315
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2241
2316
|
|
|
2242
2317
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2243
2318
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
@@ -2303,7 +2378,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2303
2378
|
@deprecated
|
|
2304
2379
|
please use fetchDepositWithdrawFees instead
|
|
2305
2380
|
|
|
2306
|
-
https://www.gate.
|
|
2381
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2307
2382
|
|
|
2308
2383
|
:param str[]|None codes: list of unified currency codes
|
|
2309
2384
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2341,10 +2416,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2341
2416
|
if withdrawFixOnChains is None:
|
|
2342
2417
|
withdrawFees = self.safe_number(entry, 'withdraw_fix')
|
|
2343
2418
|
else:
|
|
2344
|
-
|
|
2345
|
-
for j in range(0, len(
|
|
2346
|
-
|
|
2347
|
-
|
|
2419
|
+
networkIds = list(withdrawFixOnChains.keys())
|
|
2420
|
+
for j in range(0, len(networkIds)):
|
|
2421
|
+
networkId = networkIds[j]
|
|
2422
|
+
networkCode = self.network_id_to_code(networkId)
|
|
2423
|
+
withdrawFees[networkCode] = self.parse_number(withdrawFixOnChains[networkId])
|
|
2348
2424
|
result[code] = {
|
|
2349
2425
|
'withdraw': withdrawFees,
|
|
2350
2426
|
'deposit': None,
|
|
@@ -2356,7 +2432,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2356
2432
|
"""
|
|
2357
2433
|
fetch deposit and withdraw fees
|
|
2358
2434
|
|
|
2359
|
-
https://www.gate.
|
|
2435
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2360
2436
|
|
|
2361
2437
|
:param str[]|None codes: list of unified currency codes
|
|
2362
2438
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2437,8 +2513,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2437
2513
|
"""
|
|
2438
2514
|
fetch the history of funding payments paid and received on self account
|
|
2439
2515
|
|
|
2440
|
-
https://www.gate.
|
|
2441
|
-
https://www.gate.
|
|
2516
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-2
|
|
2517
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-3
|
|
2442
2518
|
|
|
2443
2519
|
:param str symbol: unified market symbol
|
|
2444
2520
|
:param int [since]: the earliest time in ms to fetch funding history for
|
|
@@ -2517,10 +2593,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2517
2593
|
"""
|
|
2518
2594
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
2519
2595
|
|
|
2520
|
-
https://www.gate.
|
|
2521
|
-
https://www.gate.
|
|
2522
|
-
https://www.gate.
|
|
2523
|
-
https://www.gate.
|
|
2596
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-order-book
|
|
2597
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-order-book
|
|
2598
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-order-book-2
|
|
2599
|
+
https://www.gate.com/docs/developers/apiv4/en/#options-order-book
|
|
2524
2600
|
|
|
2525
2601
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
2526
2602
|
:param int [limit]: the maximum amount of order book entries to return
|
|
@@ -2539,7 +2615,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2539
2615
|
#
|
|
2540
2616
|
request, query = self.prepare_request(market, market['type'], params)
|
|
2541
2617
|
if limit is not None:
|
|
2542
|
-
|
|
2618
|
+
if market['spot']:
|
|
2619
|
+
limit = min(limit, 1000)
|
|
2620
|
+
else:
|
|
2621
|
+
limit = min(limit, 300)
|
|
2622
|
+
request['limit'] = limit
|
|
2543
2623
|
request['with_id'] = True
|
|
2544
2624
|
response = None
|
|
2545
2625
|
if market['spot'] or market['margin']:
|
|
@@ -2630,10 +2710,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2630
2710
|
"""
|
|
2631
2711
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2632
2712
|
|
|
2633
|
-
https://www.gate.
|
|
2634
|
-
https://www.gate.
|
|
2635
|
-
https://www.gate.
|
|
2636
|
-
https://www.gate.
|
|
2713
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-details-of-a-specifc-order
|
|
2714
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers
|
|
2715
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers-2
|
|
2716
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
2637
2717
|
|
|
2638
2718
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
2639
2719
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2783,10 +2863,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2783
2863
|
"""
|
|
2784
2864
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2785
2865
|
|
|
2786
|
-
https://www.gate.
|
|
2787
|
-
https://www.gate.
|
|
2788
|
-
https://www.gate.
|
|
2789
|
-
https://www.gate.
|
|
2866
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-details-of-a-specifc-order
|
|
2867
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers
|
|
2868
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers-2
|
|
2869
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
2790
2870
|
|
|
2791
2871
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2792
2872
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2829,6 +2909,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2829
2909
|
|
|
2830
2910
|
def fetch_balance(self, params={}) -> Balances:
|
|
2831
2911
|
"""
|
|
2912
|
+
|
|
2913
|
+
https://www.gate.com/docs/developers/apiv4/en/#margin-account-list
|
|
2914
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-unified-account-information
|
|
2915
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-spot-trading-accounts
|
|
2916
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-account
|
|
2917
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-account-2
|
|
2918
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-information
|
|
2919
|
+
|
|
2832
2920
|
:param dict [params]: exchange specific parameters
|
|
2833
2921
|
:param str [params.type]: spot, margin, swap or future, if not provided self.options['defaultType'] is used
|
|
2834
2922
|
:param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
|
|
@@ -3069,7 +3157,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3069
3157
|
result: dict = {
|
|
3070
3158
|
'info': response,
|
|
3071
3159
|
}
|
|
3072
|
-
isolated = marginMode == 'margin'
|
|
3160
|
+
isolated = marginMode == 'margin' and type == 'spot'
|
|
3073
3161
|
data = response
|
|
3074
3162
|
if 'balances' in data: # True for cross_margin and unified
|
|
3075
3163
|
flatBalances = []
|
|
@@ -3102,14 +3190,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3102
3190
|
returnResult = result if isolated else self.safe_balance(result)
|
|
3103
3191
|
return returnResult
|
|
3104
3192
|
|
|
3105
|
-
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
3193
|
+
def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
3106
3194
|
"""
|
|
3107
3195
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
3108
3196
|
|
|
3109
|
-
https://www.gate.
|
|
3110
|
-
https://www.gate.
|
|
3111
|
-
https://www.gate.
|
|
3112
|
-
https://www.gate.
|
|
3197
|
+
https://www.gate.com/docs/developers/apiv4/en/#market-candlesticks # spot
|
|
3198
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-candlesticks # swap
|
|
3199
|
+
https://www.gate.com/docs/developers/apiv4/en/#market-candlesticks # future
|
|
3200
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-options-candlesticks # option
|
|
3113
3201
|
|
|
3114
3202
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
3115
3203
|
:param str timeframe: the length of time each candle represents
|
|
@@ -3183,7 +3271,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3183
3271
|
"""
|
|
3184
3272
|
fetches historical funding rate prices
|
|
3185
3273
|
|
|
3186
|
-
https://www.gate.
|
|
3274
|
+
https://www.gate.com/docs/developers/apiv4/en/#funding-rate-history
|
|
3187
3275
|
|
|
3188
3276
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
3189
3277
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
|
@@ -3283,10 +3371,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3283
3371
|
"""
|
|
3284
3372
|
get the list of most recent trades for a particular symbol
|
|
3285
3373
|
|
|
3286
|
-
https://www.gate.
|
|
3287
|
-
https://www.gate.
|
|
3288
|
-
https://www.gate.
|
|
3289
|
-
https://www.gate.
|
|
3374
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-market-trades
|
|
3375
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-trading-history
|
|
3376
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-trading-history-2
|
|
3377
|
+
https://www.gate.com/docs/developers/apiv4/en/#options-trade-history
|
|
3290
3378
|
|
|
3291
3379
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
3292
3380
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
@@ -3389,10 +3477,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3389
3477
|
"""
|
|
3390
3478
|
fetch all the trades made from a single order
|
|
3391
3479
|
|
|
3392
|
-
https://www.gate.
|
|
3393
|
-
https://www.gate.
|
|
3394
|
-
https://www.gate.
|
|
3395
|
-
https://www.gate.
|
|
3480
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history
|
|
3481
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-2
|
|
3482
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-3
|
|
3483
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-4
|
|
3396
3484
|
|
|
3397
3485
|
:param str id: order id
|
|
3398
3486
|
:param str symbol: unified market symbol
|
|
@@ -3430,10 +3518,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3430
3518
|
"""
|
|
3431
3519
|
Fetch personal trading history
|
|
3432
3520
|
|
|
3433
|
-
https://www.gate.
|
|
3434
|
-
https://www.gate.
|
|
3435
|
-
https://www.gate.
|
|
3436
|
-
https://www.gate.
|
|
3521
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history
|
|
3522
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-2
|
|
3523
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-3
|
|
3524
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-4
|
|
3437
3525
|
|
|
3438
3526
|
:param str symbol: unified market symbol
|
|
3439
3527
|
:param int [since]: the earliest time in ms to fetch trades for
|
|
@@ -3723,7 +3811,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3723
3811
|
"""
|
|
3724
3812
|
fetch all deposits made to an account
|
|
3725
3813
|
|
|
3726
|
-
https://www.gate.
|
|
3814
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-deposit-records
|
|
3727
3815
|
|
|
3728
3816
|
:param str code: unified currency code
|
|
3729
3817
|
:param int [since]: the earliest time in ms to fetch deposits for
|
|
@@ -3749,7 +3837,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3749
3837
|
start = self.parse_to_int(since / 1000)
|
|
3750
3838
|
request['from'] = start
|
|
3751
3839
|
request['to'] = self.sum(start, 30 * 24 * 60 * 60)
|
|
3752
|
-
request, params = self.handle_until_option('to', request, params)
|
|
3840
|
+
request, params = self.handle_until_option('to', request, params, 0.001)
|
|
3753
3841
|
response = self.privateWalletGetDeposits(self.extend(request, params))
|
|
3754
3842
|
return self.parse_transactions(response, currency)
|
|
3755
3843
|
|
|
@@ -3757,7 +3845,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3757
3845
|
"""
|
|
3758
3846
|
fetch all withdrawals made from an account
|
|
3759
3847
|
|
|
3760
|
-
https://www.gate.
|
|
3848
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
|
3761
3849
|
|
|
3762
3850
|
:param str code: unified currency code
|
|
3763
3851
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
@@ -3783,15 +3871,15 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3783
3871
|
start = self.parse_to_int(since / 1000)
|
|
3784
3872
|
request['from'] = start
|
|
3785
3873
|
request['to'] = self.sum(start, 30 * 24 * 60 * 60)
|
|
3786
|
-
request, params = self.handle_until_option('to', request, params)
|
|
3874
|
+
request, params = self.handle_until_option('to', request, params, 0.001)
|
|
3787
3875
|
response = self.privateWalletGetWithdrawals(self.extend(request, params))
|
|
3788
3876
|
return self.parse_transactions(response, currency)
|
|
3789
3877
|
|
|
3790
|
-
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
|
3878
|
+
def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
|
|
3791
3879
|
"""
|
|
3792
3880
|
make a withdrawal
|
|
3793
3881
|
|
|
3794
|
-
https://www.gate.
|
|
3882
|
+
https://www.gate.com/docs/developers/apiv4/en/#withdraw
|
|
3795
3883
|
|
|
3796
3884
|
:param str code: unified currency code
|
|
3797
3885
|
:param float amount: the amount to withdraw
|
|
@@ -3965,13 +4053,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3965
4053
|
"""
|
|
3966
4054
|
Create an order on the exchange
|
|
3967
4055
|
|
|
3968
|
-
https://www.gate.
|
|
3969
|
-
https://www.gate.
|
|
3970
|
-
https://www.gate.
|
|
3971
|
-
https://www.gate.
|
|
3972
|
-
https://www.gate.
|
|
3973
|
-
https://www.gate.
|
|
3974
|
-
https://www.gate.
|
|
4056
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-order
|
|
4057
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order
|
|
4058
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order
|
|
4059
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
|
4060
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
4061
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
|
4062
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order
|
|
3975
4063
|
|
|
3976
4064
|
:param str symbol: Unified CCXT market symbol
|
|
3977
4065
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
|
@@ -4114,7 +4202,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4114
4202
|
triggerValue = self.safe_value_n(orderParams, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
|
|
4115
4203
|
if triggerValue is not None:
|
|
4116
4204
|
raise NotSupported(self.id + ' createOrders() does not support advanced order properties(stopPrice, takeProfitPrice, stopLossPrice)')
|
|
4117
|
-
extendedParams['textIsRequired'] = True #
|
|
4205
|
+
extendedParams['textIsRequired'] = True # the exchange requires a text parameter for each order here
|
|
4118
4206
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
|
|
4119
4207
|
ordersRequests.append(orderRequest)
|
|
4120
4208
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
|
@@ -4127,9 +4215,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4127
4215
|
"""
|
|
4128
4216
|
create a list of trade orders
|
|
4129
4217
|
|
|
4130
|
-
https://www.gate.
|
|
4131
|
-
https://www.gate.
|
|
4132
|
-
https://www.gate.
|
|
4218
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-2
|
|
4219
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
4220
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
|
4133
4221
|
|
|
4134
4222
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
4135
4223
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -4362,7 +4450,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4362
4450
|
"""
|
|
4363
4451
|
create a market buy order by providing the symbol and cost
|
|
4364
4452
|
|
|
4365
|
-
https://www.gate.
|
|
4453
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-order
|
|
4366
4454
|
|
|
4367
4455
|
:param str symbol: unified symbol of the market to create an order in
|
|
4368
4456
|
:param float cost: how much you want to trade in units of the quote currency
|
|
@@ -4415,8 +4503,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4415
4503
|
"""
|
|
4416
4504
|
edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4417
4505
|
|
|
4418
|
-
https://www.gate.
|
|
4419
|
-
https://www.gate.
|
|
4506
|
+
https://www.gate.com/docs/developers/apiv4/en/#amend-an-order
|
|
4507
|
+
https://www.gate.com/docs/developers/apiv4/en/#amend-an-order-2
|
|
4420
4508
|
|
|
4421
4509
|
:param str id: order id
|
|
4422
4510
|
:param str symbol: unified symbol of the market to create an order in
|
|
@@ -4760,10 +4848,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4760
4848
|
"""
|
|
4761
4849
|
Retrieves information on an order
|
|
4762
4850
|
|
|
4763
|
-
https://www.gate.
|
|
4764
|
-
https://www.gate.
|
|
4765
|
-
https://www.gate.
|
|
4766
|
-
https://www.gate.
|
|
4851
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order
|
|
4852
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-2
|
|
4853
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-3
|
|
4854
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-4
|
|
4767
4855
|
|
|
4768
4856
|
:param str id: Order id
|
|
4769
4857
|
:param str symbol: Unified market symbol, *required for spot and margin*
|
|
@@ -4808,8 +4896,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4808
4896
|
"""
|
|
4809
4897
|
fetch all unfilled currently open orders
|
|
4810
4898
|
|
|
4811
|
-
https://www.gate.
|
|
4812
|
-
https://www.gate.
|
|
4899
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-open-orders
|
|
4900
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
4813
4901
|
|
|
4814
4902
|
:param str symbol: unified market symbol
|
|
4815
4903
|
:param int [since]: the earliest time in ms to fetch open orders for
|
|
@@ -4827,14 +4915,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4827
4915
|
"""
|
|
4828
4916
|
fetches information on multiple closed orders made by the user
|
|
4829
4917
|
|
|
4830
|
-
https://www.gate.
|
|
4831
|
-
https://www.gate.
|
|
4832
|
-
https://www.gate.
|
|
4833
|
-
https://www.gate.
|
|
4834
|
-
https://www.gate.
|
|
4835
|
-
https://www.gate.
|
|
4836
|
-
https://www.gate.
|
|
4837
|
-
https://www.gate.
|
|
4918
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-orders
|
|
4919
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
4920
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders
|
|
4921
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-auto-orders
|
|
4922
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders-2
|
|
4923
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-auto-orders-2
|
|
4924
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-options-orders
|
|
4925
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders-by-time-range
|
|
4838
4926
|
|
|
4839
4927
|
:param str symbol: unified market symbol of the market orders were made in
|
|
4840
4928
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
@@ -5101,10 +5189,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5101
5189
|
"""
|
|
5102
5190
|
Cancels an open order
|
|
5103
5191
|
|
|
5104
|
-
https://www.gate.
|
|
5105
|
-
https://www.gate.
|
|
5106
|
-
https://www.gate.
|
|
5107
|
-
https://www.gate.
|
|
5192
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order
|
|
5193
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-2
|
|
5194
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-3
|
|
5195
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-4
|
|
5108
5196
|
|
|
5109
5197
|
:param str id: Order id
|
|
5110
5198
|
:param str symbol: Unified market symbol
|
|
@@ -5228,8 +5316,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5228
5316
|
"""
|
|
5229
5317
|
cancel multiple orders
|
|
5230
5318
|
|
|
5231
|
-
https://www.gate.
|
|
5232
|
-
https://www.gate.
|
|
5319
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5320
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2
|
|
5233
5321
|
|
|
5234
5322
|
:param str[] ids: order ids
|
|
5235
5323
|
:param str symbol: unified symbol of the market the order was made in
|
|
@@ -5272,7 +5360,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5272
5360
|
"""
|
|
5273
5361
|
cancel multiple orders for multiple symbols
|
|
5274
5362
|
|
|
5275
|
-
https://www.gate.
|
|
5363
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5276
5364
|
|
|
5277
5365
|
:param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
5278
5366
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5310,10 +5398,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5310
5398
|
"""
|
|
5311
5399
|
cancel all open orders
|
|
5312
5400
|
|
|
5313
|
-
https://www.gate.
|
|
5314
|
-
https://www.gate.
|
|
5315
|
-
https://www.gate.
|
|
5316
|
-
https://www.gate.
|
|
5401
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
|
5402
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
|
5403
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
|
5404
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
|
5317
5405
|
|
|
5318
5406
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
5319
5407
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5381,7 +5469,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5381
5469
|
"""
|
|
5382
5470
|
transfer currency internally between wallets on the same account
|
|
5383
5471
|
|
|
5384
|
-
https://www.gate.
|
|
5472
|
+
https://www.gate.com/docs/developers/apiv4/en/#transfer-between-trading-accounts
|
|
5385
5473
|
|
|
5386
5474
|
:param str code: unified currency code for currency being transferred
|
|
5387
5475
|
:param float amount: the amount of currency to transfer
|
|
@@ -5455,12 +5543,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5455
5543
|
'info': transfer,
|
|
5456
5544
|
}
|
|
5457
5545
|
|
|
5458
|
-
def set_leverage(self, leverage:
|
|
5546
|
+
def set_leverage(self, leverage: int, symbol: Str = None, params={}):
|
|
5459
5547
|
"""
|
|
5460
5548
|
set the level of leverage for a market
|
|
5461
5549
|
|
|
5462
|
-
https://www.gate.
|
|
5463
|
-
https://www.gate.
|
|
5550
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-leverage
|
|
5551
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-leverage-2
|
|
5464
5552
|
|
|
5465
5553
|
:param float leverage: the rate of leverage
|
|
5466
5554
|
:param str symbol: unified market symbol
|
|
@@ -5663,9 +5751,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5663
5751
|
"""
|
|
5664
5752
|
fetch data on an open contract position
|
|
5665
5753
|
|
|
5666
|
-
https://www.gate.
|
|
5667
|
-
https://www.gate.
|
|
5668
|
-
https://www.gate.
|
|
5754
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-single-position
|
|
5755
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-single-position-2
|
|
5756
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-specified-contract-position
|
|
5669
5757
|
|
|
5670
5758
|
:param str symbol: unified market symbol of the market the position is held in
|
|
5671
5759
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5747,9 +5835,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5747
5835
|
"""
|
|
5748
5836
|
fetch all open positions
|
|
5749
5837
|
|
|
5750
|
-
https://www.gate.
|
|
5751
|
-
https://www.gate.
|
|
5752
|
-
https://www.gate.
|
|
5838
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-positions-of-a-user
|
|
5839
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-positions-of-a-user-2
|
|
5840
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-user-s-positions-of-specified-underlying
|
|
5753
5841
|
|
|
5754
5842
|
:param str[]|None symbols: Not used by gate, but parsed internally by CCXT
|
|
5755
5843
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5849,8 +5937,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5849
5937
|
"""
|
|
5850
5938
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
5851
5939
|
|
|
5852
|
-
https://www.gate.
|
|
5853
|
-
https://www.gate.
|
|
5940
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
5941
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
|
5854
5942
|
|
|
5855
5943
|
:param str[] [symbols]: list of unified market symbols
|
|
5856
5944
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5966,7 +6054,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5966
6054
|
"""
|
|
5967
6055
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
5968
6056
|
|
|
5969
|
-
https://www.gate.
|
|
6057
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-risk-limit-tiers
|
|
5970
6058
|
|
|
5971
6059
|
:param str symbol: unified market symbol
|
|
5972
6060
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5978,7 +6066,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5978
6066
|
request, requestParams = self.prepare_request(market, type, query)
|
|
5979
6067
|
if type != 'future' and type != 'swap':
|
|
5980
6068
|
raise BadRequest(self.id + ' fetchMarketLeverageTiers only supports swap and future')
|
|
5981
|
-
response = self.
|
|
6069
|
+
response = self.publicFuturesGetSettleRiskLimitTiers(self.extend(request, requestParams))
|
|
5982
6070
|
#
|
|
5983
6071
|
# [
|
|
5984
6072
|
# {
|
|
@@ -6056,7 +6144,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6056
6144
|
"""
|
|
6057
6145
|
repay borrowed margin and interest
|
|
6058
6146
|
|
|
6059
|
-
https://www.gate.
|
|
6147
|
+
https://www.gate.com/docs/apiv4/en/#repay-a-loan
|
|
6060
6148
|
|
|
6061
6149
|
:param str symbol: unified market symbol
|
|
6062
6150
|
:param str code: unified currency code of the currency to repay
|
|
@@ -6085,8 +6173,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6085
6173
|
"""
|
|
6086
6174
|
repay cross margin borrowed margin and interest
|
|
6087
6175
|
|
|
6088
|
-
https://www.gate.
|
|
6089
|
-
https://www.gate.
|
|
6176
|
+
https://www.gate.com/docs/developers/apiv4/en/#cross-margin-repayments
|
|
6177
|
+
https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay
|
|
6090
6178
|
|
|
6091
6179
|
:param str code: unified currency code of the currency to repay
|
|
6092
6180
|
:param float amount: the amount to repay
|
|
@@ -6134,7 +6222,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6134
6222
|
"""
|
|
6135
6223
|
create a loan to borrow margin
|
|
6136
6224
|
|
|
6137
|
-
https://www.gate.
|
|
6225
|
+
https://www.gate.com/docs/developers/apiv4/en/#marginuni
|
|
6138
6226
|
|
|
6139
6227
|
:param str symbol: unified market symbol, required for isolated margin
|
|
6140
6228
|
:param str code: unified currency code of the currency to borrow
|
|
@@ -6179,8 +6267,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6179
6267
|
"""
|
|
6180
6268
|
create a loan to borrow margin
|
|
6181
6269
|
|
|
6182
|
-
https://www.gate.
|
|
6183
|
-
https://www.gate.
|
|
6270
|
+
https://www.gate.com/docs/apiv4/en/#create-a-cross-margin-borrow-loan
|
|
6271
|
+
https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay
|
|
6184
6272
|
|
|
6185
6273
|
:param str code: unified currency code of the currency to borrow
|
|
6186
6274
|
:param float amount: the amount to borrow
|
|
@@ -6277,9 +6365,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6277
6365
|
"""
|
|
6278
6366
|
fetch the interest owed by the user for borrowing currency for margin trading
|
|
6279
6367
|
|
|
6280
|
-
https://www.gate.
|
|
6281
|
-
https://www.gate.
|
|
6282
|
-
https://www.gate.
|
|
6368
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-interest-records
|
|
6369
|
+
https://www.gate.com/docs/developers/apiv4/en/#interest-records-for-the-cross-margin-account
|
|
6370
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-interest-records-2
|
|
6283
6371
|
|
|
6284
6372
|
:param str [code]: unified currency code
|
|
6285
6373
|
:param str [symbol]: unified market symbol when fetching interest in isolated markets
|
|
@@ -6480,8 +6568,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6480
6568
|
"""
|
|
6481
6569
|
remove margin from a position
|
|
6482
6570
|
|
|
6483
|
-
https://www.gate.
|
|
6484
|
-
https://www.gate.
|
|
6571
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin
|
|
6572
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin-2
|
|
6485
6573
|
|
|
6486
6574
|
:param str symbol: unified market symbol
|
|
6487
6575
|
:param float amount: the amount of margin to remove
|
|
@@ -6494,8 +6582,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6494
6582
|
"""
|
|
6495
6583
|
add margin
|
|
6496
6584
|
|
|
6497
|
-
https://www.gate.
|
|
6498
|
-
https://www.gate.
|
|
6585
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin
|
|
6586
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin-2
|
|
6499
6587
|
|
|
6500
6588
|
:param str symbol: unified market symbol
|
|
6501
6589
|
:param float amount: amount of margin to add
|
|
@@ -6508,7 +6596,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6508
6596
|
"""
|
|
6509
6597
|
Retrieves the open interest of a currency
|
|
6510
6598
|
|
|
6511
|
-
https://www.gate.
|
|
6599
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-stats
|
|
6512
6600
|
|
|
6513
6601
|
:param str symbol: Unified CCXT market symbol
|
|
6514
6602
|
:param str timeframe: "5m", "15m", "30m", "1h", "4h", "1d"
|
|
@@ -6592,7 +6680,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6592
6680
|
"""
|
|
6593
6681
|
fetches historical settlement records
|
|
6594
6682
|
|
|
6595
|
-
https://www.gate.
|
|
6683
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-settlement-history-2
|
|
6596
6684
|
|
|
6597
6685
|
:param str symbol: unified market symbol of the settlement history, required on gate
|
|
6598
6686
|
:param int [since]: timestamp in ms
|
|
@@ -6638,7 +6726,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6638
6726
|
"""
|
|
6639
6727
|
fetches historical settlement records of the user
|
|
6640
6728
|
|
|
6641
|
-
https://www.gate.
|
|
6729
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-my-options-settlements
|
|
6642
6730
|
|
|
6643
6731
|
:param str symbol: unified market symbol of the settlement history
|
|
6644
6732
|
:param int [since]: timestamp in ms
|
|
@@ -6763,11 +6851,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6763
6851
|
"""
|
|
6764
6852
|
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
6765
6853
|
|
|
6766
|
-
https://www.gate.
|
|
6767
|
-
https://www.gate.
|
|
6768
|
-
https://www.gate.
|
|
6769
|
-
https://www.gate.
|
|
6770
|
-
https://www.gate.
|
|
6854
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book
|
|
6855
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-margin-account-balance-change-history
|
|
6856
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-2
|
|
6857
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-3
|
|
6858
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-account-changing-history
|
|
6771
6859
|
|
|
6772
6860
|
:param str [code]: unified currency code
|
|
6773
6861
|
:param int [since]: timestamp in ms of the earliest ledger entry
|
|
@@ -6994,7 +7082,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6994
7082
|
"""
|
|
6995
7083
|
set dual/hedged mode to True or False for a swap market, make sure all positions are closed and no orders are open before setting dual mode
|
|
6996
7084
|
|
|
6997
|
-
https://www.gate.
|
|
7085
|
+
https://www.gate.com/docs/developers/apiv4/en/#enable-or-disable-dual-mode
|
|
6998
7086
|
|
|
6999
7087
|
:param bool hedged: set to True to enable dual mode
|
|
7000
7088
|
:param str|None symbol: if passed, dual mode is set for all markets with the same settle currency
|
|
@@ -7011,7 +7099,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7011
7099
|
"""
|
|
7012
7100
|
fetches the market ids of underlying assets for a specific contract market type
|
|
7013
7101
|
|
|
7014
|
-
https://www.gate.
|
|
7102
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-underlyings
|
|
7015
7103
|
|
|
7016
7104
|
:param dict [params]: exchange specific params
|
|
7017
7105
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
@@ -7046,7 +7134,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7046
7134
|
"""
|
|
7047
7135
|
retrieves the public liquidations of a trading pair
|
|
7048
7136
|
|
|
7049
|
-
https://www.gate.
|
|
7137
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-liquidation-history
|
|
7050
7138
|
|
|
7051
7139
|
:param str symbol: unified CCXT market symbol
|
|
7052
7140
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7087,9 +7175,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7087
7175
|
"""
|
|
7088
7176
|
retrieves the users liquidated positions
|
|
7089
7177
|
|
|
7090
|
-
https://www.gate.
|
|
7091
|
-
https://www.gate.
|
|
7092
|
-
https://www.gate.
|
|
7178
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-liquidation-history
|
|
7179
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-liquidation-history-2
|
|
7180
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-user-s-liquidation-history-of-specified-underlying
|
|
7093
7181
|
|
|
7094
7182
|
:param str symbol: unified CCXT market symbol
|
|
7095
7183
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7208,12 +7296,27 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7208
7296
|
quoteValueString = self.safe_string(liquidation, 'pnl')
|
|
7209
7297
|
if quoteValueString is None:
|
|
7210
7298
|
quoteValueString = Precise.string_mul(baseValueString, priceString)
|
|
7299
|
+
# --- derive side ---
|
|
7300
|
+
# 1) options payload has explicit 'side': 'long' | 'short'
|
|
7301
|
+
optPos = self.safe_string_lower(liquidation, 'side')
|
|
7302
|
+
side: Str = None
|
|
7303
|
+
if optPos == 'long':
|
|
7304
|
+
side = 'buy'
|
|
7305
|
+
elif optPos == 'short':
|
|
7306
|
+
side = 'sell'
|
|
7307
|
+
else:
|
|
7308
|
+
if size is not None: # 2) futures/perpetual(and fallback for options): infer from size
|
|
7309
|
+
if Precise.string_gt(size, '0'):
|
|
7310
|
+
side = 'buy'
|
|
7311
|
+
elif Precise.string_lt(size, '0'):
|
|
7312
|
+
side = 'sell'
|
|
7211
7313
|
return self.safe_liquidation({
|
|
7212
7314
|
'info': liquidation,
|
|
7213
7315
|
'symbol': self.safe_symbol(marketId, market),
|
|
7214
7316
|
'contracts': self.parse_number(contractsString),
|
|
7215
7317
|
'contractSize': self.parse_number(contractSizeString),
|
|
7216
7318
|
'price': self.parse_number(priceString),
|
|
7319
|
+
'side': side,
|
|
7217
7320
|
'baseValue': self.parse_number(baseValueString),
|
|
7218
7321
|
'quoteValue': self.parse_number(Precise.string_abs(quoteValueString)),
|
|
7219
7322
|
'timestamp': timestamp,
|
|
@@ -7224,7 +7327,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7224
7327
|
"""
|
|
7225
7328
|
fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7226
7329
|
|
|
7227
|
-
https://www.gate.
|
|
7330
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
7228
7331
|
|
|
7229
7332
|
:param str symbol: unified symbol of the market to fetch greeks for
|
|
7230
7333
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7315,9 +7418,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7315
7418
|
"""
|
|
7316
7419
|
closes open positions for a market
|
|
7317
7420
|
|
|
7318
|
-
https://www.gate.
|
|
7319
|
-
https://www.gate.
|
|
7320
|
-
https://www.gate.
|
|
7421
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order
|
|
7422
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
7423
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order
|
|
7321
7424
|
|
|
7322
7425
|
:param str symbol: Unified CCXT market symbol
|
|
7323
7426
|
:param str side: 'buy' or 'sell'
|
|
@@ -7336,9 +7439,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7336
7439
|
"""
|
|
7337
7440
|
fetch the set leverage for a market
|
|
7338
7441
|
|
|
7339
|
-
https://www.gate.
|
|
7340
|
-
https://www.gate.
|
|
7341
|
-
https://www.gate.
|
|
7442
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-unified-account-information
|
|
7443
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-detail-of-lending-market
|
|
7444
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
|
|
7342
7445
|
|
|
7343
7446
|
:param str symbol: unified market symbol
|
|
7344
7447
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7440,8 +7543,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7440
7543
|
"""
|
|
7441
7544
|
fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
|
7442
7545
|
|
|
7443
|
-
https://www.gate.
|
|
7444
|
-
https://www.gate.
|
|
7546
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-lending-markets
|
|
7547
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
|
|
7445
7548
|
|
|
7446
7549
|
:param str[] symbols: a list of unified market symbols
|
|
7447
7550
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7500,7 +7603,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7500
7603
|
"""
|
|
7501
7604
|
fetches option data that is commonly found in an option chain
|
|
7502
7605
|
|
|
7503
|
-
https://www.gate.
|
|
7606
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-detail
|
|
7504
7607
|
|
|
7505
7608
|
:param str symbol: unified market symbol
|
|
7506
7609
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7558,7 +7661,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7558
7661
|
"""
|
|
7559
7662
|
fetches data for an underlying asset that is commonly found in an option chain
|
|
7560
7663
|
|
|
7561
|
-
https://www.gate.
|
|
7664
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
|
|
7562
7665
|
|
|
7563
7666
|
:param str code: base currency to fetch an option chain for
|
|
7564
7667
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7684,8 +7787,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7684
7787
|
"""
|
|
7685
7788
|
fetches historical positions
|
|
7686
7789
|
|
|
7687
|
-
https://www.gate.
|
|
7688
|
-
https://www.gate.
|
|
7790
|
+
https://www.gate.com/docs/developers/apiv4/#list-position-close-history
|
|
7791
|
+
https://www.gate.com/docs/developers/apiv4/#list-position-close-history-2
|
|
7689
7792
|
|
|
7690
7793
|
:param str[] symbols: unified conract symbols, must all have the same settle currency and the same market type
|
|
7691
7794
|
:param int [since]: the earliest time in ms to fetch positions for
|