gate-io-api 0.0.65__py3-none-any.whl → 0.0.100__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gate-io-api might be problematic. Click here for more details.

@@ -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.io',
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.io/docs/developers/apiv4/en/',
45
- 'www': 'https://gate.io/',
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://fx-api-testnet.gateio.ws/api/v4',
76
- 'delivery': 'https://fx-api-testnet.gateio.ws/api/v4',
77
- 'options': 'https://fx-api-testnet.gateio.ws/api/v4',
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://fx-api-testnet.gateio.ws/api/v4',
81
- 'delivery': 'https://fx-api-testnet.gateio.ws/api/v4',
82
- 'options': 'https://fx-api-testnet.gateio.ws/api/v4',
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.io/signup/2436035',
96
+ 'url': 'https://www.gate.com/share/CCXTGATE',
87
97
  'discount': 0.2,
88
98
  },
89
99
  },
@@ -126,7 +136,7 @@ class gate(Exchange, ImplicitAPI):
126
136
  'fetchCurrencies': True,
127
137
  'fetchDepositAddress': True,
128
138
  'fetchDepositAddresses': False,
129
- 'fetchDepositAddressesByNetwork': False,
139
+ 'fetchDepositAddressesByNetwork': True,
130
140
  'fetchDeposits': True,
131
141
  'fetchDepositWithdrawFee': 'emulated',
132
142
  'fetchDepositWithdrawFees': True,
@@ -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
- 'currencies': 1,
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}/risk_limit_tiers': 1,
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
- 'multi_collateral/currencies': 20 / 15,
585
- 'multi_collateral/ltv': 20 / 15,
586
- 'multi_collateral/fixed_rate': 20 / 15,
587
- 'multi_collateral/current_rate': 20 / 15,
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
- 'POLYGON': 'POL',
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.io/docs/developers/apiv4/en/#label-list
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.io/docs/developers/apiv4/#get-account-detail
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.io/docs/developers/apiv4/en/#get-server-current-time
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.io/docs/developers/apiv4/en/#list-all-currency-pairs-supported # spot
1227
- https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading # margin
1228
- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts # swap
1229
- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2 # future
1230
- https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time # option
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
- sandboxMode = self.safe_bool(self.options, 'sandboxMode', False)
1240
- rawPromises = [
1241
- self.fetch_contract_markets(params),
1242
- self.fetch_option_markets(params),
1243
- ]
1244
- if not sandboxMode:
1245
- # gate does not have a sandbox for spot markets
1246
- mainnetOnly = [self.fetch_spot_markets(params)]
1247
- rawPromises = self.array_concat(rawPromises, mainnetOnly)
1248
- promises = await asyncio.gather(*rawPromises)
1249
- spotMarkets = self.safe_value(promises, 0, [])
1250
- contractMarkets = self.safe_value(promises, 1, [])
1251
- optionMarkets = self.safe_value(promises, 2, [])
1252
- markets = self.array_concat(spotMarkets, contractMarkets)
1253
- return self.array_concat(markets, optionMarkets)
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)
@@ -1264,17 +1330,21 @@ class gate(Exchange, ImplicitAPI):
1264
1330
  # {
1265
1331
  # "id": "QTUM_ETH",
1266
1332
  # "base": "QTUM",
1333
+ # "base_name": "Quantum",
1267
1334
  # "quote": "ETH",
1335
+ # "quote_name": "Ethereum",
1268
1336
  # "fee": "0.2",
1269
1337
  # "min_base_amount": "0.01",
1270
1338
  # "min_quote_amount": "0.001",
1339
+ # "max_quote_amount": "50000",
1271
1340
  # "amount_precision": 3,
1272
1341
  # "precision": 6,
1273
1342
  # "trade_status": "tradable",
1274
- # "sell_start": 0,
1275
- # "buy_start": 0
1343
+ # "sell_start": 1607313600,
1344
+ # "buy_start": 1700492400,
1345
+ # "type": "normal",
1346
+ # "trade_url": "https://www.gate.com/trade/QTUM_ETH",
1276
1347
  # }
1277
- # ]
1278
1348
  #
1279
1349
  # Margin
1280
1350
  #
@@ -1305,6 +1375,8 @@ class gate(Exchange, ImplicitAPI):
1305
1375
  tradeStatus = self.safe_string(market, 'trade_status')
1306
1376
  leverage = self.safe_number(market, 'leverage')
1307
1377
  margin = leverage is not None
1378
+ buyStart = self.safe_integer_product(spotMarket, 'buy_start', 1000) # buy_start is the trading start time, while sell_start is offline orders start time
1379
+ createdTs = buyStart if (buyStart != 0) else None
1308
1380
  result.append({
1309
1381
  'id': id,
1310
1382
  'symbol': base + '/' + quote,
@@ -1354,15 +1426,16 @@ class gate(Exchange, ImplicitAPI):
1354
1426
  'max': self.safe_number(market, 'max_quote_amount') if margin else None,
1355
1427
  },
1356
1428
  },
1357
- 'created': None,
1429
+ 'created': createdTs,
1358
1430
  'info': market,
1359
1431
  })
1360
1432
  return result
1361
1433
 
1362
- async def fetch_contract_markets(self, params={}):
1434
+ async def fetch_swap_markets(self, params={}):
1363
1435
  result = []
1364
1436
  swapSettlementCurrencies = self.get_settlement_currencies('swap', 'fetchMarkets')
1365
- futureSettlementCurrencies = self.get_settlement_currencies('future', 'fetchMarkets')
1437
+ if self.options['sandboxMode']:
1438
+ swapSettlementCurrencies = ['usdt'] # gate sandbox only has usdt-margined swaps
1366
1439
  for c in range(0, len(swapSettlementCurrencies)):
