gate-io-api 0.0.74__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 +150 -21
- gate/ccxt/async_support/base/throttler.py +1 -1
- gate/ccxt/async_support/base/ws/client.py +20 -2
- gate/ccxt/async_support/base/ws/future.py +5 -3
- gate/ccxt/async_support/gate.py +339 -241
- gate/ccxt/base/decimal_to_precision.py +14 -10
- gate/ccxt/base/errors.py +12 -0
- gate/ccxt/base/exchange.py +466 -56
- gate/ccxt/base/types.py +3 -0
- gate/ccxt/gate.py +339 -241
- gate/ccxt/pro/__init__.py +2 -1
- gate/ccxt/pro/gate.py +14 -7
- {gate_io_api-0.0.74.dist-info → gate_io_api-0.0.100.dist-info}/METADATA +70 -25
- {gate_io_api-0.0.74.dist-info → gate_io_api-0.0.100.dist-info}/RECORD +18 -18
- {gate_io_api-0.0.74.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
|
},
|
|
@@ -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)
|
|
@@ -1276,7 +1342,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1276
1342
|
# "sell_start": 1607313600,
|
|
1277
1343
|
# "buy_start": 1700492400,
|
|
1278
1344
|
# "type": "normal",
|
|
1279
|
-
# "trade_url": "https://www.gate.
|
|
1345
|
+
# "trade_url": "https://www.gate.com/trade/QTUM_ETH",
|
|
1280
1346
|
# }
|
|
1281
1347
|
#
|
|
1282
1348
|
# Margin
|
|
@@ -1364,10 +1430,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1364
1430
|
})
|
|
1365
1431
|
return result
|
|
1366
1432
|
|
|
1367
|
-
def
|
|
1433
|
+
def fetch_swap_markets(self, params={}):
|
|
1368
1434
|
result = []
|
|
1369
1435
|
swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
|
|
1370
|
-
|
|
1436
|
+
if self.options['sandboxMode']:
|
|
1437
|
+
swapSettlementCurrencies = ['usdt'] # gate sandbox only has usdt-margined swaps
|
|
1371
1438
|
for c in range(0, len(swapSettlementCurrencies)):
|
|
1372
1439
|
settleId = swapSettlementCurrencies[c]
|
|
1373
1440
|
request: dict = {
|
|
@@ -1377,6 +1444,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1377
1444
|
for i in range(0, len(response)):
|
|
1378
1445
|
parsedMarket = self.parse_contract_market(response[i], settleId)
|
|
1379
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')
|
|
1380
1454
|
for c in range(0, len(futureSettlementCurrencies)):
|
|
1381
1455
|
settleId = futureSettlementCurrencies[c]
|
|
1382
1456
|
request: dict = {
|
|
@@ -1417,8 +1491,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1417
1491
|
# "leverage_min": "1",
|
|
1418
1492
|
# "leverage_max": "100",
|
|
1419
1493
|
# "risk_limit_max": "8000000",
|
|
1420
|
-
# "maker_fee_rate": "-0.00025",
|
|
1421
|
-
# "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
|
|
1422
1496
|
# "funding_rate": "0.002053",
|
|
1423
1497
|
# "order_size_max": 1000000,
|
|
1424
1498
|
# "funding_next_apply": 1610035200,
|
|
@@ -1462,8 +1536,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1462
1536
|
# "risk_limit_base": "140.726652109199",
|
|
1463
1537
|
# "risk_limit_step": "1000000",
|
|
1464
1538
|
# "risk_limit_max": "8000000",
|
|
1465
|
-
# "maker_fee_rate": "-0.00025",
|
|
1466
|
-
# "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
|
|
1467
1541
|
# "ref_discount_rate": "0",
|
|
1468
1542
|
# "ref_rebate_rate": "0.2",
|
|
1469
1543
|
# "order_price_deviate": "0.5",
|
|
@@ -1500,8 +1574,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1500
1574
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1501
1575
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1502
1576
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1503
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1504
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1505
1577
|
isLinear = quote == settle
|
|
1506
1578
|
contractSize = self.safe_string(market, 'quanto_multiplier')
|
|
1507
1579
|
# exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
|
|
@@ -1526,8 +1598,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1526
1598
|
'contract': True,
|
|
1527
1599
|
'linear': isLinear,
|
|
1528
1600
|
'inverse': not isLinear,
|
|
1529
|
-
'taker':
|
|
1530
|
-
'maker':
|
|
1601
|
+
'taker': None,
|
|
1602
|
+
'maker': None,
|
|
1531
1603
|
'contractSize': self.parse_number(contractSize),
|
|
1532
1604
|
'expiry': expiry,
|
|
1533
1605
|
'expiryDatetime': self.iso8601(expiry),
|
|
@@ -1626,8 +1698,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1626
1698
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1627
1699
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1628
1700
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1629
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1630
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1631
1701
|
result.append({
|
|
1632
1702
|
'id': id,
|
|
1633
1703
|
'symbol': symbol,
|
|
@@ -1647,8 +1717,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1647
1717
|
'contract': True,
|
|
1648
1718
|
'linear': True,
|
|
1649
1719
|
'inverse': False,
|
|
1650
|
-
'taker':
|
|
1651
|
-
'maker':
|
|
1720
|
+
'taker': None,
|
|
1721
|
+
'maker': None,
|
|
1652
1722
|
'contractSize': self.parse_number('1'),
|
|
1653
1723
|
'expiry': expiry,
|
|
1654
1724
|
'expiryDatetime': self.iso8601(expiry),
|
|
@@ -1806,7 +1876,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1806
1876
|
"""
|
|
1807
1877
|
fetches all available currencies on an exchange
|
|
1808
1878
|
|
|
1809
|
-
https://www.gate.
|
|
1879
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-currencies-details
|
|
1810
1880
|
|
|
1811
1881
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1812
1882
|
:returns dict: an associative dictionary of currencies
|
|
@@ -1814,7 +1884,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1814
1884
|
# sandbox/testnet only supports future markets
|
|
1815
1885
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
|
1816
1886
|
if apiBackup is not None:
|
|
1817
|
-
return
|
|
1887
|
+
return {}
|
|
1818
1888
|
response = self.publicSpotGetCurrencies(params)
|
|
1819
1889
|
#
|
|
1820
1890
|
# [
|
|
@@ -1907,7 +1977,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1907
1977
|
"""
|
|
1908
1978
|
fetch the current funding rate
|
|
1909
1979
|
|
|
1910
|
-
https://www.gate.
|
|
1980
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-contract
|
|
1911
1981
|
|
|
1912
1982
|
:param str symbol: unified market symbol
|
|
1913
1983
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1969,7 +2039,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1969
2039
|
"""
|
|
1970
2040
|
fetch the funding rate for multiple markets
|
|
1971
2041
|
|
|
1972
|
-
https://www.gate.
|
|
2042
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
1973
2043
|
|
|
1974
2044
|
:param str[]|None symbols: list of unified market symbols
|
|
1975
2045
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2172,11 +2242,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2172
2242
|
"""
|
|
2173
2243
|
fetch the deposit address for a currency associated with self account
|
|
2174
2244
|
|
|
2175
|
-
https://www.gate.
|
|
2245
|
+
https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address
|
|
2176
2246
|
|
|
2177
2247
|
:param str code: unified currency code
|
|
2178
2248
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2179
|
-
: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)
|
|
2180
2250
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
2181
2251
|
"""
|
|
2182
2252
|
self.load_markets()
|
|
@@ -2210,7 +2280,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2210
2280
|
"""
|
|
2211
2281
|
fetch the trading fees for a market
|
|
2212
2282
|
|
|
2213
|
-
https://www.gate.
|
|
2283
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2214
2284
|
|
|
2215
2285
|
:param str symbol: unified market symbol
|
|
2216
2286
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2242,7 +2312,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2242
2312
|
"""
|
|
2243
2313
|
fetch the trading fees for multiple markets
|
|
2244
2314
|
|
|
2245
|
-
https://www.gate.
|
|
2315
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2246
2316
|
|
|
2247
2317
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2248
2318
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
@@ -2308,7 +2378,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2308
2378
|
@deprecated
|
|
2309
2379
|
please use fetchDepositWithdrawFees instead
|
|
2310
2380
|
|
|
2311
|
-
https://www.gate.
|
|
2381
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2312
2382
|
|
|
2313
2383
|
:param str[]|None codes: list of unified currency codes
|
|
2314
2384
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2346,10 +2416,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2346
2416
|
if withdrawFixOnChains is None:
|
|
2347
2417
|
withdrawFees = self.safe_number(entry, 'withdraw_fix')
|
|
2348
2418
|
else:
|
|
2349
|
-
|
|
2350
|
-
for j in range(0, len(
|
|
2351
|
-
|
|
2352
|
-
|
|
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])
|
|
2353
2424
|
result[code] = {
|
|
2354
2425
|
'withdraw': withdrawFees,
|
|
2355
2426
|
'deposit': None,
|
|
@@ -2361,7 +2432,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2361
2432
|
"""
|
|
2362
2433
|
fetch deposit and withdraw fees
|
|
2363
2434
|
|
|
2364
|
-
https://www.gate.
|
|
2435
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2365
2436
|
|
|
2366
2437
|
:param str[]|None codes: list of unified currency codes
|
|
2367
2438
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2442,8 +2513,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2442
2513
|
"""
|
|
2443
2514
|
fetch the history of funding payments paid and received on self account
|
|
2444
2515
|
|
|
2445
|
-
https://www.gate.
|
|
2446
|
-
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
|
|
2447
2518
|
|
|
2448
2519
|
:param str symbol: unified market symbol
|
|
2449
2520
|
:param int [since]: the earliest time in ms to fetch funding history for
|
|
@@ -2522,10 +2593,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2522
2593
|
"""
|
|
2523
2594
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
2524
2595
|
|
|
2525
|
-
https://www.gate.
|
|
2526
|
-
https://www.gate.
|
|
2527
|
-
https://www.gate.
|
|
2528
|
-
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
|
|
2529
2600
|
|
|
2530
2601
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
2531
2602
|
:param int [limit]: the maximum amount of order book entries to return
|
|
@@ -2544,7 +2615,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2544
2615
|
#
|
|
2545
2616
|
request, query = self.prepare_request(market, market['type'], params)
|
|
2546
2617
|
if limit is not None:
|
|
2547
|
-
|
|
2618
|
+
if market['spot']:
|
|
2619
|
+
limit = min(limit, 1000)
|
|
2620
|
+
else:
|
|
2621
|
+
limit = min(limit, 300)
|
|
2622
|
+
request['limit'] = limit
|
|
2548
2623
|
request['with_id'] = True
|
|
2549
2624
|
response = None
|
|
2550
2625
|
if market['spot'] or market['margin']:
|
|
@@ -2635,10 +2710,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2635
2710
|
"""
|
|
2636
2711
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2637
2712
|
|
|
2638
|
-
https://www.gate.
|
|
2639
|
-
https://www.gate.
|
|
2640
|
-
https://www.gate.
|
|
2641
|
-
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
|
|
2642
2717
|
|
|
2643
2718
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
2644
2719
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2788,10 +2863,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2788
2863
|
"""
|
|
2789
2864
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2790
2865
|
|
|
2791
|
-
https://www.gate.
|
|
2792
|
-
https://www.gate.
|
|
2793
|
-
https://www.gate.
|
|
2794
|
-
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
|
|
2795
2870
|
|
|
2796
2871
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2797
2872
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2834,6 +2909,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2834
2909
|
|
|
2835
2910
|
def fetch_balance(self, params={}) -> Balances:
|
|
2836
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
|
+
|
|
2837
2920
|
:param dict [params]: exchange specific parameters
|
|
2838
2921
|
:param str [params.type]: spot, margin, swap or future, if not provided self.options['defaultType'] is used
|
|
2839
2922
|
:param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
|
|
@@ -3074,7 +3157,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3074
3157
|
result: dict = {
|
|
3075
3158
|
'info': response,
|
|
3076
3159
|
}
|
|
3077
|
-
isolated = marginMode == 'margin'
|
|
3160
|
+
isolated = marginMode == 'margin' and type == 'spot'
|
|
3078
3161
|
data = response
|
|
3079
3162
|
if 'balances' in data: # True for cross_margin and unified
|
|
3080
3163
|
flatBalances = []
|
|
@@ -3107,14 +3190,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3107
3190
|
returnResult = result if isolated else self.safe_balance(result)
|
|
3108
3191
|
return returnResult
|
|
3109
3192
|
|
|
3110
|
-
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]:
|
|
3111
3194
|
"""
|
|
3112
3195
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
3113
3196
|
|
|
3114
|
-
https://www.gate.
|
|
3115
|
-
https://www.gate.
|
|
3116
|
-
https://www.gate.
|
|
3117
|
-
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
|
|
3118
3201
|
|
|
3119
3202
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
3120
3203
|
:param str timeframe: the length of time each candle represents
|
|
@@ -3188,7 +3271,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3188
3271
|
"""
|
|
3189
3272
|
fetches historical funding rate prices
|
|
3190
3273
|
|
|
3191
|
-
https://www.gate.
|
|
3274
|
+
https://www.gate.com/docs/developers/apiv4/en/#funding-rate-history
|
|
3192
3275
|
|
|
3193
3276
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
3194
3277
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
|
@@ -3288,10 +3371,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3288
3371
|
"""
|
|
3289
3372
|
get the list of most recent trades for a particular symbol
|
|
3290
3373
|
|
|
3291
|
-
https://www.gate.
|
|
3292
|
-
https://www.gate.
|
|
3293
|
-
https://www.gate.
|
|
3294
|
-
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
|
|
3295
3378
|
|
|
3296
3379
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
3297
3380
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
@@ -3394,10 +3477,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3394
3477
|
"""
|
|
3395
3478
|
fetch all the trades made from a single order
|
|
3396
3479
|
|
|
3397
|
-
https://www.gate.
|
|
3398
|
-
https://www.gate.
|
|
3399
|
-
https://www.gate.
|
|
3400
|
-
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
|
|
3401
3484
|
|
|
3402
3485
|
:param str id: order id
|
|
3403
3486
|
:param str symbol: unified market symbol
|
|
@@ -3435,10 +3518,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3435
3518
|
"""
|
|
3436
3519
|
Fetch personal trading history
|
|
3437
3520
|
|
|
3438
|
-
https://www.gate.
|
|
3439
|
-
https://www.gate.
|
|
3440
|
-
https://www.gate.
|
|
3441
|
-
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
|
|
3442
3525
|
|
|
3443
3526
|
:param str symbol: unified market symbol
|
|
3444
3527
|
:param int [since]: the earliest time in ms to fetch trades for
|
|
@@ -3728,7 +3811,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3728
3811
|
"""
|
|
3729
3812
|
fetch all deposits made to an account
|
|
3730
3813
|
|
|
3731
|
-
https://www.gate.
|
|
3814
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-deposit-records
|
|
3732
3815
|
|
|
3733
3816
|
:param str code: unified currency code
|
|
3734
3817
|
:param int [since]: the earliest time in ms to fetch deposits for
|
|
@@ -3762,7 +3845,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3762
3845
|
"""
|
|
3763
3846
|
fetch all withdrawals made from an account
|
|
3764
3847
|
|
|
3765
|
-
https://www.gate.
|
|
3848
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
|
3766
3849
|
|
|
3767
3850
|
:param str code: unified currency code
|
|
3768
3851
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
@@ -3788,15 +3871,15 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3788
3871
|
start = self.parse_to_int(since / 1000)
|
|
3789
3872
|
request['from'] = start
|
|
3790
3873
|
request['to'] = self.sum(start, 30 * 24 * 60 * 60)
|
|
3791
|
-
request, params = self.handle_until_option('to', request, params)
|
|
3874
|
+
request, params = self.handle_until_option('to', request, params, 0.001)
|
|
3792
3875
|
response = self.privateWalletGetWithdrawals(self.extend(request, params))
|
|
3793
3876
|
return self.parse_transactions(response, currency)
|
|
3794
3877
|
|
|
3795
|
-
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:
|
|
3796
3879
|
"""
|
|
3797
3880
|
make a withdrawal
|
|
3798
3881
|
|
|
3799
|
-
https://www.gate.
|
|
3882
|
+
https://www.gate.com/docs/developers/apiv4/en/#withdraw
|
|
3800
3883
|
|
|
3801
3884
|
:param str code: unified currency code
|
|
3802
3885
|
:param float amount: the amount to withdraw
|
|
@@ -3970,13 +4053,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3970
4053
|
"""
|
|
3971
4054
|
Create an order on the exchange
|
|
3972
4055
|
|
|
3973
|
-
https://www.gate.
|
|
3974
|
-
https://www.gate.
|
|
3975
|
-
https://www.gate.
|
|
3976
|
-
https://www.gate.
|
|
3977
|
-
https://www.gate.
|
|
3978
|
-
https://www.gate.
|
|
3979
|
-
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
|
|
3980
4063
|
|
|
3981
4064
|
:param str symbol: Unified CCXT market symbol
|
|
3982
4065
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
|
@@ -4119,7 +4202,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4119
4202
|
triggerValue = self.safe_value_n(orderParams, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
|
|
4120
4203
|
if triggerValue is not None:
|
|
4121
4204
|
raise NotSupported(self.id + ' createOrders() does not support advanced order properties(stopPrice, takeProfitPrice, stopLossPrice)')
|
|
4122
|
-
extendedParams['textIsRequired'] = True #
|
|
4205
|
+
extendedParams['textIsRequired'] = True # the exchange requires a text parameter for each order here
|
|
4123
4206
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
|
|
4124
4207
|
ordersRequests.append(orderRequest)
|
|
4125
4208
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
|
@@ -4132,9 +4215,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4132
4215
|
"""
|
|
4133
4216
|
create a list of trade orders
|
|
4134
4217
|
|
|
4135
|
-
https://www.gate.
|
|
4136
|
-
https://www.gate.
|
|
4137
|
-
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
|
|
4138
4221
|
|
|
4139
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
|
|
4140
4223
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -4367,7 +4450,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4367
4450
|
"""
|
|
4368
4451
|
create a market buy order by providing the symbol and cost
|
|
4369
4452
|
|
|
4370
|
-
https://www.gate.
|
|
4453
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-order
|
|
4371
4454
|
|
|
4372
4455
|
:param str symbol: unified symbol of the market to create an order in
|
|
4373
4456
|
:param float cost: how much you want to trade in units of the quote currency
|
|
@@ -4420,8 +4503,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4420
4503
|
"""
|
|
4421
4504
|
edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4422
4505
|
|
|
4423
|
-
https://www.gate.
|
|
4424
|
-
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
|
|
4425
4508
|
|
|
4426
4509
|
:param str id: order id
|
|
4427
4510
|
:param str symbol: unified symbol of the market to create an order in
|
|
@@ -4765,10 +4848,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4765
4848
|
"""
|
|
4766
4849
|
Retrieves information on an order
|
|
4767
4850
|
|
|
4768
|
-
https://www.gate.
|
|
4769
|
-
https://www.gate.
|
|
4770
|
-
https://www.gate.
|
|
4771
|
-
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
|
|
4772
4855
|
|
|
4773
4856
|
:param str id: Order id
|
|
4774
4857
|
:param str symbol: Unified market symbol, *required for spot and margin*
|
|
@@ -4813,8 +4896,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4813
4896
|
"""
|
|
4814
4897
|
fetch all unfilled currently open orders
|
|
4815
4898
|
|
|
4816
|
-
https://www.gate.
|
|
4817
|
-
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
|
|
4818
4901
|
|
|
4819
4902
|
:param str symbol: unified market symbol
|
|
4820
4903
|
:param int [since]: the earliest time in ms to fetch open orders for
|
|
@@ -4832,14 +4915,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4832
4915
|
"""
|
|
4833
4916
|
fetches information on multiple closed orders made by the user
|
|
4834
4917
|
|
|
4835
|
-
https://www.gate.
|
|
4836
|
-
https://www.gate.
|
|
4837
|
-
https://www.gate.
|
|
4838
|
-
https://www.gate.
|
|
4839
|
-
https://www.gate.
|
|
4840
|
-
https://www.gate.
|
|
4841
|
-
https://www.gate.
|
|
4842
|
-
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
|
|
4843
4926
|
|
|
4844
4927
|
:param str symbol: unified market symbol of the market orders were made in
|
|
4845
4928
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
@@ -5106,10 +5189,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5106
5189
|
"""
|
|
5107
5190
|
Cancels an open order
|
|
5108
5191
|
|
|
5109
|
-
https://www.gate.
|
|
5110
|
-
https://www.gate.
|
|
5111
|
-
https://www.gate.
|
|
5112
|
-
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
|
|
5113
5196
|
|
|
5114
5197
|
:param str id: Order id
|
|
5115
5198
|
:param str symbol: Unified market symbol
|
|
@@ -5233,8 +5316,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5233
5316
|
"""
|
|
5234
5317
|
cancel multiple orders
|
|
5235
5318
|
|
|
5236
|
-
https://www.gate.
|
|
5237
|
-
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
|
|
5238
5321
|
|
|
5239
5322
|
:param str[] ids: order ids
|
|
5240
5323
|
:param str symbol: unified symbol of the market the order was made in
|
|
@@ -5277,7 +5360,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5277
5360
|
"""
|
|
5278
5361
|
cancel multiple orders for multiple symbols
|
|
5279
5362
|
|
|
5280
|
-
https://www.gate.
|
|
5363
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5281
5364
|
|
|
5282
5365
|
:param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
5283
5366
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5315,10 +5398,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5315
5398
|
"""
|
|
5316
5399
|
cancel all open orders
|
|
5317
5400
|
|
|
5318
|
-
https://www.gate.
|
|
5319
|
-
https://www.gate.
|
|
5320
|
-
https://www.gate.
|
|
5321
|
-
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
|
|
5322
5405
|
|
|
5323
5406
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
5324
5407
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5386,7 +5469,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5386
5469
|
"""
|
|
5387
5470
|
transfer currency internally between wallets on the same account
|
|
5388
5471
|
|
|
5389
|
-
https://www.gate.
|
|
5472
|
+
https://www.gate.com/docs/developers/apiv4/en/#transfer-between-trading-accounts
|
|
5390
5473
|
|
|
5391
5474
|
:param str code: unified currency code for currency being transferred
|
|
5392
5475
|
:param float amount: the amount of currency to transfer
|
|
@@ -5460,12 +5543,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5460
5543
|
'info': transfer,
|
|
5461
5544
|
}
|
|
5462
5545
|
|
|
5463
|
-
def set_leverage(self, leverage:
|
|
5546
|
+
def set_leverage(self, leverage: int, symbol: Str = None, params={}):
|
|
5464
5547
|
"""
|
|
5465
5548
|
set the level of leverage for a market
|
|
5466
5549
|
|
|
5467
|
-
https://www.gate.
|
|
5468
|
-
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
|
|
5469
5552
|
|
|
5470
5553
|
:param float leverage: the rate of leverage
|
|
5471
5554
|
:param str symbol: unified market symbol
|
|
@@ -5668,9 +5751,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5668
5751
|
"""
|
|
5669
5752
|
fetch data on an open contract position
|
|
5670
5753
|
|
|
5671
|
-
https://www.gate.
|
|
5672
|
-
https://www.gate.
|
|
5673
|
-
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
|
|
5674
5757
|
|
|
5675
5758
|
:param str symbol: unified market symbol of the market the position is held in
|
|
5676
5759
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5752,9 +5835,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5752
5835
|
"""
|
|
5753
5836
|
fetch all open positions
|
|
5754
5837
|
|
|
5755
|
-
https://www.gate.
|
|
5756
|
-
https://www.gate.
|
|
5757
|
-
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
|
|
5758
5841
|
|
|
5759
5842
|
:param str[]|None symbols: Not used by gate, but parsed internally by CCXT
|
|
5760
5843
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5854,8 +5937,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5854
5937
|
"""
|
|
5855
5938
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
5856
5939
|
|
|
5857
|
-
https://www.gate.
|
|
5858
|
-
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
|
|
5859
5942
|
|
|
5860
5943
|
:param str[] [symbols]: list of unified market symbols
|
|
5861
5944
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5971,7 +6054,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5971
6054
|
"""
|
|
5972
6055
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
5973
6056
|
|
|
5974
|
-
https://www.gate.
|
|
6057
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-risk-limit-tiers
|
|
5975
6058
|
|
|
5976
6059
|
:param str symbol: unified market symbol
|
|
5977
6060
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5983,7 +6066,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5983
6066
|
request, requestParams = self.prepare_request(market, type, query)
|
|
5984
6067
|
if type != 'future' and type != 'swap':
|
|
5985
6068
|
raise BadRequest(self.id + ' fetchMarketLeverageTiers only supports swap and future')
|
|
5986
|
-
response = self.
|
|
6069
|
+
response = self.publicFuturesGetSettleRiskLimitTiers(self.extend(request, requestParams))
|
|
5987
6070
|
#
|
|
5988
6071
|
# [
|
|
5989
6072
|
# {
|
|
@@ -6061,7 +6144,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6061
6144
|
"""
|
|
6062
6145
|
repay borrowed margin and interest
|
|
6063
6146
|
|
|
6064
|
-
https://www.gate.
|
|
6147
|
+
https://www.gate.com/docs/apiv4/en/#repay-a-loan
|
|
6065
6148
|
|
|
6066
6149
|
:param str symbol: unified market symbol
|
|
6067
6150
|
:param str code: unified currency code of the currency to repay
|
|
@@ -6090,8 +6173,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6090
6173
|
"""
|
|
6091
6174
|
repay cross margin borrowed margin and interest
|
|
6092
6175
|
|
|
6093
|
-
https://www.gate.
|
|
6094
|
-
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
|
|
6095
6178
|
|
|
6096
6179
|
:param str code: unified currency code of the currency to repay
|
|
6097
6180
|
:param float amount: the amount to repay
|
|
@@ -6139,7 +6222,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6139
6222
|
"""
|
|
6140
6223
|
create a loan to borrow margin
|
|
6141
6224
|
|
|
6142
|
-
https://www.gate.
|
|
6225
|
+
https://www.gate.com/docs/developers/apiv4/en/#marginuni
|
|
6143
6226
|
|
|
6144
6227
|
:param str symbol: unified market symbol, required for isolated margin
|
|
6145
6228
|
:param str code: unified currency code of the currency to borrow
|
|
@@ -6184,8 +6267,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6184
6267
|
"""
|
|
6185
6268
|
create a loan to borrow margin
|
|
6186
6269
|
|
|
6187
|
-
https://www.gate.
|
|
6188
|
-
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
|
|
6189
6272
|
|
|
6190
6273
|
:param str code: unified currency code of the currency to borrow
|
|
6191
6274
|
:param float amount: the amount to borrow
|
|
@@ -6282,9 +6365,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6282
6365
|
"""
|
|
6283
6366
|
fetch the interest owed by the user for borrowing currency for margin trading
|
|
6284
6367
|
|
|
6285
|
-
https://www.gate.
|
|
6286
|
-
https://www.gate.
|
|
6287
|
-
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
|
|
6288
6371
|
|
|
6289
6372
|
:param str [code]: unified currency code
|
|
6290
6373
|
:param str [symbol]: unified market symbol when fetching interest in isolated markets
|
|
@@ -6485,8 +6568,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6485
6568
|
"""
|
|
6486
6569
|
remove margin from a position
|
|
6487
6570
|
|
|
6488
|
-
https://www.gate.
|
|
6489
|
-
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
|
|
6490
6573
|
|
|
6491
6574
|
:param str symbol: unified market symbol
|
|
6492
6575
|
:param float amount: the amount of margin to remove
|
|
@@ -6499,8 +6582,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6499
6582
|
"""
|
|
6500
6583
|
add margin
|
|
6501
6584
|
|
|
6502
|
-
https://www.gate.
|
|
6503
|
-
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
|
|
6504
6587
|
|
|
6505
6588
|
:param str symbol: unified market symbol
|
|
6506
6589
|
:param float amount: amount of margin to add
|
|
@@ -6513,7 +6596,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6513
6596
|
"""
|
|
6514
6597
|
Retrieves the open interest of a currency
|
|
6515
6598
|
|
|
6516
|
-
https://www.gate.
|
|
6599
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-stats
|
|
6517
6600
|
|
|
6518
6601
|
:param str symbol: Unified CCXT market symbol
|
|
6519
6602
|
:param str timeframe: "5m", "15m", "30m", "1h", "4h", "1d"
|
|
@@ -6597,7 +6680,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6597
6680
|
"""
|
|
6598
6681
|
fetches historical settlement records
|
|
6599
6682
|
|
|
6600
|
-
https://www.gate.
|
|
6683
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-settlement-history-2
|
|
6601
6684
|
|
|
6602
6685
|
:param str symbol: unified market symbol of the settlement history, required on gate
|
|
6603
6686
|
:param int [since]: timestamp in ms
|
|
@@ -6643,7 +6726,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6643
6726
|
"""
|
|
6644
6727
|
fetches historical settlement records of the user
|
|
6645
6728
|
|
|
6646
|
-
https://www.gate.
|
|
6729
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-my-options-settlements
|
|
6647
6730
|
|
|
6648
6731
|
:param str symbol: unified market symbol of the settlement history
|
|
6649
6732
|
:param int [since]: timestamp in ms
|
|
@@ -6768,11 +6851,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6768
6851
|
"""
|
|
6769
6852
|
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
6770
6853
|
|
|
6771
|
-
https://www.gate.
|
|
6772
|
-
https://www.gate.
|
|
6773
|
-
https://www.gate.
|
|
6774
|
-
https://www.gate.
|
|
6775
|
-
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
|
|
6776
6859
|
|
|
6777
6860
|
:param str [code]: unified currency code
|
|
6778
6861
|
:param int [since]: timestamp in ms of the earliest ledger entry
|
|
@@ -6999,7 +7082,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6999
7082
|
"""
|
|
7000
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
|
|
7001
7084
|
|
|
7002
|
-
https://www.gate.
|
|
7085
|
+
https://www.gate.com/docs/developers/apiv4/en/#enable-or-disable-dual-mode
|
|
7003
7086
|
|
|
7004
7087
|
:param bool hedged: set to True to enable dual mode
|
|
7005
7088
|
:param str|None symbol: if passed, dual mode is set for all markets with the same settle currency
|
|
@@ -7016,7 +7099,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7016
7099
|
"""
|
|
7017
7100
|
fetches the market ids of underlying assets for a specific contract market type
|
|
7018
7101
|
|
|
7019
|
-
https://www.gate.
|
|
7102
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-underlyings
|
|
7020
7103
|
|
|
7021
7104
|
:param dict [params]: exchange specific params
|
|
7022
7105
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
@@ -7051,7 +7134,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7051
7134
|
"""
|
|
7052
7135
|
retrieves the public liquidations of a trading pair
|
|
7053
7136
|
|
|
7054
|
-
https://www.gate.
|
|
7137
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-liquidation-history
|
|
7055
7138
|
|
|
7056
7139
|
:param str symbol: unified CCXT market symbol
|
|
7057
7140
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7092,9 +7175,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7092
7175
|
"""
|
|
7093
7176
|
retrieves the users liquidated positions
|
|
7094
7177
|
|
|
7095
|
-
https://www.gate.
|
|
7096
|
-
https://www.gate.
|
|
7097
|
-
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
|
|
7098
7181
|
|
|
7099
7182
|
:param str symbol: unified CCXT market symbol
|
|
7100
7183
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7213,12 +7296,27 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7213
7296
|
quoteValueString = self.safe_string(liquidation, 'pnl')
|
|
7214
7297
|
if quoteValueString is None:
|
|
7215
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'
|
|
7216
7313
|
return self.safe_liquidation({
|
|
7217
7314
|
'info': liquidation,
|
|
7218
7315
|
'symbol': self.safe_symbol(marketId, market),
|
|
7219
7316
|
'contracts': self.parse_number(contractsString),
|
|
7220
7317
|
'contractSize': self.parse_number(contractSizeString),
|
|
7221
7318
|
'price': self.parse_number(priceString),
|
|
7319
|
+
'side': side,
|
|
7222
7320
|
'baseValue': self.parse_number(baseValueString),
|
|
7223
7321
|
'quoteValue': self.parse_number(Precise.string_abs(quoteValueString)),
|
|
7224
7322
|
'timestamp': timestamp,
|
|
@@ -7229,7 +7327,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7229
7327
|
"""
|
|
7230
7328
|
fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7231
7329
|
|
|
7232
|
-
https://www.gate.
|
|
7330
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
7233
7331
|
|
|
7234
7332
|
:param str symbol: unified symbol of the market to fetch greeks for
|
|
7235
7333
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7320,9 +7418,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7320
7418
|
"""
|
|
7321
7419
|
closes open positions for a market
|
|
7322
7420
|
|
|
7323
|
-
https://www.gate.
|
|
7324
|
-
https://www.gate.
|
|
7325
|
-
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
|
|
7326
7424
|
|
|
7327
7425
|
:param str symbol: Unified CCXT market symbol
|
|
7328
7426
|
:param str side: 'buy' or 'sell'
|
|
@@ -7341,9 +7439,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7341
7439
|
"""
|
|
7342
7440
|
fetch the set leverage for a market
|
|
7343
7441
|
|
|
7344
|
-
https://www.gate.
|
|
7345
|
-
https://www.gate.
|
|
7346
|
-
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
|
|
7347
7445
|
|
|
7348
7446
|
:param str symbol: unified market symbol
|
|
7349
7447
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7445,8 +7543,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7445
7543
|
"""
|
|
7446
7544
|
fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
|
7447
7545
|
|
|
7448
|
-
https://www.gate.
|
|
7449
|
-
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
|
|
7450
7548
|
|
|
7451
7549
|
:param str[] symbols: a list of unified market symbols
|
|
7452
7550
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7505,7 +7603,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7505
7603
|
"""
|
|
7506
7604
|
fetches option data that is commonly found in an option chain
|
|
7507
7605
|
|
|
7508
|
-
https://www.gate.
|
|
7606
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-detail
|
|
7509
7607
|
|
|
7510
7608
|
:param str symbol: unified market symbol
|
|
7511
7609
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7563,7 +7661,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7563
7661
|
"""
|
|
7564
7662
|
fetches data for an underlying asset that is commonly found in an option chain
|
|
7565
7663
|
|
|
7566
|
-
https://www.gate.
|
|
7664
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
|
|
7567
7665
|
|
|
7568
7666
|
:param str code: base currency to fetch an option chain for
|
|
7569
7667
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7689,8 +7787,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7689
7787
|
"""
|
|
7690
7788
|
fetches historical positions
|
|
7691
7789
|
|
|
7692
|
-
https://www.gate.
|
|
7693
|
-
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
|
|
7694
7792
|
|
|
7695
7793
|
:param str[] symbols: unified conract symbols, must all have the same settle currency and the same market type
|
|
7696
7794
|
:param int [since]: the earliest time in ms to fetch positions for
|