ccxt 4.4.1__py2.py3-none-any.whl → 4.4.3__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 +1 -1
- ccxt/abstract/bitmart.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +81 -18
- ccxt/async_support/bitmart.py +3 -1
- ccxt/async_support/bitstamp.py +24 -36
- ccxt/async_support/bybit.py +2 -0
- ccxt/async_support/cryptocom.py +3 -2
- ccxt/async_support/currencycom.py +1 -2
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/mexc.py +76 -1
- ccxt/async_support/xt.py +6 -2
- ccxt/base/exchange.py +53 -1
- ccxt/base/types.py +2 -2
- ccxt/binance.py +81 -18
- ccxt/bitmart.py +3 -1
- ccxt/bitstamp.py +24 -36
- ccxt/bybit.py +2 -0
- ccxt/cryptocom.py +3 -2
- ccxt/currencycom.py +1 -2
- ccxt/htx.py +1 -1
- ccxt/mexc.py +76 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +3 -47
- ccxt/pro/bitget.py +1 -7
- ccxt/pro/bitmex.py +11 -1
- ccxt/pro/bybit.py +2 -41
- ccxt/pro/cryptocom.py +183 -53
- ccxt/pro/gate.py +1 -8
- ccxt/pro/hyperliquid.py +4 -29
- ccxt/pro/kucoin.py +2 -43
- ccxt/pro/kucoinfutures.py +122 -0
- ccxt/pro/mexc.py +76 -4
- ccxt/pro/okx.py +13 -34
- ccxt/pro/oxfun.py +70 -0
- ccxt/pro/phemex.py +41 -2
- ccxt/pro/woofipro.py +64 -0
- ccxt/xt.py +6 -2
- {ccxt-4.4.1.dist-info → ccxt-4.4.3.dist-info}/METADATA +5 -5
- {ccxt-4.4.1.dist-info → ccxt-4.4.3.dist-info}/RECORD +44 -44
- {ccxt-4.4.1.dist-info → ccxt-4.4.3.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.1.dist-info → ccxt-4.4.3.dist-info}/WHEEL +0 -0
- {ccxt-4.4.1.dist-info → ccxt-4.4.3.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bitmart.py
CHANGED
@@ -84,6 +84,7 @@ class ImplicitAPI:
|
|
84
84
|
private_post_spot_v4_query_trades = privatePostSpotV4QueryTrades = Entry('spot/v4/query/trades', 'private', 'POST', {'cost': 5})
|
85
85
|
private_post_spot_v4_query_order_trades = privatePostSpotV4QueryOrderTrades = Entry('spot/v4/query/order-trades', 'private', 'POST', {'cost': 5})
|
86
86
|
private_post_spot_v4_cancel_orders = privatePostSpotV4CancelOrders = Entry('spot/v4/cancel_orders', 'private', 'POST', {'cost': 3})
|
87
|
+
private_post_spot_v4_cancel_all = privatePostSpotV4CancelAll = Entry('spot/v4/cancel_all', 'private', 'POST', {'cost': 90})
|
87
88
|
private_post_spot_v4_batch_orders = privatePostSpotV4BatchOrders = Entry('spot/v4/batch_orders', 'private', 'POST', {'cost': 3})
|
88
89
|
private_post_spot_v3_cancel_order = privatePostSpotV3CancelOrder = Entry('spot/v3/cancel_order', 'private', 'POST', {'cost': 1})
|
89
90
|
private_post_spot_v2_batch_orders = privatePostSpotV2BatchOrders = Entry('spot/v2/batch_orders', 'private', 'POST', {'cost': 1})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/binance.py
CHANGED
@@ -2634,6 +2634,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2634
2634
|
"""
|
2635
2635
|
fetches all available currencies on an exchange
|
2636
2636
|
:see: https://developers.binance.com/docs/wallet/capital/all-coins-info
|
2637
|
+
:see: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Margin-Assets
|
2637
2638
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2638
2639
|
:returns dict: an associative dictionary of currencies
|
2639
2640
|
"""
|
@@ -2650,9 +2651,13 @@ class binance(Exchange, ImplicitAPI):
|
|
2650
2651
|
apiBackup = self.safe_value(self.urls, 'apiBackup')
|
2651
2652
|
if apiBackup is not None:
|
2652
2653
|
return None
|
2653
|
-
|
2654
|
+
promises = [self.sapiGetCapitalConfigGetall(params), self.sapiGetMarginAllAssets(params)]
|
2655
|
+
results = await asyncio.gather(*promises)
|
2656
|
+
responseCurrencies = results[0]
|
2657
|
+
responseMarginables = results[1]
|
2658
|
+
marginablesById = self.index_by(responseMarginables, 'assetName')
|
2654
2659
|
result: dict = {}
|
2655
|
-
for i in range(0, len(
|
2660
|
+
for i in range(0, len(responseCurrencies)):
|
2656
2661
|
#
|
2657
2662
|
# {
|
2658
2663
|
# "coin": "LINK",
|
@@ -2748,7 +2753,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2748
2753
|
# ]
|
2749
2754
|
# }
|
2750
2755
|
#
|
2751
|
-
entry =
|
2756
|
+
entry = responseCurrencies[i]
|
2752
2757
|
id = self.safe_string(entry, 'coin')
|
2753
2758
|
name = self.safe_string(entry, 'name')
|
2754
2759
|
code = self.safe_currency_code(id)
|
@@ -2800,6 +2805,17 @@ class binance(Exchange, ImplicitAPI):
|
|
2800
2805
|
}
|
2801
2806
|
trading = self.safe_bool(entry, 'trading')
|
2802
2807
|
active = (isWithdrawEnabled and isDepositEnabled and trading)
|
2808
|
+
marginEntry = self.safe_dict(marginablesById, id, {})
|
2809
|
+
#
|
2810
|
+
# {
|
2811
|
+
# assetName: "BTC",
|
2812
|
+
# assetFullName: "Bitcoin",
|
2813
|
+
# isBorrowable: True,
|
2814
|
+
# isMortgageable: True,
|
2815
|
+
# userMinBorrow: "0",
|
2816
|
+
# userMinRepay: "0",
|
2817
|
+
# }
|
2818
|
+
#
|
2803
2819
|
result[code] = {
|
2804
2820
|
'id': id,
|
2805
2821
|
'name': name,
|
@@ -2813,6 +2829,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2813
2829
|
'fee': fee,
|
2814
2830
|
'fees': fees,
|
2815
2831
|
'limits': self.limits,
|
2832
|
+
'margin': self.safe_bool(marginEntry, 'isBorrowable'),
|
2816
2833
|
}
|
2817
2834
|
return result
|
2818
2835
|
|
@@ -2823,6 +2840,8 @@ class binance(Exchange, ImplicitAPI):
|
|
2823
2840
|
:see: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Exchange-Information # swap
|
2824
2841
|
:see: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Exchange-Information # future
|
2825
2842
|
:see: https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information # option
|
2843
|
+
:see: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Cross-Margin-Pairs # cross margin
|
2844
|
+
:see: https://developers.binance.com/docs/margin_trading/market-data/Get-All-Isolated-Margin-Symbol # isolated margin
|
2826
2845
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2827
2846
|
:returns dict[]: an array of objects representing market data
|
2828
2847
|
"""
|
@@ -2835,10 +2854,15 @@ class binance(Exchange, ImplicitAPI):
|
|
2835
2854
|
if type == 'option' and sandboxMode:
|
2836
2855
|
continue
|
2837
2856
|
fetchMarkets.append(type)
|
2857
|
+
fetchMargins = False
|
2838
2858
|
for i in range(0, len(fetchMarkets)):
|
2839
2859
|
marketType = fetchMarkets[i]
|
2840
2860
|
if marketType == 'spot':
|
2841
2861
|
promisesRaw.append(self.publicGetExchangeInfo(params))
|
2862
|
+
if self.check_required_credentials(False) and not sandboxMode:
|
2863
|
+
fetchMargins = True
|
2864
|
+
promisesRaw.append(self.sapiGetMarginAllPairs(params))
|
2865
|
+
promisesRaw.append(self.sapiGetMarginIsolatedAllPairs(params))
|
2842
2866
|
elif marketType == 'linear':
|
2843
2867
|
promisesRaw.append(self.fapiPublicGetExchangeInfo(params))
|
2844
2868
|
elif marketType == 'inverse':
|
@@ -2847,12 +2871,23 @@ class binance(Exchange, ImplicitAPI):
|
|
2847
2871
|
promisesRaw.append(self.eapiPublicGetExchangeInfo(params))
|
2848
2872
|
else:
|
2849
2873
|
raise ExchangeError(self.id + ' fetchMarkets() self.options fetchMarkets "' + marketType + '" is not a supported market type')
|
2850
|
-
|
2874
|
+
results = await asyncio.gather(*promisesRaw)
|
2851
2875
|
markets = []
|
2852
|
-
|
2853
|
-
|
2854
|
-
|
2855
|
-
|
2876
|
+
self.options['crossMarginPairsData'] = []
|
2877
|
+
self.options['isolatedMarginPairsData'] = []
|
2878
|
+
for i in range(0, len(results)):
|
2879
|
+
res = self.safe_value(results, i)
|
2880
|
+
if fetchMargins and isinstance(res, list):
|
2881
|
+
keysList = list(self.index_by(res, 'symbol').keys())
|
2882
|
+
length = (self.options['crossMarginPairsData'])
|
2883
|
+
# first one is the cross-margin promise
|
2884
|
+
if length == 0:
|
2885
|
+
self.options['crossMarginPairsData'] = keysList
|
2886
|
+
else:
|
2887
|
+
self.options['isolatedMarginPairsData'] = keysList
|
2888
|
+
else:
|
2889
|
+
resultMarkets = self.safe_list_2(res, 'symbols', 'optionSymbols', [])
|
2890
|
+
markets = self.array_concat(markets, resultMarkets)
|
2856
2891
|
#
|
2857
2892
|
# spot / margin
|
2858
2893
|
#
|
@@ -2897,6 +2932,20 @@ class binance(Exchange, ImplicitAPI):
|
|
2897
2932
|
# ],
|
2898
2933
|
# }
|
2899
2934
|
#
|
2935
|
+
# cross & isolated pairs response:
|
2936
|
+
#
|
2937
|
+
# [
|
2938
|
+
# {
|
2939
|
+
# symbol: "BTCUSDT",
|
2940
|
+
# base: "BTC",
|
2941
|
+
# quote: "USDT",
|
2942
|
+
# isMarginTrade: True,
|
2943
|
+
# isBuyAllowed: True,
|
2944
|
+
# isSellAllowed: True,
|
2945
|
+
# id: "376870555451677893", # doesn't exist in isolated
|
2946
|
+
# },
|
2947
|
+
# ]
|
2948
|
+
#
|
2900
2949
|
# futures/usdt-margined(fapi)
|
2901
2950
|
#
|
2902
2951
|
# {
|
@@ -3119,6 +3168,19 @@ class binance(Exchange, ImplicitAPI):
|
|
3119
3168
|
active = False
|
3120
3169
|
break
|
3121
3170
|
isMarginTradingAllowed = self.safe_bool(market, 'isMarginTradingAllowed', False)
|
3171
|
+
marginModes = None
|
3172
|
+
if spot:
|
3173
|
+
hasCrossMargin = self.in_array(id, self.options['crossMarginPairsData'])
|
3174
|
+
hasIsolatedMargin = self.in_array(id, self.options['isolatedMarginPairsData'])
|
3175
|
+
marginModes = {
|
3176
|
+
'cross': hasCrossMargin,
|
3177
|
+
'isolated': hasIsolatedMargin,
|
3178
|
+
}
|
3179
|
+
elif linear or inverse:
|
3180
|
+
marginModes = {
|
3181
|
+
'cross': True,
|
3182
|
+
'isolated': True,
|
3183
|
+
}
|
3122
3184
|
unifiedType = None
|
3123
3185
|
if spot:
|
3124
3186
|
unifiedType = 'spot'
|
@@ -3145,6 +3207,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3145
3207
|
'type': unifiedType,
|
3146
3208
|
'spot': spot,
|
3147
3209
|
'margin': spot and isMarginTradingAllowed,
|
3210
|
+
'marginModes': marginModes,
|
3148
3211
|
'swap': swap,
|
3149
3212
|
'future': future,
|
3150
3213
|
'option': option,
|
@@ -5970,8 +6033,8 @@ class binance(Exchange, ImplicitAPI):
|
|
5970
6033
|
marginMode, params = self.handle_margin_mode_and_params('fetchOrders', params)
|
5971
6034
|
isPortfolioMargin = None
|
5972
6035
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOrders', 'papi', 'portfolioMargin', False)
|
5973
|
-
isConditional = self.
|
5974
|
-
params = self.omit(params, ['stop', 'conditional', 'type'])
|
6036
|
+
isConditional = self.safe_bool_n(params, ['stop', 'trigger', 'conditional'])
|
6037
|
+
params = self.omit(params, ['stop', 'trigger', 'conditional', 'type'])
|
5975
6038
|
request: dict = {
|
5976
6039
|
'symbol': market['id'],
|
5977
6040
|
}
|
@@ -6220,7 +6283,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6220
6283
|
marginMode, params = self.handle_margin_mode_and_params('fetchOpenOrders', params)
|
6221
6284
|
isPortfolioMargin = None
|
6222
6285
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOpenOrders', 'papi', 'portfolioMargin', False)
|
6223
|
-
isConditional = self.safe_bool_n(params, ['stop', '
|
6286
|
+
isConditional = self.safe_bool_n(params, ['stop', 'trigger', 'conditional'])
|
6224
6287
|
if symbol is not None:
|
6225
6288
|
market = self.market(symbol)
|
6226
6289
|
request['symbol'] = market['id']
|
@@ -6234,7 +6297,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6234
6297
|
type = self.safe_string(params, 'type', defaultType)
|
6235
6298
|
subType = None
|
6236
6299
|
subType, params = self.handle_sub_type_and_params('fetchOpenOrders', market, params)
|
6237
|
-
params = self.omit(params, ['type', 'stop', '
|
6300
|
+
params = self.omit(params, ['type', 'stop', 'trigger', 'conditional'])
|
6238
6301
|
response = None
|
6239
6302
|
if type == 'option':
|
6240
6303
|
if since is not None:
|
@@ -6295,8 +6358,8 @@ class binance(Exchange, ImplicitAPI):
|
|
6295
6358
|
}
|
6296
6359
|
isPortfolioMargin = None
|
6297
6360
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'fetchOpenOrder', 'papi', 'portfolioMargin', False)
|
6298
|
-
isConditional = self.safe_bool_n(params, ['stop', '
|
6299
|
-
params = self.omit(params, ['stop', '
|
6361
|
+
isConditional = self.safe_bool_n(params, ['stop', 'trigger', 'conditional'])
|
6362
|
+
params = self.omit(params, ['stop', 'trigger', 'conditional'])
|
6300
6363
|
isPortfolioMarginConditional = (isPortfolioMargin and isConditional)
|
6301
6364
|
orderIdRequest = 'strategyId' if isPortfolioMarginConditional else 'orderId'
|
6302
6365
|
request[orderIdRequest] = id
|
@@ -6586,7 +6649,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6586
6649
|
marginMode, params = self.handle_margin_mode_and_params('cancelOrder', params)
|
6587
6650
|
isPortfolioMargin = None
|
6588
6651
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'cancelOrder', 'papi', 'portfolioMargin', False)
|
6589
|
-
isConditional = self.
|
6652
|
+
isConditional = self.safe_bool_n(params, ['stop', 'trigger', 'conditional'])
|
6590
6653
|
request: dict = {
|
6591
6654
|
'symbol': market['id'],
|
6592
6655
|
}
|
@@ -6604,7 +6667,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6604
6667
|
request['strategyId'] = id
|
6605
6668
|
else:
|
6606
6669
|
request['orderId'] = id
|
6607
|
-
params = self.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'conditional'])
|
6670
|
+
params = self.omit(params, ['type', 'origClientOrderId', 'clientOrderId', 'newClientStrategyId', 'stop', 'trigger', 'conditional'])
|
6608
6671
|
response = None
|
6609
6672
|
if market['option']:
|
6610
6673
|
response = await self.eapiPrivateDeleteOrder(self.extend(request, params))
|
@@ -6663,9 +6726,9 @@ class binance(Exchange, ImplicitAPI):
|
|
6663
6726
|
}
|
6664
6727
|
isPortfolioMargin = None
|
6665
6728
|
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'cancelAllOrders', 'papi', 'portfolioMargin', False)
|
6666
|
-
isConditional = self.
|
6729
|
+
isConditional = self.safe_bool_n(params, ['stop', 'trigger', 'conditional'])
|
6667
6730
|
type = self.safe_string(params, 'type', market['type'])
|
6668
|
-
params = self.omit(params, ['type', 'stop', 'conditional'])
|
6731
|
+
params = self.omit(params, ['type', 'stop', 'trigger', 'conditional'])
|
6669
6732
|
marginMode = None
|
6670
6733
|
marginMode, params = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
6671
6734
|
response = None
|
ccxt/async_support/bitmart.py
CHANGED
@@ -248,6 +248,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
248
248
|
'spot/v4/query/trades': 5, # 12 times/2 sec = 6/s => 30/6 = 5
|
249
249
|
'spot/v4/query/order-trades': 5, # 12 times/2 sec = 6/s => 30/6 = 5
|
250
250
|
'spot/v4/cancel_orders': 3,
|
251
|
+
'spot/v4/cancel_all': 90,
|
251
252
|
'spot/v4/batch_orders': 3,
|
252
253
|
# newer endpoint
|
253
254
|
'spot/v3/cancel_order': 1,
|
@@ -2789,6 +2790,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2789
2790
|
"""
|
2790
2791
|
cancel all open orders in a market
|
2791
2792
|
:see: https://developer-pro.bitmart.com/en/spot/#cancel-all-orders
|
2793
|
+
:see: https://developer-pro.bitmart.com/en/spot/#new-batch-order-v4-signed
|
2792
2794
|
:see: https://developer-pro.bitmart.com/en/futures/#cancel-all-orders-signed
|
2793
2795
|
:see: https://developer-pro.bitmart.com/en/futuresv2/#cancel-all-orders-signed
|
2794
2796
|
:param str symbol: unified market symbol of the market to cancel orders in
|
@@ -2806,7 +2808,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
2806
2808
|
type = None
|
2807
2809
|
type, params = self.handle_market_type_and_params('cancelAllOrders', market, params)
|
2808
2810
|
if type == 'spot':
|
2809
|
-
response = await self.
|
2811
|
+
response = await self.privatePostSpotV4CancelAll(self.extend(request, params))
|
2810
2812
|
elif type == 'swap':
|
2811
2813
|
if symbol is None:
|
2812
2814
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
ccxt/async_support/bitstamp.py
CHANGED
@@ -402,46 +402,34 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
402
402
|
'trading': {
|
403
403
|
'tierBased': True,
|
404
404
|
'percentage': True,
|
405
|
-
'taker': self.parse_number('0.
|
406
|
-
'maker': self.parse_number('0.
|
405
|
+
'taker': self.parse_number('0.004'),
|
406
|
+
'maker': self.parse_number('0.004'),
|
407
407
|
'tiers': {
|
408
408
|
'taker': [
|
409
|
-
[self.parse_number('0'), self.parse_number('0.
|
410
|
-
[self.parse_number('
|
411
|
-
[self.parse_number('100000'), self.parse_number('0.
|
412
|
-
[self.parse_number('
|
413
|
-
[self.parse_number('
|
414
|
-
[self.parse_number('
|
415
|
-
[self.parse_number('
|
416
|
-
[self.parse_number('
|
417
|
-
[self.parse_number('
|
418
|
-
[self.parse_number('
|
419
|
-
[self.parse_number('
|
420
|
-
[self.parse_number('100000000'), self.parse_number('0.0007')],
|
421
|
-
[self.parse_number('500000000'), self.parse_number('0.0005')],
|
422
|
-
[self.parse_number('2000000000'), self.parse_number('0.0003')],
|
423
|
-
[self.parse_number('6000000000'), self.parse_number('0.0001')],
|
424
|
-
[self.parse_number('20000000000'), self.parse_number('0.00005')],
|
425
|
-
[self.parse_number('20000000001'), self.parse_number('0')],
|
409
|
+
[self.parse_number('0'), self.parse_number('0.004')],
|
410
|
+
[self.parse_number('10000'), self.parse_number('0.003')],
|
411
|
+
[self.parse_number('100000'), self.parse_number('0.002')],
|
412
|
+
[self.parse_number('500000'), self.parse_number('0.0018')],
|
413
|
+
[self.parse_number('1500000'), self.parse_number('0.0016')],
|
414
|
+
[self.parse_number('5000000'), self.parse_number('0.0012')],
|
415
|
+
[self.parse_number('20000000'), self.parse_number('0.001')],
|
416
|
+
[self.parse_number('50000000'), self.parse_number('0.0008')],
|
417
|
+
[self.parse_number('100000000'), self.parse_number('0.0006')],
|
418
|
+
[self.parse_number('250000000'), self.parse_number('0.0005')],
|
419
|
+
[self.parse_number('1000000000'), self.parse_number('0.0003')],
|
426
420
|
],
|
427
421
|
'maker': [
|
428
|
-
[self.parse_number('0'), self.parse_number('0.
|
429
|
-
[self.parse_number('
|
430
|
-
[self.parse_number('100000'), self.parse_number('0.
|
431
|
-
[self.parse_number('
|
432
|
-
[self.parse_number('
|
433
|
-
[self.parse_number('
|
434
|
-
[self.parse_number('
|
435
|
-
[self.parse_number('
|
436
|
-
[self.parse_number('
|
437
|
-
[self.parse_number('
|
438
|
-
[self.parse_number('
|
439
|
-
[self.parse_number('100000000'), self.parse_number('0.0007')],
|
440
|
-
[self.parse_number('500000000'), self.parse_number('0.0005')],
|
441
|
-
[self.parse_number('2000000000'), self.parse_number('0.0003')],
|
442
|
-
[self.parse_number('6000000000'), self.parse_number('0.0001')],
|
443
|
-
[self.parse_number('20000000000'), self.parse_number('0.00005')],
|
444
|
-
[self.parse_number('20000000001'), self.parse_number('0')],
|
422
|
+
[self.parse_number('0'), self.parse_number('0.003')],
|
423
|
+
[self.parse_number('10000'), self.parse_number('0.002')],
|
424
|
+
[self.parse_number('100000'), self.parse_number('0.001')],
|
425
|
+
[self.parse_number('500000'), self.parse_number('0.0008')],
|
426
|
+
[self.parse_number('1500000'), self.parse_number('0.0006')],
|
427
|
+
[self.parse_number('5000000'), self.parse_number('0.0003')],
|
428
|
+
[self.parse_number('20000000'), self.parse_number('0.002')],
|
429
|
+
[self.parse_number('50000000'), self.parse_number('0.0001')],
|
430
|
+
[self.parse_number('100000000'), self.parse_number('0')],
|
431
|
+
[self.parse_number('250000000'), self.parse_number('0')],
|
432
|
+
[self.parse_number('1000000000'), self.parse_number('0')],
|
445
433
|
],
|
446
434
|
},
|
447
435
|
},
|
ccxt/async_support/bybit.py
CHANGED
@@ -14,6 +14,7 @@ from ccxt.base.errors import AuthenticationError
|
|
14
14
|
from ccxt.base.errors import PermissionDenied
|
15
15
|
from ccxt.base.errors import ArgumentsRequired
|
16
16
|
from ccxt.base.errors import BadRequest
|
17
|
+
from ccxt.base.errors import BadSymbol
|
17
18
|
from ccxt.base.errors import NoChange
|
18
19
|
from ccxt.base.errors import MarginModeAlreadySet
|
19
20
|
from ccxt.base.errors import ManualInteractionNeeded
|
@@ -992,6 +993,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
992
993
|
'3200300': InsufficientFunds, # {"retCode":3200300,"retMsg":"Insufficient margin balance.","result":null,"retExtMap":{}}
|
993
994
|
},
|
994
995
|
'broad': {
|
996
|
+
'Not supported symbols': BadSymbol, # {"retCode":10001,"retMsg":"Not supported symbols","result":{},"retExtInfo":{},"time":1726147060461}
|
995
997
|
'Request timeout': RequestTimeout, # {"retCode":10016,"retMsg":"Request timeout, please try again later","result":{},"retExtInfo":{},"time":1675307914985}
|
996
998
|
'unknown orderInfo': OrderNotFound, # {"ret_code":-1,"ret_msg":"unknown orderInfo","ext_code":"","ext_info":"","result":null,"time_now":"1584030414.005545","rate_limit_status":99,"rate_limit_reset_ms":1584030414003,"rate_limit":100}
|
997
999
|
'invalid api_key': AuthenticationError, # {"ret_code":10003,"ret_msg":"invalid api_key","ext_code":"","ext_info":"","result":null,"time_now":"1599547085.415797"}
|
ccxt/async_support/cryptocom.py
CHANGED
@@ -156,7 +156,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
156
156
|
'www': 'https://crypto.com/',
|
157
157
|
'referral': {
|
158
158
|
'url': 'https://crypto.com/exch/kdacthrnxt',
|
159
|
-
'discount': 0.
|
159
|
+
'discount': 0.75,
|
160
160
|
},
|
161
161
|
'doc': [
|
162
162
|
'https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html',
|
@@ -611,7 +611,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
611
611
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
612
612
|
"""
|
613
613
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
614
|
-
:see: https://exchange-docs.crypto.com/
|
614
|
+
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#public-get-tickers
|
615
615
|
:see: https://exchange-docs.crypto.com/derivatives/index.html#public-get-tickers
|
616
616
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
617
617
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1660,6 +1660,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
1660
1660
|
async def fetch_deposit_address(self, code: str, params={}):
|
1661
1661
|
"""
|
1662
1662
|
fetch the deposit address for a currency associated with self account
|
1663
|
+
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-get-deposit-address
|
1663
1664
|
:param str code: unified currency code
|
1664
1665
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1665
1666
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -1902,7 +1902,7 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1902
1902
|
'collateral': None,
|
1903
1903
|
'side': side,
|
1904
1904
|
# 'realizedProfit': self.safe_number(position, 'rpl'),
|
1905
|
-
'
|
1905
|
+
'unrealizedPnl': unrealizedProfit,
|
1906
1906
|
'leverage': leverage,
|
1907
1907
|
'percentage': None,
|
1908
1908
|
'marginMode': None,
|
@@ -1916,7 +1916,6 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1916
1916
|
'maintenanceMarginPercentage': None,
|
1917
1917
|
'marginRatio': None,
|
1918
1918
|
'id': None,
|
1919
|
-
'unrealizedPnl': None,
|
1920
1919
|
'hedged': None,
|
1921
1920
|
'stopLossPrice': None,
|
1922
1921
|
'takeProfitPrice': None,
|
ccxt/async_support/htx.py
CHANGED
@@ -6979,7 +6979,7 @@ class htx(Exchange, ImplicitAPI):
|
|
6979
6979
|
'entryPrice': entryPrice,
|
6980
6980
|
'collateral': self.parse_number(collateral),
|
6981
6981
|
'side': side,
|
6982
|
-
'
|
6982
|
+
'unrealizedPnl': unrealizedProfit,
|
6983
6983
|
'leverage': self.parse_number(leverage),
|
6984
6984
|
'percentage': self.parse_number(percentage),
|
6985
6985
|
'marginMode': marginMode,
|
ccxt/async_support/mexc.py
CHANGED
@@ -1012,6 +1012,13 @@ class mexc(Exchange, ImplicitAPI):
|
|
1012
1012
|
return self.array_concat(spotMarket, swapMarket)
|
1013
1013
|
|
1014
1014
|
async def fetch_spot_markets(self, params={}):
|
1015
|
+
"""
|
1016
|
+
* @ignore
|
1017
|
+
retrieves data on all spot markets for mexc
|
1018
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#exchange-information
|
1019
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1020
|
+
:returns dict[]: an array of objects representing market data
|
1021
|
+
"""
|
1015
1022
|
response = await self.spotPublicGetExchangeInfo(params)
|
1016
1023
|
#
|
1017
1024
|
# {
|
@@ -1127,6 +1134,13 @@ class mexc(Exchange, ImplicitAPI):
|
|
1127
1134
|
return result
|
1128
1135
|
|
1129
1136
|
async def fetch_swap_markets(self, params={}):
|
1137
|
+
"""
|
1138
|
+
* @ignore
|
1139
|
+
retrieves data on all swap markets for mexc
|
1140
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
|
1141
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1142
|
+
:returns dict[]: an array of objects representing market data
|
1143
|
+
"""
|
1130
1144
|
response = await self.contractPublicGetDetail(params)
|
1131
1145
|
#
|
1132
1146
|
# {
|
@@ -1666,6 +1680,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
1666
1680
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1667
1681
|
"""
|
1668
1682
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1683
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics
|
1684
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data
|
1669
1685
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1670
1686
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1671
1687
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1747,6 +1763,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
1747
1763
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1748
1764
|
"""
|
1749
1765
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1766
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics
|
1767
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data
|
1750
1768
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1751
1769
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1752
1770
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1929,6 +1947,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
1929
1947
|
async def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
1930
1948
|
"""
|
1931
1949
|
fetches the bid and ask price and volume for multiple markets
|
1950
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#symbol-order-book-ticker
|
1932
1951
|
:param str[]|None symbols: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
1933
1952
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1934
1953
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -2052,6 +2071,21 @@ class mexc(Exchange, ImplicitAPI):
|
|
2052
2071
|
return self.extend(request, params)
|
2053
2072
|
|
2054
2073
|
async def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2074
|
+
"""
|
2075
|
+
* @ignore
|
2076
|
+
create a trade order
|
2077
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
2078
|
+
:param str symbol: unified symbol of the market to create an order in
|
2079
|
+
:param str type: 'market' or 'limit'
|
2080
|
+
:param str side: 'buy' or 'sell'
|
2081
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
2082
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
2083
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2084
|
+
:param str [params.marginMode]: only 'isolated' is supported for spot-margin trading
|
2085
|
+
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2086
|
+
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2087
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2088
|
+
"""
|
2055
2089
|
await self.load_markets()
|
2056
2090
|
request = self.create_spot_order_request(market, type, side, amount, price, marginMode, params)
|
2057
2091
|
response = await self.spotPrivatePostOrder(self.extend(request, params))
|
@@ -2082,6 +2116,30 @@ class mexc(Exchange, ImplicitAPI):
|
|
2082
2116
|
return order
|
2083
2117
|
|
2084
2118
|
async def create_swap_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2119
|
+
"""
|
2120
|
+
* @ignore
|
2121
|
+
create a trade order
|
2122
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
2123
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
|
2124
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
|
2125
|
+
:param str symbol: unified symbol of the market to create an order in
|
2126
|
+
:param str type: 'market' or 'limit'
|
2127
|
+
:param str side: 'buy' or 'sell'
|
2128
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
2129
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
2130
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2131
|
+
:param str [params.marginMode]: only 'isolated' is supported for spot-margin trading
|
2132
|
+
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2133
|
+
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2134
|
+
:param bool [params.reduceOnly]: indicates if self order is to reduce the size of a position
|
2135
|
+
*
|
2136
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
2137
|
+
:param int [params.leverage]: leverage is necessary on isolated margin
|
2138
|
+
:param long [params.positionId]: it is recommended to hasattr(self, fill) parameter when closing a position
|
2139
|
+
:param str [params.externalOid]: external order ID
|
2140
|
+
:param int [params.positionMode]: 1:hedge, 2:one-way, default: the user's current config
|
2141
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2142
|
+
"""
|
2085
2143
|
await self.load_markets()
|
2086
2144
|
symbol = market['symbol']
|
2087
2145
|
unavailableContracts = self.safe_value(self.options, 'unavailableContracts', {})
|
@@ -2230,6 +2288,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
2230
2288
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2231
2289
|
"""
|
2232
2290
|
fetches information on an order made by the user
|
2291
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-order
|
2292
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number
|
2233
2293
|
:param str symbol: unified symbol of the market the order was made in
|
2234
2294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2235
2295
|
:param str [params.marginMode]: only 'isolated' is supported, for spot-margin trading
|
@@ -4506,7 +4566,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4506
4566
|
'entryPrice': entryPrice,
|
4507
4567
|
'collateral': None,
|
4508
4568
|
'side': side,
|
4509
|
-
'
|
4569
|
+
'unrealizedPnl': None,
|
4510
4570
|
'leverage': self.parse_number(leverage),
|
4511
4571
|
'percentage': None,
|
4512
4572
|
'marginMode': marginType,
|
@@ -4795,6 +4855,14 @@ class mexc(Exchange, ImplicitAPI):
|
|
4795
4855
|
return self.parse_transaction(response, currency)
|
4796
4856
|
|
4797
4857
|
async def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
4858
|
+
"""
|
4859
|
+
set hedged to True or False for a market
|
4860
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#change-position-mode
|
4861
|
+
:param bool hedged: set to True to use dualSidePosition
|
4862
|
+
:param str symbol: not used by mexc setPositionMode()
|
4863
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4864
|
+
:returns dict: response from the exchange
|
4865
|
+
"""
|
4798
4866
|
request: dict = {
|
4799
4867
|
'positionMode': 1 if hedged else 2, # 1 Hedge, 2 One-way, before changing position mode make sure that there are no active orders, planned orders, or open positions, the risk limit level will be reset to 1
|
4800
4868
|
}
|
@@ -4808,6 +4876,13 @@ class mexc(Exchange, ImplicitAPI):
|
|
4808
4876
|
return response
|
4809
4877
|
|
4810
4878
|
async def fetch_position_mode(self, symbol: Str = None, params={}):
|
4879
|
+
"""
|
4880
|
+
fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
4881
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-position-mode
|
4882
|
+
:param str symbol: not used by mexc fetchPositionMode
|
4883
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
4884
|
+
:returns dict: an object detailing whether the market is in hedged or one-way mode
|
4885
|
+
"""
|
4811
4886
|
response = await self.contractPrivateGetPositionPositionMode(params)
|
4812
4887
|
#
|
4813
4888
|
# {
|
ccxt/async_support/xt.py
CHANGED
@@ -1138,17 +1138,21 @@ class xt(Exchange, ImplicitAPI):
|
|
1138
1138
|
maxCost = None
|
1139
1139
|
minPrice = None
|
1140
1140
|
maxPrice = None
|
1141
|
+
amountPrecision = None
|
1141
1142
|
for i in range(0, len(filters)):
|
1142
1143
|
entry = filters[i]
|
1143
1144
|
filter = self.safe_string(entry, 'filter')
|
1144
1145
|
if filter == 'QUANTITY':
|
1145
1146
|
minAmount = self.safe_number(entry, 'min')
|
1146
1147
|
maxAmount = self.safe_number(entry, 'max')
|
1148
|
+
amountPrecision = self.safe_number(entry, 'tickSize')
|
1147
1149
|
if filter == 'QUOTE_QTY':
|
1148
1150
|
minCost = self.safe_number(entry, 'min')
|
1149
1151
|
if filter == 'PRICE':
|
1150
1152
|
minPrice = self.safe_number(entry, 'min')
|
1151
1153
|
maxPrice = self.safe_number(entry, 'max')
|
1154
|
+
if amountPrecision is None:
|
1155
|
+
amountPrecision = self.parse_number(self.parse_precision(self.safe_string(market, 'quantityPrecision')))
|
1152
1156
|
underlyingType = self.safe_string(market, 'underlyingType')
|
1153
1157
|
linear = None
|
1154
1158
|
inverse = None
|
@@ -1223,7 +1227,7 @@ class xt(Exchange, ImplicitAPI):
|
|
1223
1227
|
'optionType': None,
|
1224
1228
|
'precision': {
|
1225
1229
|
'price': self.parse_number(self.parse_precision(self.safe_string(market, 'pricePrecision'))),
|
1226
|
-
'amount':
|
1230
|
+
'amount': amountPrecision,
|
1227
1231
|
'base': self.parse_number(self.parse_precision(self.safe_string(market, 'baseCoinPrecision'))),
|
1228
1232
|
'quote': self.parse_number(self.parse_precision(self.safe_string(market, 'quoteCoinPrecision'))),
|
1229
1233
|
},
|
@@ -1356,7 +1360,7 @@ class xt(Exchange, ImplicitAPI):
|
|
1356
1360
|
self.safe_number(ohlcv, 'h'),
|
1357
1361
|
self.safe_number(ohlcv, 'l'),
|
1358
1362
|
self.safe_number(ohlcv, 'c'),
|
1359
|
-
self.safe_number_2(ohlcv,
|
1363
|
+
self.safe_number_2(ohlcv, 'q', volumeIndex),
|
1360
1364
|
]
|
1361
1365
|
|
1362
1366
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
|