1367
1440
  settleId = swapSettlementCurrencies[c]
1368
1441
  request: dict = {
@@ -1372,6 +1445,13 @@ class gate(Exchange, ImplicitAPI):
1372
1445
  for i in range(0, len(response)):
1373
1446
  parsedMarket = self.parse_contract_market(response[i], settleId)
1374
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')
1375
1455
  for c in range(0, len(futureSettlementCurrencies)):
1376
1456
  settleId = futureSettlementCurrencies[c]
1377
1457
  request: dict = {
@@ -1412,13 +1492,14 @@ class gate(Exchange, ImplicitAPI):
1412
1492
  # "leverage_min": "1",
1413
1493
  # "leverage_max": "100",
1414
1494
  # "risk_limit_max": "8000000",
1415
- # "maker_fee_rate": "-0.00025",
1416
- # "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
1417
1497
  # "funding_rate": "0.002053",
1418
1498
  # "order_size_max": 1000000,
1419
1499
  # "funding_next_apply": 1610035200,
1420
1500
  # "short_users": 977,
1421
1501
  # "config_change_time": 1609899548,
1502
+ # "create_time": 1609800048,
1422
1503
  # "trade_size": 28530850594,
1423
1504
  # "position_size": 5223816,
1424
1505
  # "long_users": 455,
@@ -1456,8 +1537,8 @@ class gate(Exchange, ImplicitAPI):
1456
1537
  # "risk_limit_base": "140.726652109199",
1457
1538
  # "risk_limit_step": "1000000",
1458
1539
  # "risk_limit_max": "8000000",
1459
- # "maker_fee_rate": "-0.00025",
1460
- # "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
1461
1542
  # "ref_discount_rate": "0",
1462
1543
  # "ref_rebate_rate": "0.2",
1463
1544
  # "order_price_deviate": "0.5",
@@ -1494,8 +1575,6 @@ class gate(Exchange, ImplicitAPI):
1494
1575
  maxMultiplier = Precise.string_add('1', priceDeviate)
1495
1576
  minPrice = Precise.string_mul(minMultiplier, markPrice)
1496
1577
  maxPrice = Precise.string_mul(maxMultiplier, markPrice)
1497
- takerPercent = self.safe_string(market, 'taker_fee_rate')
1498
- makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
1499
1578
  isLinear = quote == settle
1500
1579
  contractSize = self.safe_string(market, 'quanto_multiplier')
1501
1580
  # exception only for one market: https://api.gateio.ws/api/v4/futures/btc/contracts
@@ -1520,8 +1599,8 @@ class gate(Exchange, ImplicitAPI):
1520
1599
  'contract': True,
1521
1600
  'linear': isLinear,
1522
1601
  'inverse': not isLinear,
1523
- 'taker': self.parse_number(Precise.string_div(takerPercent, '100')), # Fee is in %, so divide by 100
1524
- 'maker': self.parse_number(Precise.string_div(makerPercent, '100')),
1602
+ 'taker': None,
1603
+ 'maker': None,
1525
1604
  'contractSize': self.parse_number(contractSize),
1526
1605
  'expiry': expiry,
1527
1606
  'expiryDatetime': self.iso8601(expiry),
@@ -1549,7 +1628,7 @@ class gate(Exchange, ImplicitAPI):
1549
1628
  'max': None,
1550
1629
  },
1551
1630
  },
1552
- 'created': None,
1631
+ 'created': self.safe_integer_product(market, 'create_time', 1000),
1553
1632
  'info': market,
1554
1633
  }
1555
1634
 
@@ -1620,8 +1699,6 @@ class gate(Exchange, ImplicitAPI):
1620
1699
  maxMultiplier = Precise.string_add('1', priceDeviate)
1621
1700
  minPrice = Precise.string_mul(minMultiplier, markPrice)
1622
1701
  maxPrice = Precise.string_mul(maxMultiplier, markPrice)
