ccxt 4.3.56__py2.py3-none-any.whl → 4.3.58__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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/abstract/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/alpaca.py +5 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +5 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/base/ws/client.py +26 -5
- ccxt/async_support/bigone.py +19 -1
- ccxt/async_support/bingx.py +114 -26
- ccxt/async_support/bitget.py +56 -47
- ccxt/async_support/coinmate.py +28 -32
- ccxt/async_support/coinone.py +15 -19
- ccxt/async_support/gate.py +102 -4
- ccxt/async_support/htx.py +87 -26
- ccxt/async_support/huobijp.py +61 -2
- ccxt/async_support/kucoin.py +3 -0
- ccxt/async_support/latoken.py +5 -1
- ccxt/async_support/okx.py +2 -0
- ccxt/async_support/woo.py +2 -1
- ccxt/base/exchange.py +1 -1
- ccxt/bigone.py +19 -1
- ccxt/bingx.py +114 -26
- ccxt/bitget.py +56 -47
- ccxt/coinmate.py +28 -32
- ccxt/coinone.py +15 -19
- ccxt/gate.py +102 -4
- ccxt/htx.py +87 -26
- ccxt/huobijp.py +61 -2
- ccxt/kucoin.py +3 -0
- ccxt/latoken.py +5 -1
- ccxt/okx.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/htx.py +1 -1
- ccxt/pro/okx.py +3 -3
- ccxt/woo.py +2 -1
- {ccxt-4.3.56.dist-info → ccxt-4.3.58.dist-info}/METADATA +4 -4
- {ccxt-4.3.56.dist-info → ccxt-4.3.58.dist-info}/RECORD +41 -41
- {ccxt-4.3.56.dist-info → ccxt-4.3.58.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.56.dist-info → ccxt-4.3.58.dist-info}/WHEEL +0 -0
- {ccxt-4.3.56.dist-info → ccxt-4.3.58.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/kucoin.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
private_get_redeem_orders = privateGetRedeemOrders = Entry('redeem/orders', 'private', 'GET', {'cost': 10})
|
88
88
|
private_get_purchase_orders = privateGetPurchaseOrders = Entry('purchase/orders', 'private', 'GET', {'cost': 10})
|
89
89
|
private_get_broker_api_rebase_download = privateGetBrokerApiRebaseDownload = Entry('broker/api/rebase/download', 'private', 'GET', {'cost': 3})
|
90
|
+
private_get_affiliate_inviter_statistics = privateGetAffiliateInviterStatistics = Entry('affiliate/inviter/statistics', 'private', 'GET', {'cost': 30})
|
90
91
|
private_post_sub_user_created = privatePostSubUserCreated = Entry('sub/user/created', 'private', 'POST', {'cost': 22.5})
|
91
92
|
private_post_sub_api_key = privatePostSubApiKey = Entry('sub/api-key', 'private', 'POST', {'cost': 30})
|
92
93
|
private_post_sub_api_key_update = privatePostSubApiKeyUpdate = Entry('sub/api-key/update', 'private', 'POST', {'cost': 45})
|
ccxt/abstract/kucoinfutures.py
CHANGED
@@ -87,6 +87,7 @@ class ImplicitAPI:
|
|
87
87
|
private_get_redeem_orders = privateGetRedeemOrders = Entry('redeem/orders', 'private', 'GET', {'cost': 10})
|
88
88
|
private_get_purchase_orders = privateGetPurchaseOrders = Entry('purchase/orders', 'private', 'GET', {'cost': 10})
|
89
89
|
private_get_broker_api_rebase_download = privateGetBrokerApiRebaseDownload = Entry('broker/api/rebase/download', 'private', 'GET', {'cost': 3})
|
90
|
+
private_get_affiliate_inviter_statistics = privateGetAffiliateInviterStatistics = Entry('affiliate/inviter/statistics', 'private', 'GET', {'cost': 30})
|
90
91
|
private_post_sub_user_created = privatePostSubUserCreated = Entry('sub/user/created', 'private', 'POST', {'cost': 22.5})
|
91
92
|
private_post_sub_api_key = privatePostSubApiKey = Entry('sub/api-key', 'private', 'POST', {'cost': 30})
|
92
93
|
private_post_sub_api_key_update = privatePostSubApiKeyUpdate = Entry('sub/api-key/update', 'private', 'POST', {'cost': 45})
|
ccxt/alpaca.py
CHANGED
@@ -787,7 +787,11 @@ class alpaca(Exchange, ImplicitAPI):
|
|
787
787
|
if isinstance(response, list):
|
788
788
|
return self.parse_orders(response, None)
|
789
789
|
else:
|
790
|
-
return
|
790
|
+
return [
|
791
|
+
self.safe_order({
|
792
|
+
'info': response,
|
793
|
+
}),
|
794
|
+
]
|
791
795
|
|
792
796
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
793
797
|
"""
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/alpaca.py
CHANGED
@@ -787,7 +787,11 @@ class alpaca(Exchange, ImplicitAPI):
|
|
787
787
|
if isinstance(response, list):
|
788
788
|
return self.parse_orders(response, None)
|
789
789
|
else:
|
790
|
-
return
|
790
|
+
return [
|
791
|
+
self.safe_order({
|
792
|
+
'info': response,
|
793
|
+
}),
|
794
|
+
]
|
791
795
|
|
792
796
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
793
797
|
"""
|
@@ -4,7 +4,7 @@ from asyncio import sleep, ensure_future, wait_for, TimeoutError
|
|
4
4
|
from .functions import milliseconds, iso8601, deep_extend
|
5
5
|
from ccxt import NetworkError, RequestTimeout, NotSupported
|
6
6
|
from ccxt.async_support.base.ws.future import Future
|
7
|
-
|
7
|
+
from collections import deque
|
8
8
|
|
9
9
|
class Client(object):
|
10
10
|
|
@@ -14,6 +14,8 @@ class Client(object):
|
|
14
14
|
options = {} # ws-specific options
|
15
15
|
subscriptions = {}
|
16
16
|
rejections = {}
|
17
|
+
message_queue = {}
|
18
|
+
useMessageQueue = True
|
17
19
|
on_message_callback = None
|
18
20
|
on_error_callback = None
|
19
21
|
on_close_callback = None
|
@@ -68,15 +70,33 @@ class Client(object):
|
|
68
70
|
if message_hash in self.rejections:
|
69
71
|
future.reject(self.rejections[message_hash])
|
70
72
|
del self.rejections[message_hash]
|
73
|
+
del self.message_queue[message_hash]
|
74
|
+
return future
|
75
|
+
if self.useMessageQueue and message_hash in self.message_queue:
|
76
|
+
queue = self.message_queue[message_hash]
|
77
|
+
if len(queue):
|
78
|
+
future.resolve(queue.popleft())
|
79
|
+
del self.futures[message_hash]
|
71
80
|
return future
|
72
81
|
|
73
82
|
def resolve(self, result, message_hash):
|
74
83
|
if self.verbose and message_hash is None:
|
75
84
|
self.log(iso8601(milliseconds()), 'resolve received None messageHash')
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
85
|
+
|
86
|
+
if self.useMessageQueue:
|
87
|
+
if message_hash not in self.message_queue:
|
88
|
+
self.message_queue[message_hash] = deque(maxlen=10)
|
89
|
+
queue = self.message_queue[message_hash]
|
90
|
+
queue.append(result)
|
91
|
+
if message_hash in self.futures:
|
92
|
+
future = self.futures[message_hash]
|
93
|
+
future.resolve(queue.popleft())
|
94
|
+
del self.futures[message_hash]
|
95
|
+
else:
|
96
|
+
if message_hash in self.futures:
|
97
|
+
future = self.futures[message_hash]
|
98
|
+
future.resolve(result)
|
99
|
+
del self.futures[message_hash]
|
80
100
|
return result
|
81
101
|
|
82
102
|
def reject(self, result, message_hash=None):
|
@@ -165,6 +185,7 @@ class Client(object):
|
|
165
185
|
ensure_future(self.close(code), loop=self.asyncio_loop)
|
166
186
|
|
167
187
|
def reset(self, error):
|
188
|
+
self.message_queue = {}
|
168
189
|
self.reject(error)
|
169
190
|
|
170
191
|
async def ping_loop(self):
|
ccxt/async_support/bigone.py
CHANGED
@@ -1540,7 +1540,25 @@ class bigone(Exchange, ImplicitAPI):
|
|
1540
1540
|
# }
|
1541
1541
|
# }
|
1542
1542
|
#
|
1543
|
-
|
1543
|
+
data = self.safe_dict(response, 'data', {})
|
1544
|
+
cancelled = self.safe_list(data, 'cancelled', [])
|
1545
|
+
failed = self.safe_list(data, 'failed', [])
|
1546
|
+
result = []
|
1547
|
+
for i in range(0, len(cancelled)):
|
1548
|
+
orderId = cancelled[i]
|
1549
|
+
result.append(self.safe_order({
|
1550
|
+
'info': orderId,
|
1551
|
+
'id': orderId,
|
1552
|
+
'status': 'canceled',
|
1553
|
+
}))
|
1554
|
+
for i in range(0, len(failed)):
|
1555
|
+
orderId = failed[i]
|
1556
|
+
result.append(self.safe_order({
|
1557
|
+
'info': orderId,
|
1558
|
+
'id': orderId,
|
1559
|
+
'status': 'failed',
|
1560
|
+
}))
|
1561
|
+
return result
|
1544
1562
|
|
1545
1563
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1546
1564
|
"""
|
ccxt/async_support/bingx.py
CHANGED
@@ -675,6 +675,29 @@ class bingx(Exchange, ImplicitAPI):
|
|
675
675
|
markets = self.safe_list(response, 'data', [])
|
676
676
|
return self.parse_markets(markets)
|
677
677
|
|
678
|
+
async def fetch_inverse_swap_markets(self, params):
|
679
|
+
response = await self.cswapV1PublicGetMarketContracts(params)
|
680
|
+
#
|
681
|
+
# {
|
682
|
+
# "code": 0,
|
683
|
+
# "msg": "",
|
684
|
+
# "timestamp": 1720074487610,
|
685
|
+
# "data": [
|
686
|
+
# {
|
687
|
+
# "symbol": "BNB-USD",
|
688
|
+
# "pricePrecision": 2,
|
689
|
+
# "minTickSize": "10",
|
690
|
+
# "minTradeValue": "10",
|
691
|
+
# "minQty": "1.00000000",
|
692
|
+
# "status": 1,
|
693
|
+
# "timeOnline": 1713175200000
|
694
|
+
# },
|
695
|
+
# ]
|
696
|
+
# }
|
697
|
+
#
|
698
|
+
markets = self.safe_list(response, 'data', [])
|
699
|
+
return self.parse_markets(markets)
|
700
|
+
|
678
701
|
def parse_market(self, market: dict) -> Market:
|
679
702
|
id = self.safe_string(market, 'symbol')
|
680
703
|
symbolParts = id.split('-')
|
@@ -683,6 +706,14 @@ class bingx(Exchange, ImplicitAPI):
|
|
683
706
|
base = self.safe_currency_code(baseId)
|
684
707
|
quote = self.safe_currency_code(quoteId)
|
685
708
|
currency = self.safe_string(market, 'currency')
|
709
|
+
checkIsInverse = False
|
710
|
+
checkIsLinear = True
|
711
|
+
minTickSize = self.safe_number(market, 'minTickSize')
|
712
|
+
if minTickSize is not None:
|
713
|
+
# inverse swap market
|
714
|
+
currency = baseId
|
715
|
+
checkIsInverse = True
|
716
|
+
checkIsLinear = False
|
686
717
|
settle = self.safe_currency_code(currency)
|
687
718
|
pricePrecision = self.safe_number(market, 'tickSize')
|
688
719
|
if pricePrecision is None:
|
@@ -699,8 +730,11 @@ class bingx(Exchange, ImplicitAPI):
|
|
699
730
|
fees = self.safe_dict(self.fees, type, {})
|
700
731
|
contractSize = self.parse_number('1') if (swap) else None
|
701
732
|
isActive = self.safe_string(market, 'status') == '1'
|
702
|
-
isInverse = None if (spot) else
|
703
|
-
isLinear = None if (spot) else
|
733
|
+
isInverse = None if (spot) else checkIsInverse
|
734
|
+
isLinear = None if (spot) else checkIsLinear
|
735
|
+
timeOnline = self.safe_integer(market, 'timeOnline')
|
736
|
+
if timeOnline == 0:
|
737
|
+
timeOnline = None
|
704
738
|
return self.safe_market_structure({
|
705
739
|
'id': id,
|
706
740
|
'symbol': symbol,
|
@@ -742,15 +776,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
742
776
|
'max': self.safe_number(market, 'maxQty'),
|
743
777
|
},
|
744
778
|
'price': {
|
745
|
-
'min':
|
779
|
+
'min': minTickSize,
|
746
780
|
'max': None,
|
747
781
|
},
|
748
782
|
'cost': {
|
749
|
-
'min': self.
|
783
|
+
'min': self.safe_number_n(market, ['minNotional', 'tradeMinUSDT', 'minTradeValue']),
|
750
784
|
'max': self.safe_number(market, 'maxNotional'),
|
751
785
|
},
|
752
786
|
},
|
753
|
-
'created':
|
787
|
+
'created': timeOnline,
|
754
788
|
'info': market,
|
755
789
|
})
|
756
790
|
|
@@ -759,16 +793,20 @@ class bingx(Exchange, ImplicitAPI):
|
|
759
793
|
retrieves data on all markets for bingx
|
760
794
|
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20Symbols
|
761
795
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Contract%20Information
|
796
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Contract%20Information
|
762
797
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
763
798
|
:returns dict[]: an array of objects representing market data
|
764
799
|
"""
|
765
800
|
requests = [self.fetch_swap_markets(params)]
|
766
801
|
isSandbox = self.safe_bool(self.options, 'sandboxMode', False)
|
767
802
|
if not isSandbox:
|
803
|
+
requests.append(self.fetch_inverse_swap_markets(params))
|
768
804
|
requests.append(self.fetch_spot_markets(params)) # sandbox is swap only
|
769
805
|
promises = await asyncio.gather(*requests)
|
770
|
-
|
771
|
-
|
806
|
+
linearSwapMarkets = self.safe_list(promises, 0, [])
|
807
|
+
inverseSwapMarkets = self.safe_list(promises, 1, [])
|
808
|
+
spotMarkets = self.safe_list(promises, 2, [])
|
809
|
+
swapMarkets = self.array_concat(linearSwapMarkets, inverseSwapMarkets)
|
772
810
|
return self.array_concat(spotMarkets, swapMarkets)
|
773
811
|
|
774
812
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
@@ -778,13 +816,14 @@ class bingx(Exchange, ImplicitAPI):
|
|
778
816
|
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Candlestick%20chart%20data
|
779
817
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#%20K-Line%20Data
|
780
818
|
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/market-api.html#K-Line%20Data%20-%20Mark%20Price
|
819
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20K-line%20Data
|
781
820
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
782
821
|
:param str timeframe: the length of time each candle represents
|
783
822
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
784
823
|
:param int [limit]: the maximum amount of candles to fetch
|
785
824
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
786
825
|
:param int [params.until]: timestamp in ms of the latest candle to fetch
|
787
|
-
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [
|
826
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
788
827
|
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
789
828
|
"""
|
790
829
|
await self.load_markets()
|
@@ -809,12 +848,15 @@ class bingx(Exchange, ImplicitAPI):
|
|
809
848
|
if market['spot']:
|
810
849
|
response = await self.spotV1PublicGetMarketKline(self.extend(request, params))
|
811
850
|
else:
|
812
|
-
|
813
|
-
|
814
|
-
if price == 'mark':
|
815
|
-
response = await self.swapV1PrivateGetMarketMarkPriceKlines(self.extend(request, params))
|
851
|
+
if market['inverse']:
|
852
|
+
response = await self.cswapV1PublicGetMarketKlines(self.extend(request, params))
|
816
853
|
else:
|
817
|
-
|
854
|
+
price = self.safe_string(params, 'price')
|
855
|
+
params = self.omit(params, 'price')
|
856
|
+
if price == 'mark':
|
857
|
+
response = await self.swapV1PrivateGetMarketMarkPriceKlines(self.extend(request, params))
|
858
|
+
else:
|
859
|
+
response = await self.swapV3PublicGetQuoteKlines(self.extend(request, params))
|
818
860
|
#
|
819
861
|
# {
|
820
862
|
# "code": 0,
|
@@ -1107,6 +1149,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1107
1149
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1108
1150
|
:see: https://bingx-api.github.io/docs/#/spot/market-api.html#Query%20depth%20information
|
1109
1151
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Market%20Depth
|
1152
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Query%20Depth%20Data
|
1110
1153
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1111
1154
|
:param int [limit]: the maximum amount of order book entries to return
|
1112
1155
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1125,7 +1168,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
1125
1168
|
if marketType == 'spot':
|
1126
1169
|
response = await self.spotV1PublicGetMarketDepth(self.extend(request, params))
|
1127
1170
|
else:
|
1128
|
-
|
1171
|
+
if market['inverse']:
|
1172
|
+
response = await self.cswapV1PublicGetMarketDepth(self.extend(request, params))
|
1173
|
+
else:
|
1174
|
+
response = await self.swapV2PublicGetQuoteDepth(self.extend(request, params))
|
1129
1175
|
#
|
1130
1176
|
# spot
|
1131
1177
|
#
|
@@ -1191,6 +1237,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1191
1237
|
"""
|
1192
1238
|
fetch the current funding rate
|
1193
1239
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Current%20Funding%20Rate
|
1240
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Price%20&%20Current%20Funding%20Rate
|
1194
1241
|
:param str symbol: unified market symbol
|
1195
1242
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1196
1243
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -1200,7 +1247,11 @@ class bingx(Exchange, ImplicitAPI):
|
|
1200
1247
|
request: dict = {
|
1201
1248
|
'symbol': market['id'],
|
1202
1249
|
}
|
1203
|
-
response =
|
1250
|
+
response = None
|
1251
|
+
if market['inverse']:
|
1252
|
+
response = await self.cswapV1PublicGetMarketPremiumIndex(self.extend(request, params))
|
1253
|
+
else:
|
1254
|
+
response = await self.swapV2PublicGetQuotePremiumIndex(self.extend(request, params))
|
1204
1255
|
#
|
1205
1256
|
# {
|
1206
1257
|
# "code":0,
|
@@ -1338,9 +1389,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
1338
1389
|
|
1339
1390
|
async def fetch_open_interest(self, symbol: str, params={}):
|
1340
1391
|
"""
|
1341
|
-
|
1392
|
+
retrieves the open interest of a trading pair
|
1342
1393
|
:see: https://bingx-api.github.io/docs/#/swapV2/market-api.html#Get%20Swap%20Open%20Positions
|
1343
|
-
:
|
1394
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/market-api.html#Get%20Swap%20Open%20Positions
|
1395
|
+
:param str symbol: unified CCXT market symbol
|
1344
1396
|
:param dict [params]: exchange specific parameters
|
1345
1397
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
1346
1398
|
"""
|
@@ -1349,7 +1401,13 @@ class bingx(Exchange, ImplicitAPI):
|
|
1349
1401
|
request: dict = {
|
1350
1402
|
'symbol': market['id'],
|
1351
1403
|
}
|
1352
|
-
response =
|
1404
|
+
response = None
|
1405
|
+
if market['inverse']:
|
1406
|
+
response = await self.cswapV1PublicGetMarketOpenInterest(self.extend(request, params))
|
1407
|
+
else:
|
1408
|
+
response = await self.swapV2PublicGetQuoteOpenInterest(self.extend(request, params))
|
1409
|
+
#
|
1410
|
+
# linear swap
|
1353
1411
|
#
|
1354
1412
|
# {
|
1355
1413
|
# "code": 0,
|
@@ -1361,18 +1419,48 @@ class bingx(Exchange, ImplicitAPI):
|
|
1361
1419
|
# }
|
1362
1420
|
# }
|
1363
1421
|
#
|
1364
|
-
|
1365
|
-
|
1422
|
+
# inverse swap
|
1423
|
+
#
|
1424
|
+
# {
|
1425
|
+
# "code": 0,
|
1426
|
+
# "msg": "",
|
1427
|
+
# "timestamp": 1720328247986,
|
1428
|
+
# "data": [
|
1429
|
+
# {
|
1430
|
+
# "symbol": "BTC-USD",
|
1431
|
+
# "openInterest": "749.1160",
|
1432
|
+
# "timestamp": 1720310400000
|
1433
|
+
# }
|
1434
|
+
# ]
|
1435
|
+
# }
|
1436
|
+
#
|
1437
|
+
result: dict = {}
|
1438
|
+
if market['inverse']:
|
1439
|
+
data = self.safe_list(response, 'data', [])
|
1440
|
+
result = self.safe_dict(data, 0, {})
|
1441
|
+
else:
|
1442
|
+
result = self.safe_dict(response, 'data', {})
|
1443
|
+
return self.parse_open_interest(result, market)
|
1366
1444
|
|
1367
1445
|
def parse_open_interest(self, interest, market: Market = None):
|
1368
1446
|
#
|
1369
|
-
#
|
1370
|
-
#
|
1371
|
-
#
|
1372
|
-
#
|
1373
|
-
#
|
1447
|
+
# linear swap
|
1448
|
+
#
|
1449
|
+
# {
|
1450
|
+
# "openInterest": "3289641547.10",
|
1451
|
+
# "symbol": "BTC-USDT",
|
1452
|
+
# "time": 1672026617364
|
1453
|
+
# }
|
1454
|
+
#
|
1455
|
+
# inverse swap
|
1456
|
+
#
|
1457
|
+
# {
|
1458
|
+
# "symbol": "BTC-USD",
|
1459
|
+
# "openInterest": "749.1160",
|
1460
|
+
# "timestamp": 1720310400000
|
1461
|
+
# }
|
1374
1462
|
#
|
1375
|
-
timestamp = self.
|
1463
|
+
timestamp = self.safe_integer_2(interest, 'time', 'timestamp')
|
1376
1464
|
id = self.safe_string(interest, 'symbol')
|
1377
1465
|
symbol = self.safe_symbol(id, market, '-', 'swap')
|
1378
1466
|
openInterest = self.safe_number(interest, 'openInterest')
|
ccxt/async_support/bitget.py
CHANGED
@@ -4692,6 +4692,22 @@ class bitget(Exchange, ImplicitAPI):
|
|
4692
4692
|
response = await self.privateMarginPostMarginV1CrossOrderBatchCancelOrder(self.extend(request, params))
|
4693
4693
|
else:
|
4694
4694
|
response = await self.privateMarginPostMarginV1IsolatedOrderBatchCancelOrder(self.extend(request, params))
|
4695
|
+
#
|
4696
|
+
# {
|
4697
|
+
# "code": "00000",
|
4698
|
+
# "msg": "success",
|
4699
|
+
# "requestTime": 1700717155622,
|
4700
|
+
# "data": {
|
4701
|
+
# "resultList": [
|
4702
|
+
# {
|
4703
|
+
# "orderId": "1111453253721796609",
|
4704
|
+
# "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
|
4705
|
+
# },
|
4706
|
+
# ],
|
4707
|
+
# "failure": []
|
4708
|
+
# }
|
4709
|
+
# }
|
4710
|
+
#
|
4695
4711
|
else:
|
4696
4712
|
if stop:
|
4697
4713
|
stopRequest: dict = {
|
@@ -4700,6 +4716,27 @@ class bitget(Exchange, ImplicitAPI):
|
|
4700
4716
|
response = await self.privateSpotPostV2SpotTradeBatchCancelPlanOrder(self.extend(stopRequest, params))
|
4701
4717
|
else:
|
4702
4718
|
response = await self.privateSpotPostV2SpotTradeCancelSymbolOrder(self.extend(request, params))
|
4719
|
+
#
|
4720
|
+
# {
|
4721
|
+
# "code": "00000",
|
4722
|
+
# "msg": "success",
|
4723
|
+
# "requestTime": 1700716953996,
|
4724
|
+
# "data": {
|
4725
|
+
# "symbol": "BTCUSDT"
|
4726
|
+
# }
|
4727
|
+
# }
|
4728
|
+
#
|
4729
|
+
timestamp = self.safe_integer(response, 'requestTime')
|
4730
|
+
responseData = self.safe_dict(response, 'data')
|
4731
|
+
marketId = self.safe_string(responseData, 'symbol')
|
4732
|
+
return [
|
4733
|
+
self.safe_order({
|
4734
|
+
'info': response,
|
4735
|
+
'symbol': self.safe_symbol(marketId, None, None, 'spot'),
|
4736
|
+
'timestamp': timestamp,
|
4737
|
+
'datetime': self.iso8601(timestamp),
|
4738
|
+
}),
|
4739
|
+
]
|
4703
4740
|
else:
|
4704
4741
|
productType = None
|
4705
4742
|
productType, params = self.handle_product_type_and_params(market, params)
|
@@ -4708,53 +4745,25 @@ class bitget(Exchange, ImplicitAPI):
|
|
4708
4745
|
response = await self.privateMixPostV2MixOrderCancelPlanOrder(self.extend(request, params))
|
4709
4746
|
else:
|
4710
4747
|
response = await self.privateMixPostV2MixOrderBatchCancelOrders(self.extend(request, params))
|
4711
|
-
|
4712
|
-
|
4713
|
-
|
4714
|
-
|
4715
|
-
|
4716
|
-
|
4717
|
-
|
4718
|
-
|
4719
|
-
|
4720
|
-
|
4721
|
-
|
4722
|
-
|
4723
|
-
|
4724
|
-
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
# "successList": [
|
4731
|
-
# {
|
4732
|
-
# "orderId": "1024598257429823488",
|
4733
|
-
# "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
|
4734
|
-
# },
|
4735
|
-
# ],
|
4736
|
-
# "failureList": []
|
4737
|
-
# }
|
4738
|
-
# }
|
4739
|
-
#
|
4740
|
-
# spot margin
|
4741
|
-
#
|
4742
|
-
# {
|
4743
|
-
# "code": "00000",
|
4744
|
-
# "msg": "success",
|
4745
|
-
# "requestTime": 1700717155622,
|
4746
|
-
# "data": {
|
4747
|
-
# "resultList": [
|
4748
|
-
# {
|
4749
|
-
# "orderId": "1111453253721796609",
|
4750
|
-
# "clientOid": "2ae7fc8a4ff949b6b60d770ca3950e2d"
|
4751
|
-
# },
|
4752
|
-
# ],
|
4753
|
-
# "failure": []
|
4754
|
-
# }
|
4755
|
-
# }
|
4756
|
-
#
|
4757
|
-
return response
|
4748
|
+
# {
|
4749
|
+
# "code": "00000",
|
4750
|
+
# "msg": "success",
|
4751
|
+
# "requestTime": "1680008815965",
|
4752
|
+
# "data": {
|
4753
|
+
# "successList": [
|
4754
|
+
# {
|
4755
|
+
# "orderId": "1024598257429823488",
|
4756
|
+
# "clientOid": "876493ce-c287-4bfc-9f4a-8b1905881313"
|
4757
|
+
# },
|
4758
|
+
# ],
|
4759
|
+
# "failureList": []
|
4760
|
+
# }
|
4761
|
+
# }
|
4762
|
+
data = self.safe_dict(response, 'data')
|
4763
|
+
resultList = self.safe_list_2(data, 'resultList', 'successList')
|
4764
|
+
failureList = self.safe_list_2(data, 'failure', 'failureList')
|
4765
|
+
responseList = self.array_concat(resultList, failureList)
|
4766
|
+
return self.parse_orders(responseList)
|
4758
4767
|
|
4759
4768
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
4760
4769
|
"""
|
ccxt/async_support/coinmate.py
CHANGED
@@ -26,7 +26,7 @@ class coinmate(Exchange, ImplicitAPI):
|
|
26
26
|
'id': 'coinmate',
|
27
27
|
'name': 'CoinMate',
|
28
28
|
'countries': ['GB', 'CZ', 'EU'], # UK, Czech Republic
|
29
|
-
'rateLimit':
|
29
|
+
'rateLimit': 600,
|
30
30
|
'has': {
|
31
31
|
'CORS': True,
|
32
32
|
'spot': True,
|
@@ -175,28 +175,28 @@ class coinmate(Exchange, ImplicitAPI):
|
|
175
175
|
'trading': {
|
176
176
|
'tierBased': True,
|
177
177
|
'percentage': True,
|
178
|
-
'
|
179
|
-
'
|
178
|
+
'taker': self.parse_number('0.006'),
|
179
|
+
'maker': self.parse_number('0.004'),
|
180
180
|
'tiers': {
|
181
181
|
'taker': [
|
182
|
-
[self.parse_number('0'), self.parse_number('0.
|
183
|
-
[self.parse_number('10000'), self.parse_number('0.
|
184
|
-
[self.parse_number('100000'), self.parse_number('0.
|
185
|
-
[self.parse_number('250000'), self.parse_number('0.
|
186
|
-
[self.parse_number('500000'), self.parse_number('0.
|
187
|
-
[self.parse_number('1000000'), self.parse_number('0.
|
188
|
-
[self.parse_number('3000000'), self.parse_number('0.
|
189
|
-
[self.parse_number('15000000'), self.parse_number('0.
|
182
|
+
[self.parse_number('0'), self.parse_number('0.006')],
|
183
|
+
[self.parse_number('10000'), self.parse_number('0.003')],
|
184
|
+
[self.parse_number('100000'), self.parse_number('0.0023')],
|
185
|
+
[self.parse_number('250000'), self.parse_number('0.0021')],
|
186
|
+
[self.parse_number('500000'), self.parse_number('0.0018')],
|
187
|
+
[self.parse_number('1000000'), self.parse_number('0.0015')],
|
188
|
+
[self.parse_number('3000000'), self.parse_number('0.0012')],
|
189
|
+
[self.parse_number('15000000'), self.parse_number('0.001')],
|
190
190
|
],
|
191
191
|
'maker': [
|
192
|
-
[self.parse_number('0'), self.parse_number('0.
|
193
|
-
[self.parse_number('10000'), self.parse_number('0.
|
194
|
-
[self.parse_number('100000'), self.parse_number('0.
|
195
|
-
[self.parse_number('250000'), self.parse_number('0.
|
192
|
+
[self.parse_number('0'), self.parse_number('0.004')],
|
193
|
+
[self.parse_number('10000'), self.parse_number('0.002')],
|
194
|
+
[self.parse_number('100000'), self.parse_number('0.0012')],
|
195
|
+
[self.parse_number('250000'), self.parse_number('0.0009')],
|
196
196
|
[self.parse_number('500000'), self.parse_number('0.0005')],
|
197
197
|
[self.parse_number('1000000'), self.parse_number('0.0003')],
|
198
198
|
[self.parse_number('3000000'), self.parse_number('0.0002')],
|
199
|
-
[self.parse_number('15000000'), self.parse_number('0')],
|
199
|
+
[self.parse_number('15000000'), self.parse_number('-0.0004')],
|
200
200
|
],
|
201
201
|
},
|
202
202
|
},
|
@@ -1048,20 +1048,16 @@ class coinmate(Exchange, ImplicitAPI):
|
|
1048
1048
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
1049
1049
|
|
1050
1050
|
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
1051
|
-
if response is
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
self.throw_exactly_matched_exception(self.exceptions['exact'], body, feedback)
|
1064
|
-
self.throw_broadly_matched_exception(self.exceptions['broad'], body, feedback)
|
1065
|
-
raise ExchangeError(feedback) # unknown message
|
1066
|
-
raise ExchangeError(self.id + ' ' + body)
|
1051
|
+
if response is None:
|
1052
|
+
return None # fallback to default error handler
|
1053
|
+
#
|
1054
|
+
# {"error":true,"errorMessage":"Api internal error","data":null}
|
1055
|
+
# {"error":true,"errorMessage":"Access denied.","data":null}
|
1056
|
+
#
|
1057
|
+
errorMessage = self.safe_string(response, 'errorMessage')
|
1058
|
+
if errorMessage is not None:
|
1059
|
+
feedback = self.id + ' ' + body
|
1060
|
+
self.throw_exactly_matched_exception(self.exceptions['exact'], errorMessage, feedback)
|
1061
|
+
self.throw_broadly_matched_exception(self.exceptions['broad'], errorMessage, feedback)
|
1062
|
+
raise ExchangeError(feedback) # unknown message
|
1067
1063
|
return None
|