ccxt 4.4.94__py2.py3-none-any.whl → 4.4.96__py2.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.
- ccxt/__init__.py +3 -1
- ccxt/abstract/bingx.py +3 -0
- ccxt/abstract/foxbit.py +26 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/woo.py +59 -4
- ccxt/apex.py +3 -3
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -1
- ccxt/async_support/apex.py +3 -3
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +5 -3
- ccxt/async_support/base/ws/future.py +5 -1
- ccxt/async_support/bingx.py +129 -92
- ccxt/async_support/bitget.py +31 -144
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitrue.py +13 -8
- ccxt/async_support/bitstamp.py +2 -0
- ccxt/async_support/blofin.py +6 -1
- ccxt/async_support/bybit.py +15 -6
- ccxt/async_support/coinbase.py +36 -0
- ccxt/async_support/coinbaseexchange.py +4 -2
- ccxt/async_support/coinbaseinternational.py +2 -2
- ccxt/async_support/coinmate.py +34 -0
- ccxt/async_support/coinone.py +34 -0
- ccxt/async_support/coinsph.py +29 -0
- ccxt/async_support/coinspot.py +36 -1
- ccxt/async_support/cryptocom.py +2 -1
- ccxt/async_support/cryptomus.py +41 -1
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/derive.py +1 -1
- ccxt/async_support/ellipx.py +40 -0
- ccxt/async_support/foxbit.py +1935 -0
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hyperliquid.py +3 -2
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/kucoinfutures.py +3 -2
- ccxt/async_support/mexc.py +28 -13
- ccxt/async_support/modetrade.py +3 -3
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +10 -3
- ccxt/async_support/onetrading.py +1 -1
- ccxt/async_support/oxfun.py +2 -1
- ccxt/async_support/paradex.py +2 -2
- ccxt/async_support/vertex.py +3 -2
- ccxt/async_support/woo.py +1255 -875
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/exchange.py +8 -5
- ccxt/bingx.py +129 -92
- ccxt/bitget.py +31 -144
- ccxt/bitmart.py +2 -2
- ccxt/bitrue.py +13 -8
- ccxt/bitstamp.py +2 -0
- ccxt/blofin.py +6 -1
- ccxt/bybit.py +15 -6
- ccxt/coinbase.py +36 -0
- ccxt/coinbaseexchange.py +4 -2
- ccxt/coinbaseinternational.py +2 -2
- ccxt/coinmate.py +34 -0
- ccxt/coinone.py +34 -0
- ccxt/coinsph.py +29 -0
- ccxt/coinspot.py +36 -1
- ccxt/cryptocom.py +2 -1
- ccxt/cryptomus.py +41 -1
- ccxt/defx.py +1 -1
- ccxt/derive.py +1 -1
- ccxt/ellipx.py +40 -0
- ccxt/foxbit.py +1935 -0
- ccxt/gate.py +1 -1
- ccxt/hyperliquid.py +3 -2
- ccxt/kucoin.py +1 -1
- ccxt/kucoinfutures.py +3 -2
- ccxt/mexc.py +28 -13
- ccxt/modetrade.py +3 -3
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +10 -3
- ccxt/onetrading.py +1 -1
- ccxt/oxfun.py +2 -1
- ccxt/paradex.py +2 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/hyperliquid.py +6 -6
- ccxt/pro/kraken.py +17 -16
- ccxt/pro/mexc.py +10 -10
- ccxt/test/tests_async.py +17 -2
- ccxt/test/tests_sync.py +17 -2
- ccxt/vertex.py +3 -2
- ccxt/woo.py +1255 -875
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.94.dist-info → ccxt-4.4.96.dist-info}/METADATA +8 -8
- {ccxt-4.4.94.dist-info → ccxt-4.4.96.dist-info}/RECORD +92 -89
- {ccxt-4.4.94.dist-info → ccxt-4.4.96.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.94.dist-info → ccxt-4.4.96.dist-info}/WHEEL +0 -0
- {ccxt-4.4.94.dist-info → ccxt-4.4.96.dist-info}/top_level.txt +0 -0
ccxt/async_support/bingx.py
CHANGED
@@ -128,6 +128,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
128
128
|
'account': 'https://open-api.{hostname}/openApi',
|
129
129
|
'copyTrading': 'https://open-api.{hostname}/openApi',
|
130
130
|
'cswap': 'https://open-api.{hostname}/openApi',
|
131
|
+
'api': 'https://open-api.{hostname}/openApi',
|
131
132
|
},
|
132
133
|
'test': {
|
133
134
|
'swap': 'https://open-api-vst.{hostname}/openApi', # only swap is really "test" but since the API keys are the same, we want to keep all the functionalities when the user enables the sandboxmode
|
@@ -457,6 +458,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
457
458
|
'private': {
|
458
459
|
'get': {
|
459
460
|
'asset/transfer': 1,
|
461
|
+
'asset/transferRecord': 5,
|
460
462
|
'capital/deposit/hisrec': 1,
|
461
463
|
'capital/withdraw/history': 1,
|
462
464
|
},
|
@@ -465,6 +467,20 @@ class bingx(Exchange, ImplicitAPI):
|
|
465
467
|
},
|
466
468
|
},
|
467
469
|
},
|
470
|
+
'asset': {
|
471
|
+
'v1': {
|
472
|
+
'private': {
|
473
|
+
'post': {
|
474
|
+
'transfer': 5,
|
475
|
+
},
|
476
|
+
},
|
477
|
+
'public': {
|
478
|
+
'get': {
|
479
|
+
'transfer/supportCoins': 5,
|
480
|
+
},
|
481
|
+
},
|
482
|
+
},
|
483
|
+
},
|
468
484
|
},
|
469
485
|
},
|
470
486
|
'timeframes': {
|
@@ -529,16 +545,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
529
545
|
'options': {
|
530
546
|
'defaultType': 'spot',
|
531
547
|
'accountsByType': {
|
532
|
-
'funding': '
|
533
|
-
'spot': '
|
534
|
-
'
|
535
|
-
'
|
548
|
+
'funding': 'fund',
|
549
|
+
'spot': 'spot',
|
550
|
+
'future': 'stdFutures',
|
551
|
+
'swap': 'USDTMPerp',
|
552
|
+
'linear': 'USDTMPerp',
|
553
|
+
'inverse': 'coinMPerp',
|
536
554
|
},
|
537
555
|
'accountsById': {
|
538
|
-
'
|
539
|
-
'
|
540
|
-
'
|
541
|
-
'
|
556
|
+
'fund': 'funding',
|
557
|
+
'spot': 'spot',
|
558
|
+
'stdFutures': 'future',
|
559
|
+
'USDTMPerp': 'linear',
|
560
|
+
'coinMPerp': 'inverse',
|
542
561
|
},
|
543
562
|
'recvWindow': 5 * 1000, # 5 sec
|
544
563
|
'broker': 'CCXT',
|
@@ -780,6 +799,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
780
799
|
'min': self.safe_number(rawNetwork, 'withdrawMin'),
|
781
800
|
'max': self.safe_number(rawNetwork, 'withdrawMax'),
|
782
801
|
},
|
802
|
+
'deposit': {
|
803
|
+
'min': self.safe_number(rawNetwork, 'depositMin'),
|
804
|
+
'max': None,
|
805
|
+
},
|
783
806
|
}
|
784
807
|
precision = self.parse_number(self.parse_precision(self.safe_string(rawNetwork, 'withdrawPrecision')))
|
785
808
|
networks[networkCode] = {
|
@@ -793,20 +816,35 @@ class bingx(Exchange, ImplicitAPI):
|
|
793
816
|
'precision': precision,
|
794
817
|
'limits': limits,
|
795
818
|
}
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
819
|
+
if not (code in result): # the exchange could return the same currency with different networks
|
820
|
+
result[code] = {
|
821
|
+
'info': entry,
|
822
|
+
'code': code,
|
823
|
+
'id': currencyId,
|
824
|
+
'precision': None,
|
825
|
+
'name': name,
|
826
|
+
'active': None,
|
827
|
+
'deposit': None,
|
828
|
+
'withdraw': None,
|
829
|
+
'networks': networks,
|
830
|
+
'fee': None,
|
831
|
+
'limits': None,
|
832
|
+
'type': 'crypto', # only cryptos now
|
833
|
+
}
|
834
|
+
else:
|
835
|
+
existing = result[code]
|
836
|
+
existingNetworks = self.safe_dict(existing, 'networks', {})
|
837
|
+
newNetworkCodes = list(networks.keys())
|
838
|
+
for j in range(0, len(newNetworkCodes)):
|
839
|
+
newNetworkCode = newNetworkCodes[j]
|
840
|
+
if not (newNetworkCode in existingNetworks):
|
841
|
+
existingNetworks[newNetworkCode] = networks[newNetworkCode]
|
842
|
+
result[code]['networks'] = existingNetworks
|
843
|
+
codes = list(result.keys())
|
844
|
+
for i in range(0, len(codes)):
|
845
|
+
code = codes[i]
|
846
|
+
currency = result[code]
|
847
|
+
result[code] = self.safe_currency_structure(currency)
|
810
848
|
return result
|
811
849
|
|
812
850
|
async def fetch_spot_markets(self, params) -> List[Market]:
|
@@ -4642,26 +4680,39 @@ class bingx(Exchange, ImplicitAPI):
|
|
4642
4680
|
"""
|
4643
4681
|
transfer currency internally between wallets on the same account
|
4644
4682
|
|
4645
|
-
https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer
|
4683
|
+
https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer%20New
|
4646
4684
|
|
4647
4685
|
:param str code: unified currency code
|
4648
4686
|
:param float amount: amount to transfer
|
4649
4687
|
:param str fromAccount: account to transfer from(spot, swap, futures, or funding)
|
4650
|
-
:param str toAccount: account to transfer to(spot, swap,
|
4688
|
+
:param str toAccount: account to transfer to(spot, swap(linear or inverse), future, or funding)
|
4651
4689
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4652
4690
|
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
|
4653
4691
|
"""
|
4654
4692
|
await self.load_markets()
|
4655
4693
|
currency = self.currency(code)
|
4656
4694
|
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
4695
|
+
subType = None
|
4696
|
+
subType, params = self.handle_sub_type_and_params('transfer', None, params)
|
4657
4697
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
4658
4698
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
4699
|
+
if fromId == 'swap':
|
4700
|
+
if subType == 'inverse':
|
4701
|
+
fromId = 'coinMPerp'
|
4702
|
+
else:
|
4703
|
+
fromId = 'USDTMPerp'
|
4704
|
+
if toId == 'swap':
|
4705
|
+
if subType == 'inverse':
|
4706
|
+
toId = 'coinMPerp'
|
4707
|
+
else:
|
4708
|
+
toId = 'USDTMPerp'
|
4659
4709
|
request: dict = {
|
4710
|
+
'fromAccount': fromId,
|
4711
|
+
'toAccount': toId,
|
4660
4712
|
'asset': currency['id'],
|
4661
4713
|
'amount': self.currency_to_precision(code, amount),
|
4662
|
-
'type': fromId + '_' + toId,
|
4663
4714
|
}
|
4664
|
-
response = await self.
|
4715
|
+
response = await self.apiAssetV1PrivatePostTransfer(self.extend(request, params))
|
4665
4716
|
#
|
4666
4717
|
# {
|
4667
4718
|
# "tranId": 1933130865269936128,
|
@@ -4670,7 +4721,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
4670
4721
|
#
|
4671
4722
|
return {
|
4672
4723
|
'info': response,
|
4673
|
-
'id': self.safe_string(response, '
|
4724
|
+
'id': self.safe_string(response, 'transferId'),
|
4674
4725
|
'timestamp': None,
|
4675
4726
|
'datetime': None,
|
4676
4727
|
'currency': code,
|
@@ -4684,18 +4735,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
4684
4735
|
"""
|
4685
4736
|
fetch a history of internal transfers made on an account
|
4686
4737
|
|
4687
|
-
https://bingx-api.github.io/docs/#/
|
4738
|
+
https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20transfer%20records%20new
|
4688
4739
|
|
4689
4740
|
:param str [code]: unified currency code of the currency transferred
|
4690
4741
|
:param int [since]: the earliest time in ms to fetch transfers for
|
4691
4742
|
:param int [limit]: the maximum number of transfers structures to retrieve(default 10, max 100)
|
4692
4743
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4693
|
-
:param str params.fromAccount:(mandatory) transfer from(spot, swap,
|
4694
|
-
:param str params.toAccount:(mandatory) transfer to(spot, swap,
|
4744
|
+
:param str params.fromAccount:(mandatory) transfer from(spot, swap(linear or inverse), future, or funding)
|
4745
|
+
:param str params.toAccount:(mandatory) transfer to(spot, swap(linear or inverse), future, or funding)
|
4695
4746
|
:param boolean [params.paginate]: whether to paginate the results(default False)
|
4696
4747
|
:returns dict[]: a list of `transfer structures <https://docs.ccxt.com/#/?id=transfer-structure>`
|
4697
4748
|
"""
|
4698
4749
|
await self.load_markets()
|
4750
|
+
request: dict = {}
|
4699
4751
|
currency = None
|
4700
4752
|
if code is not None:
|
4701
4753
|
currency = self.currency(code)
|
@@ -4705,34 +4757,36 @@ class bingx(Exchange, ImplicitAPI):
|
|
4705
4757
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
4706
4758
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
4707
4759
|
if fromId is None or toId is None:
|
4708
|
-
raise ExchangeError(self.id + ' fromAccount & toAccount
|
4760
|
+
raise ExchangeError(self.id + ' fromAccount & toAccount parameters are required')
|
4761
|
+
if fromAccount is not None:
|
4762
|
+
request['fromAccount'] = fromId
|
4763
|
+
if toAccount is not None:
|
4764
|
+
request['toAccount'] = toId
|
4709
4765
|
params = self.omit(params, ['fromAccount', 'toAccount'])
|
4710
4766
|
maxLimit = 100
|
4711
4767
|
paginate = False
|
4712
4768
|
paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate', False)
|
4713
4769
|
if paginate:
|
4714
4770
|
return await self.fetch_paginated_call_dynamic('fetchTransfers', None, since, limit, params, maxLimit)
|
4715
|
-
request: dict = {
|
4716
|
-
'type': fromId + '_' + toId,
|
4717
|
-
}
|
4718
4771
|
if since is not None:
|
4719
4772
|
request['startTime'] = since
|
4720
4773
|
if limit is not None:
|
4721
|
-
request['
|
4774
|
+
request['pageSize'] = limit
|
4722
4775
|
request, params = self.handle_until_option('endTime', request, params)
|
4723
|
-
response = await self.
|
4776
|
+
response = await self.apiV3PrivateGetAssetTransferRecord(self.extend(request, params))
|
4724
4777
|
#
|
4725
4778
|
# {
|
4726
|
-
# "total":
|
4779
|
+
# "total": 2,
|
4727
4780
|
# "rows": [
|
4728
4781
|
# {
|
4729
|
-
# "asset": "
|
4730
|
-
# "amount": "
|
4731
|
-
# "type": "FUND_SFUTURES",
|
4782
|
+
# "asset": "LTC",
|
4783
|
+
# "amount": "0.05000000000000000000",
|
4732
4784
|
# "status": "CONFIRMED",
|
4733
|
-
# "
|
4734
|
-
# "timestamp":
|
4735
|
-
#
|
4785
|
+
# "transferId": "1051461075661819338791",
|
4786
|
+
# "timestamp": 1752202092000,
|
4787
|
+
# "fromAccount": "spot",
|
4788
|
+
# "toAccount": "USDTMPerp"
|
4789
|
+
# }
|
4736
4790
|
# ]
|
4737
4791
|
# }
|
4738
4792
|
#
|
@@ -4740,15 +4794,14 @@ class bingx(Exchange, ImplicitAPI):
|
|
4740
4794
|
return self.parse_transfers(rows, currency, since, limit)
|
4741
4795
|
|
4742
4796
|
def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
|
4743
|
-
tranId = self.safe_string(transfer, '
|
4797
|
+
tranId = self.safe_string(transfer, 'transferId')
|
4744
4798
|
timestamp = self.safe_integer(transfer, 'timestamp')
|
4745
|
-
|
4799
|
+
currencyId = self.safe_string(transfer, 'asset')
|
4800
|
+
currencyCode = self.safe_currency_code(currencyId, currency)
|
4746
4801
|
status = self.safe_string(transfer, 'status')
|
4747
4802
|
accountsById = self.safe_dict(self.options, 'accountsById', {})
|
4748
|
-
|
4749
|
-
|
4750
|
-
fromId = self.safe_string(typeIdSplit, 0)
|
4751
|
-
toId = self.safe_string(typeIdSplit, 1)
|
4803
|
+
fromId = self.safe_string(transfer, 'fromAccount')
|
4804
|
+
toId = self.safe_string(transfer, 'toAccount')
|
4752
4805
|
fromAccount = self.safe_string(accountsById, fromId, fromId)
|
4753
4806
|
toAccount = self.safe_string(accountsById, toId, toId)
|
4754
4807
|
return {
|
@@ -5459,37 +5512,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
5459
5512
|
|
5460
5513
|
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
5461
5514
|
#
|
5462
|
-
#
|
5463
|
-
# "coin": "BTC",
|
5464
|
-
# "name": "BTC",
|
5465
|
-
# "networkList": [
|
5466
|
-
# {
|
5467
|
-
# "name": "BTC",
|
5468
|
-
# "network": "BTC",
|
5469
|
-
# "isDefault": True,
|
5470
|
-
# "minConfirm": "2",
|
5471
|
-
# "withdrawEnable": True,
|
5472
|
-
# "withdrawFee": "0.00035",
|
5473
|
-
# "withdrawMax": "1.62842",
|
5474
|
-
# "withdrawMin": "0.0005"
|
5475
|
-
# },
|
5476
|
-
# {
|
5477
|
-
# "name": "BTC",
|
5478
|
-
# "network": "BEP20",
|
5479
|
-
# "isDefault": False,
|
5480
|
-
# "minConfirm": "15",
|
5481
|
-
# "withdrawEnable": True,
|
5482
|
-
# "withdrawFee": "0.00001",
|
5483
|
-
# "withdrawMax": "1.62734",
|
5484
|
-
# "withdrawMin": "0.0001"
|
5485
|
-
# }
|
5486
|
-
# ]
|
5487
|
-
# }
|
5515
|
+
# currencie structure
|
5488
5516
|
#
|
5489
|
-
|
5490
|
-
|
5517
|
+
networks = self.safe_dict(fee, 'networks', {})
|
5518
|
+
networkCodes = list(networks.keys())
|
5519
|
+
networksLength = len(networkCodes)
|
5491
5520
|
result: dict = {
|
5492
|
-
'info':
|
5521
|
+
'info': networks,
|
5493
5522
|
'withdraw': {
|
5494
5523
|
'fee': None,
|
5495
5524
|
'percentage': None,
|
@@ -5500,18 +5529,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
5500
5529
|
},
|
5501
5530
|
'networks': {},
|
5502
5531
|
}
|
5503
|
-
if
|
5504
|
-
for i in range(0,
|
5505
|
-
|
5506
|
-
|
5507
|
-
isDefault = self.safe_bool(network, 'isDefault')
|
5508
|
-
currencyCode = self.safe_string(currency, 'code')
|
5509
|
-
networkCode = self.network_id_to_code(networkId, currencyCode)
|
5532
|
+
if networksLength != 0:
|
5533
|
+
for i in range(0, networksLength):
|
5534
|
+
networkCode = networkCodes[i]
|
5535
|
+
network = networks[networkCode]
|
5510
5536
|
result['networks'][networkCode] = {
|
5511
5537
|
'deposit': {'fee': None, 'percentage': None},
|
5512
|
-
'withdraw': {'fee': self.safe_number(network, '
|
5538
|
+
'withdraw': {'fee': self.safe_number(network, 'fee'), 'percentage': False},
|
5513
5539
|
}
|
5514
|
-
if
|
5540
|
+
if networksLength == 1:
|
5515
5541
|
result['withdraw']['fee'] = self.safe_number(network, 'withdrawFee')
|
5516
5542
|
result['withdraw']['percentage'] = False
|
5517
5543
|
return result
|
@@ -5527,9 +5553,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
5527
5553
|
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
|
5528
5554
|
"""
|
5529
5555
|
await self.load_markets()
|
5530
|
-
response = await self.
|
5531
|
-
|
5532
|
-
|
5556
|
+
response = await self.fetch_currencies(params)
|
5557
|
+
depositWithdrawFees: dict = {}
|
5558
|
+
responseCodes = list(response.keys())
|
5559
|
+
for i in range(0, len(responseCodes)):
|
5560
|
+
code = responseCodes[i]
|
5561
|
+
if (codes is None) or (self.in_array(code, codes)):
|
5562
|
+
entry = response[code]
|
5563
|
+
depositWithdrawFees[code] = self.parse_deposit_withdraw_fee(entry)
|
5564
|
+
return depositWithdrawFees
|
5533
5565
|
|
5534
5566
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
5535
5567
|
"""
|
@@ -6229,8 +6261,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
6229
6261
|
raise NotSupported(self.id + ' does not have a testnet/sandbox URL for ' + type + ' endpoints')
|
6230
6262
|
url = self.implode_hostname(self.urls['api'][type])
|
6231
6263
|
path = self.implode_params(path, params)
|
6232
|
-
|
6233
|
-
|
6264
|
+
versionIsTransfer = (version == 'transfer')
|
6265
|
+
versionIsAsset = (version == 'asset')
|
6266
|
+
if versionIsTransfer or versionIsAsset:
|
6267
|
+
if versionIsTransfer:
|
6268
|
+
type = 'account/transfer'
|
6269
|
+
else:
|
6270
|
+
type = 'api/asset'
|
6234
6271
|
version = section[2]
|
6235
6272
|
access = section[3]
|
6236
6273
|
if path != 'account/apiPermissions':
|
ccxt/async_support/bitget.py
CHANGED
@@ -1998,7 +1998,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1998
1998
|
'cross': hasCrossMargin,
|
1999
1999
|
'isolated': hasIsolatedMargin,
|
2000
2000
|
}
|
2001
|
-
isMarginTradingAllowed = hasCrossMargin or
|
2001
|
+
isMarginTradingAllowed = hasCrossMargin or hasIsolatedMargin
|
2002
2002
|
else:
|
2003
2003
|
if symbolType == 'perpetual':
|
2004
2004
|
type = 'swap'
|
@@ -4112,82 +4112,35 @@ class bitget(Exchange, ImplicitAPI):
|
|
4112
4112
|
# "result": "success"
|
4113
4113
|
# }
|
4114
4114
|
#
|
4115
|
-
# spot: fetchOrder
|
4116
|
-
#
|
4117
|
-
# {
|
4118
|
-
# "userId": "7264631750",
|
4119
|
-
# "symbol": "BTCUSDT",
|
4120
|
-
# "orderId": "1111461743123927040",
|
4121
|
-
# "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
|
4122
|
-
# "price": "25000.0000000000000000",
|
4123
|
-
# "size": "0.0002000000000000",
|
4124
|
-
# "orderType": "limit",
|
4125
|
-
# "side": "buy",
|
4126
|
-
# "status": "live",
|
4127
|
-
# "priceAvg": "0",
|
4128
|
-
# "baseVolume": "0.0000000000000000",
|
4129
|
-
# "quoteVolume": "0.0000000000000000",
|
4130
|
-
# "enterPointSource": "API",
|
4131
|
-
# "feeDetail": "",
|
4132
|
-
# "orderSource": "normal",
|
4133
|
-
# "cTime": "1700719050198",
|
4134
|
-
# "uTime": "1700719050198"
|
4135
|
-
# }
|
4136
|
-
#
|
4137
|
-
# swap and future: fetchOrder
|
4138
|
-
#
|
4139
|
-
# {
|
4140
|
-
# "symbol": "BTCUSDT",
|
4141
|
-
# "size": "0.001",
|
4142
|
-
# "orderId": "1111465253393825792",
|
4143
|
-
# "clientOid": "1111465253431574529",
|
4144
|
-
# "baseVolume": "0",
|
4145
|
-
# "fee": "0",
|
4146
|
-
# "price": "27000",
|
4147
|
-
# "priceAvg": "",
|
4148
|
-
# "state": "live",
|
4149
|
-
# "side": "buy",
|
4150
|
-
# "force": "gtc",
|
4151
|
-
# "totalProfits": "0",
|
4152
|
-
# "posSide": "long",
|
4153
|
-
# "marginCoin": "USDT",
|
4154
|
-
# "presetStopSurplusPrice": "",
|
4155
|
-
# "presetStopLossPrice": "",
|
4156
|
-
# "quoteVolume": "0",
|
4157
|
-
# "orderType": "limit",
|
4158
|
-
# "leverage": "20",
|
4159
|
-
# "marginMode": "crossed",
|
4160
|
-
# "reduceOnly": "NO",
|
4161
|
-
# "enterPointSource": "API",
|
4162
|
-
# "tradeSide": "open",
|
4163
|
-
# "posMode": "hedge_mode",
|
4164
|
-
# "orderSource": "normal",
|
4165
|
-
# "cTime": "1700719887120",
|
4166
|
-
# "uTime": "1700719887120"
|
4167
|
-
# }
|
4168
|
-
#
|
4169
|
-
# spot: fetchOpenOrders
|
4115
|
+
# spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4170
4116
|
#
|
4171
4117
|
# {
|
4172
4118
|
# "userId": "7264631750",
|
4173
4119
|
# "symbol": "BTCUSDT",
|
4174
4120
|
# "orderId": "1111499608327360513",
|
4175
4121
|
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4176
|
-
# "
|
4177
|
-
# "
|
4122
|
+
# "size": "0.0002000000000000", # COST for 'buy market' order! AMOUNT in all other cases
|
4123
|
+
# "price": "0", # in fetchOrder: 0 for market order, otherwise limit price(field not present in fetchOpenOrders
|
4178
4124
|
# "orderType": "limit",
|
4179
4125
|
# "side": "buy",
|
4180
4126
|
# "status": "live",
|
4181
4127
|
# "basePrice": "0",
|
4182
|
-
# "
|
4183
|
-
# "
|
4128
|
+
# "priceAvg": "25000.0000000000000000", # 0 if nothing filled
|
4129
|
+
# "baseVolume": "0.0000000000000000", # 0 if nothing filled
|
4130
|
+
# "quoteVolume": "0.0000000000000000", # 0 if nothing filled
|
4184
4131
|
# "enterPointSource": "WEB",
|
4185
4132
|
# "orderSource": "normal",
|
4186
4133
|
# "cTime": "1700728077966",
|
4187
4134
|
# "uTime": "1700728077966"
|
4135
|
+
# "feeDetail": "{\\"newFees\\":{\\"c\\":0,\\"d\\":0,\\"deduction\\":false,\\"r\\":-0.0064699886,\\"t\\":-0.0064699886,\\"totalDeductionFee\\":0},\\"USDT\\":{\\"deduction\\":false,\\"feeCoinCode\\":\\"USDT\\",\\"totalDeductionFee\\":0,\\"totalFee\\":-0.0064699886000000}}", # might not be present in fetchOpenOrders
|
4136
|
+
# "triggerPrice": null,
|
4137
|
+
# "tpslType": "normal",
|
4138
|
+
# "quoteCoin": "USDT", # not present in fetchOpenOrders
|
4139
|
+
# "baseCoin": "DOT", # not present in fetchOpenOrders
|
4140
|
+
# "cancelReason": "", # not present in fetchOpenOrders
|
4188
4141
|
# }
|
4189
4142
|
#
|
4190
|
-
# spot
|
4143
|
+
# spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4191
4144
|
#
|
4192
4145
|
# {
|
4193
4146
|
# "orderId": "1111503385931620352",
|
@@ -4228,18 +4181,19 @@ class bitget(Exchange, ImplicitAPI):
|
|
4228
4181
|
# "uTime": "1700729691866"
|
4229
4182
|
# }
|
4230
4183
|
#
|
4231
|
-
# swap: fetchOpenOrders, fetchCanceledAndClosedOrders
|
4184
|
+
# swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
|
4232
4185
|
#
|
4233
4186
|
# {
|
4234
4187
|
# "symbol": "BTCUSDT",
|
4235
|
-
# "size": "0.
|
4236
|
-
# "orderId": "
|
4237
|
-
# "clientOid": "
|
4188
|
+
# "size": "0.001",
|
4189
|
+
# "orderId": "1111465253393825792",
|
4190
|
+
# "clientOid": "1111465253431574529",
|
4238
4191
|
# "baseVolume": "0",
|
4239
4192
|
# "fee": "0",
|
4240
|
-
# "price": "
|
4193
|
+
# "price": "27000",
|
4241
4194
|
# "priceAvg": "",
|
4242
|
-
# "
|
4195
|
+
# "state": "live",
|
4196
|
+
# # "status": "live", # key for fetchOpenOrders, fetchClosedOrders
|
4243
4197
|
# "side": "buy",
|
4244
4198
|
# "force": "gtc",
|
4245
4199
|
# "totalProfits": "0",
|
@@ -4248,7 +4202,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4248
4202
|
# "quoteVolume": "0",
|
4249
4203
|
# "leverage": "20",
|
4250
4204
|
# "marginMode": "crossed",
|
4251
|
-
# "enterPointSource": "
|
4205
|
+
# "enterPointSource": "API",
|
4252
4206
|
# "tradeSide": "open",
|
4253
4207
|
# "posMode": "hedge_mode",
|
4254
4208
|
# "orderType": "limit",
|
@@ -4256,94 +4210,22 @@ class bitget(Exchange, ImplicitAPI):
|
|
4256
4210
|
# "presetStopSurplusPrice": "",
|
4257
4211
|
# "presetStopLossPrice": "",
|
4258
4212
|
# "reduceOnly": "NO",
|
4259
|
-
# "cTime": "
|
4260
|
-
# "uTime": "
|
4261
|
-
# }
|
4213
|
+
# "cTime": "1700719887120",
|
4214
|
+
# "uTime": "1700719887120"
|
4262
4215
|
#
|
4263
|
-
# swap
|
4216
|
+
# for swap trigger order, the additional below fields are present:
|
4264
4217
|
#
|
4265
|
-
# {
|
4266
4218
|
# "planType": "normal_plan",
|
4267
|
-
# "symbol": "BTCUSDT",
|
4268
|
-
# "size": "0.001",
|
4269
|
-
# "orderId": "1111491399869075457",
|
4270
|
-
# "clientOid": "1111491399869075456",
|
4271
|
-
# "price": "27000",
|
4272
4219
|
# "callbackRatio": "",
|
4273
4220
|
# "triggerPrice": "24000",
|
4274
4221
|
# "triggerType": "mark_price",
|
4275
4222
|
# "planStatus": "live",
|
4276
|
-
# "side": "buy",
|
4277
|
-
# "posSide": "long",
|
4278
|
-
# "marginCoin": "USDT",
|
4279
|
-
# "marginMode": "crossed",
|
4280
|
-
# "enterPointSource": "API",
|
4281
|
-
# "tradeSide": "open",
|
4282
|
-
# "posMode": "hedge_mode",
|
4283
|
-
# "orderType": "limit",
|
4284
|
-
# "stopSurplusTriggerPrice": "",
|
4285
|
-
# "stopSurplusExecutePrice": "",
|
4286
|
-
# "stopSurplusTriggerType": "fill_price",
|
4287
|
-
# "stopLossTriggerPrice": "",
|
4288
|
-
# "stopLossExecutePrice": "",
|
4289
|
-
# "stopLossTriggerType": "fill_price",
|
4290
|
-
# "cTime": "1700726120917",
|
4291
|
-
# "uTime": "1700726120917"
|
4292
|
-
# }
|
4293
|
-
#
|
4294
|
-
# spot: fetchCanceledAndClosedOrders
|
4295
|
-
#
|
4296
|
-
# {
|
4297
|
-
# "userId": "7264631750",
|
4298
|
-
# "symbol": "BTCUSDT",
|
4299
|
-
# "orderId": "1111499608327360513",
|
4300
|
-
# "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
|
4301
|
-
# "price": "25000.0000000000000000",
|
4302
|
-
# "size": "0.0002000000000000",
|
4303
|
-
# "orderType": "limit",
|
4304
|
-
# "side": "buy",
|
4305
|
-
# "status": "cancelled",
|
4306
|
-
# "priceAvg": "0",
|
4307
|
-
# "baseVolume": "0.0000000000000000",
|
4308
|
-
# "quoteVolume": "0.0000000000000000",
|
4309
|
-
# "enterPointSource": "WEB",
|
4310
|
-
# "feeDetail": "",
|
4311
|
-
# "orderSource": "normal",
|
4312
|
-
# "cTime": "1700728077966",
|
4313
|
-
# "uTime": "1700728911471"
|
4314
|
-
# }
|
4315
|
-
#
|
4316
|
-
# swap stop: fetchCanceledAndClosedOrders
|
4317
|
-
#
|
4318
|
-
# {
|
4319
|
-
# "planType": "normal_plan",
|
4320
|
-
# "symbol": "BTCUSDT",
|
4321
|
-
# "size": "0.001",
|
4322
|
-
# "orderId": "1111491399869075457",
|
4323
|
-
# "clientOid": "1111491399869075456",
|
4324
|
-
# "planStatus": "cancelled",
|
4325
|
-
# "price": "27000",
|
4326
|
-
# "feeDetail": null,
|
4327
|
-
# "baseVolume": "0",
|
4328
|
-
# "callbackRatio": "",
|
4329
|
-
# "triggerPrice": "24000",
|
4330
|
-
# "triggerType": "mark_price",
|
4331
|
-
# "side": "buy",
|
4332
|
-
# "posSide": "long",
|
4333
|
-
# "marginCoin": "USDT",
|
4334
|
-
# "marginMode": "crossed",
|
4335
|
-
# "enterPointSource": "API",
|
4336
|
-
# "tradeSide": "open",
|
4337
|
-
# "posMode": "hedge_mode",
|
4338
|
-
# "orderType": "limit",
|
4339
4223
|
# "stopSurplusTriggerPrice": "",
|
4340
4224
|
# "stopSurplusExecutePrice": "",
|
4341
4225
|
# "stopSurplusTriggerType": "fill_price",
|
4342
4226
|
# "stopLossTriggerPrice": "",
|
4343
4227
|
# "stopLossExecutePrice": "",
|
4344
4228
|
# "stopLossTriggerType": "fill_price",
|
4345
|
-
# "cTime": "1700726120917",
|
4346
|
-
# "uTime": "1700727879652"
|
4347
4229
|
# }
|
4348
4230
|
#
|
4349
4231
|
errorMessage = self.safe_string(order, 'errorMsg')
|
@@ -4421,6 +4303,11 @@ class bitget(Exchange, ImplicitAPI):
|
|
4421
4303
|
side = 'sell' if (side == 'buy') else 'buy'
|
4422
4304
|
# on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
|
4423
4305
|
# so the side of the reduceOnly order is inversed
|
4306
|
+
orderType = self.safe_string(order, 'orderType')
|
4307
|
+
isBuyMarket = (side == 'buy') and (orderType == 'market')
|
4308
|
+
if market['spot'] and isBuyMarket:
|
4309
|
+
# in top comment, for 'buy market' the 'size' field is COST, not AMOUNT
|
4310
|
+
size = self.safe_string(order, 'baseVolume')
|
4424
4311
|
return self.safe_order({
|
4425
4312
|
'info': order,
|
4426
4313
|
'id': self.safe_string_2(order, 'orderId', 'data'),
|
@@ -4430,7 +4317,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
4430
4317
|
'lastTradeTimestamp': updateTimestamp,
|
4431
4318
|
'lastUpdateTimestamp': updateTimestamp,
|
4432
4319
|
'symbol': market['symbol'],
|
4433
|
-
'type':
|
4320
|
+
'type': orderType,
|
4434
4321
|
'side': side,
|
4435
4322
|
'price': price,
|
4436
4323
|
'amount': size,
|
ccxt/async_support/bitmart.py
CHANGED
@@ -3083,7 +3083,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3083
3083
|
# }
|
3084
3084
|
#
|
3085
3085
|
if market['swap']:
|
3086
|
-
return response
|
3086
|
+
return self.safe_order({'info': response})
|
3087
3087
|
data = self.safe_value(response, 'data')
|
3088
3088
|
if data is True:
|
3089
3089
|
return self.safe_order({'id': id}, market)
|
@@ -3200,7 +3200,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3200
3200
|
# "trace": "7f9c94e10f9d4513bc08a7bfc2a5559a.70.16954131323145323"
|
3201
3201
|
# }
|
3202
3202
|
#
|
3203
|
-
return response
|
3203
|
+
return [self.safe_order({'info': response})]
|
3204
3204
|
|
3205
3205
|
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3206
3206
|
if symbol is None:
|