1623
- takerPercent = self.safe_string(market, 'taker_fee_rate')
1624
- makerPercent = self.safe_string(market, 'maker_fee_rate', takerPercent)
1625
1702
  result.append({
1626
1703
  'id': id,
1627
1704
  'symbol': symbol,
@@ -1641,12 +1718,12 @@ class gate(Exchange, ImplicitAPI):
1641
1718
  'contract': True,
1642
1719
  'linear': True,
1643
1720
  'inverse': False,
1644
- 'taker': self.parse_number(Precise.string_div(takerPercent, '100')), # Fee is in %, so divide by 100
1645
- 'maker': self.parse_number(Precise.string_div(makerPercent, '100')),
1721
+ 'taker': None,
1722
+ 'maker': None,
1646
1723
  'contractSize': self.parse_number('1'),
1647
1724
  'expiry': expiry,
1648
1725
  'expiryDatetime': self.iso8601(expiry),
1649
- 'strike': strike,
1726
+ 'strike': self.parse_number(strike),
1650
1727
  'optionType': optionType,
1651
1728
  'precision': {
1652
1729
  'amount': self.parse_number('1'), # all options have self step size
@@ -1800,7 +1877,7 @@ class gate(Exchange, ImplicitAPI):
1800
1877
  """
1801
1878
  fetches all available currencies on an exchange
1802
1879
 
1803
- https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
1880
+ https://www.gate.com/docs/developers/apiv4/en/#list-all-currencies-details
1804
1881
 
1805
1882
  :param dict [params]: extra parameters specific to the exchange API endpoint
1806
1883
  :returns dict: an associative dictionary of currencies
@@ -1808,7 +1885,7 @@ class gate(Exchange, ImplicitAPI):
1808
1885
  # sandbox/testnet only supports future markets
1809
1886
  apiBackup = self.safe_value(self.urls, 'apiBackup')
1810
1887
  if apiBackup is not None:
1811
- return None
1888
+ return {}
1812
1889
  response = await self.publicSpotGetCurrencies(params)
1813
1890
  #
1814
1891
  # [
@@ -1901,7 +1978,7 @@ class gate(Exchange, ImplicitAPI):
1901
1978
  """
1902
1979
  fetch the current funding rate
1903
1980
 
1904
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
1981
+ https://www.gate.com/docs/developers/apiv4/en/#get-a-single-contract
1905
1982
 
1906
1983
  :param str symbol: unified market symbol
1907
1984
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -1963,7 +2040,7 @@ class gate(Exchange, ImplicitAPI):
1963
2040
  """
1964
2041
  fetch the funding rate for multiple markets
1965
2042
 
1966
- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
2043
+ https://www.gate.com/docs/developers/apiv4/en/#list-all-futures-contracts
1967
2044
 
1968
2045
  :param str[]|None symbols: list of unified market symbols
1969
2046
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2159,28 +2236,26 @@ class gate(Exchange, ImplicitAPI):
2159
2236
  chains = self.safe_value(response, 'multichain_addresses', [])
2160
2237
  currencyId = self.safe_string(response, 'currency')
2161
2238
  currency = self.safe_currency(currencyId, currency)
2162
- parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
2163
- 'currency': currency['id'],
2164
- })
2239
+ parsed = self.parse_deposit_addresses(chains, None, False)
2165
2240
  return self.index_by(parsed, 'network')
2166
2241
 
2167
2242
  async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
2168
2243
  """
2169
2244
  fetch the deposit address for a currency associated with self account
2170
2245
 
2171
- https://www.gate.io/docs/developers/apiv4/en/#generate-currency-deposit-address
2246
+ https://www.gate.com/docs/developers/apiv4/en/#generate-currency-deposit-address
2172
2247
 
2173
2248
  :param str code: unified currency code
2174
2249
  :param dict [params]: extra parameters specific to the exchange API endpoint
2175
- :param str [params.network]: unified network code(not used directly by gate.io but used by ccxt to filter the response)
2250
+ :param str [params.network]: unified network code(not used directly by gate.com but used by ccxt to filter the response)
2176
2251
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
2177
2252
  """
2178
2253
  await self.load_markets()
2179
2254
  networkCode = None
2180
2255
  networkCode, params = self.handle_network_code_and_params(params)
2181
2256
  chainsIndexedById = await self.fetch_deposit_addresses_by_network(code, params)
2182
- selectedNetworkId = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
2183
- return chainsIndexedById[selectedNetworkId]
2257
+ selectedNetworkIdOrCode = self.select_network_code_from_unified_networks(code, networkCode, chainsIndexedById)
2258
+ return chainsIndexedById[selectedNetworkIdOrCode]
2184
2259
 
2185
2260
  def parse_deposit_address(self, depositAddress, currency=None):
2186
2261
  #
@@ -2206,7 +2281,7 @@ class gate(Exchange, ImplicitAPI):
2206
2281
  """
2207
2282
  fetch the trading fees for a market
2208
2283
 
2209
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-personal-trading-fee
2284
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
2210
2285
 
2211
2286
  :param str symbol: unified market symbol
2212
2287
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2238,7 +2313,7 @@ class gate(Exchange, ImplicitAPI):
2238
2313
  """
2239
2314
  fetch the trading fees for multiple markets
2240
2315
 
2241
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-personal-trading-fee
2316
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-personal-trading-fee
2242
2317
 
2243
2318
  :param dict [params]: extra parameters specific to the exchange API endpoint
2244
2319
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
@@ -2304,7 +2379,7 @@ class gate(Exchange, ImplicitAPI):
2304
2379
  @deprecated
2305
2380
  please use fetchDepositWithdrawFees instead
2306
2381
 
2307
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-status
2382
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
2308
2383
 
2309
2384
  :param str[]|None codes: list of unified currency codes
2310
2385
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2342,10 +2417,11 @@ class gate(Exchange, ImplicitAPI):
2342
2417
  if withdrawFixOnChains is None:
2343
2418
  withdrawFees = self.safe_number(entry, 'withdraw_fix')
2344
2419
  else:
2345
- chainKeys = list(withdrawFixOnChains.keys())
2346
- for j in range(0, len(chainKeys)):
2347
- chainKey = chainKeys[j]
2348
- withdrawFees[chainKey] = self.parse_number(withdrawFixOnChains[chainKey])
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])
2349
2425
  result[code] = {
2350
2426
  'withdraw': withdrawFees,
2351
2427
  'deposit': None,
@@ -2357,7 +2433,7 @@ class gate(Exchange, ImplicitAPI):
2357
2433
  """
2358
2434
  fetch deposit and withdraw fees
2359
2435
 
2360
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-status
2436
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-status
2361
2437
 
2362
2438
  :param str[]|None codes: list of unified currency codes
2363
2439
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2438,8 +2514,8 @@ class gate(Exchange, ImplicitAPI):
2438
2514
  """
2439
2515
  fetch the history of funding payments paid and received on self account
2440
2516
 
2441
- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
2442
- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
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
2443
2519
 
2444
2520
  :param str symbol: unified market symbol
2445
2521
  :param int [since]: the earliest time in ms to fetch funding history for
@@ -2518,10 +2594,10 @@ class gate(Exchange, ImplicitAPI):
2518
2594
  """
2519
2595
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
2520
2596
 
2521
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-order-book
2522
- https://www.gate.io/docs/developers/apiv4/en/#futures-order-book
2523
- https://www.gate.io/docs/developers/apiv4/en/#futures-order-book-2
2524
- https://www.gate.io/docs/developers/apiv4/en/#options-order-book
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
2525
2601
 
2526
2602
  :param str symbol: unified symbol of the market to fetch the order book for
2527
2603
  :param int [limit]: the maximum amount of order book entries to return
@@ -2540,7 +2616,11 @@ class gate(Exchange, ImplicitAPI):
2540
2616
  #
2541
2617
  request, query = self.prepare_request(market, market['type'], params)
2542
2618
  if limit is not None:
2543
- request['limit'] = limit # default 10, max 100
2619
+ if market['spot']:
2620
+ limit = min(limit, 1000)
2621
+ else:
2622
+ limit = min(limit, 300)
2623
+ request['limit'] = limit
2544
2624
  request['with_id'] = True
2545
2625
  response = None
2546
2626
  if market['spot'] or market['margin']:
@@ -2631,10 +2711,10 @@ class gate(Exchange, ImplicitAPI):
2631
2711
  """
2632
2712
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
2633
2713
 
2634
- https://www.gate.io/docs/developers/apiv4/en/#get-details-of-a-specifc-order
2635
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers
2636
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers-2
2637
- https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts
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
2638
2718
 
2639
2719
  :param str symbol: unified symbol of the market to fetch the ticker for
2640
2720
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2784,10 +2864,10 @@ class gate(Exchange, ImplicitAPI):
2784
2864
  """
2785
2865
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
2786
2866
 
2787
- https://www.gate.io/docs/developers/apiv4/en/#get-details-of-a-specifc-order
2788
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers
2789
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-tickers-2
2790
- https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts
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
2791
2871
 
2792
2872
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
2793
2873
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -2830,6 +2910,14 @@ class gate(Exchange, ImplicitAPI):
2830
2910
 
2831
2911
  async def fetch_balance(self, params={}) -> Balances:
2832
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
+
2833
2921
  :param dict [params]: exchange specific parameters
2834
2922
  :param str [params.type]: spot, margin, swap or future, if not provided self.options['defaultType'] is used
2835
2923
  :param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - default="usdt" for swap and "btc" for future
@@ -3070,7 +3158,7 @@ class gate(Exchange, ImplicitAPI):
3070
3158
  result: dict = {
3071
3159
  'info': response,
3072
3160
  }
3073
- isolated = marginMode == 'margin'
3161
+ isolated = marginMode == 'margin' and type == 'spot'
3074
3162
  data = response
3075
3163
  if 'balances' in data: # True for cross_margin and unified
3076
3164
  flatBalances = []
@@ -3103,14 +3191,14 @@ class gate(Exchange, ImplicitAPI):
3103
3191
  returnResult = result if isolated else self.safe_balance(result)
3104
3192
  return returnResult
3105
3193
 
3106
- 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]:
3107
3195
  """
3108
3196
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
3109
3197
 
3110
- https://www.gate.io/docs/developers/apiv4/en/#market-candlesticks # spot
3111
- https://www.gate.io/docs/developers/apiv4/en/#get-futures-candlesticks # swap
3112
- https://www.gate.io/docs/developers/apiv4/en/#market-candlesticks # future
3113
- https://www.gate.io/docs/developers/apiv4/en/#get-options-candlesticks # option
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
3114
3202
 
3115
3203
  :param str symbol: unified symbol of the market to fetch OHLCV data for
3116
3204
  :param str timeframe: the length of time each candle represents
@@ -3184,7 +3272,7 @@ class gate(Exchange, ImplicitAPI):
3184
3272
  """
3185
3273
  fetches historical funding rate prices
3186
3274
 
3187
- https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
3275
+ https://www.gate.com/docs/developers/apiv4/en/#funding-rate-history
3188
3276
 
3189
3277
  :param str symbol: unified symbol of the market to fetch the funding rate history for
3190
3278
  :param int [since]: timestamp in ms of the earliest funding rate to fetch
@@ -3284,10 +3372,10 @@ class gate(Exchange, ImplicitAPI):
3284
3372
  """
3285
3373
  get the list of most recent trades for a particular symbol
3286
3374
 
3287
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
3288
- https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
3289
- https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
3290
- https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
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
3291
3379
 
3292
3380
  :param str symbol: unified symbol of the market to fetch trades for
3293
3381
  :param int [since]: timestamp in ms of the earliest trade to fetch
@@ -3390,10 +3478,10 @@ class gate(Exchange, ImplicitAPI):
3390
3478
  """
3391
3479
  fetch all the trades made from a single order
3392
3480
 
3393
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
3394
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
3395
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
3396
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
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
3397
3485
 
3398
3486
  :param str id: order id
3399
3487
  :param str symbol: unified market symbol
@@ -3431,10 +3519,10 @@ class gate(Exchange, ImplicitAPI):
3431
3519
  """
3432
3520
  Fetch personal trading history
3433
3521
 
3434
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
3435
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
3436
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
3437
- https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
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
3438
3526
 
3439
3527
  :param str symbol: unified market symbol
3440
3528
  :param int [since]: the earliest time in ms to fetch trades for
@@ -3724,7 +3812,7 @@ class gate(Exchange, ImplicitAPI):
3724
3812
  """
3725
3813
  fetch all deposits made to an account
3726
3814
 
3727
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
3815
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-deposit-records
3728
3816
 
3729
3817
  :param str code: unified currency code
3730
3818
  :param int [since]: the earliest time in ms to fetch deposits for
@@ -3750,7 +3838,7 @@ class gate(Exchange, ImplicitAPI):
3750
3838
  start = self.parse_to_int(since / 1000)
3751
3839
  request['from'] = start
3752
3840
  request['to'] = self.sum(start, 30 * 24 * 60 * 60)
3753
- request, params = self.handle_until_option('to', request, params)
3841
+ request, params = self.handle_until_option('to', request, params, 0.001)
3754
3842
  response = await self.privateWalletGetDeposits(self.extend(request, params))
3755
3843
  return self.parse_transactions(response, currency)
3756
3844
 
@@ -3758,7 +3846,7 @@ class gate(Exchange, ImplicitAPI):
3758
3846
  """
3759
3847
  fetch all withdrawals made from an account
3760
3848
 
3761
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
3849
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-withdrawal-records
3762
3850
 
3763
3851
  :param str code: unified currency code
3764
3852
  :param int [since]: the earliest time in ms to fetch withdrawals for
@@ -3784,15 +3872,15 @@ class gate(Exchange, ImplicitAPI):
3784
3872
  start = self.parse_to_int(since / 1000)
3785
3873
  request['from'] = start
3786
3874
  request['to'] = self.sum(start, 30 * 24 * 60 * 60)
3787
- request, params = self.handle_until_option('to', request, params)
3875
+ request, params = self.handle_until_option('to', request, params, 0.001)
3788
3876
  response = await self.privateWalletGetWithdrawals(self.extend(request, params))
3789
3877
  return self.parse_transactions(response, currency)
3790
3878
 
3791
- 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:
3792
3880
  """
3793
3881
  make a withdrawal
3794
3882
 
3795
- https://www.gate.io/docs/developers/apiv4/en/#withdraw
3883
+ https://www.gate.com/docs/developers/apiv4/en/#withdraw
3796
3884
 
3797
3885
  :param str code: unified currency code
3798
3886
  :param float amount: the amount to withdraw
@@ -3966,13 +4054,13 @@ class gate(Exchange, ImplicitAPI):
3966
4054
  """
3967
4055
  Create an order on the exchange
3968
4056
 
3969
- https://www.gate.io/docs/developers/apiv4/en/#create-an-order
3970
- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
3971
- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
3972
- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
3973
- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
3974
- https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
3975
- https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
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
3976
4064
 
3977
4065
  :param str symbol: Unified CCXT market symbol
3978
4066
  :param str type: 'limit' or 'market' *"market" is contract only*
@@ -4115,7 +4203,7 @@ class gate(Exchange, ImplicitAPI):
4115
4203
  triggerValue = self.safe_value_n(orderParams, ['triggerPrice', 'stopPrice', 'takeProfitPrice', 'stopLossPrice'])
4116
4204
  if triggerValue is not None:
4117
4205
  raise NotSupported(self.id + ' createOrders() does not support advanced order properties(stopPrice, takeProfitPrice, stopLossPrice)')
4118
- extendedParams['textIsRequired'] = True # Gate.io requires a text parameter for each order here
4206
+ extendedParams['textIsRequired'] = True # the exchange requires a text parameter for each order here
4119
4207
  orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
4120
4208
  ordersRequests.append(orderRequest)
4121
4209
  symbols = self.market_symbols(orderSymbols, None, False, True, True)
@@ -4128,9 +4216,9 @@ class gate(Exchange, ImplicitAPI):
4128
4216
  """
4129
4217
  create a list of trade orders
4130
4218
 
4131
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
4132
- https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
4133
- https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
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
4134
4222
 
4135
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
4136
4224
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -4363,7 +4451,7 @@ class gate(Exchange, ImplicitAPI):
4363
4451
  """
4364
4452
  create a market buy order by providing the symbol and cost
4365
4453
 
4366
- https://www.gate.io/docs/developers/apiv4/en/#create-an-order
4454
+ https://www.gate.com/docs/developers/apiv4/en/#create-an-order
4367
4455
 
4368
4456
  :param str symbol: unified symbol of the market to create an order in
4369
4457
  :param float cost: how much you want to trade in units of the quote currency
@@ -4416,8 +4504,8 @@ class gate(Exchange, ImplicitAPI):
4416
4504
  """
4417
4505
  edit a trade order, gate currently only supports the modification of the price or amount fields
4418
4506
 
4419
- https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
4420
- https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
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
4421
4509
 
4422
4510
  :param str id: order id
4423
4511
  :param str symbol: unified symbol of the market to create an order in
@@ -4761,10 +4849,10 @@ class gate(Exchange, ImplicitAPI):
4761
4849
  """
4762
4850
  Retrieves information on an order
4763
4851
 
4764
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order
4765
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
4766
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-3
4767
- https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-4
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
4768
4856
 
4769
4857
  :param str id: Order id
4770
4858
  :param str symbol: Unified market symbol, *required for spot and margin*
@@ -4809,8 +4897,8 @@ class gate(Exchange, ImplicitAPI):
4809
4897
  """
4810
4898
  fetch all unfilled currently open orders
4811
4899
 
4812
- https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
4813
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
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
4814
4902
 
4815
4903
  :param str symbol: unified market symbol
4816
4904
  :param int [since]: the earliest time in ms to fetch open orders for
@@ -4828,14 +4916,14 @@ class gate(Exchange, ImplicitAPI):
4828
4916
  """
4829
4917
  fetches information on multiple closed orders made by the user
4830
4918
 
4831
- https://www.gate.io/docs/developers/apiv4/en/#list-orders
4832
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
4833
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
4834
- https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
4835
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
4836
- https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
4837
- https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
4838
- https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-by-time-range
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
4839
4927
 
4840
4928
  :param str symbol: unified market symbol of the market orders were made in
4841
4929
  :param int [since]: the earliest time in ms to fetch orders for
@@ -5102,10 +5190,10 @@ class gate(Exchange, ImplicitAPI):
5102
5190
  """
5103
5191
  Cancels an open order
5104
5192
 
5105
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
5106
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
5107
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
5108
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
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
5109
5197
 
5110
5198
  :param str id: Order id
5111
5199
  :param str symbol: Unified market symbol
@@ -5229,8 +5317,8 @@ class gate(Exchange, ImplicitAPI):
5229
5317
  """
5230
5318
  cancel multiple orders
5231
5319
 
5232
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5233
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2
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
5234
5322
 
5235
5323
  :param str[] ids: order ids
5236
5324
  :param str symbol: unified symbol of the market the order was made in
@@ -5273,7 +5361,7 @@ class gate(Exchange, ImplicitAPI):
5273
5361
  """
5274
5362
  cancel multiple orders for multiple symbols
5275
5363
 
5276
- https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5364
+ https://www.gate.com/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5277
5365
 
5278
5366
  :param CancellationRequest[] orders: list of order ids with symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
5279
5367
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5311,10 +5399,10 @@ class gate(Exchange, ImplicitAPI):
5311
5399
  """
5312
5400
  cancel all open orders
5313
5401
 
5314
- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
5315
- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
5316
- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
5317
- https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
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
5318
5406
 
5319
5407
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
5320
5408
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5382,7 +5470,7 @@ class gate(Exchange, ImplicitAPI):
5382
5470
  """
5383
5471
  transfer currency internally between wallets on the same account
5384
5472
 
5385
- https://www.gate.io/docs/developers/apiv4/en/#transfer-between-trading-accounts
5473
+ https://www.gate.com/docs/developers/apiv4/en/#transfer-between-trading-accounts
5386
5474
 
5387
5475
  :param str code: unified currency code for currency being transferred
5388
5476
  :param float amount: the amount of currency to transfer
@@ -5456,12 +5544,12 @@ class gate(Exchange, ImplicitAPI):
5456
5544
  'info': transfer,
5457
5545
  }
5458
5546
 
5459
- async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
5547
+ async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
5460
5548
  """
5461
5549
  set the level of leverage for a market
5462
5550
 
5463
- https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
5464
- https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
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
5465
5553
 
5466
5554
  :param float leverage: the rate of leverage
5467
5555
  :param str symbol: unified market symbol
@@ -5664,9 +5752,9 @@ class gate(Exchange, ImplicitAPI):
5664
5752
  """
5665
5753
  fetch data on an open contract position
5666
5754
 
5667
- https://www.gate.io/docs/developers/apiv4/en/#get-single-position
5668
- https://www.gate.io/docs/developers/apiv4/en/#get-single-position-2
5669
- https://www.gate.io/docs/developers/apiv4/en/#get-specified-contract-position
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
5670
5758
 
5671
5759
  :param str symbol: unified market symbol of the market the position is held in
5672
5760
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5748,9 +5836,9 @@ class gate(Exchange, ImplicitAPI):
5748
5836
  """
5749
5837
  fetch all open positions
5750
5838
 
5751
- https://www.gate.io/docs/developers/apiv4/en/#list-all-positions-of-a-user
5752
- https://www.gate.io/docs/developers/apiv4/en/#list-all-positions-of-a-user-2
5753
- https://www.gate.io/docs/developers/apiv4/en/#list-user-s-positions-of-specified-underlying
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
5754
5842
 
5755
5843
  :param str[]|None symbols: Not used by gate, but parsed internally by CCXT
5756
5844
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5850,8 +5938,8 @@ class gate(Exchange, ImplicitAPI):
5850
5938
  """
5851
5939
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
5852
5940
 
5853
- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
5854
- https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
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
5855
5943
 
5856
5944
  :param str[] [symbols]: list of unified market symbols
5857
5945
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5967,7 +6055,7 @@ class gate(Exchange, ImplicitAPI):
5967
6055
  """
5968
6056
  retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
5969
6057
 
5970
- https://www.gate.io/docs/developers/apiv4/en/#list-risk-limit-tiers
6058
+ https://www.gate.com/docs/developers/apiv4/en/#list-risk-limit-tiers
5971
6059
 
5972
6060
  :param str symbol: unified market symbol
5973
6061
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -5979,7 +6067,7 @@ class gate(Exchange, ImplicitAPI):
5979
6067
  request, requestParams = self.prepare_request(market, type, query)
5980
6068
  if type != 'future' and type != 'swap':
5981
6069
  raise BadRequest(self.id + ' fetchMarketLeverageTiers only supports swap and future')
5982
- response = await self.privateFuturesGetSettleRiskLimitTiers(self.extend(request, requestParams))
6070
+ response = await self.publicFuturesGetSettleRiskLimitTiers(self.extend(request, requestParams))
5983
6071
  #
5984
6072
  # [
5985
6073
  # {
@@ -6057,7 +6145,7 @@ class gate(Exchange, ImplicitAPI):
6057
6145
  """
6058
6146
  repay borrowed margin and interest
6059
6147
 
6060
- https://www.gate.io/docs/apiv4/en/#repay-a-loan
6148
+ https://www.gate.com/docs/apiv4/en/#repay-a-loan
6061
6149
 
6062
6150
  :param str symbol: unified market symbol
6063
6151
  :param str code: unified currency code of the currency to repay
@@ -6086,8 +6174,8 @@ class gate(Exchange, ImplicitAPI):
6086
6174
  """
6087
6175
  repay cross margin borrowed margin and interest
6088
6176
 
6089
- https://www.gate.io/docs/developers/apiv4/en/#cross-margin-repayments
6090
- https://www.gate.io/docs/developers/apiv4/en/#borrow-or-repay
6177
+ https://www.gate.com/docs/developers/apiv4/en/#cross-margin-repayments
6178
+ https://www.gate.com/docs/developers/apiv4/en/#borrow-or-repay
6091
6179
 
6092
6180
  :param str code: unified currency code of the currency to repay
6093
6181
  :param float amount: the amount to repay
@@ -6135,7 +6223,7 @@ class gate(Exchange, ImplicitAPI):
6135
6223
  """
6136
6224
  create a loan to borrow margin
6137
6225
 
6138
- https://www.gate.io/docs/developers/apiv4/en/#marginuni
6226
+ https://www.gate.com/docs/developers/apiv4/en/#marginuni
6139
6227
 
6140
6228
  :param str symbol: unified market symbol, required for isolated margin
6141
6229
  :param str code: unified currency code of the currency to borrow
@@ -6180,8 +6268,8 @@ class gate(Exchange, ImplicitAPI):
6180
6268
  """
6181
6269
  create a loan to borrow margin
6182
6270
 
6183
- https://www.gate.io/docs/apiv4/en/#create-a-cross-margin-borrow-loan
6184
- https://www.gate.io/docs/developers/apiv4/en/#borrow-or-repay
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
6185
6273
 
6186
6274
  :param str code: unified currency code of the currency to borrow
6187
6275
  :param float amount: the amount to borrow
@@ -6278,9 +6366,9 @@ class gate(Exchange, ImplicitAPI):
6278
6366
  """
6279
6367
  fetch the interest owed by the user for borrowing currency for margin trading
6280
6368
 
6281
- https://www.gate.io/docs/developers/apiv4/en/#list-interest-records
6282
- https://www.gate.io/docs/developers/apiv4/en/#interest-records-for-the-cross-margin-account
6283
- https://www.gate.io/docs/developers/apiv4/en/#list-interest-records-2
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
6284
6372
 
6285
6373
  :param str [code]: unified currency code
6286
6374
  :param str [symbol]: unified market symbol when fetching interest in isolated markets
@@ -6481,8 +6569,8 @@ class gate(Exchange, ImplicitAPI):
6481
6569
  """
6482
6570
  remove margin from a position
6483
6571
 
6484
- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
6485
- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
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
6486
6574
 
6487
6575
  :param str symbol: unified market symbol
6488
6576
  :param float amount: the amount of margin to remove
@@ -6495,8 +6583,8 @@ class gate(Exchange, ImplicitAPI):
6495
6583
  """
6496
6584
  add margin
6497
6585
 
6498
- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
6499
- https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
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
6500
6588
 
6501
6589
  :param str symbol: unified market symbol
6502
6590
  :param float amount: amount of margin to add
@@ -6509,7 +6597,7 @@ class gate(Exchange, ImplicitAPI):
6509
6597
  """
6510
6598
  Retrieves the open interest of a currency
6511
6599
 
6512
- https://www.gate.io/docs/developers/apiv4/en/#futures-stats
6600
+ https://www.gate.com/docs/developers/apiv4/en/#futures-stats
6513
6601
 
6514
6602
  :param str symbol: Unified CCXT market symbol
6515
6603
  :param str timeframe: "5m", "15m", "30m", "1h", "4h", "1d"
@@ -6593,7 +6681,7 @@ class gate(Exchange, ImplicitAPI):
6593
6681
  """
6594
6682
  fetches historical settlement records
6595
6683
 
6596
- https://www.gate.io/docs/developers/apiv4/en/#list-settlement-history-2
6684
+ https://www.gate.com/docs/developers/apiv4/en/#list-settlement-history-2
6597
6685
 
6598
6686
  :param str symbol: unified market symbol of the settlement history, required on gate
6599
6687
  :param int [since]: timestamp in ms
@@ -6639,7 +6727,7 @@ class gate(Exchange, ImplicitAPI):
6639
6727
  """
6640
6728
  fetches historical settlement records of the user
6641
6729
 
6642
- https://www.gate.io/docs/developers/apiv4/en/#list-my-options-settlements
6730
+ https://www.gate.com/docs/developers/apiv4/en/#list-my-options-settlements
6643
6731
 
6644
6732
  :param str symbol: unified market symbol of the settlement history
6645
6733
  :param int [since]: timestamp in ms
@@ -6764,11 +6852,11 @@ class gate(Exchange, ImplicitAPI):
6764
6852
  """
6765
6853
  fetch the history of changes, actions done by the user or operations that altered the balance of the user
6766
6854
 
6767
- https://www.gate.io/docs/developers/apiv4/en/#query-account-book
6768
- https://www.gate.io/docs/developers/apiv4/en/#list-margin-account-balance-change-history
6769
- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
6770
- https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
6771
- https://www.gate.io/docs/developers/apiv4/en/#list-account-changing-history
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
6772
6860
 
6773
6861
  :param str [code]: unified currency code
6774
6862
  :param int [since]: timestamp in ms of the earliest ledger entry
@@ -6995,7 +7083,7 @@ class gate(Exchange, ImplicitAPI):
6995
7083
  """
6996
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
6997
7085
 
6998
- https://www.gate.io/docs/developers/apiv4/en/#enable-or-disable-dual-mode
7086
+ https://www.gate.com/docs/developers/apiv4/en/#enable-or-disable-dual-mode
6999
7087
 
7000
7088
  :param bool hedged: set to True to enable dual mode
7001
7089
  :param str|None symbol: if passed, dual mode is set for all markets with the same settle currency
@@ -7012,7 +7100,7 @@ class gate(Exchange, ImplicitAPI):
7012
7100
  """
7013
7101
  fetches the market ids of underlying assets for a specific contract market type
7014
7102
 
7015
- https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
7103
+ https://www.gate.com/docs/developers/apiv4/en/#list-all-underlyings
7016
7104
 
7017
7105
  :param dict [params]: exchange specific params
7018
7106
  :param str [params.type]: the contract market type, 'option', 'swap' or 'future', the default is 'option'
@@ -7047,7 +7135,7 @@ class gate(Exchange, ImplicitAPI):
7047
7135
  """
7048
7136
  retrieves the public liquidations of a trading pair
7049
7137
 
7050
- https://www.gate.io/docs/developers/apiv4/en/#retrieve-liquidation-history
7138
+ https://www.gate.com/docs/developers/apiv4/en/#retrieve-liquidation-history
7051
7139
 
7052
7140
  :param str symbol: unified CCXT market symbol
7053
7141
  :param int [since]: the earliest time in ms to fetch liquidations for
@@ -7088,9 +7176,9 @@ class gate(Exchange, ImplicitAPI):
7088
7176
  """
7089
7177
  retrieves the users liquidated positions
7090
7178
 
7091
- https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history
7092
- https://www.gate.io/docs/developers/apiv4/en/#list-liquidation-history-2
7093
- https://www.gate.io/docs/developers/apiv4/en/#list-user-s-liquidation-history-of-specified-underlying
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
7094
7182
 
7095
7183
  :param str symbol: unified CCXT market symbol
7096
7184
  :param int [since]: the earliest time in ms to fetch liquidations for
@@ -7209,12 +7297,27 @@ class gate(Exchange, ImplicitAPI):
7209
7297
  quoteValueString = self.safe_string(liquidation, 'pnl')
7210
7298
  if quoteValueString is None:
7211
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'
7212
7314
  return self.safe_liquidation({
7213
7315
  'info': liquidation,
7214
7316
  'symbol': self.safe_symbol(marketId, market),
7215
7317
  'contracts': self.parse_number(contractsString),
7216
7318
  'contractSize': self.parse_number(contractSizeString),
7217
7319
  'price': self.parse_number(priceString),
7320
+ 'side': side,
7218
7321
  'baseValue': self.parse_number(baseValueString),
7219
7322
  'quoteValue': self.parse_number(Precise.string_abs(quoteValueString)),
7220
7323
  'timestamp': timestamp,
@@ -7225,7 +7328,7 @@ class gate(Exchange, ImplicitAPI):
7225
7328
  """
7226
7329
  fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
7227
7330
 
7228
- https://www.gate.io/docs/developers/apiv4/en/#list-tickers-of-options-contracts
7331
+ https://www.gate.com/docs/developers/apiv4/en/#list-tickers-of-options-contracts
7229
7332
 
7230
7333
  :param str symbol: unified symbol of the market to fetch greeks for
7231
7334
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7316,9 +7419,9 @@ class gate(Exchange, ImplicitAPI):
7316
7419
  """
7317
7420
  closes open positions for a market
7318
7421
 
7319
- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
7320
- https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
7321
- https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
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
7322
7425
 
7323
7426
  :param str symbol: Unified CCXT market symbol
7324
7427
  :param str side: 'buy' or 'sell'
@@ -7337,9 +7440,9 @@ class gate(Exchange, ImplicitAPI):
7337
7440
  """
7338
7441
  fetch the set leverage for a market
7339
7442
 
7340
- https://www.gate.io/docs/developers/apiv4/en/#get-unified-account-information
7341
- https://www.gate.io/docs/developers/apiv4/en/#get-detail-of-lending-market
7342
- https://www.gate.io/docs/developers/apiv4/en/#query-one-single-margin-currency-pair-deprecated
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
7343
7446
 
7344
7447
  :param str symbol: unified market symbol
7345
7448
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7441,8 +7544,8 @@ class gate(Exchange, ImplicitAPI):
7441
7544
  """
7442
7545
  fetch the set leverage for all leverage markets, only spot margin is supported on gate
7443
7546
 
7444
- https://www.gate.io/docs/developers/apiv4/en/#list-lending-markets
7445
- https://www.gate.io/docs/developers/apiv4/en/#list-all-supported-currency-pairs-supported-in-margin-trading-deprecated
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
7446
7549
 
7447
7550
  :param str[] symbols: a list of unified market symbols
7448
7551
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7501,7 +7604,7 @@ class gate(Exchange, ImplicitAPI):
7501
7604
  """
7502
7605
  fetches option data that is commonly found in an option chain
7503
7606
 
7504
- https://www.gate.io/docs/developers/apiv4/en/#query-specified-contract-detail
7607
+ https://www.gate.com/docs/developers/apiv4/en/#query-specified-contract-detail
7505
7608
 
7506
7609
  :param str symbol: unified market symbol
7507
7610
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7559,7 +7662,7 @@ class gate(Exchange, ImplicitAPI):
7559
7662
  """
7560
7663
  fetches data for an underlying asset that is commonly found in an option chain
7561
7664
 
7562
- https://www.gate.io/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
7665
+ https://www.gate.com/docs/developers/apiv4/en/#list-all-the-contracts-with-specified-underlying-and-expiration-time
7563
7666
 
7564
7667
  :param str code: base currency to fetch an option chain for
7565
7668
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -7685,8 +7788,8 @@ class gate(Exchange, ImplicitAPI):
7685
7788
  """
7686
7789
  fetches historical positions
7687
7790
 
7688
- https://www.gate.io/docs/developers/apiv4/#list-position-close-history
7689
- https://www.gate.io/docs/developers/apiv4/#list-position-close-history-2
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
7690
7793
 
7691
7794
  :param str[] symbols: unified conract symbols, must all have the same settle currency and the same market type
7692
7795
  :param int [since]: the earliest time in ms to fetch positions for