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/async_support/gate.py
CHANGED
|
@@ -33,7 +33,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
33
33
|
def describe(self) -> Any:
|
|
34
34
|
return self.deep_extend(super(gate, self).describe(), {
|
|
35
35
|
'id': 'gate',
|
|
36
|
-
'name': 'Gate
|
|
36
|
+
'name': 'Gate',
|
|
37
37
|
'countries': ['KR'],
|
|
38
38
|
'rateLimit': 50, # 200 requests per 10 second or 50ms
|
|
39
39
|
'version': 'v4',
|
|
@@ -41,8 +41,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
41
41
|
'pro': True,
|
|
42
42
|
'urls': {
|
|
43
43
|
'logo': 'https://github.com/user-attachments/assets/64f988c5-07b6-4652-b5c1-679a6bf67c85',
|
|
44
|
-
'doc': 'https://www.gate.
|
|
45
|
-
'www': 'https://gate.
|
|
44
|
+
'doc': 'https://www.gate.com/docs/developers/apiv4/en/',
|
|
45
|
+
'www': 'https://gate.com',
|
|
46
46
|
'api': {
|
|
47
47
|
'public': {
|
|
48
48
|
'wallet': 'https://api.gateio.ws/api/v4',
|
|
@@ -72,18 +72,28 @@ class gate(Exchange, ImplicitAPI):
|
|
|
72
72
|
},
|
|
73
73
|
'test': {
|
|
74
74
|
'public': {
|
|
75
|
-
'futures': 'https://
|
|
76
|
-
'delivery': 'https://
|
|
77
|
-
'options': 'https://
|
|
75
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
76
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
77
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
78
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
79
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
80
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
81
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
82
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
78
83
|
},
|
|
79
84
|
'private': {
|
|
80
|
-
'futures': 'https://
|
|
81
|
-
'delivery': 'https://
|
|
82
|
-
'options': 'https://
|
|
85
|
+
'futures': 'https://api-testnet.gateapi.io/api/v4',
|
|
86
|
+
'delivery': 'https://api-testnet.gateapi.io/api/v4',
|
|
87
|
+
'options': 'https://api-testnet.gateapi.io/api/v4',
|
|
88
|
+
'spot': 'https://api-testnet.gateapi.io/api/v4',
|
|
89
|
+
'wallet': 'https://api-testnet.gateapi.io/api/v4',
|
|
90
|
+
'margin': 'https://api-testnet.gateapi.io/api/v4',
|
|
91
|
+
'sub_accounts': 'https://api-testnet.gateapi.io/api/v4',
|
|
92
|
+
'account': 'https://api-testnet.gateapi.io/api/v4',
|
|
83
93
|
},
|
|
84
94
|
},
|
|
85
95
|
'referral': {
|
|
86
|
-
'url': 'https://www.gate.
|
|
96
|
+
'url': 'https://www.gate.com/share/CCXTGATE',
|
|
87
97
|
'discount': 0.2,
|
|
88
98
|
},
|
|
89
99
|
},
|
|
@@ -196,6 +206,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
196
206
|
'currency_chains': 1,
|
|
197
207
|
},
|
|
198
208
|
},
|
|
209
|
+
'unified': {
|
|
210
|
+
'get': {
|
|
211
|
+
'currencies': 1,
|
|
212
|
+
'history_loan_rate': 1,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
199
215
|
'spot': {
|
|
200
216
|
'get': {
|
|
201
217
|
'currencies': 1,
|
|
@@ -207,22 +223,25 @@ class gate(Exchange, ImplicitAPI):
|
|
|
207
223
|
'trades': 1,
|
|
208
224
|
'candlesticks': 1,
|
|
209
225
|
'time': 1,
|
|
226
|
+
'insurance_history': 1,
|
|
210
227
|
},
|
|
211
228
|
},
|
|
212
229
|
'margin': {
|
|
213
230
|
'get': {
|
|
214
|
-
'currency_pairs': 1,
|
|
215
|
-
'currency_pairs/{currency_pair}': 1,
|
|
216
|
-
'funding_book': 1,
|
|
217
|
-
'cross/currencies': 1,
|
|
218
|
-
'cross/currencies/{currency}': 1,
|
|
219
231
|
'uni/currency_pairs': 1,
|
|
220
232
|
'uni/currency_pairs/{currency_pair}': 1,
|
|
233
|
+
'loan_margin_tiers': 1,
|
|
234
|
+
'currency_pairs': 1, # deprecated
|
|
235
|
+
'currency_pairs/{currency_pair}': 1, # deprecated
|
|
236
|
+
'funding_book': 1, # deprecated
|
|
237
|
+
'cross/currencies': 1, # deprecated
|
|
238
|
+
'cross/currencies/{currency}': 1, # deprecated
|
|
221
239
|
},
|
|
222
240
|
},
|
|
223
241
|
'flash_swap': {
|
|
224
242
|
'get': {
|
|
225
|
-
'
|
|
243
|
+
'currency_pairs': 1,
|
|
244
|
+
'currencies': 1, # deprecated
|
|
226
245
|
},
|
|
227
246
|
},
|
|
228
247
|
'futures': {
|
|
@@ -251,6 +270,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
251
270
|
'{settle}/candlesticks': 1,
|
|
252
271
|
'{settle}/tickers': 1,
|
|
253
272
|
'{settle}/insurance': 1,
|
|
273
|
+
'{settle}/risk_limit_tiers': 1,
|
|
254
274
|
},
|
|
255
275
|
},
|
|
256
276
|
'options': {
|
|
@@ -273,6 +293,17 @@ class gate(Exchange, ImplicitAPI):
|
|
|
273
293
|
'get': {
|
|
274
294
|
'uni/currencies': 1,
|
|
275
295
|
'uni/currencies/{currency}': 1,
|
|
296
|
+
'dual/investment_plan': 1,
|
|
297
|
+
'structured/products': 1,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
'loan': {
|
|
301
|
+
'get': {
|
|
302
|
+
'collateral/currencies': 1,
|
|
303
|
+
'multi_collateral/currencies': 1,
|
|
304
|
+
'multi_collateral/ltv': 1,
|
|
305
|
+
'multi_collateral/fixed_rate': 1,
|
|
306
|
+
'multi_collateral/current_rate': 1,
|
|
276
307
|
},
|
|
277
308
|
},
|
|
278
309
|
},
|
|
@@ -336,25 +367,28 @@ class gate(Exchange, ImplicitAPI):
|
|
|
336
367
|
'unified': {
|
|
337
368
|
'get': {
|
|
338
369
|
'accounts': 20 / 15,
|
|
339
|
-
'account_mode': 20 / 15,
|
|
340
370
|
'borrowable': 20 / 15,
|
|
341
371
|
'transferable': 20 / 15,
|
|
372
|
+
'transferables': 20 / 15,
|
|
373
|
+
'batch_borrowable': 20 / 15,
|
|
342
374
|
'loans': 20 / 15,
|
|
343
375
|
'loan_records': 20 / 15,
|
|
344
376
|
'interest_records': 20 / 15,
|
|
345
|
-
'estimate_rate': 20 / 15,
|
|
346
|
-
'currency_discount_tiers': 20 / 15,
|
|
347
377
|
'risk_units': 20 / 15,
|
|
348
378
|
'unified_mode': 20 / 15,
|
|
379
|
+
'estimate_rate': 20 / 15,
|
|
380
|
+
'currency_discount_tiers': 20 / 15,
|
|
349
381
|
'loan_margin_tiers': 20 / 15,
|
|
350
382
|
'leverage/user_currency_config': 20 / 15,
|
|
351
383
|
'leverage/user_currency_setting': 20 / 15,
|
|
384
|
+
'account_mode': 20 / 15, # deprecated
|
|
352
385
|
},
|
|
353
386
|
'post': {
|
|
354
|
-
'account_mode': 20 / 15,
|
|
355
387
|
'loans': 200 / 15, # 15r/10s cost = 20 / 1.5 = 13.33
|
|
356
388
|
'portfolio_calculator': 20 / 15,
|
|
357
389
|
'leverage/user_currency_setting': 20 / 15,
|
|
390
|
+
'collateral_currencies': 20 / 15,
|
|
391
|
+
'account_mode': 20 / 15, # deprecated
|
|
358
392
|
},
|
|
359
393
|
'put': {
|
|
360
394
|
'unified_mode': 20 / 15,
|
|
@@ -400,48 +434,49 @@ class gate(Exchange, ImplicitAPI):
|
|
|
400
434
|
'funding_accounts': 20 / 15,
|
|
401
435
|
'auto_repay': 20 / 15,
|
|
402
436
|
'transferable': 20 / 15,
|
|
403
|
-
'loans': 20 / 15,
|
|
404
|
-
'loans/{loan_id}': 20 / 15,
|
|
405
|
-
'loans/{loan_id}/repayment': 20 / 15,
|
|
406
|
-
'loan_records': 20 / 15,
|
|
407
|
-
'loan_records/{loan_record_id}': 20 / 15,
|
|
408
|
-
'borrowable': 20 / 15,
|
|
409
|
-
'cross/accounts': 20 / 15,
|
|
410
|
-
'cross/account_book': 20 / 15,
|
|
411
|
-
'cross/loans': 20 / 15,
|
|
412
|
-
'cross/loans/{loan_id}': 20 / 15,
|
|
413
|
-
'cross/repayments': 20 / 15,
|
|
414
|
-
'cross/interest_records': 20 / 15,
|
|
415
|
-
'cross/transferable': 20 / 15,
|
|
416
|
-
'cross/estimate_rate': 20 / 15,
|
|
417
|
-
'cross/borrowable': 20 / 15,
|
|
418
437
|
'uni/estimate_rate': 20 / 15,
|
|
419
438
|
'uni/loans': 20 / 15,
|
|
420
439
|
'uni/loan_records': 20 / 15,
|
|
421
440
|
'uni/interest_records': 20 / 15,
|
|
422
441
|
'uni/borrowable': 20 / 15,
|
|
442
|
+
'user/loan_margin_tiers': 20 / 15,
|
|
443
|
+
'user/account': 20 / 15,
|
|
444
|
+
'loans': 20 / 15, # deprecated
|
|
445
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
446
|
+
'loans/{loan_id}/repayment': 20 / 15, # deprecated
|
|
447
|
+
'loan_records': 20 / 15, # deprecated
|
|
448
|
+
'loan_records/{loan_record_id}': 20 / 15, # deprecated
|
|
449
|
+
'borrowable': 20 / 15, # deprecated
|
|
450
|
+
'cross/accounts': 20 / 15, # deprecated
|
|
451
|
+
'cross/account_book': 20 / 15, # deprecated
|
|
452
|
+
'cross/loans': 20 / 15, # deprecated
|
|
453
|
+
'cross/loans/{loan_id}': 20 / 15, # deprecated
|
|
454
|
+
'cross/repayments': 20 / 15, # deprecated
|
|
455
|
+
'cross/interest_records': 20 / 15, # deprecated
|
|
456
|
+
'cross/transferable': 20 / 15, # deprecated
|
|
457
|
+
'cross/estimate_rate': 20 / 15, # deprecated
|
|
458
|
+
'cross/borrowable': 20 / 15, # deprecated
|
|
423
459
|
},
|
|
424
460
|
'post': {
|
|
425
461
|
'auto_repay': 20 / 15,
|
|
426
|
-
'loans': 20 / 15,
|
|
427
|
-
'merged_loans': 20 / 15,
|
|
428
|
-
'loans/{loan_id}/repayment': 20 / 15,
|
|
429
|
-
'cross/loans': 20 / 15,
|
|
430
|
-
'cross/repayments': 20 / 15,
|
|
431
462
|
'uni/loans': 20 / 15,
|
|
463
|
+
'leverage/user_market_setting': 20 / 15,
|
|
464
|
+
'loans': 20 / 15, # deprecated
|
|
465
|
+
'merged_loans': 20 / 15, # deprecated
|
|
466
|
+
'loans/{loan_id}/repayment': 20 / 15, # deprecated
|
|
467
|
+
'cross/loans': 20 / 15, # deprecated
|
|
468
|
+
'cross/repayments': 20 / 15, # deprecated
|
|
432
469
|
},
|
|
433
470
|
'patch': {
|
|
434
|
-
'loans/{loan_id}': 20 / 15,
|
|
435
|
-
'loan_records/{loan_record_id}': 20 / 15,
|
|
471
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
472
|
+
'loan_records/{loan_record_id}': 20 / 15, # deprecated
|
|
436
473
|
},
|
|
437
474
|
'delete': {
|
|
438
|
-
'loans/{loan_id}': 20 / 15,
|
|
475
|
+
'loans/{loan_id}': 20 / 15, # deprecated
|
|
439
476
|
},
|
|
440
477
|
},
|
|
441
478
|
'flash_swap': {
|
|
442
479
|
'get': {
|
|
443
|
-
'currencies': 1,
|
|
444
|
-
'currency_pairs': 1,
|
|
445
480
|
'orders': 1,
|
|
446
481
|
'orders/{order_id}': 1,
|
|
447
482
|
},
|
|
@@ -466,7 +501,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
466
501
|
'{settle}/liquidates': 1,
|
|
467
502
|
'{settle}/auto_deleverages': 1,
|
|
468
503
|
'{settle}/fee': 1,
|
|
469
|
-
'{settle}/
|
|
504
|
+
'{settle}/risk_limit_table': 1,
|
|
470
505
|
'{settle}/price_orders': 1,
|
|
471
506
|
'{settle}/price_orders/{order_id}': 1,
|
|
472
507
|
},
|
|
@@ -474,6 +509,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
474
509
|
'{settle}/positions/{contract}/margin': 1,
|
|
475
510
|
'{settle}/positions/{contract}/leverage': 1,
|
|
476
511
|
'{settle}/positions/{contract}/risk_limit': 1,
|
|
512
|
+
'{settle}/positions/cross_mode': 1,
|
|
513
|
+
'{settle}/dual_comp/positions/cross_mode': 1,
|
|
477
514
|
'{settle}/dual_mode': 1,
|
|
478
515
|
'{settle}/dual_comp/positions/{contract}/margin': 1,
|
|
479
516
|
'{settle}/dual_comp/positions/{contract}/leverage': 1,
|
|
@@ -482,6 +519,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
482
519
|
'{settle}/batch_orders': 0.4,
|
|
483
520
|
'{settle}/countdown_cancel_all': 0.4,
|
|
484
521
|
'{settle}/batch_cancel_orders': 0.4,
|
|
522
|
+
'{settle}/batch_amend_orders': 0.4,
|
|
523
|
+
'{settle}/bbo_orders': 0.4,
|
|
485
524
|
'{settle}/price_orders': 0.4,
|
|
486
525
|
},
|
|
487
526
|
'put': {
|
|
@@ -549,19 +588,32 @@ class gate(Exchange, ImplicitAPI):
|
|
|
549
588
|
},
|
|
550
589
|
'earn': {
|
|
551
590
|
'get': {
|
|
552
|
-
'uni/currencies': 20 / 15,
|
|
553
|
-
'uni/currencies/{currency}': 20 / 15,
|
|
554
591
|
'uni/lends': 20 / 15,
|
|
555
592
|
'uni/lend_records': 20 / 15,
|
|
556
593
|
'uni/interests/{currency}': 20 / 15,
|
|
557
594
|
'uni/interest_records': 20 / 15,
|
|
558
595
|
'uni/interest_status/{currency}': 20 / 15,
|
|
596
|
+
'uni/chart': 20 / 15,
|
|
597
|
+
'uni/rate': 20 / 15,
|
|
598
|
+
'staking/eth2/rate_records': 20 / 15,
|
|
599
|
+
'dual/orders': 20 / 15,
|
|
600
|
+
'structured/orders': 20 / 15,
|
|
601
|
+
'staking/coins': 20 / 15,
|
|
602
|
+
'staking/order_list': 20 / 15,
|
|
603
|
+
'staking/award_list': 20 / 15,
|
|
604
|
+
'staking/assets': 20 / 15,
|
|
605
|
+
'uni/currencies': 20 / 15, # deprecated
|
|
606
|
+
'uni/currencies/{currency}': 20 / 15, # deprecated
|
|
559
607
|
},
|
|
560
608
|
'post': {
|
|
561
609
|
'uni/lends': 20 / 15,
|
|
610
|
+
'staking/eth2/swap': 20 / 15,
|
|
611
|
+
'dual/orders': 20 / 15,
|
|
612
|
+
'structured/orders': 20 / 15,
|
|
613
|
+
'staking/swap': 20 / 15,
|
|
562
614
|
},
|
|
563
615
|
'put': {
|
|
564
|
-
'uni/interest_reinvest': 20 / 15,
|
|
616
|
+
'uni/interest_reinvest': 20 / 15, # deprecated
|
|
565
617
|
},
|
|
566
618
|
'patch': {
|
|
567
619
|
'uni/lends': 20 / 15,
|
|
@@ -575,16 +627,16 @@ class gate(Exchange, ImplicitAPI):
|
|
|
575
627
|
'collateral/collaterals': 20 / 15,
|
|
576
628
|
'collateral/total_amount': 20 / 15,
|
|
577
629
|
'collateral/ltv': 20 / 15,
|
|
578
|
-
'collateral/currencies': 20 / 15,
|
|
579
630
|
'multi_collateral/orders': 20 / 15,
|
|
580
631
|
'multi_collateral/orders/{order_id}': 20 / 15,
|
|
581
632
|
'multi_collateral/repay': 20 / 15,
|
|
582
633
|
'multi_collateral/mortgage': 20 / 15,
|
|
583
634
|
'multi_collateral/currency_quota': 20 / 15,
|
|
584
|
-
'
|
|
585
|
-
'multi_collateral/
|
|
586
|
-
'multi_collateral/
|
|
587
|
-
'multi_collateral/
|
|
635
|
+
'collateral/currencies': 20 / 15, # deprecated
|
|
636
|
+
'multi_collateral/currencies': 20 / 15, # deprecated
|
|
637
|
+
'multi_collateral/ltv': 20 / 15, # deprecated
|
|
638
|
+
'multi_collateral/fixed_rate': 20 / 15, # deprecated
|
|
639
|
+
'multi_collateral/current_rate': 20 / 15, # deprecated
|
|
588
640
|
},
|
|
589
641
|
'post': {
|
|
590
642
|
'collateral/orders': 20 / 15,
|
|
@@ -598,14 +650,17 @@ class gate(Exchange, ImplicitAPI):
|
|
|
598
650
|
'account': {
|
|
599
651
|
'get': {
|
|
600
652
|
'detail': 20 / 15,
|
|
653
|
+
'main_keys': 20 / 15,
|
|
601
654
|
'rate_limit': 20 / 15,
|
|
602
655
|
'stp_groups': 20 / 15,
|
|
603
656
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
604
657
|
'stp_groups/debit_fee': 20 / 15,
|
|
658
|
+
'debit_fee': 20 / 15,
|
|
605
659
|
},
|
|
606
660
|
'post': {
|
|
607
661
|
'stp_groups': 20 / 15,
|
|
608
662
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
663
|
+
'debit_fee': 20 / 15,
|
|
609
664
|
},
|
|
610
665
|
'delete': {
|
|
611
666
|
'stp_groups/{stp_id}/users': 20 / 15,
|
|
@@ -615,6 +670,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
615
670
|
'get': {
|
|
616
671
|
'agency/transaction_history': 20 / 15,
|
|
617
672
|
'agency/commission_history': 20 / 15,
|
|
673
|
+
'partner/transaction_history': 20 / 15,
|
|
674
|
+
'partner/commission_history': 20 / 15,
|
|
675
|
+
'partner/sub_list': 20 / 15,
|
|
676
|
+
'broker/commission_history': 20 / 15,
|
|
677
|
+
'broker/transaction_history': 20 / 15,
|
|
678
|
+
'user/info': 20 / 15,
|
|
679
|
+
'user/sub_relation': 20 / 15,
|
|
618
680
|
},
|
|
619
681
|
},
|
|
620
682
|
},
|
|
@@ -685,9 +747,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
685
747
|
'BSC': 'BSC',
|
|
686
748
|
'BEP20': 'BSC',
|
|
687
749
|
'SOL': 'SOL',
|
|
688
|
-
'
|
|
689
|
-
'MATIC': 'POL',
|
|
690
|
-
'OP': 'OPETH',
|
|
750
|
+
'MATIC': 'MATIC',
|
|
691
751
|
'OPTIMISM': 'OPETH',
|
|
692
752
|
'ADA': 'ADA', # CARDANO
|
|
693
753
|
'AVAXC': 'AVAX_C',
|
|
@@ -767,6 +827,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
767
827
|
'option': 'options',
|
|
768
828
|
'options': 'options',
|
|
769
829
|
},
|
|
830
|
+
'fetchMarkets': {
|
|
831
|
+
'types': ['spot', 'swap', 'future', 'option'],
|
|
832
|
+
},
|
|
770
833
|
'swap': {
|
|
771
834
|
'fetchMarkets': {
|
|
772
835
|
'settlementCurrencies': ['usdt', 'btc'],
|
|
@@ -988,7 +1051,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
988
1051
|
},
|
|
989
1052
|
},
|
|
990
1053
|
},
|
|
991
|
-
# https://www.gate.
|
|
1054
|
+
# https://www.gate.com/docs/developers/apiv4/en/#label-list
|
|
992
1055
|
'exceptions': {
|
|
993
1056
|
'exact': {
|
|
994
1057
|
'INVALID_PARAM_VALUE': BadRequest,
|
|
@@ -1101,7 +1164,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1101
1164
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1102
1165
|
returns unifiedAccount so the user can check if the unified account is enabled
|
|
1103
1166
|
|
|
1104
|
-
https://www.gate.
|
|
1167
|
+
https://www.gate.com/docs/developers/apiv4/#get-account-detail
|
|
1105
1168
|
|
|
1106
1169
|
:returns boolean: True or False if the enabled unified account is enabled or not and sets the unifiedAccount option if it is None
|
|
1107
1170
|
"""
|
|
@@ -1136,7 +1199,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1136
1199
|
"""
|
|
1137
1200
|
fetches the current integer timestamp in milliseconds from the exchange server
|
|
1138
1201
|
|
|
1139
|
-
https://www.gate.
|
|
1202
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-server-current-time
|
|
1140
1203
|
|
|
1141
1204
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1142
1205
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
|
@@ -1223,11 +1286,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1223
1286
|
"""
|
|
1224
1287
|
retrieves data on all markets for gate
|
|
1225
1288
|
|
|
1226
|
-
https://www.gate.
|
|
1227
|
-
https://www.gate.
|
|
1228
|
-
https://www.gate.
|
|
1229
|
-
https://www.gate.
|
|
1230
|
-
https://www.gate.
|
|
1289
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-currency-pairs-supported # spot
|
|
1290
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading # margin
|
|
1291
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts # swap
|
|
1292
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts-2 # future
|
|
1293
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time # option
|
|
1231
1294
|
|
|
1232
1295
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1233
1296
|
:returns dict[]: an array of objects representing market data
|
|
@@ -1236,21 +1299,24 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1236
1299
|
await self.load_time_difference()
|
|
1237
1300
|
if self.check_required_credentials(False):
|
|
1238
1301
|
await self.load_unified_status()
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1302
|
+
rawPromises = []
|
|
1303
|
+
fetchMarketsOptions = self.safe_dict(self.options, 'fetchMarkets')
|
|
1304
|
+
types = self.safe_list(fetchMarketsOptions, 'types', ['spot', 'swap', 'future', 'option'])
|
|
1305
|
+
for i in range(0, len(types)):
|
|
1306
|
+
marketType = types[i]
|
|
1307
|
+
if marketType == 'spot':
|
|
1308
|
+
# if not sandboxMode:
|
|
1309
|
+
# gate doesn't have a sandbox for spot markets
|
|
1310
|
+
rawPromises.append(self.fetch_spot_markets(params))
|
|
1311
|
+
# }
|
|
1312
|
+
elif marketType == 'swap':
|
|
1313
|
+
rawPromises.append(self.fetch_swap_markets(params))
|
|
1314
|
+
elif marketType == 'future':
|
|
1315
|
+
rawPromises.append(self.fetch_future_markets(params))
|
|
1316
|
+
elif marketType == 'option':
|
|
1317
|
+
rawPromises.append(self.fetch_option_markets(params))
|
|
1318
|
+
results = await asyncio.gather(*rawPromises)
|
|
1319
|
+
return self.arrays_concat(results)
|
|
1254
1320
|
|
|
1255
1321
|
async def fetch_spot_markets(self, params={}):
|
|
1256
1322
|
marginPromise = self.publicMarginGetCurrencyPairs(params)
|
|
@@ -1277,7 +1343,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1277
1343
|
# "sell_start": 1607313600,
|
|
1278
1344
|
# "buy_start": 1700492400,
|
|
1279
1345
|
# "type": "normal",
|
|
1280
|
-
# "trade_url": "https://www.gate.
|
|
1346
|
+
# "trade_url": "https://www.gate.com/trade/QTUM_ETH",
|
|
1281
1347
|
# }
|
|
1282
1348
|
#
|
|
1283
1349
|
# Margin
|
|
@@ -1365,10 +1431,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1365
1431
|
})
|
|
1366
1432
|
return result
|
|
1367
1433
|
|
|
1368
|
-
async def
|
|
1434
|
+
async def fetch_swap_markets(self, params={}):
|
|
1369
1435
|
result = []
|
|
1370
1436
|
swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
|
|
1371
|
-
|
|
1437
|
+
if self.options['sandboxMode']:
|
|
1438
|
+
swapSettlementCurrencies = ['usdt'] # gate sandbox only has usdt-margined swaps
|
|
1372
1439
|
for c in range(0, len(swapSettlementCurrencies)):
|
|
1373
1440
|
settleId = swapSettlementCurrencies[c]
|
|
1374
1441
|
request: dict = {
|
|
@@ -1378,6 +1445,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1378
1445
|
for i in range(0, len(response)):
|
|
1379
1446
|
parsedMarket = self.parse_contract_market(response[i], settleId)
|
|
1380
1447
|
result.append(parsedMarket)
|
|
1448
|
+
return result
|
|
1449
|
+
|
|
1450
|
+
async def fetch_future_markets(self, params={}):
|
|
1451
|
+
if self.options['sandboxMode']:
|
|
1452
|
+
return [] # right now sandbox does not have inverse swaps
|
|
1453
|
+
result = []
|
|
1454
|
+
futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
|
|
1381
1455
|
for c in range(0, len(futureSettlementCurrencies)):
|
|
1382
1456
|
settleId = futureSettlementCurrencies[c]
|
|
1383
1457
|
request: dict = {
|
|
@@ -1418,8 +1492,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1418
1492
|
# "leverage_min": "1",
|
|
1419
1493
|
# "leverage_max": "100",
|
|
1420
1494
|
# "risk_limit_max": "8000000",
|
|
1421
|
-
# "maker_fee_rate": "-0.00025",
|
|
1422
|
-
# "taker_fee_rate": "0.00075",
|
|
1495
|
+
# "maker_fee_rate": "-0.00025", # not actual value for regular users
|
|
1496
|
+
# "taker_fee_rate": "0.00075", # not actual value for regular users
|
|
1423
1497
|
# "funding_rate": "0.002053",
|
|
1424
1498
|
# "order_size_max": 1000000,
|
|
1425
1499
|
# "funding_next_apply": 1610035200,
|
|
@@ -1463,8 +1537,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1463
1537
|
# "risk_limit_base": "140.726652109199",
|
|
1464
1538
|
# "risk_limit_step": "1000000",
|
|
1465
1539
|
# "risk_limit_max": "8000000",
|
|
1466
|
-
# "maker_fee_rate": "-0.00025",
|
|
1467
|
-
# "taker_fee_rate": "0.00075",
|
|
1540
|
+
# "maker_fee_rate": "-0.00025", # not actual value for regular users
|
|
1541
|
+
# "taker_fee_rate": "0.00075", # not actual value for regular users
|
|
1468
1542
|
# "ref_discount_rate": "0",
|
|
1469
1543
|
# "ref_rebate_rate": "0.2",
|
|
1470
1544
|
# "order_price_deviate": "0.5",
|
|
@@ -1501,8 +1575,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1501
1575
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1502
1576
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1503
1577
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1504
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1505
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1506
1578
|
isLinear = quote == settle
|
|
1507
1579
|
contractSize = self.safe_string(market, 'quanto_multiplier')
|
|
1508
1580
|
# exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
|
|
@@ -1527,8 +1599,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1527
1599
|
'contract': True,
|
|
1528
1600
|
'linear': isLinear,
|
|
1529
1601
|
'inverse': not isLinear,
|
|
1530
|
-
'taker':
|
|
1531
|
-
'maker':
|
|
1602
|
+
'taker': None,
|
|
1603
|
+
'maker': None,
|
|
1532
1604
|
'contractSize': self.parse_number(contractSize),
|
|
1533
1605
|
'expiry': expiry,
|
|
1534
1606
|
'expiryDatetime': self.iso8601(expiry),
|
|
@@ -1627,8 +1699,6 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1627
1699
|
maxMultiplier = Precise.string_add('1', priceDeviate)
|
|
1628
1700
|
minPrice = Precise.string_mul(minMultiplier, markPrice)
|
|
1629
1701
|
maxPrice = Precise.string_mul(maxMultiplier, markPrice)
|
|
1630
|
-
takerPercent = self.safe_string(market, 'taker_fee_rate')
|
|
1631
|
-
makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
|
|
1632
1702
|
result.append({
|
|
1633
1703
|
'id': id,
|
|
1634
1704
|
'symbol': symbol,
|
|
@@ -1648,8 +1718,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1648
1718
|
'contract': True,
|
|
1649
1719
|
'linear': True,
|
|
1650
1720
|
'inverse': False,
|
|
1651
|
-
'taker':
|
|
1652
|
-
'maker':
|
|
1721
|
+
'taker': None,
|
|
1722
|
+
'maker': None,
|
|
1653
1723
|
'contractSize': self.parse_number('1'),
|
|
1654
1724
|
'expiry': expiry,
|
|
1655
1725
|
'expiryDatetime': self.iso8601(expiry),
|
|
@@ -1807,7 +1877,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1807
1877
|
"""
|
|
1808
1878
|
fetches all available currencies on an exchange
|
|
1809
1879
|
|
|
1810
|
-
https://www.gate.
|
|
1880
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-currencies-details
|
|
1811
1881
|
|
|
1812
1882
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
1813
1883
|
:returns dict: an associative dictionary of currencies
|
|
@@ -1815,7 +1885,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1815
1885
|
# sandbox/testnet only supports future markets
|
|
1816
1886
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
|
1817
1887
|
if apiBackup is not None:
|
|
1818
|
-
return
|
|
1888
|
+
return {}
|
|
1819
1889
|
response = await self.publicSpotGetCurrencies(params)
|
|
1820
1890
|
#
|
|
1821
1891
|
# [
|
|
@@ -1908,7 +1978,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1908
1978
|
"""
|
|
1909
1979
|
fetch the current funding rate
|
|
1910
1980
|
|
|
1911
|
-
https://www.gate.
|
|
1981
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-contract
|
|
1912
1982
|
|
|
1913
1983
|
:param str symbol: unified market symbol
|
|
1914
1984
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -1970,7 +2040,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
1970
2040
|
"""
|
|
1971
2041
|
fetch the funding rate for multiple markets
|
|
1972
2042
|
|
|
1973
|
-
https://www.gate.
|
|
2043
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
1974
2044
|
|
|
1975
2045
|
:param str[]|None symbols: list of unified market symbols
|
|
1976
2046
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2173,11 +2243,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2173
2243
|
"""
|
|
2174
2244
|
fetch the deposit address for a currency associated with self account
|
|
2175
2245
|
|
|
2176
|
-
https://www.gate.
|
|
2246
|
+
https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address
|
|
2177
2247
|
|
|
2178
2248
|
:param str code: unified currency code
|
|
2179
2249
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2180
|
-
:param str [params.network]: unified network code(not used directly by gate.
|
|
2250
|
+
:param str [params.network]: unified network code(not used directly by gate.com but used by ccxt to filter the response)
|
|
2181
2251
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
|
2182
2252
|
"""
|
|
2183
2253
|
await self.load_markets()
|
|
@@ -2211,7 +2281,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2211
2281
|
"""
|
|
2212
2282
|
fetch the trading fees for a market
|
|
2213
2283
|
|
|
2214
|
-
https://www.gate.
|
|
2284
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2215
2285
|
|
|
2216
2286
|
:param str symbol: unified market symbol
|
|
2217
2287
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2243,7 +2313,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2243
2313
|
"""
|
|
2244
2314
|
fetch the trading fees for multiple markets
|
|
2245
2315
|
|
|
2246
|
-
https://www.gate.
|
|
2316
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
|
|
2247
2317
|
|
|
2248
2318
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
2249
2319
|
:returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
|
|
@@ -2309,7 +2379,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2309
2379
|
@deprecated
|
|
2310
2380
|
please use fetchDepositWithdrawFees instead
|
|
2311
2381
|
|
|
2312
|
-
https://www.gate.
|
|
2382
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2313
2383
|
|
|
2314
2384
|
:param str[]|None codes: list of unified currency codes
|
|
2315
2385
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2347,10 +2417,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2347
2417
|
if withdrawFixOnChains is None:
|
|
2348
2418
|
withdrawFees = self.safe_number(entry, 'withdraw_fix')
|
|
2349
2419
|
else:
|
|
2350
|
-
|
|
2351
|
-
for j in range(0, len(
|
|
2352
|
-
|
|
2353
|
-
|
|
2420
|
+
networkIds = list(withdrawFixOnChains.keys())
|
|
2421
|
+
for j in range(0, len(networkIds)):
|
|
2422
|
+
networkId = networkIds[j]
|
|
2423
|
+
networkCode = self.network_id_to_code(networkId)
|
|
2424
|
+
withdrawFees[networkCode] = self.parse_number(withdrawFixOnChains[networkId])
|
|
2354
2425
|
result[code] = {
|
|
2355
2426
|
'withdraw': withdrawFees,
|
|
2356
2427
|
'deposit': None,
|
|
@@ -2362,7 +2433,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2362
2433
|
"""
|
|
2363
2434
|
fetch deposit and withdraw fees
|
|
2364
2435
|
|
|
2365
|
-
https://www.gate.
|
|
2436
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
|
|
2366
2437
|
|
|
2367
2438
|
:param str[]|None codes: list of unified currency codes
|
|
2368
2439
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2443,8 +2514,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2443
2514
|
"""
|
|
2444
2515
|
fetch the history of funding payments paid and received on self account
|
|
2445
2516
|
|
|
2446
|
-
https://www.gate.
|
|
2447
|
-
https://www.gate.
|
|
2517
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-2
|
|
2518
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-3
|
|
2448
2519
|
|
|
2449
2520
|
:param str symbol: unified market symbol
|
|
2450
2521
|
:param int [since]: the earliest time in ms to fetch funding history for
|
|
@@ -2523,10 +2594,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2523
2594
|
"""
|
|
2524
2595
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
|
2525
2596
|
|
|
2526
|
-
https://www.gate.
|
|
2527
|
-
https://www.gate.
|
|
2528
|
-
https://www.gate.
|
|
2529
|
-
https://www.gate.
|
|
2597
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-order-book
|
|
2598
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-order-book
|
|
2599
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-order-book-2
|
|
2600
|
+
https://www.gate.com/docs/developers/apiv4/en/#options-order-book
|
|
2530
2601
|
|
|
2531
2602
|
:param str symbol: unified symbol of the market to fetch the order book for
|
|
2532
2603
|
:param int [limit]: the maximum amount of order book entries to return
|
|
@@ -2545,7 +2616,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2545
2616
|
#
|
|
2546
2617
|
request, query = self.prepare_request(market, market['type'], params)
|
|
2547
2618
|
if limit is not None:
|
|
2548
|
-
|
|
2619
|
+
if market['spot']:
|
|
2620
|
+
limit = min(limit, 1000)
|
|
2621
|
+
else:
|
|
2622
|
+
limit = min(limit, 300)
|
|
2623
|
+
request['limit'] = limit
|
|
2549
2624
|
request['with_id'] = True
|
|
2550
2625
|
response = None
|
|
2551
2626
|
if market['spot'] or market['margin']:
|
|
@@ -2636,10 +2711,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2636
2711
|
"""
|
|
2637
2712
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
2638
2713
|
|
|
2639
|
-
https://www.gate.
|
|
2640
|
-
https://www.gate.
|
|
2641
|
-
https://www.gate.
|
|
2642
|
-
https://www.gate.
|
|
2714
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-details-of-a-specifc-order
|
|
2715
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers
|
|
2716
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers-2
|
|
2717
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
2643
2718
|
|
|
2644
2719
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
|
2645
2720
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2789,10 +2864,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2789
2864
|
"""
|
|
2790
2865
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
2791
2866
|
|
|
2792
|
-
https://www.gate.
|
|
2793
|
-
https://www.gate.
|
|
2794
|
-
https://www.gate.
|
|
2795
|
-
https://www.gate.
|
|
2867
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-details-of-a-specifc-order
|
|
2868
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers
|
|
2869
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-tickers-2
|
|
2870
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
2796
2871
|
|
|
2797
2872
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
2798
2873
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -2835,6 +2910,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
2835
2910
|
|
|
2836
2911
|
async def fetch_balance(self, params={}) -> Balances:
|
|
2837
2912
|
"""
|
|
2913
|
+
|
|
2914
|
+
https://www.gate.com/docs/developers/apiv4/en/#margin-account-list
|
|
2915
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-unified-account-information
|
|
2916
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-spot-trading-accounts
|
|
2917
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-account
|
|
2918
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-account-2
|
|
2919
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-information
|
|
2920
|
+
|
|
2838
2921
|
:param dict [params]: exchange specific parameters
|
|
2839
2922
|
:param str [params.type]: spot, margin, swap or future, if not provided self.options['defaultType'] is used
|
|
2840
2923
|
:param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
|
|
@@ -3075,7 +3158,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3075
3158
|
result: dict = {
|
|
3076
3159
|
'info': response,
|
|
3077
3160
|
}
|
|
3078
|
-
isolated = marginMode == 'margin'
|
|
3161
|
+
isolated = marginMode == 'margin' and type == 'spot'
|
|
3079
3162
|
data = response
|
|
3080
3163
|
if 'balances' in data: # True for cross_margin and unified
|
|
3081
3164
|
flatBalances = []
|
|
@@ -3108,14 +3191,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3108
3191
|
returnResult = result if isolated else self.safe_balance(result)
|
|
3109
3192
|
return returnResult
|
|
3110
3193
|
|
|
3111
|
-
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
3194
|
+
async def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
|
3112
3195
|
"""
|
|
3113
3196
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
3114
3197
|
|
|
3115
|
-
https://www.gate.
|
|
3116
|
-
https://www.gate.
|
|
3117
|
-
https://www.gate.
|
|
3118
|
-
https://www.gate.
|
|
3198
|
+
https://www.gate.com/docs/developers/apiv4/en/#market-candlesticks # spot
|
|
3199
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-futures-candlesticks # swap
|
|
3200
|
+
https://www.gate.com/docs/developers/apiv4/en/#market-candlesticks # future
|
|
3201
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-options-candlesticks # option
|
|
3119
3202
|
|
|
3120
3203
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
|
3121
3204
|
:param str timeframe: the length of time each candle represents
|
|
@@ -3189,7 +3272,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3189
3272
|
"""
|
|
3190
3273
|
fetches historical funding rate prices
|
|
3191
3274
|
|
|
3192
|
-
https://www.gate.
|
|
3275
|
+
https://www.gate.com/docs/developers/apiv4/en/#funding-rate-history
|
|
3193
3276
|
|
|
3194
3277
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
|
3195
3278
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
|
@@ -3289,10 +3372,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3289
3372
|
"""
|
|
3290
3373
|
get the list of most recent trades for a particular symbol
|
|
3291
3374
|
|
|
3292
|
-
https://www.gate.
|
|
3293
|
-
https://www.gate.
|
|
3294
|
-
https://www.gate.
|
|
3295
|
-
https://www.gate.
|
|
3375
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-market-trades
|
|
3376
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-trading-history
|
|
3377
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-trading-history-2
|
|
3378
|
+
https://www.gate.com/docs/developers/apiv4/en/#options-trade-history
|
|
3296
3379
|
|
|
3297
3380
|
:param str symbol: unified symbol of the market to fetch trades for
|
|
3298
3381
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
|
@@ -3395,10 +3478,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3395
3478
|
"""
|
|
3396
3479
|
fetch all the trades made from a single order
|
|
3397
3480
|
|
|
3398
|
-
https://www.gate.
|
|
3399
|
-
https://www.gate.
|
|
3400
|
-
https://www.gate.
|
|
3401
|
-
https://www.gate.
|
|
3481
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history
|
|
3482
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-2
|
|
3483
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-3
|
|
3484
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-4
|
|
3402
3485
|
|
|
3403
3486
|
:param str id: order id
|
|
3404
3487
|
:param str symbol: unified market symbol
|
|
@@ -3436,10 +3519,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3436
3519
|
"""
|
|
3437
3520
|
Fetch personal trading history
|
|
3438
3521
|
|
|
3439
|
-
https://www.gate.
|
|
3440
|
-
https://www.gate.
|
|
3441
|
-
https://www.gate.
|
|
3442
|
-
https://www.gate.
|
|
3522
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history
|
|
3523
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-2
|
|
3524
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-3
|
|
3525
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-personal-trading-history-4
|
|
3443
3526
|
|
|
3444
3527
|
:param str symbol: unified market symbol
|
|
3445
3528
|
:param int [since]: the earliest time in ms to fetch trades for
|
|
@@ -3729,7 +3812,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3729
3812
|
"""
|
|
3730
3813
|
fetch all deposits made to an account
|
|
3731
3814
|
|
|
3732
|
-
https://www.gate.
|
|
3815
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-deposit-records
|
|
3733
3816
|
|
|
3734
3817
|
:param str code: unified currency code
|
|
3735
3818
|
:param int [since]: the earliest time in ms to fetch deposits for
|
|
@@ -3763,7 +3846,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3763
3846
|
"""
|
|
3764
3847
|
fetch all withdrawals made from an account
|
|
3765
3848
|
|
|
3766
|
-
https://www.gate.
|
|
3849
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-records
|
|
3767
3850
|
|
|
3768
3851
|
:param str code: unified currency code
|
|
3769
3852
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
|
@@ -3789,15 +3872,15 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3789
3872
|
start = self.parse_to_int(since / 1000)
|
|
3790
3873
|
request['from'] = start
|
|
3791
3874
|
request['to'] = self.sum(start, 30 * 24 * 60 * 60)
|
|
3792
|
-
request, params = self.handle_until_option('to', request, params)
|
|
3875
|
+
request, params = self.handle_until_option('to', request, params, 0.001)
|
|
3793
3876
|
response = await self.privateWalletGetWithdrawals(self.extend(request, params))
|
|
3794
3877
|
return self.parse_transactions(response, currency)
|
|
3795
3878
|
|
|
3796
|
-
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
|
3879
|
+
async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction:
|
|
3797
3880
|
"""
|
|
3798
3881
|
make a withdrawal
|
|
3799
3882
|
|
|
3800
|
-
https://www.gate.
|
|
3883
|
+
https://www.gate.com/docs/developers/apiv4/en/#withdraw
|
|
3801
3884
|
|
|
3802
3885
|
:param str code: unified currency code
|
|
3803
3886
|
:param float amount: the amount to withdraw
|
|
@@ -3971,13 +4054,13 @@ class gate(Exchange, ImplicitAPI):
|
|
|
3971
4054
|
"""
|
|
3972
4055
|
Create an order on the exchange
|
|
3973
4056
|
|
|
3974
|
-
https://www.gate.
|
|
3975
|
-
https://www.gate.
|
|
3976
|
-
https://www.gate.
|
|
3977
|
-
https://www.gate.
|
|
3978
|
-
https://www.gate.
|
|
3979
|
-
https://www.gate.
|
|
3980
|
-
https://www.gate.
|
|
4057
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-order
|
|
4058
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order
|
|
4059
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order
|
|
4060
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order-2
|
|
4061
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
4062
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-price-triggered-order-3
|
|
4063
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order
|
|
3981
4064
|
|
|
3982
4065
|
:param str symbol: Unified CCXT market symbol
|
|
3983
4066
|
:param str type: 'limit' or 'market' *"market" is contract only*
|
|
@@ -4120,7 +4203,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4120
4203
|
triggerValue = self.safe_value_n(orderParams, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
|
|
4121
4204
|
if triggerValue is not None:
|
|
4122
4205
|
raise NotSupported(self.id + ' createOrders() does not support advanced order properties(stopPrice, takeProfitPrice, stopLossPrice)')
|
|
4123
|
-
extendedParams['textIsRequired'] = True #
|
|
4206
|
+
extendedParams['textIsRequired'] = True # the exchange requires a text parameter for each order here
|
|
4124
4207
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
|
|
4125
4208
|
ordersRequests.append(orderRequest)
|
|
4126
4209
|
symbols = self.market_symbols(orderSymbols, None, False, True, True)
|
|
@@ -4133,9 +4216,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4133
4216
|
"""
|
|
4134
4217
|
create a list of trade orders
|
|
4135
4218
|
|
|
4136
|
-
https://www.gate.
|
|
4137
|
-
https://www.gate.
|
|
4138
|
-
https://www.gate.
|
|
4219
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-2
|
|
4220
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-batch-of-orders
|
|
4221
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
|
4139
4222
|
|
|
4140
4223
|
: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
|
|
4141
4224
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -4368,7 +4451,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4368
4451
|
"""
|
|
4369
4452
|
create a market buy order by providing the symbol and cost
|
|
4370
4453
|
|
|
4371
|
-
https://www.gate.
|
|
4454
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-order
|
|
4372
4455
|
|
|
4373
4456
|
:param str symbol: unified symbol of the market to create an order in
|
|
4374
4457
|
:param float cost: how much you want to trade in units of the quote currency
|
|
@@ -4421,8 +4504,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4421
4504
|
"""
|
|
4422
4505
|
edit a trade order, gate currently only supports the modification of the price or amount fields
|
|
4423
4506
|
|
|
4424
|
-
https://www.gate.
|
|
4425
|
-
https://www.gate.
|
|
4507
|
+
https://www.gate.com/docs/developers/apiv4/en/#amend-an-order
|
|
4508
|
+
https://www.gate.com/docs/developers/apiv4/en/#amend-an-order-2
|
|
4426
4509
|
|
|
4427
4510
|
:param str id: order id
|
|
4428
4511
|
:param str symbol: unified symbol of the market to create an order in
|
|
@@ -4766,10 +4849,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4766
4849
|
"""
|
|
4767
4850
|
Retrieves information on an order
|
|
4768
4851
|
|
|
4769
|
-
https://www.gate.
|
|
4770
|
-
https://www.gate.
|
|
4771
|
-
https://www.gate.
|
|
4772
|
-
https://www.gate.
|
|
4852
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order
|
|
4853
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-2
|
|
4854
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-3
|
|
4855
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-a-single-order-4
|
|
4773
4856
|
|
|
4774
4857
|
:param str id: Order id
|
|
4775
4858
|
:param str symbol: Unified market symbol, *required for spot and margin*
|
|
@@ -4814,8 +4897,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4814
4897
|
"""
|
|
4815
4898
|
fetch all unfilled currently open orders
|
|
4816
4899
|
|
|
4817
|
-
https://www.gate.
|
|
4818
|
-
https://www.gate.
|
|
4900
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-open-orders
|
|
4901
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
4819
4902
|
|
|
4820
4903
|
:param str symbol: unified market symbol
|
|
4821
4904
|
:param int [since]: the earliest time in ms to fetch open orders for
|
|
@@ -4833,14 +4916,14 @@ class gate(Exchange, ImplicitAPI):
|
|
|
4833
4916
|
"""
|
|
4834
4917
|
fetches information on multiple closed orders made by the user
|
|
4835
4918
|
|
|
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.
|
|
4843
|
-
https://www.gate.
|
|
4919
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-orders
|
|
4920
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-running-auto-order-list
|
|
4921
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders
|
|
4922
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-auto-orders
|
|
4923
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders-2
|
|
4924
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-auto-orders-2
|
|
4925
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-options-orders
|
|
4926
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-futures-orders-by-time-range
|
|
4844
4927
|
|
|
4845
4928
|
:param str symbol: unified market symbol of the market orders were made in
|
|
4846
4929
|
:param int [since]: the earliest time in ms to fetch orders for
|
|
@@ -5107,10 +5190,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5107
5190
|
"""
|
|
5108
5191
|
Cancels an open order
|
|
5109
5192
|
|
|
5110
|
-
https://www.gate.
|
|
5111
|
-
https://www.gate.
|
|
5112
|
-
https://www.gate.
|
|
5113
|
-
https://www.gate.
|
|
5193
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order
|
|
5194
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-2
|
|
5195
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-3
|
|
5196
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-single-order-4
|
|
5114
5197
|
|
|
5115
5198
|
:param str id: Order id
|
|
5116
5199
|
:param str symbol: Unified market symbol
|
|
@@ -5234,8 +5317,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5234
5317
|
"""
|
|
5235
5318
|
cancel multiple orders
|
|
5236
5319
|
|
|
5237
|
-
https://www.gate.
|
|
5238
|
-
https://www.gate.
|
|
5320
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5321
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2
|
|
5239
5322
|
|
|
5240
5323
|
:param str[] ids: order ids
|
|
5241
5324
|
:param str symbol: unified symbol of the market the order was made in
|
|
@@ -5278,7 +5361,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5278
5361
|
"""
|
|
5279
5362
|
cancel multiple orders for multiple symbols
|
|
5280
5363
|
|
|
5281
|
-
https://www.gate.
|
|
5364
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
|
|
5282
5365
|
|
|
5283
5366
|
:param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
|
5284
5367
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5316,10 +5399,10 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5316
5399
|
"""
|
|
5317
5400
|
cancel all open orders
|
|
5318
5401
|
|
|
5319
|
-
https://www.gate.
|
|
5320
|
-
https://www.gate.
|
|
5321
|
-
https://www.gate.
|
|
5322
|
-
https://www.gate.
|
|
5402
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
|
|
5403
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched
|
|
5404
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
|
|
5405
|
+
https://www.gate.com/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
|
|
5323
5406
|
|
|
5324
5407
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
|
5325
5408
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5387,7 +5470,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5387
5470
|
"""
|
|
5388
5471
|
transfer currency internally between wallets on the same account
|
|
5389
5472
|
|
|
5390
|
-
https://www.gate.
|
|
5473
|
+
https://www.gate.com/docs/developers/apiv4/en/#transfer-between-trading-accounts
|
|
5391
5474
|
|
|
5392
5475
|
:param str code: unified currency code for currency being transferred
|
|
5393
5476
|
:param float amount: the amount of currency to transfer
|
|
@@ -5461,12 +5544,12 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5461
5544
|
'info': transfer,
|
|
5462
5545
|
}
|
|
5463
5546
|
|
|
5464
|
-
async def set_leverage(self, leverage:
|
|
5547
|
+
async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
|
|
5465
5548
|
"""
|
|
5466
5549
|
set the level of leverage for a market
|
|
5467
5550
|
|
|
5468
|
-
https://www.gate.
|
|
5469
|
-
https://www.gate.
|
|
5551
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-leverage
|
|
5552
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-leverage-2
|
|
5470
5553
|
|
|
5471
5554
|
:param float leverage: the rate of leverage
|
|
5472
5555
|
:param str symbol: unified market symbol
|
|
@@ -5669,9 +5752,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5669
5752
|
"""
|
|
5670
5753
|
fetch data on an open contract position
|
|
5671
5754
|
|
|
5672
|
-
https://www.gate.
|
|
5673
|
-
https://www.gate.
|
|
5674
|
-
https://www.gate.
|
|
5755
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-single-position
|
|
5756
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-single-position-2
|
|
5757
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-specified-contract-position
|
|
5675
5758
|
|
|
5676
5759
|
:param str symbol: unified market symbol of the market the position is held in
|
|
5677
5760
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5753,9 +5836,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5753
5836
|
"""
|
|
5754
5837
|
fetch all open positions
|
|
5755
5838
|
|
|
5756
|
-
https://www.gate.
|
|
5757
|
-
https://www.gate.
|
|
5758
|
-
https://www.gate.
|
|
5839
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-positions-of-a-user
|
|
5840
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-positions-of-a-user-2
|
|
5841
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-user-s-positions-of-specified-underlying
|
|
5759
5842
|
|
|
5760
5843
|
:param str[]|None symbols: Not used by gate, but parsed internally by CCXT
|
|
5761
5844
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5855,8 +5938,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5855
5938
|
"""
|
|
5856
5939
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
|
5857
5940
|
|
|
5858
|
-
https://www.gate.
|
|
5859
|
-
https://www.gate.
|
|
5941
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
|
|
5942
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts-2
|
|
5860
5943
|
|
|
5861
5944
|
:param str[] [symbols]: list of unified market symbols
|
|
5862
5945
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5972,7 +6055,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5972
6055
|
"""
|
|
5973
6056
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
|
|
5974
6057
|
|
|
5975
|
-
https://www.gate.
|
|
6058
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-risk-limit-tiers
|
|
5976
6059
|
|
|
5977
6060
|
:param str symbol: unified market symbol
|
|
5978
6061
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -5984,7 +6067,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
5984
6067
|
request, requestParams = self.prepare_request(market, type, query)
|
|
5985
6068
|
if type != 'future' and type != 'swap':
|
|
5986
6069
|
raise BadRequest(self.id + ' fetchMarketLeverageTiers only supports swap and future')
|
|
5987
|
-
response = await self.
|
|
6070
|
+
response = await self.publicFuturesGetSettleRiskLimitTiers(self.extend(request, requestParams))
|
|
5988
6071
|
#
|
|
5989
6072
|
# [
|
|
5990
6073
|
# {
|
|
@@ -6062,7 +6145,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6062
6145
|
"""
|
|
6063
6146
|
repay borrowed margin and interest
|
|
6064
6147
|
|
|
6065
|
-
https://www.gate.
|
|
6148
|
+
https://www.gate.com/docs/apiv4/en/#repay-a-loan
|
|
6066
6149
|
|
|
6067
6150
|
:param str symbol: unified market symbol
|
|
6068
6151
|
:param str code: unified currency code of the currency to repay
|
|
@@ -6091,8 +6174,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6091
6174
|
"""
|
|
6092
6175
|
repay cross margin borrowed margin and interest
|
|
6093
6176
|
|
|
6094
|
-
https://www.gate.
|
|
6095
|
-
https://www.gate.
|
|
6177
|
+
https://www.gate.com/docs/developers/apiv4/en/#cross-margin-repayments
|
|
6178
|
+
https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay
|
|
6096
6179
|
|
|
6097
6180
|
:param str code: unified currency code of the currency to repay
|
|
6098
6181
|
:param float amount: the amount to repay
|
|
@@ -6140,7 +6223,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6140
6223
|
"""
|
|
6141
6224
|
create a loan to borrow margin
|
|
6142
6225
|
|
|
6143
|
-
https://www.gate.
|
|
6226
|
+
https://www.gate.com/docs/developers/apiv4/en/#marginuni
|
|
6144
6227
|
|
|
6145
6228
|
:param str symbol: unified market symbol, required for isolated margin
|
|
6146
6229
|
:param str code: unified currency code of the currency to borrow
|
|
@@ -6185,8 +6268,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6185
6268
|
"""
|
|
6186
6269
|
create a loan to borrow margin
|
|
6187
6270
|
|
|
6188
|
-
https://www.gate.
|
|
6189
|
-
https://www.gate.
|
|
6271
|
+
https://www.gate.com/docs/apiv4/en/#create-a-cross-margin-borrow-loan
|
|
6272
|
+
https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay
|
|
6190
6273
|
|
|
6191
6274
|
:param str code: unified currency code of the currency to borrow
|
|
6192
6275
|
:param float amount: the amount to borrow
|
|
@@ -6283,9 +6366,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6283
6366
|
"""
|
|
6284
6367
|
fetch the interest owed by the user for borrowing currency for margin trading
|
|
6285
6368
|
|
|
6286
|
-
https://www.gate.
|
|
6287
|
-
https://www.gate.
|
|
6288
|
-
https://www.gate.
|
|
6369
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-interest-records
|
|
6370
|
+
https://www.gate.com/docs/developers/apiv4/en/#interest-records-for-the-cross-margin-account
|
|
6371
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-interest-records-2
|
|
6289
6372
|
|
|
6290
6373
|
:param str [code]: unified currency code
|
|
6291
6374
|
:param str [symbol]: unified market symbol when fetching interest in isolated markets
|
|
@@ -6486,8 +6569,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6486
6569
|
"""
|
|
6487
6570
|
remove margin from a position
|
|
6488
6571
|
|
|
6489
|
-
https://www.gate.
|
|
6490
|
-
https://www.gate.
|
|
6572
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin
|
|
6573
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin-2
|
|
6491
6574
|
|
|
6492
6575
|
:param str symbol: unified market symbol
|
|
6493
6576
|
:param float amount: the amount of margin to remove
|
|
@@ -6500,8 +6583,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6500
6583
|
"""
|
|
6501
6584
|
add margin
|
|
6502
6585
|
|
|
6503
|
-
https://www.gate.
|
|
6504
|
-
https://www.gate.
|
|
6586
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin
|
|
6587
|
+
https://www.gate.com/docs/developers/apiv4/en/#update-position-margin-2
|
|
6505
6588
|
|
|
6506
6589
|
:param str symbol: unified market symbol
|
|
6507
6590
|
:param float amount: amount of margin to add
|
|
@@ -6514,7 +6597,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6514
6597
|
"""
|
|
6515
6598
|
Retrieves the open interest of a currency
|
|
6516
6599
|
|
|
6517
|
-
https://www.gate.
|
|
6600
|
+
https://www.gate.com/docs/developers/apiv4/en/#futures-stats
|
|
6518
6601
|
|
|
6519
6602
|
:param str symbol: Unified CCXT market symbol
|
|
6520
6603
|
:param str timeframe: "5m", "15m", "30m", "1h", "4h", "1d"
|
|
@@ -6598,7 +6681,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6598
6681
|
"""
|
|
6599
6682
|
fetches historical settlement records
|
|
6600
6683
|
|
|
6601
|
-
https://www.gate.
|
|
6684
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-settlement-history-2
|
|
6602
6685
|
|
|
6603
6686
|
:param str symbol: unified market symbol of the settlement history, required on gate
|
|
6604
6687
|
:param int [since]: timestamp in ms
|
|
@@ -6644,7 +6727,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6644
6727
|
"""
|
|
6645
6728
|
fetches historical settlement records of the user
|
|
6646
6729
|
|
|
6647
|
-
https://www.gate.
|
|
6730
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-my-options-settlements
|
|
6648
6731
|
|
|
6649
6732
|
:param str symbol: unified market symbol of the settlement history
|
|
6650
6733
|
:param int [since]: timestamp in ms
|
|
@@ -6769,11 +6852,11 @@ class gate(Exchange, ImplicitAPI):
|
|
|
6769
6852
|
"""
|
|
6770
6853
|
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
|
6771
6854
|
|
|
6772
|
-
https://www.gate.
|
|
6773
|
-
https://www.gate.
|
|
6774
|
-
https://www.gate.
|
|
6775
|
-
https://www.gate.
|
|
6776
|
-
https://www.gate.
|
|
6855
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book
|
|
6856
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-margin-account-balance-change-history
|
|
6857
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-2
|
|
6858
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-account-book-3
|
|
6859
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-account-changing-history
|
|
6777
6860
|
|
|
6778
6861
|
:param str [code]: unified currency code
|
|
6779
6862
|
:param int [since]: timestamp in ms of the earliest ledger entry
|
|
@@ -7000,7 +7083,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7000
7083
|
"""
|
|
7001
7084
|
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
|
|
7002
7085
|
|
|
7003
|
-
https://www.gate.
|
|
7086
|
+
https://www.gate.com/docs/developers/apiv4/en/#enable-or-disable-dual-mode
|
|
7004
7087
|
|
|
7005
7088
|
:param bool hedged: set to True to enable dual mode
|
|
7006
7089
|
:param str|None symbol: if passed, dual mode is set for all markets with the same settle currency
|
|
@@ -7017,7 +7100,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7017
7100
|
"""
|
|
7018
7101
|
fetches the market ids of underlying assets for a specific contract market type
|
|
7019
7102
|
|
|
7020
|
-
https://www.gate.
|
|
7103
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-underlyings
|
|
7021
7104
|
|
|
7022
7105
|
:param dict [params]: exchange specific params
|
|
7023
7106
|
:param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
|
|
@@ -7052,7 +7135,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7052
7135
|
"""
|
|
7053
7136
|
retrieves the public liquidations of a trading pair
|
|
7054
7137
|
|
|
7055
|
-
https://www.gate.
|
|
7138
|
+
https://www.gate.com/docs/developers/apiv4/en/#retrieve-liquidation-history
|
|
7056
7139
|
|
|
7057
7140
|
:param str symbol: unified CCXT market symbol
|
|
7058
7141
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7093,9 +7176,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7093
7176
|
"""
|
|
7094
7177
|
retrieves the users liquidated positions
|
|
7095
7178
|
|
|
7096
|
-
https://www.gate.
|
|
7097
|
-
https://www.gate.
|
|
7098
|
-
https://www.gate.
|
|
7179
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-liquidation-history
|
|
7180
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-liquidation-history-2
|
|
7181
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-user-s-liquidation-history-of-specified-underlying
|
|
7099
7182
|
|
|
7100
7183
|
:param str symbol: unified CCXT market symbol
|
|
7101
7184
|
:param int [since]: the earliest time in ms to fetch liquidations for
|
|
@@ -7214,12 +7297,27 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7214
7297
|
quoteValueString = self.safe_string(liquidation, 'pnl')
|
|
7215
7298
|
if quoteValueString is None:
|
|
7216
7299
|
quoteValueString = Precise.string_mul(baseValueString, priceString)
|
|
7300
|
+
# --- derive side ---
|
|
7301
|
+
# 1) options payload has explicit 'side': 'long' | 'short'
|
|
7302
|
+
optPos = self.safe_string_lower(liquidation, 'side')
|
|
7303
|
+
side: Str = None
|
|
7304
|
+
if optPos == 'long':
|
|
7305
|
+
side = 'buy'
|
|
7306
|
+
elif optPos == 'short':
|
|
7307
|
+
side = 'sell'
|
|
7308
|
+
else:
|
|
7309
|
+
if size is not None: # 2) futures/perpetual(and fallback for options): infer from size
|
|
7310
|
+
if Precise.string_gt(size, '0'):
|
|
7311
|
+
side = 'buy'
|
|
7312
|
+
elif Precise.string_lt(size, '0'):
|
|
7313
|
+
side = 'sell'
|
|
7217
7314
|
return self.safe_liquidation({
|
|
7218
7315
|
'info': liquidation,
|
|
7219
7316
|
'symbol': self.safe_symbol(marketId, market),
|
|
7220
7317
|
'contracts': self.parse_number(contractsString),
|
|
7221
7318
|
'contractSize': self.parse_number(contractSizeString),
|
|
7222
7319
|
'price': self.parse_number(priceString),
|
|
7320
|
+
'side': side,
|
|
7223
7321
|
'baseValue': self.parse_number(baseValueString),
|
|
7224
7322
|
'quoteValue': self.parse_number(Precise.string_abs(quoteValueString)),
|
|
7225
7323
|
'timestamp': timestamp,
|
|
@@ -7230,7 +7328,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7230
7328
|
"""
|
|
7231
7329
|
fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
|
7232
7330
|
|
|
7233
|
-
https://www.gate.
|
|
7331
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
|
|
7234
7332
|
|
|
7235
7333
|
:param str symbol: unified symbol of the market to fetch greeks for
|
|
7236
7334
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7321,9 +7419,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7321
7419
|
"""
|
|
7322
7420
|
closes open positions for a market
|
|
7323
7421
|
|
|
7324
|
-
https://www.gate.
|
|
7325
|
-
https://www.gate.
|
|
7326
|
-
https://www.gate.
|
|
7422
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order
|
|
7423
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-a-futures-order-2
|
|
7424
|
+
https://www.gate.com/docs/developers/apiv4/en/#create-an-options-order
|
|
7327
7425
|
|
|
7328
7426
|
:param str symbol: Unified CCXT market symbol
|
|
7329
7427
|
:param str side: 'buy' or 'sell'
|
|
@@ -7342,9 +7440,9 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7342
7440
|
"""
|
|
7343
7441
|
fetch the set leverage for a market
|
|
7344
7442
|
|
|
7345
|
-
https://www.gate.
|
|
7346
|
-
https://www.gate.
|
|
7347
|
-
https://www.gate.
|
|
7443
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-unified-account-information
|
|
7444
|
+
https://www.gate.com/docs/developers/apiv4/en/#get-detail-of-lending-market
|
|
7445
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
|
|
7348
7446
|
|
|
7349
7447
|
:param str symbol: unified market symbol
|
|
7350
7448
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7446,8 +7544,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7446
7544
|
"""
|
|
7447
7545
|
fetch the set leverage for all leverage markets, only spot margin is supported on gate
|
|
7448
7546
|
|
|
7449
|
-
https://www.gate.
|
|
7450
|
-
https://www.gate.
|
|
7547
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-lending-markets
|
|
7548
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
|
|
7451
7549
|
|
|
7452
7550
|
:param str[] symbols: a list of unified market symbols
|
|
7453
7551
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7506,7 +7604,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7506
7604
|
"""
|
|
7507
7605
|
fetches option data that is commonly found in an option chain
|
|
7508
7606
|
|
|
7509
|
-
https://www.gate.
|
|
7607
|
+
https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-detail
|
|
7510
7608
|
|
|
7511
7609
|
:param str symbol: unified market symbol
|
|
7512
7610
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7564,7 +7662,7 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7564
7662
|
"""
|
|
7565
7663
|
fetches data for an underlying asset that is commonly found in an option chain
|
|
7566
7664
|
|
|
7567
|
-
https://www.gate.
|
|
7665
|
+
https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
|
|
7568
7666
|
|
|
7569
7667
|
:param str code: base currency to fetch an option chain for
|
|
7570
7668
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
|
@@ -7690,8 +7788,8 @@ class gate(Exchange, ImplicitAPI):
|
|
|
7690
7788
|
"""
|
|
7691
7789
|
fetches historical positions
|
|
7692
7790
|
|
|
7693
|
-
https://www.gate.
|
|
7694
|
-
https://www.gate.
|
|
7791
|
+
https://www.gate.com/docs/developers/apiv4/#list-position-close-history
|
|
7792
|
+
https://www.gate.com/docs/developers/apiv4/#list-position-close-history-2
|
|
7695
7793
|
|
|
7696
7794
|
:param str[] symbols: unified conract symbols, must all have the same settle currency and the same market type
|
|
7697
7795
|
:param int [since]: the earliest time in ms to fetch positions for
|